Commit 4d64ca88 authored by Colomban Wendling's avatar Colomban Wendling

OVCCGtk: switch to GObject 2.38-style object private data

parent d4d85c26
......@@ -31,8 +31,6 @@
#include "ovccgtk-enum-types.h"
#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), OVCCGTK_TYPE_BOARD, OVCCGtkBoardPrivate))
/* arbitrary size limits */
#define TILE_SIZE_MIN (TILE_SIZE / 2)
#define TILE_SIZE_MAX (TILE_SIZE * 8)
......@@ -125,7 +123,7 @@ static gboolean ovccgtk_board_scroll (GtkWidget *widget,
static gboolean ovccgtk_board_key_press (GtkWidget *widget,
GdkEventKey *event);
G_DEFINE_TYPE (OVCCGtkBoard, ovccgtk_board, GTK_TYPE_DRAWING_AREA)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkBoard, ovccgtk_board, GTK_TYPE_DRAWING_AREA)
static void ovccgtk_board_class_init (OVCCGtkBoardClass *klass)
......@@ -230,13 +228,11 @@ static void ovccgtk_board_class_init (OVCCGtkBoardClass *klass)
OVCC_TYPE_POSITION,
OVCC_TYPE_TILE_OBJECT,
OVCC_TYPE_PAWN_KIND);
g_type_class_add_private ((gpointer)klass, sizeof(OVCCGtkBoardPrivate));
}
static void ovccgtk_board_init (OVCCGtkBoard *self)
{
self->priv = GET_PRIVATE (self);
self->priv = ovccgtk_board_get_instance_private (self);
self->priv->sig_board_add_tile = 0;
self->priv->board = NULL;
self->priv->margin = TILE_SIZE / 2;
......
......@@ -67,9 +67,9 @@ static void ovccgtk_cell_renderer_color_render (GtkCellRenderer
GtkCellRendererState flags);
G_DEFINE_TYPE (OVCCGtkCellRendererColor,
ovccgtk_cell_renderer_color,
GTK_TYPE_CELL_RENDERER)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkCellRendererColor,
ovccgtk_cell_renderer_color,
GTK_TYPE_CELL_RENDERER)
static void
......@@ -109,17 +109,12 @@ ovccgtk_cell_renderer_color_class_init (OVCCGtkCellRendererColorClass *klass)
24,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private ((gpointer) klass,
sizeof (OVCCGtkCellRendererColorPrivate));
}
static void
ovccgtk_cell_renderer_color_init (OVCCGtkCellRendererColor *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OVCCGTK_TYPE_CELL_RENDERER_COLOR,
OVCCGtkCellRendererColorPrivate);
self->priv = ovccgtk_cell_renderer_color_get_instance_private (self);
self->priv->shape = OVCCGTK_CELL_RENDERER_COLOR_SHAPE_FILL;
self->priv->size = 24;
......
......@@ -49,7 +49,9 @@ static void ovccgtk_client_get_property (GObject *object,
GParamSpec *pspec);
G_DEFINE_TYPE (OVCCGtkClient, ovccgtk_client, OVCCCLIENT_TYPE_CLIENT)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkClient,
ovccgtk_client,
OVCCCLIENT_TYPE_CLIENT)
static void
......@@ -69,16 +71,12 @@ ovccgtk_client_class_init (OVCCGtkClientClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private ((gpointer) klass, sizeof (OVCCGtkClientPrivate));
}
static void
ovccgtk_client_init (OVCCGtkClient *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OVCCGTK_TYPE_CLIENT,
OVCCGtkClientPrivate);
self->priv = ovccgtk_client_get_instance_private (self);
self->priv->name = NULL;
}
......
......@@ -34,7 +34,7 @@ struct _OVCCGtkFramePrivate
};
G_DEFINE_TYPE (OVCCGtkFrame, ovccgtk_frame, GTK_TYPE_FRAME)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkFrame, ovccgtk_frame, GTK_TYPE_FRAME)
static void
......@@ -70,8 +70,6 @@ ovccgtk_frame_class_init (OVCCGtkFrameClass *klass)
object_class->finalize = ovccgtk_frame_finalize;
container_class->add = ovccgtk_frame_add;
g_type_class_add_private (klass, sizeof (OVCCGtkFramePrivate));
}
static void
......@@ -79,8 +77,8 @@ ovccgtk_frame_label_notify (GObject *object,
GParamSpec *pspec,
gpointer data)
{
OVCCGtkFrame *self = OVCCGTK_FRAME (object);
GtkWidget *label;
OVCCGtkFrame *self = OVCCGTK_FRAME (object);
GtkWidget *label;
label = gtk_frame_get_label_widget (GTK_FRAME (self));
if (label) {
......@@ -91,9 +89,7 @@ ovccgtk_frame_label_notify (GObject *object,
static void
ovccgtk_frame_init (OVCCGtkFrame *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OVCCGTK_TYPE_FRAME,
OVCCGtkFramePrivate);
self->priv = ovccgtk_frame_get_instance_private (self);
/* set-up the frame attributes */
gtk_frame_set_shadow_type (GTK_FRAME (self), GTK_SHADOW_NONE);
......
......@@ -56,9 +56,9 @@ static void ovccgtk_message_info_set_propery (GObject *obj
GParamSpec *pspec);
G_DEFINE_TYPE (OVCCGtkMessageInfo,
ovccgtk_message_info,
GTK_TYPE_INFO_BAR)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkMessageInfo,
ovccgtk_message_info,
GTK_TYPE_INFO_BAR)
enum
......@@ -128,8 +128,6 @@ ovccgtk_message_info_class_init (OVCCGtkMessageInfoClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
g_type_class_add_private (klass, sizeof (OVCCGtkMessageInfoPrivate));
}
static void
......@@ -139,8 +137,7 @@ ovccgtk_message_info_init (OVCCGtkMessageInfo *self)
GtkWidget *box;
GtkWidget *label_box;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, OVCCGTK_TYPE_MESSAGE_INFO,
OVCCGtkMessageInfoPrivate);
self->priv = ovccgtk_message_info_get_instance_private (self);
self->priv->icon = gtk_image_new ();
self->priv->primary_label = ovccgtk_wrap_label_new (NULL);
......
......@@ -75,9 +75,9 @@ static void set_text_cell_data (GtkCellLayout *cell_la
gpointer data);
G_DEFINE_TYPE (OVCCGtkPlayerList,
ovccgtk_player_list,
GTK_TYPE_TREE_VIEW)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkPlayerList,
ovccgtk_player_list,
GTK_TYPE_TREE_VIEW)
enum
......@@ -126,8 +126,6 @@ ovccgtk_player_list_class_init (OVCCGtkPlayerListClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
g_type_class_add_private (klass, sizeof (OVCCGtkPlayerListPrivate));
}
static void
......@@ -136,8 +134,7 @@ ovccgtk_player_list_init (OVCCGtkPlayerList *self)
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, OVCCGTK_TYPE_PLAYER_LIST,
OVCCGtkPlayerListPrivate);
self->priv = ovccgtk_player_list_get_instance_private (self);
self->priv->store = gtk_list_store_new (1, OVCC_TYPE_PLAYER);
self->priv->default_player = NULL;
......
......@@ -59,9 +59,9 @@ static void ovccgtk_wrap_label_notify_label_handler (GOb
gpointer data);
G_DEFINE_TYPE (OVCCGtkWrapLabel,
ovccgtk_wrap_label,
GTK_TYPE_LABEL)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkWrapLabel,
ovccgtk_wrap_label,
GTK_TYPE_LABEL)
static void
......@@ -76,15 +76,12 @@ ovccgtk_wrap_label_class_init (OVCCGtkWrapLabelClass *klass)
widget_class->get_preferred_height_for_width = ovccgtk_wrap_label_get_preferred_height_for_width;
widget_class->get_request_mode = ovccgtk_wrap_label_get_request_mode;
widget_class->size_allocate = ovccgtk_wrap_label_size_allocate;
g_type_class_add_private (klass, sizeof (OVCCGtkWrapLabelPrivate));
}
static void
ovccgtk_wrap_label_init (OVCCGtkWrapLabel *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, OVCCGTK_TYPE_WRAP_LABEL,
OVCCGtkWrapLabelPrivate);
self->priv = ovccgtk_wrap_label_get_instance_private (self);
self->priv->wrap_width = 0;
self->priv->wrap_height = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment