[gdl] Use the gobject like private definition and some cleanup. Fixes bug #649254
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdl] Use the gobject like private definition and some cleanup. Fixes bug #649254
- Date: Tue, 3 May 2011 10:09:50 +0000 (UTC)
commit fd3bcae5b2d7f5f00805987d605f9d7a7358b409
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue May 3 11:03:44 2011 +0200
Use the gobject like private definition and some cleanup. Fixes bug #649254
gdl/gdl-dock-bar.c | 129 +++++++++++-----------
gdl/gdl-dock-bar.h | 2 +-
gdl/gdl-dock-item-grip.c | 159 ++++++++++++++-------------
gdl/gdl-dock-item-grip.h | 2 +-
gdl/gdl-dock-item.c | 243 +++++++++++++++++++++---------------------
gdl/gdl-dock-item.h | 2 +-
gdl/gdl-dock-layout.c | 142 ++++++++++++------------
gdl/gdl-dock-layout.h | 2 +-
gdl/gdl-dock-master.c | 200 ++++++++++++++++++-----------------
gdl/gdl-dock-master.h | 2 +-
gdl/gdl-dock-object.c | 5 -
gdl/gdl-dock-placeholder.c | 253 ++++++++++++++++++++++----------------------
gdl/gdl-dock-placeholder.h | 2 +-
gdl/gdl-dock.c | 123 +++++++++++----------
gdl/gdl-dock.h | 2 +-
gdl/gdl-switcher.c | 17 ++--
16 files changed, 650 insertions(+), 635 deletions(-)
---
diff --git a/gdl/gdl-dock-bar.c b/gdl/gdl-dock-bar.c
index e90083f..9a2f461 100644
--- a/gdl/gdl-dock-bar.c
+++ b/gdl/gdl-dock-bar.c
@@ -51,7 +51,7 @@ static void gdl_dock_bar_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
-static void gdl_dock_bar_destroy (GtkWidget *object);
+static void gdl_dock_bar_dispose (GObject *object);
static void gdl_dock_bar_attach (GdlDockBar *dockbar,
GdlDockMaster *master);
@@ -92,16 +92,17 @@ static void update_dock_items (GdlDockBar *dockbar, gboolean full_update);
void
gdl_dock_bar_class_init (GdlDockBarClass *klass)
{
- GObjectClass *g_object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
- g_object_class = G_OBJECT_CLASS (klass);
+ object_class = G_OBJECT_CLASS (klass);
- g_object_class->get_property = gdl_dock_bar_get_property;
- g_object_class->set_property = gdl_dock_bar_set_property;
+ object_class->get_property = gdl_dock_bar_get_property;
+ object_class->set_property = gdl_dock_bar_set_property;
+ object_class->dispose = gdl_dock_bar_dispose;
g_object_class_install_property (
- g_object_class, PROP_MASTER,
+ object_class, PROP_MASTER,
g_param_spec_object ("master", _("Master"),
_("GdlDockMaster object which the dockbar widget "
"is attached to"),
@@ -109,7 +110,7 @@ gdl_dock_bar_class_init (GdlDockBarClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_DOCKBAR_STYLE,
+ object_class, PROP_DOCKBAR_STYLE,
g_param_spec_enum ("dockbar-style", _("Dockbar style"),
_("Dockbar style to show items on it"),
GDL_TYPE_DOCK_BAR_STYLE,
@@ -120,17 +121,21 @@ gdl_dock_bar_class_init (GdlDockBarClass *klass)
widget_class->get_preferred_width = gdl_dock_bar_get_preferred_width;
widget_class->get_preferred_height = gdl_dock_bar_get_preferred_height;
widget_class->size_allocate = gdl_dock_bar_size_allocate;
- widget_class->destroy = gdl_dock_bar_destroy;
+
+ g_type_class_add_private (object_class, sizeof (GdlDockBarPrivate));
}
static void
gdl_dock_bar_init (GdlDockBar *dockbar)
{
- dockbar->_priv = g_new0 (GdlDockBarPrivate, 1);
- dockbar->_priv->master = NULL;
- dockbar->_priv->items = NULL;
- dockbar->_priv->orientation = GTK_ORIENTATION_VERTICAL;
- dockbar->_priv->dockbar_style = GDL_DOCK_BAR_BOTH;
+ dockbar->priv = G_TYPE_INSTANCE_GET_PRIVATE (dockbar,
+ GDL_TYPE_DOCK_BAR,
+ GdlDockBarPrivate);
+
+ dockbar->priv->master = NULL;
+ dockbar->priv->items = NULL;
+ dockbar->priv->orientation = GTK_ORIENTATION_VERTICAL;
+ dockbar->priv->dockbar_style = GDL_DOCK_BAR_BOTH;
}
static void
@@ -143,10 +148,10 @@ gdl_dock_bar_get_property (GObject *object,
switch (prop_id) {
case PROP_MASTER:
- g_value_set_object (value, dockbar->_priv->master);
+ g_value_set_object (value, dockbar->priv->master);
break;
case PROP_DOCKBAR_STYLE:
- g_value_set_enum (value, dockbar->_priv->dockbar_style);
+ g_value_set_enum (value, dockbar->priv->dockbar_style);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -166,7 +171,7 @@ gdl_dock_bar_set_property (GObject *object,
gdl_dock_bar_attach (dockbar, g_value_get_object (value));
break;
case PROP_DOCKBAR_STYLE:
- dockbar->_priv->dockbar_style = g_value_get_enum (value);
+ dockbar->priv->dockbar_style = g_value_get_enum (value);
update_dock_items (dockbar, TRUE);
break;
default:
@@ -182,34 +187,28 @@ on_dock_item_foreach_disconnect (GdlDockItem *item, GdlDockBar *dock_bar)
}
static void
-gdl_dock_bar_destroy (GtkWidget *object)
+gdl_dock_bar_dispose (GObject *object)
{
GdlDockBar *dockbar = GDL_DOCK_BAR (object);
+ GdlDockBarPrivate *priv = dockbar->priv;
+
+ if (priv->items) {
+ g_slist_foreach (priv->items,
+ (GFunc) on_dock_item_foreach_disconnect,
+ object);
+ g_slist_free (priv->items);
+ priv->items = NULL;
+ }
- if (dockbar->_priv) {
- GdlDockBarPrivate *priv = dockbar->_priv;
-
- if (priv->items) {
- g_slist_foreach (priv->items,
- (GFunc) on_dock_item_foreach_disconnect,
- object);
- g_slist_free (priv->items);
- }
-
- if (priv->master) {
- g_signal_handlers_disconnect_matched (priv->master,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, dockbar);
- g_object_unref (priv->master);
- priv->master = NULL;
- }
-
- dockbar->_priv = NULL;
-
- g_free (priv);
+ if (priv->master) {
+ g_signal_handlers_disconnect_matched (priv->master,
+ G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, dockbar);
+ g_object_unref (priv->master);
+ priv->master = NULL;
}
-
- GTK_WIDGET_CLASS (gdl_dock_bar_parent_class)->destroy (object);
+
+ G_OBJECT_CLASS (gdl_dock_bar_parent_class)->dispose (object);
}
static void
@@ -222,7 +221,7 @@ gdl_dock_bar_remove_item (GdlDockBar *dockbar,
g_return_if_fail (GDL_IS_DOCK_BAR (dockbar));
g_return_if_fail (GDL_IS_DOCK_ITEM (item));
- priv = dockbar->_priv;
+ priv = dockbar->priv;
if (g_slist_index (priv->items, item) == -1) {
g_warning ("Item has not been added to the dockbar");
@@ -274,7 +273,7 @@ gdl_dock_bar_add_item (GdlDockBar *dockbar,
g_return_if_fail (GDL_IS_DOCK_BAR (dockbar));
g_return_if_fail (GDL_IS_DOCK_ITEM (item));
- priv = dockbar->_priv;
+ priv = dockbar->priv;
if (g_slist_index (priv->items, item) != -1) {
g_warning ("Item has already been added to the dockbar");
@@ -287,26 +286,26 @@ gdl_dock_bar_add_item (GdlDockBar *dockbar,
button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- if (dockbar->_priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (dockbar->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
box = gtk_hbox_new (FALSE, 0);
else
box = gtk_vbox_new (FALSE, 0);
g_object_get (item, "stock-id", &stock_id, "long-name", &name, NULL);
- if (dockbar->_priv->dockbar_style == GDL_DOCK_BAR_TEXT ||
- dockbar->_priv->dockbar_style == GDL_DOCK_BAR_BOTH) {
+ if (dockbar->priv->dockbar_style == GDL_DOCK_BAR_TEXT ||
+ dockbar->priv->dockbar_style == GDL_DOCK_BAR_BOTH) {
label = gtk_label_new (name);
- if (dockbar->_priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (dockbar->priv->orientation == GTK_ORIENTATION_VERTICAL)
gtk_label_set_angle (GTK_LABEL (label), 90);
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
}
/* FIXME: For now AUTO behaves same as BOTH */
- if (dockbar->_priv->dockbar_style == GDL_DOCK_BAR_ICONS ||
- dockbar->_priv->dockbar_style == GDL_DOCK_BAR_BOTH ||
- dockbar->_priv->dockbar_style == GDL_DOCK_BAR_AUTO) {
+ if (dockbar->priv->dockbar_style == GDL_DOCK_BAR_ICONS ||
+ dockbar->priv->dockbar_style == GDL_DOCK_BAR_BOTH ||
+ dockbar->priv->dockbar_style == GDL_DOCK_BAR_AUTO) {
if (stock_id) {
image = gtk_image_new_from_stock (stock_id,
GTK_ICON_SIZE_SMALL_TOOLBAR);
@@ -353,10 +352,10 @@ update_dock_items (GdlDockBar *dockbar, gboolean full_update)
g_return_if_fail (dockbar != NULL);
- if (!dockbar->_priv->master)
+ if (!dockbar->priv->master)
return;
- master = dockbar->_priv->master;
+ master = dockbar->priv->master;
/* build items list */
items = NULL;
@@ -366,10 +365,10 @@ update_dock_items (GdlDockBar *dockbar, gboolean full_update)
for (l = items; l != NULL; l = l->next) {
GdlDockItem *item = GDL_DOCK_ITEM (l->data);
- if (g_slist_index (dockbar->_priv->items, item) != -1 &&
+ if (g_slist_index (dockbar->priv->items, item) != -1 &&
!GDL_DOCK_ITEM_ICONIFIED (item))
gdl_dock_bar_remove_item (dockbar, item);
- else if (g_slist_index (dockbar->_priv->items, item) == -1 &&
+ else if (g_slist_index (dockbar->priv->items, item) == -1 &&
GDL_DOCK_ITEM_ICONIFIED (item))
gdl_dock_bar_add_item (dockbar, item);
}
@@ -377,7 +376,7 @@ update_dock_items (GdlDockBar *dockbar, gboolean full_update)
for (l = items; l != NULL; l = l->next) {
GdlDockItem *item = GDL_DOCK_ITEM (l->data);
- if (g_slist_index (dockbar->_priv->items, item) != -1)
+ if (g_slist_index (dockbar->priv->items, item) != -1)
gdl_dock_bar_remove_item (dockbar, item);
if (GDL_DOCK_ITEM_ICONIFIED (item))
gdl_dock_bar_add_item (dockbar, item);
@@ -400,17 +399,17 @@ gdl_dock_bar_attach (GdlDockBar *dockbar,
g_return_if_fail (dockbar != NULL);
g_return_if_fail (master == NULL || GDL_IS_DOCK_MASTER (master));
- if (dockbar->_priv->master) {
- g_signal_handlers_disconnect_matched (dockbar->_priv->master,
+ if (dockbar->priv->master) {
+ g_signal_handlers_disconnect_matched (dockbar->priv->master,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, dockbar);
- g_object_unref (dockbar->_priv->master);
+ g_object_unref (dockbar->priv->master);
}
- dockbar->_priv->master = master;
- if (dockbar->_priv->master) {
- g_object_ref (dockbar->_priv->master);
- g_signal_connect (dockbar->_priv->master, "layout-changed",
+ dockbar->priv->master = master;
+ if (dockbar->priv->master) {
+ g_object_ref (dockbar->priv->master);
+ g_signal_connect (dockbar->priv->master, "layout-changed",
G_CALLBACK (gdl_dock_bar_layout_changed_cb),
dockbar);
}
@@ -426,7 +425,7 @@ static void gdl_dock_bar_size_request (GtkWidget *widget,
dockbar = GDL_DOCK_BAR (widget);
/* default to vertical for unknown values */
- switch (dockbar->_priv->orientation) {
+ switch (dockbar->priv->orientation) {
case GTK_ORIENTATION_HORIZONTAL:
gdl_dock_bar_size_hrequest (widget, requisition);
break;
@@ -467,7 +466,7 @@ static void gdl_dock_bar_size_allocate (GtkWidget *widget,
dockbar = GDL_DOCK_BAR (widget);
/* default to vertical for unknown values */
- switch (dockbar->_priv->orientation) {
+ switch (dockbar->priv->orientation) {
case GTK_ORIENTATION_HORIZONTAL:
gdl_dock_bar_size_hallocate (widget, allocation);
break;
@@ -1042,7 +1041,7 @@ GtkOrientation gdl_dock_bar_get_orientation (GdlDockBar *dockbar)
g_return_val_if_fail (GDL_IS_DOCK_BAR (dockbar),
GTK_ORIENTATION_VERTICAL);
- return dockbar->_priv->orientation;
+ return dockbar->priv->orientation;
}
void gdl_dock_bar_set_orientation (GdlDockBar *dockbar,
@@ -1050,7 +1049,7 @@ void gdl_dock_bar_set_orientation (GdlDockBar *dockbar,
{
g_return_if_fail (GDL_IS_DOCK_BAR (dockbar));
- dockbar->_priv->orientation = orientation;
+ dockbar->priv->orientation = orientation;
gtk_widget_queue_resize (GTK_WIDGET (dockbar));
}
diff --git a/gdl/gdl-dock-bar.h b/gdl/gdl-dock-bar.h
index ca6da1d..48ae634 100644
--- a/gdl/gdl-dock-bar.h
+++ b/gdl/gdl-dock-bar.h
@@ -51,7 +51,7 @@ struct _GdlDockBar {
GdlDock *dock;
- GdlDockBarPrivate *_priv;
+ GdlDockBarPrivate *priv;
};
struct _GdlDockBarClass {
diff --git a/gdl/gdl-dock-item-grip.c b/gdl/gdl-dock-item-grip.c
index 2acc55a..bcff1bf 100644
--- a/gdl/gdl-dock-item-grip.c
+++ b/gdl/gdl-dock-item-grip.c
@@ -113,7 +113,7 @@ gdl_dock_item_grip_draw (GtkWidget *widget,
grip = GDL_DOCK_ITEM_GRIP (widget);
- if (grip->_priv->handle_shown)
+ if (grip->priv->handle_shown)
{
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
@@ -167,19 +167,19 @@ gdl_dock_item_grip_item_notify (GObject *master,
} else if (strcmp (pspec->name, "behavior") == 0) {
cursor = FALSE;
- if (grip->_priv->close_button) {
+ if (grip->priv->close_button) {
if (GDL_DOCK_ITEM_CANT_CLOSE (grip->item)) {
- gtk_widget_hide (GTK_WIDGET (grip->_priv->close_button));
+ gtk_widget_hide (GTK_WIDGET (grip->priv->close_button));
} else {
- gtk_widget_show (GTK_WIDGET (grip->_priv->close_button));
+ gtk_widget_show (GTK_WIDGET (grip->priv->close_button));
cursor = TRUE;
}
}
- if (grip->_priv->iconify_button) {
+ if (grip->priv->iconify_button) {
if (GDL_DOCK_ITEM_CANT_ICONIFY (grip->item)) {
- gtk_widget_hide (GTK_WIDGET (grip->_priv->iconify_button));
+ gtk_widget_hide (GTK_WIDGET (grip->priv->iconify_button));
} else {
- gtk_widget_show (GTK_WIDGET (grip->_priv->iconify_button));
+ gtk_widget_show (GTK_WIDGET (grip->priv->iconify_button));
cursor = TRUE;
}
}
@@ -194,11 +194,11 @@ gdl_dock_item_grip_destroy (GtkWidget *object)
{
GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP (object);
- if (grip->_priv) {
- GdlDockItemGripPrivate *priv = grip->_priv;
+ if (grip->priv) {
+ GdlDockItemGripPrivate *priv = grip->priv;
if (priv->label) {
- gtk_widget_unparent(grip->_priv->label);
+ gtk_widget_unparent(grip->priv->label);
priv->label = NULL;
}
@@ -208,7 +208,7 @@ gdl_dock_item_grip_destroy (GtkWidget *object)
grip);
grip->item = NULL;
- grip->_priv = NULL;
+ grip->priv = NULL;
g_free (priv);
}
@@ -241,10 +241,10 @@ gdl_dock_item_grip_set_property (GObject *object,
G_CALLBACK (gdl_dock_item_grip_item_notify),
grip);
- if (!GDL_DOCK_ITEM_CANT_CLOSE (grip->item) && grip->_priv->close_button)
- gtk_widget_show (grip->_priv->close_button);
- if (!GDL_DOCK_ITEM_CANT_ICONIFY (grip->item) && grip->_priv->iconify_button)
- gtk_widget_show (grip->_priv->iconify_button);
+ if (!GDL_DOCK_ITEM_CANT_CLOSE (grip->item) && grip->priv->close_button)
+ gtk_widget_show (grip->priv->close_button);
+ if (!GDL_DOCK_ITEM_CANT_ICONIFY (grip->item) && grip->priv->iconify_button)
+ gtk_widget_show (grip->priv->iconify_button);
}
break;
default:
@@ -265,7 +265,7 @@ gdl_dock_item_grip_close_clicked (GtkWidget *widget,
static void
gdl_dock_item_grip_fix_iconify_button (GdlDockItemGrip *grip)
{
- GtkWidget *iconify_button = grip->_priv->iconify_button;
+ GtkWidget *iconify_button = grip->priv->iconify_button;
GdkWindow *window = NULL;
GdkEvent *event = NULL;
@@ -341,50 +341,53 @@ gdl_dock_item_grip_init (GdlDockItemGrip *grip)
{
GtkWidget *image;
+ grip->priv = G_TYPE_INSTANCE_GET_PRIVATE (grip,
+ GDL_TYPE_DOCK_ITEM_GRIP,
+ GdlDockItemGripPrivate);
+
gtk_widget_set_has_window (GTK_WIDGET (grip), FALSE);
-
- grip->_priv = g_new0 (GdlDockItemGripPrivate, 1);
- grip->_priv->label = NULL;
- grip->_priv->handle_shown = FALSE;
+
+ grip->priv->label = NULL;
+ grip->priv->handle_shown = FALSE;
/* create the close button */
gtk_widget_push_composite_child ();
- grip->_priv->close_button = gtk_button_new ();
+ grip->priv->close_button = gtk_button_new ();
gtk_widget_pop_composite_child ();
- gtk_widget_set_can_focus (grip->_priv->close_button, FALSE);
- gtk_widget_set_parent (grip->_priv->close_button, GTK_WIDGET (grip));
- gtk_button_set_relief (GTK_BUTTON (grip->_priv->close_button), GTK_RELIEF_NONE);
- gtk_widget_show (grip->_priv->close_button);
+ gtk_widget_set_can_focus (grip->priv->close_button, FALSE);
+ gtk_widget_set_parent (grip->priv->close_button, GTK_WIDGET (grip));
+ gtk_button_set_relief (GTK_BUTTON (grip->priv->close_button), GTK_RELIEF_NONE);
+ gtk_widget_show (grip->priv->close_button);
image = gdl_dock_item_button_image_new(GDL_DOCK_ITEM_BUTTON_IMAGE_CLOSE);
- gtk_container_add (GTK_CONTAINER (grip->_priv->close_button), image);
+ gtk_container_add (GTK_CONTAINER (grip->priv->close_button), image);
gtk_widget_show (image);
- g_signal_connect (G_OBJECT (grip->_priv->close_button), "clicked",
+ g_signal_connect (G_OBJECT (grip->priv->close_button), "clicked",
G_CALLBACK (gdl_dock_item_grip_close_clicked), grip);
/* create the iconify button */
gtk_widget_push_composite_child ();
- grip->_priv->iconify_button = gtk_button_new ();
+ grip->priv->iconify_button = gtk_button_new ();
gtk_widget_pop_composite_child ();
- gtk_widget_set_can_focus (grip->_priv->iconify_button, FALSE);
- gtk_widget_set_parent (grip->_priv->iconify_button, GTK_WIDGET (grip));
- gtk_button_set_relief (GTK_BUTTON (grip->_priv->iconify_button), GTK_RELIEF_NONE);
- gtk_widget_show (grip->_priv->iconify_button);
+ gtk_widget_set_can_focus (grip->priv->iconify_button, FALSE);
+ gtk_widget_set_parent (grip->priv->iconify_button, GTK_WIDGET (grip));
+ gtk_button_set_relief (GTK_BUTTON (grip->priv->iconify_button), GTK_RELIEF_NONE);
+ gtk_widget_show (grip->priv->iconify_button);
image = gdl_dock_item_button_image_new(GDL_DOCK_ITEM_BUTTON_IMAGE_ICONIFY);
- gtk_container_add (GTK_CONTAINER (grip->_priv->iconify_button), image);
+ gtk_container_add (GTK_CONTAINER (grip->priv->iconify_button), image);
gtk_widget_show (image);
- g_signal_connect (G_OBJECT (grip->_priv->iconify_button), "clicked",
+ g_signal_connect (G_OBJECT (grip->priv->iconify_button), "clicked",
G_CALLBACK (gdl_dock_item_grip_iconify_clicked), grip);
/* set tooltips on the buttons */
- gtk_widget_set_tooltip_text (grip->_priv->iconify_button,
+ gtk_widget_set_tooltip_text (grip->priv->iconify_button,
_("Iconify this dock"));
- gtk_widget_set_tooltip_text (grip->_priv->close_button,
+ gtk_widget_set_tooltip_text (grip->priv->close_button,
_("Close this dock"));
}
@@ -395,16 +398,16 @@ gdl_dock_item_grip_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gdl_dock_item_grip_parent_class)->realize (widget);
- g_return_if_fail (grip->_priv != NULL);
+ g_return_if_fail (grip->priv != NULL);
if (!grip->title_window) {
GtkAllocation allocation;
GdkWindowAttr attributes;
GdkCursor *cursor;
- g_return_if_fail (grip->_priv->label != NULL);
+ g_return_if_fail (grip->priv->label != NULL);
- gtk_widget_get_allocation (grip->_priv->label, &allocation);
+ gtk_widget_get_allocation (grip->priv->label, &allocation);
attributes.x = allocation.x;
attributes.y = allocation.y;
@@ -492,24 +495,24 @@ gdl_dock_item_grip_get_preferred_width (GtkWidget *widget,
*minimum = *natural = 0;
- if(grip->_priv->handle_shown) {
+ if(grip->priv->handle_shown) {
*minimum += DRAG_HANDLE_SIZE;
*natural += DRAG_HANDLE_SIZE;
}
- if (gtk_widget_get_visible (grip->_priv->close_button)) {
- gtk_widget_get_preferred_width (grip->_priv->close_button, &child_min, &child_nat);
+ if (gtk_widget_get_visible (grip->priv->close_button)) {
+ gtk_widget_get_preferred_width (grip->priv->close_button, &child_min, &child_nat);
*minimum += child_min;
*natural += child_nat;
}
- if (gtk_widget_get_visible (grip->_priv->iconify_button)) {
- gtk_widget_get_preferred_width (grip->_priv->iconify_button, &child_min, &child_nat);
+ if (gtk_widget_get_visible (grip->priv->iconify_button)) {
+ gtk_widget_get_preferred_width (grip->priv->iconify_button, &child_min, &child_nat);
*minimum += child_min;
*natural += child_nat;
}
- gtk_widget_get_preferred_width (grip->_priv->label, &child_min, &child_nat);
+ gtk_widget_get_preferred_width (grip->priv->label, &child_min, &child_nat);
*minimum += child_min;
*natural += child_nat;
}
@@ -529,15 +532,15 @@ gdl_dock_item_grip_get_preferred_height (GtkWidget *widget,
*minimum = *natural = 0;
- gtk_widget_get_preferred_height (grip->_priv->close_button, &child_min, &child_nat);
+ gtk_widget_get_preferred_height (grip->priv->close_button, &child_min, &child_nat);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
- gtk_widget_get_preferred_height (grip->_priv->iconify_button, &child_min, &child_nat);
+ gtk_widget_get_preferred_height (grip->priv->iconify_button, &child_min, &child_nat);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
- gtk_widget_get_preferred_height (grip->_priv->label, &child_min, &child_nat);
+ gtk_widget_get_preferred_height (grip->priv->label, &child_min, &child_nat);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
}
@@ -559,14 +562,14 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
GTK_WIDGET_CLASS (gdl_dock_item_grip_parent_class)->size_allocate (widget, allocation);
- gtk_widget_get_preferred_size (grip->_priv->close_button,
+ gtk_widget_get_preferred_size (grip->priv->close_button,
&close_requisition, NULL);
- gtk_widget_get_preferred_size (grip->_priv->iconify_button,
+ gtk_widget_get_preferred_size (grip->priv->iconify_button,
&iconify_requisition, NULL);
/* Calculate the Minimum Width where buttons will fit */
int min_width = close_requisition.width + iconify_requisition.width;
- if(grip->_priv->handle_shown)
+ if(grip->priv->handle_shown)
min_width += DRAG_HANDLE_SIZE;
const gboolean space_for_buttons = (allocation->width >= min_width);
@@ -578,7 +581,7 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
child_allocation.y = 0;
/* Layout Close Button */
- if (gtk_widget_get_visible (grip->_priv->close_button)) {
+ if (gtk_widget_get_visible (grip->priv->close_button)) {
if(space_for_buttons) {
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL)
@@ -590,14 +593,14 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
child_allocation.width = 0;
}
- gtk_widget_size_allocate (grip->_priv->close_button, &child_allocation);
+ gtk_widget_size_allocate (grip->priv->close_button, &child_allocation);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
child_allocation.x += close_requisition.width;
}
/* Layout Iconify Button */
- if (gtk_widget_get_visible (grip->_priv->iconify_button)) {
+ if (gtk_widget_get_visible (grip->priv->iconify_button)) {
if(space_for_buttons) {
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL)
@@ -609,7 +612,7 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
child_allocation.width = 0;
}
- gtk_widget_size_allocate (grip->_priv->iconify_button, &child_allocation);
+ gtk_widget_size_allocate (grip->priv->iconify_button, &child_allocation);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
child_allocation.x += iconify_requisition.width;
@@ -620,7 +623,7 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
child_allocation.width = child_allocation.x;
child_allocation.x = 0;
- if(grip->_priv->handle_shown) {
+ if(grip->priv->handle_shown) {
child_allocation.x += DRAG_HANDLE_SIZE;
child_allocation.width -= DRAG_HANDLE_SIZE;
}
@@ -629,7 +632,7 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
child_allocation.width = allocation->width -
(child_allocation.x - allocation->x)/* - ALIGN_BORDER*/;
- if(grip->_priv->handle_shown)
+ if(grip->priv->handle_shown)
child_allocation.width -= DRAG_HANDLE_SIZE;
}
@@ -638,8 +641,8 @@ gdl_dock_item_grip_size_allocate (GtkWidget *widget,
child_allocation.y = 0;
child_allocation.height = allocation->height;
- if(grip->_priv->label) {
- gtk_widget_size_allocate (grip->_priv->label, &child_allocation);
+ if(grip->priv->label) {
+ gtk_widget_size_allocate (grip->priv->label, &child_allocation);
}
if (grip->title_window) {
@@ -676,14 +679,14 @@ gdl_dock_item_grip_forall (GtkContainer *container,
g_return_if_fail (GDL_IS_DOCK_ITEM_GRIP (container));
grip = GDL_DOCK_ITEM_GRIP (container);
- if (grip->_priv) {
- if(grip->_priv->label) {
- (* callback) (grip->_priv->label, callback_data);
+ if (grip->priv) {
+ if(grip->priv->label) {
+ (* callback) (grip->priv->label, callback_data);
}
if (include_internals) {
- (* callback) (grip->_priv->close_button, callback_data);
- (* callback) (grip->_priv->iconify_button, callback_data);
+ (* callback) (grip->priv->close_button, callback_data);
+ (* callback) (grip->priv->iconify_button, callback_data);
}
}
}
@@ -697,15 +700,15 @@ gdl_dock_item_grip_child_type (GtkContainer *container)
static void
gdl_dock_item_grip_class_init (GdlDockItemGripClass *klass)
{
- GObjectClass *gobject_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- gobject_class = G_OBJECT_CLASS (klass);
+ object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
- gobject_class->set_property = gdl_dock_item_grip_set_property;
+ object_class->set_property = gdl_dock_item_grip_set_property;
widget_class->destroy = gdl_dock_item_grip_destroy;
@@ -725,11 +728,13 @@ gdl_dock_item_grip_class_init (GdlDockItemGripClass *klass)
gtk_container_class_handle_border_width (container_class);
g_object_class_install_property (
- gobject_class, PROP_ITEM,
+ object_class, PROP_ITEM,
g_param_spec_object ("item", _("Controlling dock item"),
_("Dockitem which 'owns' this grip"),
GDL_TYPE_DOCK_ITEM,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_type_class_add_private (object_class, sizeof (GdlDockItemGripPrivate));
}
static void
@@ -769,17 +774,17 @@ gdl_dock_item_grip_set_label (GdlDockItemGrip *grip,
{
g_return_if_fail (grip != NULL);
- if (grip->_priv->label) {
- gtk_widget_unparent(grip->_priv->label);
- g_object_unref (grip->_priv->label);
- grip->_priv->label = NULL;
+ if (grip->priv->label) {
+ gtk_widget_unparent(grip->priv->label);
+ g_object_unref (grip->priv->label);
+ grip->priv->label = NULL;
}
if (label) {
g_object_ref (label);
gtk_widget_set_parent (label, GTK_WIDGET (grip));
gtk_widget_show (label);
- grip->_priv->label = label;
+ grip->priv->label = label;
}
}
/**
@@ -792,8 +797,8 @@ void
gdl_dock_item_grip_hide_handle (GdlDockItemGrip *grip)
{
g_return_if_fail (grip != NULL);
- if (grip->_priv->handle_shown) {
- grip->_priv->handle_shown = FALSE;
+ if (grip->priv->handle_shown) {
+ grip->priv->handle_shown = FALSE;
gdl_dock_item_grip_showhide_handle (grip);
};
}
@@ -808,8 +813,8 @@ void
gdl_dock_item_grip_show_handle (GdlDockItemGrip *grip)
{
g_return_if_fail (grip != NULL);
- if (!grip->_priv->handle_shown) {
- grip->_priv->handle_shown = TRUE;
+ if (!grip->priv->handle_shown) {
+ grip->priv->handle_shown = TRUE;
gdl_dock_item_grip_showhide_handle (grip);
};
}
diff --git a/gdl/gdl-dock-item-grip.h b/gdl/gdl-dock-item-grip.h
index 4abf909..7220f27 100644
--- a/gdl/gdl-dock-item-grip.h
+++ b/gdl/gdl-dock-item-grip.h
@@ -58,7 +58,7 @@ struct _GdlDockItemGrip {
GdkWindow *title_window;
- GdlDockItemGripPrivate *_priv;
+ GdlDockItemGripPrivate *priv;
};
struct _GdlDockItemGripClass {
diff --git a/gdl/gdl-dock-item.c b/gdl/gdl-dock-item.c
index 5ff57c7..4365d0f 100644
--- a/gdl/gdl-dock-item.c
+++ b/gdl/gdl-dock-item.c
@@ -201,19 +201,19 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
{
static gboolean style_initialized = FALSE;
- GObjectClass *g_object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- GdlDockObjectClass *object_class;
+ GdlDockObjectClass *dock_object_class;
- g_object_class = G_OBJECT_CLASS (klass);
+ object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
- object_class = GDL_DOCK_OBJECT_CLASS (klass);
+ dock_object_class = GDL_DOCK_OBJECT_CLASS (klass);
- g_object_class->constructor = gdl_dock_item_constructor;
- g_object_class->set_property = gdl_dock_item_set_property;
- g_object_class->get_property = gdl_dock_item_get_property;
+ object_class->constructor = gdl_dock_item_constructor;
+ object_class->set_property = gdl_dock_item_set_property;
+ object_class->get_property = gdl_dock_item_get_property;
widget_class->destroy = gdl_dock_item_destroy;
@@ -234,11 +234,11 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
container_class->forall = gdl_dock_item_forall;
container_class->child_type = gdl_dock_item_child_type;
gtk_container_class_handle_border_width (container_class);
-
- object_class->is_compound = FALSE;
- object_class->dock_request = gdl_dock_item_dock_request;
- object_class->dock = gdl_dock_item_dock;
+ dock_object_class->is_compound = FALSE;
+
+ dock_object_class->dock_request = gdl_dock_item_dock_request;
+ dock_object_class->dock = gdl_dock_item_dock;
/* properties */
@@ -253,7 +253,7 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
* widget text direction is set to RTL).
*/
g_object_class_install_property (
- g_object_class, PROP_ORIENTATION,
+ object_class, PROP_ORIENTATION,
g_param_spec_enum ("orientation", _("Orientation"),
_("Orientation of the docking item"),
GTK_TYPE_ORIENTATION,
@@ -269,7 +269,7 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
/* --- end of registration */
g_object_class_install_property (
- g_object_class, PROP_RESIZE,
+ object_class, PROP_RESIZE,
g_param_spec_boolean ("resize", _("Resizable"),
_("If set, the dock item can be resized when "
"docked in a GtkPanel widget"),
@@ -277,7 +277,7 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_BEHAVIOR,
+ object_class, PROP_BEHAVIOR,
g_param_spec_flags ("behavior", _("Item behavior"),
_("General behavior for the dock item (i.e. "
"whether it can float, if it's locked, etc.)"),
@@ -286,7 +286,7 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_LOCKED,
+ object_class, PROP_LOCKED,
g_param_spec_boolean ("locked", _("Locked"),
_("If set, the dock item cannot be dragged around "
"and it doesn't show a grip"),
@@ -295,14 +295,14 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
GDL_DOCK_PARAM_EXPORT));
g_object_class_install_property (
- g_object_class, PROP_PREFERRED_WIDTH,
+ object_class, PROP_PREFERRED_WIDTH,
g_param_spec_int ("preferred-width", _("Preferred width"),
_("Preferred width for the dock item"),
-1, G_MAXINT, -1,
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_PREFERRED_HEIGHT,
+ object_class, PROP_PREFERRED_HEIGHT,
g_param_spec_int ("preferred-height", _("Preferred height"),
_("Preferred height for the dock item"),
-1, G_MAXINT, -1,
@@ -401,11 +401,17 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
"class \"GdlDockItem\" "
"style : gtk \"gdl-dock-item-default\"\n");
}
+
+ g_type_class_add_private (object_class, sizeof (GdlDockItemPrivate));
}
static void
gdl_dock_item_init (GdlDockItem *item)
{
+ item->priv = G_TYPE_INSTANCE_GET_PRIVATE (item,
+ GDL_TYPE_DOCK_ITEM,
+ GdlDockItemPrivate);
+
gtk_widget_set_has_window (GTK_WIDGET (item), TRUE);
item->child = NULL;
@@ -417,14 +423,13 @@ gdl_dock_item_init (GdlDockItem *item)
item->dragoff_x = item->dragoff_y = 0;
- item->_priv = g_new0 (GdlDockItemPrivate, 1);
- item->_priv->menu = NULL;
+ item->priv->menu = NULL;
- item->_priv->preferred_width = item->_priv->preferred_height = -1;
- item->_priv->tab_label = NULL;
- item->_priv->intern_tab_label = FALSE;
+ item->priv->preferred_width = item->priv->preferred_height = -1;
+ item->priv->tab_label = NULL;
+ item->priv->intern_tab_label = FALSE;
- item->_priv->ph = NULL;
+ item->priv->ph = NULL;
}
static void
@@ -468,13 +473,13 @@ gdl_dock_item_constructor (GType type,
gchar* stock_id;
if (GDL_DOCK_ITEM_HAS_GRIP (item)) {
- item->_priv->grip_shown = TRUE;
- item->_priv->grip = gdl_dock_item_grip_new (item);
- gtk_widget_set_parent (item->_priv->grip, GTK_WIDGET (item));
- gtk_widget_show (item->_priv->grip);
+ item->priv->grip_shown = TRUE;
+ item->priv->grip = gdl_dock_item_grip_new (item);
+ gtk_widget_set_parent (item->priv->grip, GTK_WIDGET (item));
+ gtk_widget_show (item->priv->grip);
}
else {
- item->_priv->grip_shown = FALSE;
+ item->priv->grip_shown = FALSE;
}
g_object_get (g_object, "long-name", &long_name, "stock-id", &stock_id, NULL);
@@ -488,17 +493,17 @@ gdl_dock_item_constructor (GType type,
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- item->_priv->notify_label =
+ item->priv->notify_label =
g_signal_connect (item, "notify::long-name", G_CALLBACK (on_long_name_changed),
label);
- item->_priv->notify_stock_id =
+ item->priv->notify_stock_id =
g_signal_connect (item, "notify::stock-id", G_CALLBACK (on_stock_id_changed),
icon);
gtk_widget_show_all (hbox);
gdl_dock_item_set_tablabel (item, hbox);
- item->_priv->intern_tab_label = TRUE;
+ item->priv->intern_tab_label = TRUE;
g_free (long_name);
g_free (stock_id);
@@ -558,10 +563,10 @@ gdl_dock_item_set_property (GObject *g_object,
break;
}
case PROP_PREFERRED_WIDTH:
- item->_priv->preferred_width = g_value_get_int (value);
+ item->priv->preferred_width = g_value_get_int (value);
break;
case PROP_PREFERRED_HEIGHT:
- item->_priv->preferred_height = g_value_get_int (value);
+ item->priv->preferred_height = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (g_object, prop_id, pspec);
@@ -591,10 +596,10 @@ gdl_dock_item_get_property (GObject *g_object,
g_value_set_boolean (value, !GDL_DOCK_ITEM_NOT_LOCKED (item));
break;
case PROP_PREFERRED_WIDTH:
- g_value_set_int (value, item->_priv->preferred_width);
+ g_value_set_int (value, item->priv->preferred_width);
break;
case PROP_PREFERRED_HEIGHT:
- g_value_set_int (value, item->_priv->preferred_height);
+ g_value_set_int (value, item->priv->preferred_height);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (g_object, prop_id, pspec);
@@ -607,8 +612,8 @@ gdl_dock_item_destroy (GtkWidget *object)
{
GdlDockItem *item = GDL_DOCK_ITEM (object);
- if (item->_priv) {
- GdlDockItemPrivate *priv = item->_priv;
+ if (item->priv) {
+ GdlDockItemPrivate *priv = item->priv;
if (priv->tab_label) {
gdl_dock_item_set_tablabel (item, NULL);
@@ -626,7 +631,7 @@ gdl_dock_item_destroy (GtkWidget *object)
priv->ph = NULL;
}
- item->_priv = NULL;
+ item->priv = NULL;
g_free (priv);
}
@@ -673,10 +678,10 @@ gdl_dock_item_remove (GtkContainer *container,
g_return_if_fail (GDL_IS_DOCK_ITEM (container));
item = GDL_DOCK_ITEM (container);
- if (item->_priv && widget == item->_priv->grip) {
+ if (item->priv && widget == item->priv->grip) {
gboolean grip_was_visible = gtk_widget_get_visible (widget);
gtk_widget_unparent (widget);
- item->_priv->grip = NULL;
+ item->priv->grip = NULL;
if (grip_was_visible)
gtk_widget_queue_resize (GTK_WIDGET (item));
return;
@@ -707,8 +712,8 @@ gdl_dock_item_forall (GtkContainer *container,
g_return_if_fail (callback != NULL);
- if (include_internals && item->_priv->grip)
- (* callback) (item->_priv->grip, callback_data);
+ if (include_internals && item->priv->grip)
+ (* callback) (item->priv->grip, callback_data);
if (item->child)
(* callback) (item->child, callback_data);
@@ -747,7 +752,7 @@ gdl_dock_item_get_preferred_width (GtkWidget *widget,
if (item->orientation == GTK_ORIENTATION_HORIZONTAL) {
if (GDL_DOCK_ITEM_GRIP_SHOWN (item)) {
- gtk_widget_get_preferred_width (item->_priv->grip, minimum, natural);
+ gtk_widget_get_preferred_width (item->priv->grip, minimum, natural);
} else
*minimum = *natural = 0;
@@ -797,7 +802,7 @@ gdl_dock_item_get_preferred_height (GtkWidget *widget,
*minimum = *natural = 0;
} else {
if (GDL_DOCK_ITEM_GRIP_SHOWN (item)) {
- gtk_widget_get_preferred_height (item->_priv->grip, minimum, natural);
+ gtk_widget_get_preferred_height (item->priv->grip, minimum, natural);
} else
*minimum = *natural = 0;
@@ -827,8 +832,8 @@ gdl_dock_item_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
/* Once size is allocated, preferred size is no longer necessary */
- item->_priv->preferred_height = -1;
- item->_priv->preferred_width = -1;
+ item->priv->preferred_height = -1;
+ item->priv->preferred_width = -1;
if (gtk_widget_get_realized (widget))
gdk_window_move_resize (gtk_widget_get_window (widget),
@@ -854,7 +859,7 @@ gdl_dock_item_size_allocate (GtkWidget *widget,
GtkAllocation grip_alloc = child_allocation;
GtkRequisition grip_req;
- gtk_widget_size_request (item->_priv->grip, &grip_req);
+ gtk_widget_size_request (item->priv->grip, &grip_req);
if (item->orientation == GTK_ORIENTATION_HORIZONTAL) {
child_allocation.x += grip_req.width;
@@ -865,8 +870,8 @@ gdl_dock_item_size_allocate (GtkWidget *widget,
child_allocation.height -= grip_req.height;
grip_alloc.height = grip_req.height;
}
- if (item->_priv->grip)
- gtk_widget_size_allocate (item->_priv->grip, &grip_alloc);
+ if (item->priv->grip)
+ gtk_widget_size_allocate (item->priv->grip, &grip_alloc);
}
/* Allocation can't be negative */
if (child_allocation.width < 0)
@@ -896,10 +901,10 @@ gdl_dock_item_map (GtkWidget *widget)
&& !gtk_widget_get_mapped (item->child))
gtk_widget_map (item->child);
- if (item->_priv->grip
- && gtk_widget_get_visible (GTK_WIDGET (item->_priv->grip))
- && !gtk_widget_get_mapped (GTK_WIDGET (item->_priv->grip)))
- gtk_widget_map (item->_priv->grip);
+ if (item->priv->grip
+ && gtk_widget_get_visible (GTK_WIDGET (item->priv->grip))
+ && !gtk_widget_get_mapped (GTK_WIDGET (item->priv->grip)))
+ gtk_widget_map (item->priv->grip);
}
static void
@@ -919,8 +924,8 @@ gdl_dock_item_unmap (GtkWidget *widget)
if (item->child)
gtk_widget_unmap (item->child);
- if (item->_priv->grip)
- gtk_widget_unmap (item->_priv->grip);
+ if (item->priv->grip)
+ gtk_widget_unmap (item->priv->grip);
}
static void
@@ -966,8 +971,8 @@ gdl_dock_item_realize (GtkWidget *widget)
if (item->child)
gtk_widget_set_parent_window (item->child, window);
- if (item->_priv->grip)
- gtk_widget_set_parent_window (item->_priv->grip, window);
+ if (item->priv->grip)
+ gtk_widget_set_parent_window (item->priv->grip, window);
}
static void
@@ -1012,14 +1017,14 @@ gdl_dock_item_button_changed (GtkWidget *widget,
item = GDL_DOCK_ITEM (widget);
- if (!EVENT_IN_GRIP_EVENT_WINDOW (event, item->_priv->grip))
+ if (!EVENT_IN_GRIP_EVENT_WINDOW (event, item->priv->grip))
return FALSE;
locked = !GDL_DOCK_ITEM_NOT_LOCKED (item);
event_handled = FALSE;
- gtk_widget_get_allocation (item->_priv->grip, &allocation);
+ gtk_widget_get_allocation (item->priv->grip, &allocation);
/* Check if user clicked on the drag handle. */
switch (item->orientation) {
@@ -1038,14 +1043,14 @@ gdl_dock_item_button_changed (GtkWidget *widget,
if (!locked && event->button == 1 && event->type == GDK_BUTTON_PRESS) {
/* Set in_drag flag, grab pointer and call begin drag operation. */
if (in_handle) {
- item->_priv->start_x = event->x;
- item->_priv->start_y = event->y;
+ item->priv->start_x = event->x;
+ item->priv->start_y = event->y;
GDL_DOCK_ITEM_SET_FLAGS (item, GDL_DOCK_IN_PREDRAG);
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
GDK_FLEUR);
- gdk_window_set_cursor (GDL_DOCK_ITEM_GRIP (item->_priv->grip)->title_window,
+ gdk_window_set_cursor (GDL_DOCK_ITEM_GRIP (item->priv->grip)->title_window,
cursor);
gdk_cursor_unref (cursor);
@@ -1065,10 +1070,10 @@ gdl_dock_item_button_changed (GtkWidget *widget,
/* we check the window since if the item was redocked it's
been unrealized and maybe it's not realized again yet */
- if (GDL_DOCK_ITEM_GRIP (item->_priv->grip)->title_window) {
+ if (GDL_DOCK_ITEM_GRIP (item->priv->grip)->title_window) {
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
GDK_HAND2);
- gdk_window_set_cursor (GDL_DOCK_ITEM_GRIP (item->_priv->grip)->title_window,
+ gdk_window_set_cursor (GDL_DOCK_ITEM_GRIP (item->priv->grip)->title_window,
cursor);
gdk_cursor_unref (cursor);
}
@@ -1094,18 +1099,18 @@ gdl_dock_item_motion (GtkWidget *widget,
item = GDL_DOCK_ITEM (widget);
- if (!EVENT_IN_GRIP_EVENT_WINDOW (event, item->_priv->grip))
+ if (!EVENT_IN_GRIP_EVENT_WINDOW (event, item->priv->grip))
return FALSE;
if (GDL_DOCK_ITEM_IN_PREDRAG (item)) {
if (gtk_drag_check_threshold (widget,
- item->_priv->start_x,
- item->_priv->start_y,
+ item->priv->start_x,
+ item->priv->start_y,
event->x,
event->y)) {
GDL_DOCK_ITEM_UNSET_FLAGS (item, GDL_DOCK_IN_PREDRAG);
- item->dragoff_x = item->_priv->start_x;
- item->dragoff_y = item->_priv->start_y;
+ item->dragoff_x = item->priv->start_x;
+ item->dragoff_y = item->priv->start_y;
gdl_dock_item_drag_start (item);
}
@@ -1485,7 +1490,7 @@ gdl_dock_item_detach_menu (GtkWidget *widget,
GdlDockItem *item;
item = GDL_DOCK_ITEM (widget);
- item->_priv->menu = NULL;
+ item->priv->menu = NULL;
}
static void
@@ -1495,37 +1500,37 @@ gdl_dock_item_popup_menu (GdlDockItem *item,
{
GtkWidget *mitem;
- if (!item->_priv->menu) {
+ if (!item->priv->menu) {
/* Create popup menu and attach it to the dock item */
- item->_priv->menu = gtk_menu_new ();
- gtk_menu_attach_to_widget (GTK_MENU (item->_priv->menu),
+ item->priv->menu = gtk_menu_new ();
+ gtk_menu_attach_to_widget (GTK_MENU (item->priv->menu),
GTK_WIDGET (item),
gdl_dock_item_detach_menu);
if (item->behavior & GDL_DOCK_ITEM_BEH_LOCKED) {
/* UnLock menuitem */
mitem = gtk_menu_item_new_with_label (_("UnLock"));
- gtk_menu_shell_append (GTK_MENU_SHELL (item->_priv->menu),
+ gtk_menu_shell_append (GTK_MENU_SHELL (item->priv->menu),
mitem);
g_signal_connect (mitem, "activate",
G_CALLBACK (gdl_dock_item_unlock_cb), item);
} else {
/* Hide menuitem. */
mitem = gtk_menu_item_new_with_label (_("Hide"));
- gtk_menu_shell_append (GTK_MENU_SHELL (item->_priv->menu), mitem);
+ gtk_menu_shell_append (GTK_MENU_SHELL (item->priv->menu), mitem);
g_signal_connect (mitem, "activate",
G_CALLBACK (gdl_dock_item_hide_cb), item);
/* Lock menuitem */
mitem = gtk_menu_item_new_with_label (_("Lock"));
- gtk_menu_shell_append (GTK_MENU_SHELL (item->_priv->menu), mitem);
+ gtk_menu_shell_append (GTK_MENU_SHELL (item->priv->menu), mitem);
g_signal_connect (mitem, "activate",
G_CALLBACK (gdl_dock_item_lock_cb), item);
}
}
/* Show popup menu. */
- gtk_widget_show_all (item->_priv->menu);
- gtk_menu_popup (GTK_MENU (item->_priv->menu), NULL, NULL, NULL, NULL,
+ gtk_widget_show_all (item->priv->menu);
+ gtk_menu_popup (GTK_MENU (item->priv->menu), NULL, NULL, NULL, NULL,
button, time);
}
@@ -1582,12 +1587,12 @@ gdl_dock_item_tab_button (GtkWidget *widget,
switch (item->orientation) {
case GTK_ORIENTATION_HORIZONTAL:
gtk_widget_get_allocation (GTK_WIDGET (data), &allocation);
- /*item->dragoff_x = item->_priv->grip_size / 2;*/
+ /*item->dragoff_x = item->priv->grip_size / 2;*/
item->dragoff_y = allocation.height / 2;
break;
case GTK_ORIENTATION_VERTICAL:
/*item->dragoff_x = GTK_WIDGET (data)->allocation.width / 2;*/
- item->dragoff_y = item->_priv->grip_size / 2;
+ item->dragoff_y = item->priv->grip_size / 2;
break;
};
gdl_dock_item_drag_start (item);
@@ -1642,13 +1647,13 @@ gdl_dock_item_showhide_grip (GdlDockItem *item)
display = gtk_widget_get_display (GTK_WIDGET (item));
cursor = NULL;
- if (item->_priv->grip) {
+ if (item->priv->grip) {
if (GDL_DOCK_ITEM_GRIP_SHOWN (item) &&
GDL_DOCK_ITEM_NOT_LOCKED(item))
cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
}
- if (item->_priv->grip && GDL_DOCK_ITEM_GRIP (item->_priv->grip)->title_window)
- gdk_window_set_cursor (GDL_DOCK_ITEM_GRIP (item->_priv->grip)->title_window, cursor);
+ if (item->priv->grip && GDL_DOCK_ITEM_GRIP (item->priv->grip)->title_window)
+ gdk_window_set_cursor (GDL_DOCK_ITEM_GRIP (item->priv->grip)->title_window, cursor);
if (cursor)
gdk_cursor_unref (cursor);
@@ -1826,7 +1831,7 @@ gdl_dock_item_get_tablabel (GdlDockItem *item)
g_return_val_if_fail (item != NULL, NULL);
g_return_val_if_fail (GDL_IS_DOCK_ITEM (item), NULL);
- return item->_priv->tab_label;
+ return item->priv->tab_label;
}
/**
@@ -1844,29 +1849,29 @@ gdl_dock_item_set_tablabel (GdlDockItem *item,
{
g_return_if_fail (item != NULL);
- if (item->_priv->intern_tab_label)
+ if (item->priv->intern_tab_label)
{
- item->_priv->intern_tab_label = FALSE;
- g_signal_handler_disconnect (item, item->_priv->notify_label);
- g_signal_handler_disconnect (item, item->_priv->notify_stock_id);
+ item->priv->intern_tab_label = FALSE;
+ g_signal_handler_disconnect (item, item->priv->notify_label);
+ g_signal_handler_disconnect (item, item->priv->notify_stock_id);
}
- if (item->_priv->tab_label) {
+ if (item->priv->tab_label) {
/* disconnect and unref the previous tablabel */
- if (GDL_IS_DOCK_TABLABEL (item->_priv->tab_label)) {
- g_signal_handlers_disconnect_matched (item->_priv->tab_label,
+ if (GDL_IS_DOCK_TABLABEL (item->priv->tab_label)) {
+ g_signal_handlers_disconnect_matched (item->priv->tab_label,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
NULL, item);
- g_object_set (item->_priv->tab_label, "item", NULL, NULL);
+ g_object_set (item->priv->tab_label, "item", NULL, NULL);
}
- g_object_unref (item->_priv->tab_label);
- item->_priv->tab_label = NULL;
+ g_object_unref (item->priv->tab_label);
+ item->priv->tab_label = NULL;
}
if (tablabel) {
g_object_ref_sink (G_OBJECT (tablabel));
- item->_priv->tab_label = tablabel;
+ item->priv->tab_label = tablabel;
if (GDL_IS_DOCK_TABLABEL (tablabel)) {
g_object_set (tablabel, "item", item, NULL);
/* connect to tablabel signal */
@@ -1890,7 +1895,7 @@ gdl_dock_item_get_grip(GdlDockItem *item)
g_return_val_if_fail (item != NULL, NULL);
g_return_val_if_fail (GDL_IS_DOCK_ITEM (item), NULL);
- return item->_priv->grip;
+ return item->priv->grip;
}
/**
@@ -1903,8 +1908,8 @@ void
gdl_dock_item_hide_grip (GdlDockItem *item)
{
g_return_if_fail (item != NULL);
- if (item->_priv->grip_shown) {
- item->_priv->grip_shown = FALSE;
+ if (item->priv->grip_shown) {
+ item->priv->grip_shown = FALSE;
gdl_dock_item_showhide_grip (item);
};
g_warning ("Grips always show unless GDL_DOCK_ITEM_BEH_NO_GRIP is set\n" );
@@ -1920,8 +1925,8 @@ void
gdl_dock_item_show_grip (GdlDockItem *item)
{
g_return_if_fail (item != NULL);
- if (!item->_priv->grip_shown) {
- item->_priv->grip_shown = TRUE;
+ if (!item->priv->grip_shown) {
+ item->priv->grip_shown = TRUE;
gdl_dock_item_showhide_grip (item);
};
}
@@ -1997,8 +2002,8 @@ gdl_dock_item_hide_item (GdlDockItem *item)
/* if the object is manual, create a new placeholder to be able to
restore the position later */
if (!GDL_DOCK_OBJECT_AUTOMATIC (item)) {
- if (item->_priv->ph)
- g_object_unref (item->_priv->ph);
+ if (item->priv->ph)
+ g_object_unref (item->priv->ph);
gboolean isFloating = FALSE;
gint width=0, height=0, x=0, y = 0;
@@ -2015,10 +2020,10 @@ gdl_dock_item_hide_item (GdlDockItem *item)
NULL);
} else {
gtk_widget_get_allocation (GTK_WIDGET (item), &allocation);
- item->_priv->preferred_width = allocation.width;
- item->_priv->preferred_height = allocation.height;
+ item->priv->preferred_width = allocation.width;
+ item->priv->preferred_height = allocation.height;
}
- item->_priv->ph = GDL_DOCK_PLACEHOLDER (
+ item->priv->ph = GDL_DOCK_PLACEHOLDER (
g_object_new (GDL_TYPE_DOCK_PLACEHOLDER,
"sticky", FALSE,
"host", item,
@@ -2028,7 +2033,7 @@ gdl_dock_item_hide_item (GdlDockItem *item)
"floatx", x,
"floaty", y,
NULL));
- g_object_ref_sink (item->_priv->ph);
+ g_object_ref_sink (item->priv->ph);
}
gdl_dock_object_freeze (GDL_DOCK_OBJECT (item));
@@ -2079,10 +2084,10 @@ gdl_dock_item_show_item (GdlDockItem *item)
GDL_DOCK_OBJECT_UNSET_FLAGS (item, GDL_DOCK_ICONIFIED);
- if (item->_priv->ph) {
+ if (item->priv->ph) {
gboolean isFloating=FALSE;
gint width = 0, height = 0, x= 0, y = 0;
- g_object_get (G_OBJECT(item->_priv->ph),
+ g_object_get (G_OBJECT(item->priv->ph),
"width", &width,
"height", &height,
"floating",&isFloating,
@@ -2095,11 +2100,11 @@ gdl_dock_item_show_item (GdlDockItem *item)
gdl_dock_add_floating_item (GDL_DOCK (controller),
item, x, y, width, height);
} else {
- gtk_container_add (GTK_CONTAINER (item->_priv->ph),
+ gtk_container_add (GTK_CONTAINER (item->priv->ph),
GTK_WIDGET (item));
}
- g_object_unref (item->_priv->ph);
- item->_priv->ph = NULL;
+ g_object_unref (item->priv->ph);
+ item->priv->ph = NULL;
} else if (gdl_dock_object_is_bound (GDL_DOCK_OBJECT (item))) {
GdlDockObject *toplevel;
@@ -2164,22 +2169,22 @@ gdl_dock_item_set_default_position (GdlDockItem *item,
{
g_return_if_fail (item != NULL);
- if (item->_priv->ph) {
- g_object_unref (item->_priv->ph);
- item->_priv->ph = NULL;
+ if (item->priv->ph) {
+ g_object_unref (item->priv->ph);
+ item->priv->ph = NULL;
}
if (reference && GDL_DOCK_OBJECT_ATTACHED (reference)) {
if (GDL_IS_DOCK_PLACEHOLDER (reference)) {
g_object_ref_sink (reference);
- item->_priv->ph = GDL_DOCK_PLACEHOLDER (reference);
+ item->priv->ph = GDL_DOCK_PLACEHOLDER (reference);
} else {
- item->_priv->ph = GDL_DOCK_PLACEHOLDER (
+ item->priv->ph = GDL_DOCK_PLACEHOLDER (
g_object_new (GDL_TYPE_DOCK_PLACEHOLDER,
"sticky", TRUE,
"host", reference,
NULL));
- g_object_ref_sink (item->_priv->ph);
+ g_object_ref_sink (item->priv->ph);
}
}
}
@@ -2203,8 +2208,8 @@ gdl_dock_item_preferred_size (GdlDockItem *item,
gtk_widget_get_allocation (GTK_WIDGET (item), &allocation);
- req->width = MAX (item->_priv->preferred_width, allocation.width);
- req->height = MAX (item->_priv->preferred_height, allocation.height);
+ req->width = MAX (item->priv->preferred_width, allocation.width);
+ req->height = MAX (item->priv->preferred_height, allocation.height);
}
diff --git a/gdl/gdl-dock-item.h b/gdl/gdl-dock-item.h
index f20e74c..9f699c0 100644
--- a/gdl/gdl-dock-item.h
+++ b/gdl/gdl-dock-item.h
@@ -112,7 +112,7 @@ struct _GdlDockItem {
gint dragoff_x, dragoff_y; /* these need to be
accesible from
outside */
- GdlDockItemPrivate *_priv;
+ GdlDockItemPrivate *priv;
};
struct _GdlDockItemClass {
diff --git a/gdl/gdl-dock-layout.c b/gdl/gdl-dock-layout.c
index ff2a27a..af4c7de 100644
--- a/gdl/gdl-dock-layout.c
+++ b/gdl/gdl-dock-layout.c
@@ -108,14 +108,14 @@ G_DEFINE_TYPE (GdlDockLayout, gdl_dock_layout, G_TYPE_OBJECT);
static void
gdl_dock_layout_class_init (GdlDockLayoutClass *klass)
{
- GObjectClass *g_object_class = (GObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_object_class->set_property = gdl_dock_layout_set_property;
- g_object_class->get_property = gdl_dock_layout_get_property;
- g_object_class->dispose = gdl_dock_layout_dispose;
+ object_class->set_property = gdl_dock_layout_set_property;
+ object_class->get_property = gdl_dock_layout_get_property;
+ object_class->dispose = gdl_dock_layout_dispose;
g_object_class_install_property (
- g_object_class, PROP_MASTER,
+ object_class, PROP_MASTER,
g_param_spec_object ("master", _("Master"),
_("GdlDockMaster object which the layout object "
"is attached to"),
@@ -123,21 +123,26 @@ gdl_dock_layout_class_init (GdlDockLayoutClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_DIRTY,
+ object_class, PROP_DIRTY,
g_param_spec_boolean ("dirty", _("Dirty"),
_("True if the layouts have changed and need to be "
"saved to a file"),
FALSE,
G_PARAM_READABLE));
+
+ g_type_class_add_private (object_class, sizeof (GdlDockLayoutPrivate));
}
static void
gdl_dock_layout_init (GdlDockLayout *layout)
{
+ layout->priv = G_TYPE_INSTANCE_GET_PRIVATE (layout,
+ GDL_TYPE_DOCK_LAYOUT,
+ GdlDockLayoutPrivate);
+
layout->master = NULL;
layout->dirty = FALSE;
- layout->_priv = g_new0 (GdlDockLayoutPrivate, 1);
- layout->_priv->idle_save_pending = FALSE;
+ layout->priv->idle_save_pending = FALSE;
gdl_dock_layout_build_models (layout);
}
@@ -184,45 +189,40 @@ gdl_dock_layout_dispose (GObject *object)
{
GdlDockLayout *layout;
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDL_IS_DOCK_LAYOUT (object));
-
layout = GDL_DOCK_LAYOUT (object);
if (layout->master)
gdl_dock_layout_attach (layout, NULL);
- if (layout->_priv) {
- if (layout->_priv->idle_save_pending) {
- layout->_priv->idle_save_pending = FALSE;
- g_idle_remove_by_data (layout);
- }
-
- if (layout->_priv->doc) {
- xmlFreeDoc (layout->_priv->doc);
- layout->_priv->doc = NULL;
- }
+ if (layout->priv->idle_save_pending) {
+ layout->priv->idle_save_pending = FALSE;
+ g_idle_remove_by_data (layout);
+ }
- if (layout->_priv->items_model) {
- g_object_unref (layout->_priv->items_model);
- g_object_unref (layout->_priv->layouts_model);
- layout->_priv->items_model = NULL;
- layout->_priv->layouts_model = NULL;
- }
-
- xmlFreeDoc(layout->_priv->doc);
- g_free (layout->_priv);
- layout->_priv = NULL;
+ if (layout->priv->doc) {
+ xmlFreeDoc (layout->priv->doc);
+ layout->priv->doc = NULL;
+ }
+
+ if (layout->priv->items_model) {
+ g_object_unref (layout->priv->items_model);
+ g_object_unref (layout->priv->layouts_model);
+ layout->priv->items_model = NULL;
+ layout->priv->layouts_model = NULL;
}
+
+ xmlFreeDoc(layout->priv->doc);
+
+ G_OBJECT_CLASS (gdl_dock_layout_parent_class)->dispose (object);
}
static void
gdl_dock_layout_build_doc (GdlDockLayout *layout)
{
- g_return_if_fail (layout->_priv->doc == NULL);
+ g_return_if_fail (layout->priv->doc == NULL);
- layout->_priv->doc = xmlNewDoc (BAD_CAST "1.0");
- layout->_priv->doc->children = xmlNewDocNode (layout->_priv->doc, NULL,
+ layout->priv->doc = xmlNewDoc (BAD_CAST "1.0");
+ layout->priv->doc->children = xmlNewDocNode (layout->priv->doc, NULL,
BAD_CAST ROOT_ELEMENT, NULL);
}
@@ -235,11 +235,11 @@ gdl_dock_layout_find_layout (GdlDockLayout *layout,
g_return_val_if_fail (layout != NULL, NULL);
- if (!layout->_priv->doc)
+ if (!layout->priv->doc)
return NULL;
/* get document root */
- node = layout->_priv->doc->children;
+ node = layout->priv->doc->children;
for (node = node->children; node; node = node->next) {
xmlChar *layout_name;
@@ -265,22 +265,22 @@ gdl_dock_layout_find_layout (GdlDockLayout *layout,
static void
gdl_dock_layout_build_models (GdlDockLayout *layout)
{
- if (!layout->_priv->items_model) {
- layout->_priv->items_model = gtk_list_store_new (4,
+ if (!layout->priv->items_model) {
+ layout->priv->items_model = gtk_list_store_new (4,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_POINTER);
gtk_tree_sortable_set_sort_column_id (
- GTK_TREE_SORTABLE (layout->_priv->items_model),
+ GTK_TREE_SORTABLE (layout->priv->items_model),
COLUMN_NAME, GTK_SORT_ASCENDING);
}
- if (!layout->_priv->layouts_model) {
- layout->_priv->layouts_model = gtk_list_store_new (2, G_TYPE_STRING,
+ if (!layout->priv->layouts_model) {
+ layout->priv->layouts_model = gtk_list_store_new (2, G_TYPE_STRING,
G_TYPE_BOOLEAN);
gtk_tree_sortable_set_sort_column_id (
- GTK_TREE_SORTABLE (layout->_priv->layouts_model),
+ GTK_TREE_SORTABLE (layout->priv->layouts_model),
COLUMN_NAME, GTK_SORT_ASCENDING);
}
}
@@ -303,7 +303,7 @@ update_items_model (GdlDockLayout *layout)
gboolean locked;
g_return_if_fail (layout != NULL);
- g_return_if_fail (layout->_priv->items_model != NULL);
+ g_return_if_fail (layout->priv->items_model != NULL);
if (!layout->master)
return;
@@ -313,7 +313,7 @@ update_items_model (GdlDockLayout *layout)
gdl_dock_master_foreach (layout->master, (GFunc) build_list, &items);
/* walk the current model */
- store = layout->_priv->items_model;
+ store = layout->priv->items_model;
/* update items model data after a layout load */
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) {
@@ -387,14 +387,14 @@ update_layouts_model (GdlDockLayout *layout)
GtkTreeIter iter;
g_return_if_fail (layout != NULL);
- g_return_if_fail (layout->_priv->layouts_model != NULL);
+ g_return_if_fail (layout->priv->layouts_model != NULL);
/* build layouts list */
- gtk_list_store_clear (layout->_priv->layouts_model);
+ gtk_list_store_clear (layout->priv->layouts_model);
items = gdl_dock_layout_get_layouts (layout, FALSE);
for (l = items; l; l = l->next) {
- gtk_list_store_append (layout->_priv->layouts_model, &iter);
- gtk_list_store_set (layout->_priv->layouts_model, &iter,
+ gtk_list_store_append (layout->priv->layouts_model, &iter);
+ gtk_list_store_set (layout->priv->layouts_model, &iter,
COLUMN_NAME, l->data, COLUMN_EDITABLE, TRUE,
-1);
g_free (l->data);
@@ -465,7 +465,7 @@ show_toggled_cb (GtkCellRendererToggle *renderer,
g_return_if_fail (layout != NULL);
- model = GTK_TREE_MODEL (layout->_priv->items_model);
+ model = GTK_TREE_MODEL (layout->priv->items_model);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
COLUMN_SHOW, &value,
@@ -608,7 +608,7 @@ gdl_dock_layout_construct_items_ui (GdlDockLayout *layout)
/* set models */
gtk_tree_view_set_model (GTK_TREE_VIEW (items_list),
- GTK_TREE_MODEL (layout->_priv->items_model));
+ GTK_TREE_MODEL (layout->priv->items_model));
/* construct list views */
renderer = gtk_cell_renderer_toggle_new ();
@@ -648,7 +648,7 @@ cell_edited_cb (GtkCellRendererText *cell,
gchar *name;
xmlNodePtr node;
- model = GTK_TREE_MODEL (ui_data->layout->_priv->layouts_model);
+ model = GTK_TREE_MODEL (ui_data->layout->priv->layouts_model);
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
@@ -700,7 +700,7 @@ gdl_dock_layout_construct_layouts_ui (GdlDockLayout *layout)
/* set models */
gtk_tree_view_set_model (GTK_TREE_VIEW (layouts_list),
- GTK_TREE_MODEL (layout->_priv->layouts_model));
+ GTK_TREE_MODEL (layout->priv->layouts_model));
/* construct list views */
renderer = gtk_cell_renderer_text_new ();
@@ -1100,7 +1100,7 @@ gdl_dock_layout_idle_save (GdlDockLayout *layout)
/* save default layout */
gdl_dock_layout_save_layout (layout, NULL);
- layout->_priv->idle_save_pending = FALSE;
+ layout->priv->idle_save_pending = FALSE;
return FALSE;
}
@@ -1112,9 +1112,9 @@ gdl_dock_layout_layout_changed_cb (GdlDockMaster *master,
/* update model */
update_items_model (layout);
- if (!layout->_priv->idle_save_pending) {
+ if (!layout->priv->idle_save_pending) {
g_idle_add ((GSourceFunc) gdl_dock_layout_idle_save, layout);
- layout->_priv->idle_save_pending = TRUE;
+ layout->priv->idle_save_pending = TRUE;
}
}
@@ -1140,7 +1140,7 @@ gdl_dock_layout_attach (GdlDockLayout *layout,
g_object_unref (layout->master);
}
- gtk_list_store_clear (layout->_priv->items_model);
+ gtk_list_store_clear (layout->priv->items_model);
layout->master = master;
if (layout->master) {
@@ -1173,7 +1173,7 @@ gdl_dock_layout_load_layout (GdlDockLayout *layout,
g_return_val_if_fail (layout != NULL, FALSE);
- if (!layout->_priv->doc || !layout->master)
+ if (!layout->priv->doc || !layout->master)
return FALSE;
if (!name)
@@ -1214,7 +1214,7 @@ gdl_dock_layout_save_layout (GdlDockLayout *layout,
g_return_if_fail (layout != NULL);
g_return_if_fail (layout->master != NULL);
- if (!layout->_priv->doc)
+ if (!layout->priv->doc)
gdl_dock_layout_build_doc (layout);
if (!name)
@@ -1230,7 +1230,7 @@ gdl_dock_layout_save_layout (GdlDockLayout *layout,
};
/* create the new node */
- node = xmlNewChild (layout->_priv->doc->children, NULL,
+ node = xmlNewChild (layout->priv->doc->children, NULL,
BAD_CAST LAYOUT_ELEMENT_NAME, NULL);
xmlSetProp (node, BAD_CAST NAME_ATTRIBUTE_NAME, BAD_CAST layout_name);
@@ -1313,25 +1313,25 @@ gdl_dock_layout_load_from_file (GdlDockLayout *layout,
{
gboolean retval = FALSE;
- if (layout->_priv->doc) {
- xmlFreeDoc (layout->_priv->doc);
- layout->_priv->doc = NULL;
+ if (layout->priv->doc) {
+ xmlFreeDoc (layout->priv->doc);
+ layout->priv->doc = NULL;
layout->dirty = FALSE;
g_object_notify (G_OBJECT (layout), "dirty");
}
/* FIXME: cannot open symlinks */
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
- layout->_priv->doc = xmlParseFile (filename);
- if (layout->_priv->doc) {
- xmlNodePtr root = layout->_priv->doc->children;
+ layout->priv->doc = xmlParseFile (filename);
+ if (layout->priv->doc) {
+ xmlNodePtr root = layout->priv->doc->children;
/* minimum validation: test the root element */
if (root && !strcmp ((char*)root->name, ROOT_ELEMENT)) {
update_layouts_model (layout);
retval = TRUE;
} else {
- xmlFreeDoc (layout->_priv->doc);
- layout->_priv->doc = NULL;
+ xmlFreeDoc (layout->priv->doc);
+ layout->priv->doc = NULL;
}
}
}
@@ -1361,12 +1361,12 @@ gdl_dock_layout_save_to_file (GdlDockLayout *layout,
g_return_val_if_fail (filename != NULL, FALSE);
/* if there is still no xml doc, create an empty one */
- if (!layout->_priv->doc)
+ if (!layout->priv->doc)
gdl_dock_layout_build_doc (layout);
file_handle = fopen (filename, "w");
if (file_handle) {
- bytes = xmlDocDump (file_handle, layout->_priv->doc);
+ bytes = xmlDocDump (file_handle, layout->priv->doc);
if (bytes >= 0) {
layout->dirty = FALSE;
g_object_notify (G_OBJECT (layout), "dirty");
@@ -1402,10 +1402,10 @@ gdl_dock_layout_get_layouts (GdlDockLayout *layout,
g_return_val_if_fail (layout != NULL, NULL);
- if (!layout->_priv->doc)
+ if (!layout->priv->doc)
return NULL;
- node = layout->_priv->doc->children;
+ node = layout->priv->doc->children;
for (node = node->children; node; node = node->next) {
xmlChar *name;
diff --git a/gdl/gdl-dock-layout.h b/gdl/gdl-dock-layout.h
index eb71bbe..b870bf8 100644
--- a/gdl/gdl-dock-layout.h
+++ b/gdl/gdl-dock-layout.h
@@ -48,7 +48,7 @@ struct _GdlDockLayout {
gboolean dirty;
GdlDockMaster *master;
- GdlDockLayoutPrivate *_priv;
+ GdlDockLayoutPrivate *priv;
};
struct _GdlDockLayoutClass {
diff --git a/gdl/gdl-dock-master.c b/gdl/gdl-dock-master.c
index f27a43d..f471f5c 100644
--- a/gdl/gdl-dock-master.c
+++ b/gdl/gdl-dock-master.c
@@ -115,8 +115,8 @@ struct _GdlDockMasterPrivate {
};
#define COMPUTE_LOCKED(master) \
- (g_hash_table_size ((master)->_priv->unlocked_items) == 0 ? 1 : \
- (g_hash_table_size ((master)->_priv->locked_items) == 0 ? 0 : -1))
+ (g_hash_table_size ((master)->priv->unlocked_items) == 0 ? 1 : \
+ (g_hash_table_size ((master)->priv->locked_items) == 0 ? 0 : -1))
static guint master_signals [LAST_SIGNAL] = { 0 };
@@ -128,23 +128,25 @@ G_DEFINE_TYPE (GdlDockMaster, gdl_dock_master, G_TYPE_OBJECT);
static void
gdl_dock_master_class_init (GdlDockMasterClass *klass)
{
- GObjectClass *g_object_class;
+ GObjectClass *object_class;
- g_object_class = G_OBJECT_CLASS (klass);
+ object_class = G_OBJECT_CLASS (klass);
- g_object_class->dispose = gdl_dock_master_dispose;
- g_object_class->set_property = gdl_dock_master_set_property;
- g_object_class->get_property = gdl_dock_master_get_property;
+ object_class->dispose = gdl_dock_master_dispose;
+ object_class->set_property = gdl_dock_master_set_property;
+ object_class->get_property = gdl_dock_master_get_property;
+
+ klass->layout_changed = gdl_dock_master_layout_changed;
g_object_class_install_property (
- g_object_class, PROP_DEFAULT_TITLE,
+ object_class, PROP_DEFAULT_TITLE,
g_param_spec_string ("default-title", _("Default title"),
_("Default title for newly created floating docks"),
NULL,
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_LOCKED,
+ object_class, PROP_LOCKED,
g_param_spec_int ("locked", _("Locked"),
_("If is set to 1, all the dock items bound to the master "
"are locked; if it's 0, all are unlocked; -1 indicates "
@@ -153,7 +155,7 @@ gdl_dock_master_class_init (GdlDockMasterClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (
- g_object_class, PROP_SWITCHER_STYLE,
+ object_class, PROP_SWITCHER_STYLE,
g_param_spec_enum ("switcher-style", _("Switcher Style"),
_("Switcher buttons style"),
GDL_TYPE_SWITCHER_STYLE,
@@ -171,23 +173,26 @@ gdl_dock_master_class_init (GdlDockMasterClass *klass)
G_TYPE_NONE, /* return type */
0);
- klass->layout_changed = gdl_dock_master_layout_changed;
+ g_type_class_add_private (object_class, sizeof (GdlDockMasterPrivate));
}
static void
gdl_dock_master_init (GdlDockMaster *master)
{
+ master->priv = G_TYPE_INSTANCE_GET_PRIVATE (master,
+ GDL_TYPE_DOCK_MASTER,
+ GdlDockMasterPrivate);
+
master->dock_objects = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
master->toplevel_docks = NULL;
master->controller = NULL;
master->dock_number = 1;
-
- master->_priv = g_new0 (GdlDockMasterPrivate, 1);
- master->_priv->number = 1;
- master->_priv->switcher_style = GDL_SWITCHER_STYLE_BOTH;
- master->_priv->locked_items = g_hash_table_new (g_direct_hash, g_direct_equal);
- master->_priv->unlocked_items = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ master->priv->number = 1;
+ master->priv->switcher_style = GDL_SWITCHER_STYLE_BOTH;
+ master->priv->locked_items = g_hash_table_new (g_direct_hash, g_direct_equal);
+ master->priv->unlocked_items = g_hash_table_new (g_direct_hash, g_direct_equal);
}
static void
@@ -253,13 +258,11 @@ ht_foreach_build_slist (gpointer key,
}
static void
-gdl_dock_master_dispose (GObject *g_object)
+gdl_dock_master_dispose (GObject *object)
{
GdlDockMaster *master;
-
- g_return_if_fail (GDL_IS_DOCK_MASTER (g_object));
- master = GDL_DOCK_MASTER (g_object);
+ master = GDL_DOCK_MASTER (object);
if (master->toplevel_docks) {
g_list_foreach (master->toplevel_docks,
@@ -280,36 +283,37 @@ gdl_dock_master_dispose (GObject *g_object)
g_hash_table_destroy (master->dock_objects);
master->dock_objects = NULL;
}
-
- if (master->_priv) {
- if (master->_priv->idle_layout_changed_id)
- g_source_remove (master->_priv->idle_layout_changed_id);
-
- if (master->_priv->drag_request) {
- if (G_IS_VALUE (&master->_priv->drag_request->extra))
- g_value_unset (&master->_priv->drag_request->extra);
- g_free (master->_priv->drag_request);
- master->_priv->drag_request = NULL;
- }
- g_free (master->_priv->default_title);
- master->_priv->default_title = NULL;
- g_hash_table_destroy (master->_priv->locked_items);
- master->_priv->locked_items = NULL;
- g_hash_table_destroy (master->_priv->unlocked_items);
- master->_priv->unlocked_items = NULL;
+ if (master->priv->idle_layout_changed_id)
+ g_source_remove (master->priv->idle_layout_changed_id);
- if (master->_priv->area_window)
- {
- gtk_widget_destroy (master->_priv->area_window);
- master->_priv->area_window = NULL;
- }
-
- g_free (master->_priv);
- master->_priv = NULL;
+ if (master->priv->drag_request) {
+ if (G_IS_VALUE (&master->priv->drag_request->extra))
+ g_value_unset (&master->priv->drag_request->extra);
+
+ g_free (master->priv->drag_request);
+ master->priv->drag_request = NULL;
+ }
+
+ g_free (master->priv->default_title);
+ master->priv->default_title = NULL;
+
+ if (master->priv->locked_items) {
+ g_hash_table_unref (master->priv->locked_items);
+ master->priv->locked_items = NULL;
+ }
+
+ if (master->priv->unlocked_items) {
+ g_hash_table_unref (master->priv->unlocked_items);
+ master->priv->unlocked_items = NULL;
+ }
+
+ if (master->priv->area_window) {
+ gtk_widget_destroy (master->priv->area_window);
+ master->priv->area_window = NULL;
}
- G_OBJECT_CLASS (gdl_dock_master_parent_class)->dispose (g_object);
+ G_OBJECT_CLASS (gdl_dock_master_parent_class)->dispose (object);
}
static void
@@ -354,8 +358,8 @@ gdl_dock_master_set_property (GObject *object,
switch (prop_id) {
case PROP_DEFAULT_TITLE:
- g_free (master->_priv->default_title);
- master->_priv->default_title = g_value_dup_string (value);
+ g_free (master->priv->default_title);
+ master->priv->default_title = g_value_dup_string (value);
break;
case PROP_LOCKED:
if (g_value_get_int (value) >= 0)
@@ -380,13 +384,13 @@ gdl_dock_master_get_property (GObject *object,
switch (prop_id) {
case PROP_DEFAULT_TITLE:
- g_value_set_string (value, master->_priv->default_title);
+ g_value_set_string (value, master->priv->default_title);
break;
case PROP_LOCKED:
g_value_set_int (value, COMPUTE_LOCKED (master));
break;
case PROP_SWITCHER_STYLE:
- g_value_set_enum (value, master->_priv->switcher_style);
+ g_value_set_enum (value, master->priv->switcher_style);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -406,10 +410,10 @@ gdl_dock_master_drag_begin (GdlDockItem *item,
master = GDL_DOCK_MASTER (data);
- if (!master->_priv->drag_request)
- master->_priv->drag_request = g_new0 (GdlDockRequest, 1);
+ if (!master->priv->drag_request)
+ master->priv->drag_request = g_new0 (GdlDockRequest, 1);
- request = master->_priv->drag_request;
+ request = master->priv->drag_request;
/* Set the target to itself so it won't go floating with just a click. */
request->applicant = GDL_DOCK_OBJECT (item);
@@ -418,8 +422,8 @@ gdl_dock_master_drag_begin (GdlDockItem *item,
if (G_IS_VALUE (&request->extra))
g_value_unset (&request->extra);
- master->_priv->rect_drawn = FALSE;
- master->_priv->rect_owner = NULL;
+ master->priv->rect_drawn = FALSE;
+ master->priv->rect_owner = NULL;
}
static void
@@ -434,18 +438,18 @@ gdl_dock_master_drag_end (GdlDockItem *item,
g_return_if_fail (item != NULL);
master = GDL_DOCK_MASTER (data);
- request = master->_priv->drag_request;
+ request = master->priv->drag_request;
g_return_if_fail (GDL_DOCK_OBJECT (item) == request->applicant);
/* Erase previously drawn rectangle */
- if (master->_priv->rect_owner)
+ if (master->priv->rect_owner)
{
- gdl_dock_xor_rect_hide (master->_priv->rect_owner);
+ gdl_dock_xor_rect_hide (master->priv->rect_owner);
}
- if (master->_priv->area_window)
+ if (master->priv->area_window)
{
- gtk_widget_hide (master->_priv->area_window);
+ gtk_widget_hide (master->priv->area_window);
}
/* cancel conditions */
@@ -479,7 +483,7 @@ gdl_dock_master_drag_motion (GdlDockItem *item,
g_return_if_fail (item != NULL && data != NULL);
master = GDL_DOCK_MASTER (data);
- request = master->_priv->drag_request;
+ request = master->priv->drag_request;
g_return_if_fail (GDL_DOCK_OBJECT (item) == request->applicant);
@@ -584,19 +588,19 @@ gdl_dock_master_drag_motion (GdlDockItem *item,
my_request.rect.y == request->rect.y &&
my_request.rect.width == request->rect.width &&
my_request.rect.height == request->rect.height &&
- dock == master->_priv->rect_owner)) {
+ dock == master->priv->rect_owner)) {
/* erase the previous rectangle */
- if (master->_priv->rect_drawn)
+ if (master->priv->rect_drawn)
gdl_dock_master_xor_rect (master);
}
/* set the new values */
*request = my_request;
- master->_priv->rect_owner = dock;
+ master->priv->rect_owner = dock;
/* draw the previous rectangle */
- if (~master->_priv->rect_drawn)
+ if (~master->priv->rect_drawn)
gdl_dock_master_xor_rect (master);
}
@@ -618,29 +622,29 @@ gdl_dock_master_xor_rect (GdlDockMaster *master)
{
cairo_rectangle_int_t *rect;
- if (!master->_priv || !master->_priv->drag_request)
+ if (!master->priv || !master->priv->drag_request)
return;
- master->_priv->rect_drawn = ~master->_priv->rect_drawn;
+ master->priv->rect_drawn = ~master->priv->rect_drawn;
- if (master->_priv->rect_owner) {
- if (master->_priv->area_window)
+ if (master->priv->rect_owner) {
+ if (master->priv->area_window)
{
- gtk_widget_hide (master->_priv->area_window);
+ gtk_widget_hide (master->priv->area_window);
}
- gdl_dock_xor_rect (master->_priv->rect_owner,
- &master->_priv->drag_request->rect);
+ gdl_dock_xor_rect (master->priv->rect_owner,
+ &master->priv->drag_request->rect);
return;
}
- rect = &master->_priv->drag_request->rect;
+ rect = &master->priv->drag_request->rect;
- if (!master->_priv->area_window)
+ if (!master->priv->area_window)
{
- master->_priv->area_window = gdl_preview_window_new ();
+ master->priv->area_window = gdl_preview_window_new ();
}
- gdl_preview_window_update (GDL_PREVIEW_WINDOW (master->_priv->area_window), rect);
+ gdl_preview_window_update (GDL_PREVIEW_WINDOW (master->priv->area_window), rect);
}
static void
@@ -654,9 +658,9 @@ gdl_dock_master_layout_changed (GdlDockMaster *master)
g_signal_emit_by_name (master->controller, "layout-changed");
/* remove the idle handler if there is one */
- if (master->_priv->idle_layout_changed_id) {
- g_source_remove (master->_priv->idle_layout_changed_id);
- master->_priv->idle_layout_changed_id = 0;
+ if (master->priv->idle_layout_changed_id) {
+ g_source_remove (master->priv->idle_layout_changed_id);
+ master->priv->idle_layout_changed_id = 0;
}
}
@@ -667,7 +671,7 @@ idle_emit_layout_changed (gpointer user_data)
g_return_val_if_fail (master && GDL_IS_DOCK_MASTER (master), FALSE);
- master->_priv->idle_layout_changed_id = 0;
+ master->priv->idle_layout_changed_id = 0;
g_signal_emit (master, master_signals [LAYOUT_CHANGED], 0);
return FALSE;
@@ -690,8 +694,8 @@ item_dock_cb (GdlDockObject *object,
* requestor, however, could mean that it's being shown */
if (!GDL_DOCK_OBJECT_IN_REFLOW (requestor) &&
!GDL_DOCK_OBJECT_AUTOMATIC (requestor)) {
- if (!master->_priv->idle_layout_changed_id)
- master->_priv->idle_layout_changed_id =
+ if (!master->priv->idle_layout_changed_id)
+ master->priv->idle_layout_changed_id =
g_idle_add (idle_emit_layout_changed, master);
}
}
@@ -708,8 +712,8 @@ item_detach_cb (GdlDockObject *object,
if (!GDL_DOCK_OBJECT_IN_REFLOW (object) &&
!GDL_DOCK_OBJECT_AUTOMATIC (object)) {
- if (!master->_priv->idle_layout_changed_id)
- master->_priv->idle_layout_changed_id =
+ if (!master->priv->idle_layout_changed_id)
+ master->priv->idle_layout_changed_id =
g_idle_add (idle_emit_layout_changed, master);
}
}
@@ -726,11 +730,11 @@ item_notify_cb (GdlDockObject *object,
g_object_get (object, "locked", &item_locked, NULL);
if (item_locked) {
- g_hash_table_remove (master->_priv->unlocked_items, object);
- g_hash_table_insert (master->_priv->locked_items, object, NULL);
+ g_hash_table_remove (master->priv->unlocked_items, object);
+ g_hash_table_insert (master->priv->locked_items, object, NULL);
} else {
- g_hash_table_remove (master->_priv->locked_items, object);
- g_hash_table_insert (master->_priv->unlocked_items, object, NULL);
+ g_hash_table_remove (master->priv->locked_items, object);
+ g_hash_table_insert (master->priv->unlocked_items, object, NULL);
}
if (COMPUTE_LOCKED (master) != locked)
@@ -752,7 +756,7 @@ gdl_dock_master_add (GdlDockMaster *master,
if (!object->name)
/* directly set the name, since it's a construction only
property */
- object->name = g_strdup_printf ("__dock_%u", master->_priv->number++);
+ object->name = g_strdup_printf ("__dock_%u", master->priv->number++);
/* add the object to our hash list */
if ((found_object = g_hash_table_lookup (master->dock_objects, object->name))) {
@@ -813,14 +817,14 @@ gdl_dock_master_add (GdlDockMaster *master,
GDL_IS_SWITCHER (GDL_DOCK_ITEM (object)->child))
{
g_object_set (GDL_DOCK_ITEM (object)->child, "switcher-style",
- master->_priv->switcher_style, NULL);
+ master->priv->switcher_style, NULL);
}
/* post a layout_changed emission if the item is not automatic
* (since it should be added to the items model) */
if (!GDL_DOCK_OBJECT_AUTOMATIC (object)) {
- if (!master->_priv->idle_layout_changed_id)
- master->_priv->idle_layout_changed_id =
+ if (!master->priv->idle_layout_changed_id)
+ master->priv->idle_layout_changed_id =
g_idle_add (idle_emit_layout_changed, master);
}
}
@@ -836,8 +840,8 @@ gdl_dock_master_remove (GdlDockMaster *master,
* that's the case */
if (GDL_IS_DOCK_ITEM (object) && GDL_DOCK_ITEM_HAS_GRIP (GDL_DOCK_ITEM (object))) {
gint locked = COMPUTE_LOCKED (master);
- if (g_hash_table_remove (master->_priv->locked_items, object) ||
- g_hash_table_remove (master->_priv->unlocked_items, object)) {
+ if (g_hash_table_remove (master->priv->locked_items, object) ||
+ g_hash_table_remove (master->priv->unlocked_items, object)) {
if (COMPUTE_LOCKED (master) != locked)
g_object_notify (G_OBJECT (master), "locked");
}
@@ -852,8 +856,8 @@ gdl_dock_master_remove (GdlDockMaster *master,
/* post a layout_changed emission if the item is not automatic
* (since it should be removed from the items model) */
if (!GDL_DOCK_OBJECT_AUTOMATIC (object)) {
- if (!master->_priv->idle_layout_changed_id)
- master->_priv->idle_layout_changed_id =
+ if (!master->priv->idle_layout_changed_id)
+ master->priv->idle_layout_changed_id =
g_idle_add (idle_emit_layout_changed, master);
}
@@ -973,7 +977,7 @@ gdl_dock_master_set_switcher_style (GdlDockMaster *master,
GList *l;
g_return_if_fail (GDL_IS_DOCK_MASTER (master));
- master->_priv->switcher_style = switcher_style;
+ master->priv->switcher_style = switcher_style;
for (l = master->toplevel_docks; l; l = l->next) {
GdlDock *dock = GDL_DOCK (l->data);
if (dock->root)
diff --git a/gdl/gdl-dock-master.h b/gdl/gdl-dock-master.h
index 1ce23b7..82ace7a 100644
--- a/gdl/gdl-dock-master.h
+++ b/gdl/gdl-dock-master.h
@@ -62,7 +62,7 @@ struct _GdlDockMaster {
gint dock_number; /* for toplevel dock numbering */
- GdlDockMasterPrivate *_priv;
+ GdlDockMasterPrivate *priv;
};
struct _GdlDockMasterClass {
diff --git a/gdl/gdl-dock-object.c b/gdl/gdl-dock-object.c
index 6fb8aca..53bd3ee 100644
--- a/gdl/gdl-dock-object.c
+++ b/gdl/gdl-dock-object.c
@@ -252,17 +252,12 @@ static void
gdl_dock_object_finalize (GObject *g_object)
{
GdlDockObject *object;
-
- g_return_if_fail (g_object != NULL && GDL_IS_DOCK_OBJECT (g_object));
object = GDL_DOCK_OBJECT (g_object);
g_free (object->name);
- object->name = NULL;
g_free (object->long_name);
- object->long_name = NULL;
g_free (object->stock_id);
- object->stock_id = NULL;
G_OBJECT_CLASS (gdl_dock_object_parent_class)->finalize (g_object);
}
diff --git a/gdl/gdl-dock-placeholder.c b/gdl/gdl-dock-placeholder.c
index 560063f..9debc69 100644
--- a/gdl/gdl-dock-placeholder.c
+++ b/gdl/gdl-dock-placeholder.c
@@ -95,7 +95,7 @@ struct _GdlDockPlaceholderPrivate {
/* current object this placeholder is pinned to */
GdlDockObject *host;
gboolean sticky;
-
+
/* when the placeholder is moved up the hierarchy, this stack
keeps track of the necessary dock positions needed to get the
placeholder to the original position */
@@ -104,15 +104,15 @@ struct _GdlDockPlaceholderPrivate {
/* Width and height of the attachments */
gint width;
gint height;
-
+
/* connected signal handlers */
guint host_detach_handler;
guint host_dock_handler;
-
- /* Window Coordinates if Dock was floating */
- gboolean floating;
- gint floatx;
- gint floaty;
+
+ /* Window Coordinates if Dock was floating */
+ gboolean floating;
+ gint floatx;
+ gint floaty;
};
@@ -123,29 +123,38 @@ G_DEFINE_TYPE (GdlDockPlaceholder, gdl_dock_placeholder, GDL_TYPE_DOCK_OBJECT);
static void
gdl_dock_placeholder_class_init (GdlDockPlaceholderClass *klass)
{
- GObjectClass *g_object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- GdlDockObjectClass *object_class;
+ GdlDockObjectClass *dock_object_class;
- g_object_class = G_OBJECT_CLASS (klass);
+ object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
- object_class = GDL_DOCK_OBJECT_CLASS (klass);
+ dock_object_class = GDL_DOCK_OBJECT_CLASS (klass);
+
+ object_class->get_property = gdl_dock_placeholder_get_property;
+ object_class->set_property = gdl_dock_placeholder_set_property;
+
+ widget_class->destroy = gdl_dock_placeholder_destroy;
+ container_class->add = gdl_dock_placeholder_add;
+
+ dock_object_class->is_compound = FALSE;
+ dock_object_class->detach = gdl_dock_placeholder_detach;
+ dock_object_class->reduce = gdl_dock_placeholder_reduce;
+ dock_object_class->dock = gdl_dock_placeholder_dock;
+ dock_object_class->present = gdl_dock_placeholder_present;
- g_object_class->get_property = gdl_dock_placeholder_get_property;
- g_object_class->set_property = gdl_dock_placeholder_set_property;
-
g_object_class_install_property (
- g_object_class, PROP_STICKY,
+ object_class, PROP_STICKY,
g_param_spec_boolean ("sticky", _("Sticky"),
- _("Whether the placeholder will stick to its host or "
- "move up the hierarchy when the host is redocked"),
- FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
+ _("Whether the placeholder will stick to its host or "
+ "move up the hierarchy when the host is redocked"),
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
g_object_class_install_property (
- g_object_class, PROP_HOST,
+ object_class, PROP_HOST,
g_param_spec_object ("host", _("Host"),
_("The dock object this placeholder is attached to"),
GDL_TYPE_DOCK_OBJECT,
@@ -153,7 +162,7 @@ gdl_dock_placeholder_class_init (GdlDockPlaceholderClass *klass)
/* this will return the top of the placement stack */
g_object_class_install_property (
- g_object_class, PROP_NEXT_PLACEMENT,
+ object_class, PROP_NEXT_PLACEMENT,
g_param_spec_enum ("next-placement", _("Next placement"),
_("The position an item will be docked to our host if a "
"request is made to dock to us"),
@@ -163,7 +172,7 @@ gdl_dock_placeholder_class_init (GdlDockPlaceholderClass *klass)
GDL_DOCK_PARAM_EXPORT | GDL_DOCK_PARAM_AFTER));
g_object_class_install_property (
- g_object_class, PROP_WIDTH,
+ object_class, PROP_WIDTH,
g_param_spec_int ("width", _("Width"),
_("Width for the widget when it's attached to the placeholder"),
-1, G_MAXINT, -1,
@@ -171,52 +180,46 @@ gdl_dock_placeholder_class_init (GdlDockPlaceholderClass *klass)
GDL_DOCK_PARAM_EXPORT));
g_object_class_install_property (
- g_object_class, PROP_HEIGHT,
+ object_class, PROP_HEIGHT,
g_param_spec_int ("height", _("Height"),
_("Height for the widget when it's attached to the placeholder"),
-1, G_MAXINT, -1,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
GDL_DOCK_PARAM_EXPORT));
- g_object_class_install_property (
- g_object_class, PROP_FLOATING,
- g_param_spec_boolean ("floating", _("Floating Toplevel"),
+ g_object_class_install_property (
+ object_class, PROP_FLOATING,
+ g_param_spec_boolean ("floating", _("Floating Toplevel"),
_("Whether the placeholder is standing in for a "
"floating toplevel dock"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (
- g_object_class, PROP_FLOAT_X,
+ g_object_class_install_property (
+ object_class, PROP_FLOAT_X,
g_param_spec_int ("floatx", _("X Coordinate"),
_("X coordinate for dock when floating"),
-1, G_MAXINT, -1,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
GDL_DOCK_PARAM_EXPORT));
- g_object_class_install_property (
- g_object_class, PROP_FLOAT_Y,
+ g_object_class_install_property (
+ object_class, PROP_FLOAT_Y,
g_param_spec_int ("floaty", _("Y Coordinate"),
_("Y coordinate for dock when floating"),
-1, G_MAXINT, -1,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
GDL_DOCK_PARAM_EXPORT));
-
-
- widget_class->destroy = gdl_dock_placeholder_destroy;
- container_class->add = gdl_dock_placeholder_add;
-
- object_class->is_compound = FALSE;
- object_class->detach = gdl_dock_placeholder_detach;
- object_class->reduce = gdl_dock_placeholder_reduce;
- object_class->dock = gdl_dock_placeholder_dock;
- object_class->present = gdl_dock_placeholder_present;
+
+ g_type_class_add_private (object_class, sizeof (GdlDockPlaceholderPrivate));
}
static void
gdl_dock_placeholder_init (GdlDockPlaceholder *ph)
{
+ ph->priv = G_TYPE_INSTANCE_GET_PRIVATE (ph,
+ GDL_TYPE_DOCK_PLACEHOLDER,
+ GdlDockPlaceholderPrivate);
+
gtk_widget_set_has_window (GTK_WIDGET (ph), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (ph), FALSE);
-
- ph->_priv = g_new0 (GdlDockPlaceholderPrivate, 1);
}
static void
@@ -229,33 +232,33 @@ gdl_dock_placeholder_set_property (GObject *g_object,
switch (prop_id) {
case PROP_STICKY:
- if (ph->_priv)
- ph->_priv->sticky = g_value_get_boolean (value);
+ if (ph->priv)
+ ph->priv->sticky = g_value_get_boolean (value);
break;
case PROP_HOST:
gdl_dock_placeholder_attach (ph, g_value_get_object (value));
break;
case PROP_NEXT_PLACEMENT:
- if (ph->_priv) {
- ph->_priv->placement_stack =
- g_slist_prepend (ph->_priv->placement_stack,
+ if (ph->priv) {
+ ph->priv->placement_stack =
+ g_slist_prepend (ph->priv->placement_stack,
GINT_TO_POINTER (g_value_get_enum (value)));
}
break;
case PROP_WIDTH:
- ph->_priv->width = g_value_get_int (value);
+ ph->priv->width = g_value_get_int (value);
break;
case PROP_HEIGHT:
- ph->_priv->height = g_value_get_int (value);
+ ph->priv->height = g_value_get_int (value);
break;
case PROP_FLOATING:
- ph->_priv->floating = g_value_get_boolean (value);
+ ph->priv->floating = g_value_get_boolean (value);
break;
case PROP_FLOAT_X:
- ph->_priv->floatx = g_value_get_int (value);
+ ph->priv->floatx = g_value_get_int (value);
break;
case PROP_FLOAT_Y:
- ph->_priv->floaty = g_value_get_int (value);
+ ph->priv->floaty = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (g_object, prop_id, pspec);
@@ -273,37 +276,37 @@ gdl_dock_placeholder_get_property (GObject *g_object,
switch (prop_id) {
case PROP_STICKY:
- if (ph->_priv)
- g_value_set_boolean (value, ph->_priv->sticky);
+ if (ph->priv)
+ g_value_set_boolean (value, ph->priv->sticky);
else
g_value_set_boolean (value, FALSE);
break;
case PROP_HOST:
- if (ph->_priv)
- g_value_set_object (value, ph->_priv->host);
+ if (ph->priv)
+ g_value_set_object (value, ph->priv->host);
else
g_value_set_object (value, NULL);
break;
case PROP_NEXT_PLACEMENT:
- if (ph->_priv && ph->_priv->placement_stack)
- g_value_set_enum (value, (GdlDockPlacement) ph->_priv->placement_stack->data);
+ if (ph->priv && ph->priv->placement_stack)
+ g_value_set_enum (value, (GdlDockPlacement) ph->priv->placement_stack->data);
else
g_value_set_enum (value, GDL_DOCK_CENTER);
break;
case PROP_WIDTH:
- g_value_set_int (value, ph->_priv->width);
+ g_value_set_int (value, ph->priv->width);
break;
case PROP_HEIGHT:
- g_value_set_int (value, ph->_priv->height);
+ g_value_set_int (value, ph->priv->height);
break;
case PROP_FLOATING:
- g_value_set_boolean (value, ph->_priv->floating);
+ g_value_set_boolean (value, ph->priv->floating);
break;
case PROP_FLOAT_X:
- g_value_set_int (value, ph->_priv->floatx);
+ g_value_set_int (value, ph->priv->floatx);
break;
case PROP_FLOAT_Y:
- g_value_set_int (value, ph->_priv->floaty);
+ g_value_set_int (value, ph->priv->floaty);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (g_object, prop_id, pspec);
@@ -316,11 +319,11 @@ gdl_dock_placeholder_destroy (GtkWidget *object)
{
GdlDockPlaceholder *ph = GDL_DOCK_PLACEHOLDER (object);
- if (ph->_priv) {
- if (ph->_priv->host)
+ if (ph->priv) {
+ if (ph->priv->host)
gdl_dock_placeholder_detach (GDL_DOCK_OBJECT (object), FALSE);
- g_free (ph->_priv);
- ph->_priv = NULL;
+ g_free (ph->priv);
+ ph->priv = NULL;
}
GTK_WIDGET_CLASS (gdl_dock_placeholder_parent_class)->destroy (object);
@@ -337,8 +340,8 @@ gdl_dock_placeholder_add (GtkContainer *container,
g_return_if_fail (GDL_IS_DOCK_ITEM (widget));
ph = GDL_DOCK_PLACEHOLDER (container);
- if (ph->_priv->placement_stack)
- pos = (GdlDockPlacement) ph->_priv->placement_stack->data;
+ if (ph->priv->placement_stack)
+ pos = (GdlDockPlacement) ph->priv->placement_stack->data;
gdl_dock_object_dock (GDL_DOCK_OBJECT (ph), GDL_DOCK_OBJECT (widget),
pos, NULL);
@@ -354,8 +357,8 @@ gdl_dock_placeholder_detach (GdlDockObject *object,
disconnect_host (ph);
/* free the placement stack */
- g_slist_free (ph->_priv->placement_stack);
- ph->_priv->placement_stack = NULL;
+ g_slist_free (ph->priv->placement_stack);
+ ph->priv->placement_stack = NULL;
GDL_DOCK_OBJECT_UNSET_FLAGS (object, GDL_DOCK_ATTACHED);
}
@@ -445,14 +448,14 @@ attempt_to_dock_on_host (GdlDockPlaceholder *ph, GdlDockObject *host,
/* Restore dock item's dimention */
switch (placement) {
case GDL_DOCK_LEFT:
- if (ph->_priv->width > 0) {
+ if (ph->priv->width > 0) {
g_object_set (G_OBJECT (parent), "position",
- ph->_priv->width, NULL);
+ ph->priv->width, NULL);
}
break;
case GDL_DOCK_RIGHT:
- if (ph->_priv->width > 0) {
- gint complementary_width = host_width - ph->_priv->width;
+ if (ph->priv->width > 0) {
+ gint complementary_width = host_width - ph->priv->width;
if (complementary_width > 0)
g_object_set (G_OBJECT (parent), "position",
@@ -460,14 +463,14 @@ attempt_to_dock_on_host (GdlDockPlaceholder *ph, GdlDockObject *host,
}
break;
case GDL_DOCK_TOP:
- if (ph->_priv->height > 0) {
+ if (ph->priv->height > 0) {
g_object_set (G_OBJECT (parent), "position",
- ph->_priv->height, NULL);
+ ph->priv->height, NULL);
}
break;
case GDL_DOCK_BOTTOM:
- if (ph->_priv->height > 0) {
- gint complementary_height = host_height - ph->_priv->height;
+ if (ph->priv->height > 0) {
+ gint complementary_height = host_height - ph->priv->height;
if (complementary_height > 0)
g_object_set (G_OBJECT (parent), "position",
@@ -488,8 +491,8 @@ gdl_dock_placeholder_dock (GdlDockObject *object,
{
GdlDockPlaceholder *ph = GDL_DOCK_PLACEHOLDER (object);
- if (ph->_priv->host) {
- attempt_to_dock_on_host (ph, ph->_priv->host, requestor,
+ if (ph->priv->host) {
+ attempt_to_dock_on_host (ph, ph->priv->host, requestor,
position, other_data);
}
else {
@@ -511,7 +514,7 @@ gdl_dock_placeholder_dock (GdlDockObject *object,
static void
print_placement_stack (GdlDockPlaceholder *ph)
{
- GSList *s = ph->_priv->placement_stack;
+ GSList *s = ph->priv->placement_stack;
GEnumClass *enum_class = G_ENUM_CLASS (g_type_class_ref (GDL_TYPE_DOCK_PLACEMENT));
GEnumValue *enum_value;
gchar *name;
@@ -519,7 +522,7 @@ print_placement_stack (GdlDockPlaceholder *ph)
message = g_string_new (NULL);
g_string_printf (message, "[%p] host: %p (%s), stack: ",
- ph, ph->_priv->host, G_OBJECT_TYPE_NAME (ph->_priv->host));
+ ph, ph->priv->host, G_OBJECT_TYPE_NAME (ph->priv->host));
for (; s; s = s->next) {
enum_value = g_enum_get_value (enum_class, (GdlDockPlacement) s->data);
name = enum_value ? enum_value->value_name : NULL;
@@ -577,7 +580,7 @@ gdl_dock_placeholder_weak_notify (gpointer data,
/* we shouldn't get here, so perform an emergency detach. instead
we should have gotten a detach signal from our host */
- ph->_priv->host = NULL;
+ ph->priv->host = NULL;
/* We didn't get a detach signal from the host. Detach from the
supposedly dead host (consequently attaching to the controller) */
@@ -585,8 +588,8 @@ gdl_dock_placeholder_weak_notify (gpointer data,
detach_cb (NULL, TRUE, data);
#if 0
/* free the placement stack */
- g_slist_free (ph->_priv->placement_stack);
- ph->_priv->placement_stack = NULL;
+ g_slist_free (ph->priv->placement_stack);
+ ph->priv->placement_stack = NULL;
GDL_DOCK_OBJECT_UNSET_FLAGS (ph, GDL_DOCK_ATTACHED);
#endif
}
@@ -606,15 +609,15 @@ detach_cb (GdlDockObject *object,
* when we get the host's dock signal. */
ph = GDL_DOCK_PLACEHOLDER (user_data);
- obj = ph->_priv->host;
+ obj = ph->priv->host;
if (obj != object) {
g_warning (_("Got a detach signal from an object (%p) who is not "
- "our host %p"), object, ph->_priv->host);
+ "our host %p"), object, ph->priv->host);
return;
}
/* skip sticky objects */
- if (ph->_priv->sticky)
+ if (ph->priv->sticky)
return;
if (obj)
@@ -629,8 +632,8 @@ detach_cb (GdlDockObject *object,
/* get placement hint from the new host */
if (gdl_dock_object_child_placement (new_host, obj, &pos)) {
- ph->_priv->placement_stack = g_slist_prepend (
- ph->_priv->placement_stack, (gpointer) pos);
+ ph->priv->placement_stack = g_slist_prepend (
+ ph->priv->placement_stack, (gpointer) pos);
}
else {
g_warning (_("Something weird happened while getting the child "
@@ -657,8 +660,8 @@ detach_cb (GdlDockObject *object,
new_host = gdl_dock_master_get_controller (GDL_DOCK_OBJECT_GET_MASTER (ph));
/*
- ph->_priv->placement_stack = g_slist_prepend (
- ph->_priv->placement_stack, (gpointer) GDL_DOCK_FLOATING);
+ ph->priv->placement_stack = g_slist_prepend (
+ ph->priv->placement_stack, (gpointer) GDL_DOCK_FLOATING);
*/
}
if (new_host)
@@ -681,15 +684,15 @@ detach_cb (GdlDockObject *object,
static void
do_excursion (GdlDockPlaceholder *ph)
{
- if (ph->_priv->host &&
- !ph->_priv->sticky &&
- ph->_priv->placement_stack &&
- gdl_dock_object_is_compound (ph->_priv->host)) {
+ if (ph->priv->host &&
+ !ph->priv->sticky &&
+ ph->priv->placement_stack &&
+ gdl_dock_object_is_compound (ph->priv->host)) {
GdlDockPlacement pos, stack_pos =
- (GdlDockPlacement) ph->_priv->placement_stack->data;
+ (GdlDockPlacement) ph->priv->placement_stack->data;
GList *children, *l;
- GdlDockObject *host = ph->_priv->host;
+ GdlDockObject *host = ph->priv->host;
children = gtk_container_get_children (GTK_CONTAINER (host));
for (l = children; l; l = l->next) {
@@ -699,9 +702,9 @@ do_excursion (GdlDockPlaceholder *ph)
&pos);
if (pos == stack_pos) {
/* remove the stack position */
- ph->_priv->placement_stack =
- g_slist_remove_link (ph->_priv->placement_stack,
- ph->_priv->placement_stack);
+ ph->priv->placement_stack =
+ g_slist_remove_link (ph->priv->placement_stack,
+ ph->priv->placement_stack);
/* connect to the new host */
disconnect_host (ph);
@@ -730,14 +733,14 @@ dock_cb (GdlDockObject *object,
g_return_if_fail (user_data != NULL && GDL_IS_DOCK_PLACEHOLDER (user_data));
ph = GDL_DOCK_PLACEHOLDER (user_data);
- g_return_if_fail (ph->_priv->host == object);
+ g_return_if_fail (ph->priv->host == object);
/* see if the given position is compatible for the stack's top
element */
- if (!ph->_priv->sticky && ph->_priv->placement_stack) {
- pos = (GdlDockPlacement) ph->_priv->placement_stack->data;
+ if (!ph->priv->sticky && ph->priv->placement_stack) {
+ pos = (GdlDockPlacement) ph->priv->placement_stack->data;
if (gdl_dock_object_child_placement (object, requestor, &pos)) {
- if (pos == (GdlDockPlacement) ph->_priv->placement_stack->data) {
+ if (pos == (GdlDockPlacement) ph->priv->placement_stack->data) {
/* the position is compatible: excurse down */
do_excursion (ph);
}
@@ -751,20 +754,20 @@ dock_cb (GdlDockObject *object,
static void
disconnect_host (GdlDockPlaceholder *ph)
{
- if (!ph->_priv->host)
+ if (!ph->priv->host)
return;
- if (ph->_priv->host_detach_handler)
- g_signal_handler_disconnect (ph->_priv->host, ph->_priv->host_detach_handler);
- if (ph->_priv->host_dock_handler)
- g_signal_handler_disconnect (ph->_priv->host, ph->_priv->host_dock_handler);
- ph->_priv->host_detach_handler = 0;
- ph->_priv->host_dock_handler = 0;
+ if (ph->priv->host_detach_handler)
+ g_signal_handler_disconnect (ph->priv->host, ph->priv->host_detach_handler);
+ if (ph->priv->host_dock_handler)
+ g_signal_handler_disconnect (ph->priv->host, ph->priv->host_dock_handler);
+ ph->priv->host_detach_handler = 0;
+ ph->priv->host_dock_handler = 0;
/* remove weak ref to object */
- g_object_weak_unref (G_OBJECT (ph->_priv->host),
+ g_object_weak_unref (G_OBJECT (ph->priv->host),
gdl_dock_placeholder_weak_notify, ph);
- ph->_priv->host = NULL;
+ ph->priv->host = NULL;
#ifdef PLACEHOLDER_DEBUG
g_message ("Host just disconnected!, ph = %p", ph);
@@ -775,21 +778,21 @@ static void
connect_host (GdlDockPlaceholder *ph,
GdlDockObject *new_host)
{
- if (ph->_priv->host)
+ if (ph->priv->host)
disconnect_host (ph);
- ph->_priv->host = new_host;
- g_object_weak_ref (G_OBJECT (ph->_priv->host),
+ ph->priv->host = new_host;
+ g_object_weak_ref (G_OBJECT (ph->priv->host),
gdl_dock_placeholder_weak_notify, ph);
- ph->_priv->host_detach_handler =
- g_signal_connect (ph->_priv->host,
+ ph->priv->host_detach_handler =
+ g_signal_connect (ph->priv->host,
"detach",
(GCallback) detach_cb,
(gpointer) ph);
- ph->_priv->host_dock_handler =
- g_signal_connect (ph->_priv->host,
+ ph->priv->host_dock_handler =
+ g_signal_connect (ph->priv->host,
"dock",
(GCallback) dock_cb,
(gpointer) ph);
@@ -804,7 +807,7 @@ gdl_dock_placeholder_attach (GdlDockPlaceholder *ph,
GdlDockObject *object)
{
g_return_if_fail (ph != NULL && GDL_IS_DOCK_PLACEHOLDER (ph));
- g_return_if_fail (ph->_priv != NULL);
+ g_return_if_fail (ph->priv != NULL);
g_return_if_fail (object != NULL);
/* object binding */
@@ -816,7 +819,7 @@ gdl_dock_placeholder_attach (GdlDockPlaceholder *ph,
gdl_dock_object_freeze (GDL_DOCK_OBJECT (ph));
/* detach from previous host first */
- if (ph->_priv->host)
+ if (ph->priv->host)
gdl_dock_object_detach (GDL_DOCK_OBJECT (ph), FALSE);
connect_host (ph, object);
diff --git a/gdl/gdl-dock-placeholder.h b/gdl/gdl-dock-placeholder.h
index 1364712..dcaa230 100644
--- a/gdl/gdl-dock-placeholder.h
+++ b/gdl/gdl-dock-placeholder.h
@@ -44,7 +44,7 @@ typedef struct _GdlDockPlaceholderPrivate GdlDockPlaceholderPrivate;
struct _GdlDockPlaceholder {
GdlDockObject object;
- GdlDockPlaceholderPrivate *_priv;
+ GdlDockPlaceholderPrivate *priv;
};
struct _GdlDockPlaceholderClass {
diff --git a/gdl/gdl-dock.c b/gdl/gdl-dock.c
index d4003b0..8bad1d7 100644
--- a/gdl/gdl-dock.c
+++ b/gdl/gdl-dock.c
@@ -261,17 +261,22 @@ gdl_dock_class_init (GdlDockClass *klass)
0);
klass->layout_changed = NULL;
+
+ g_type_class_add_private (object_class, sizeof (GdlDockPrivate));
}
static void
gdl_dock_init (GdlDock *dock)
{
+ dock->priv = G_TYPE_INSTANCE_GET_PRIVATE (dock,
+ GDL_TYPE_DOCK,
+ GdlDockPrivate);
+
gtk_widget_set_has_window (GTK_WIDGET (dock), FALSE);
dock->root = NULL;
- dock->_priv = g_new0 (GdlDockPrivate, 1);
- dock->_priv->width = -1;
- dock->_priv->height = -1;
+ dock->priv->width = -1;
+ dock->priv->height = -1;
}
static gboolean
@@ -284,10 +289,10 @@ gdl_dock_floating_configure_event_cb (GtkWidget *widget,
g_return_val_if_fail (user_data != NULL && GDL_IS_DOCK (user_data), TRUE);
dock = GDL_DOCK (user_data);
- dock->_priv->float_x = event->x;
- dock->_priv->float_y = event->y;
- dock->_priv->width = event->width;
- dock->_priv->height = event->height;
+ dock->priv->float_x = event->x;
+ dock->priv->float_y = event->y;
+ dock->priv->width = event->width;
+ dock->priv->height = event->height;
return FALSE;
}
@@ -315,29 +320,29 @@ gdl_dock_constructor (GType type,
gdl_dock_object_bind (GDL_DOCK_OBJECT (dock), G_OBJECT (master));
}
- if (dock->_priv->floating) {
+ if (dock->priv->floating) {
GdlDockObject *controller;
/* create floating window for this dock */
- dock->_priv->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_object_set_data (G_OBJECT (dock->_priv->window), "dock", dock);
+ dock->priv->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_object_set_data (G_OBJECT (dock->priv->window), "dock", dock);
/* set position and default size */
- gtk_window_set_position (GTK_WINDOW (dock->_priv->window),
+ gtk_window_set_position (GTK_WINDOW (dock->priv->window),
GTK_WIN_POS_MOUSE);
- gtk_window_set_default_size (GTK_WINDOW (dock->_priv->window),
- dock->_priv->width,
- dock->_priv->height);
- gtk_window_set_type_hint (GTK_WINDOW (dock->_priv->window),
+ gtk_window_set_default_size (GTK_WINDOW (dock->priv->window),
+ dock->priv->width,
+ dock->priv->height);
+ gtk_window_set_type_hint (GTK_WINDOW (dock->priv->window),
GDK_WINDOW_TYPE_HINT_NORMAL);
/* metacity ignores this */
- gtk_window_move (GTK_WINDOW (dock->_priv->window),
- dock->_priv->float_x,
- dock->_priv->float_y);
+ gtk_window_move (GTK_WINDOW (dock->priv->window),
+ dock->priv->float_x,
+ dock->priv->float_y);
/* connect to the configure event so we can track down window geometry */
- g_signal_connect (dock->_priv->window, "configure_event",
+ g_signal_connect (dock->priv->window, "configure_event",
(GCallback) gdl_dock_floating_configure_event_cb,
dock);
@@ -347,9 +352,9 @@ gdl_dock_constructor (GType type,
g_signal_connect (dock, "notify::long-name",
(GCallback) gdl_dock_notify_cb, NULL);
- gtk_container_add (GTK_CONTAINER (dock->_priv->window), GTK_WIDGET (dock));
+ gtk_container_add (GTK_CONTAINER (dock->priv->window), GTK_WIDGET (dock));
- g_signal_connect (dock->_priv->window, "delete_event",
+ g_signal_connect (dock->priv->window, "delete_event",
G_CALLBACK (gdl_dock_floating_window_delete_event_cb),
NULL);
}
@@ -369,7 +374,7 @@ gdl_dock_set_property (GObject *object,
switch (prop_id) {
case PROP_FLOATING:
- dock->_priv->floating = g_value_get_boolean (value);
+ dock->priv->floating = g_value_get_boolean (value);
break;
case PROP_DEFAULT_TITLE:
if (GDL_DOCK_OBJECT (object)->master)
@@ -378,16 +383,16 @@ gdl_dock_set_property (GObject *object,
NULL);
break;
case PROP_WIDTH:
- dock->_priv->width = g_value_get_int (value);
+ dock->priv->width = g_value_get_int (value);
break;
case PROP_HEIGHT:
- dock->_priv->height = g_value_get_int (value);
+ dock->priv->height = g_value_get_int (value);
break;
case PROP_FLOAT_X:
- dock->_priv->float_x = g_value_get_int (value);
+ dock->priv->float_x = g_value_get_int (value);
break;
case PROP_FLOAT_Y:
- dock->_priv->float_y = g_value_get_int (value);
+ dock->priv->float_y = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -399,10 +404,10 @@ gdl_dock_set_property (GObject *object,
case PROP_HEIGHT:
case PROP_FLOAT_X:
case PROP_FLOAT_Y:
- if (dock->_priv->floating && dock->_priv->window) {
- gtk_window_resize (GTK_WINDOW (dock->_priv->window),
- dock->_priv->width,
- dock->_priv->height);
+ if (dock->priv->floating && dock->priv->window) {
+ gtk_window_resize (GTK_WINDOW (dock->priv->window),
+ dock->priv->width,
+ dock->priv->height);
}
break;
}
@@ -418,7 +423,7 @@ gdl_dock_get_property (GObject *object,
switch (prop_id) {
case PROP_FLOATING:
- g_value_set_boolean (value, dock->_priv->floating);
+ g_value_set_boolean (value, dock->priv->floating);
break;
case PROP_DEFAULT_TITLE:
if (GDL_DOCK_OBJECT (object)->master) {
@@ -436,16 +441,16 @@ gdl_dock_get_property (GObject *object,
g_value_set_string (value, NULL);
break;
case PROP_WIDTH:
- g_value_set_int (value, dock->_priv->width);
+ g_value_set_int (value, dock->priv->width);
break;
case PROP_HEIGHT:
- g_value_set_int (value, dock->_priv->height);
+ g_value_set_int (value, dock->priv->height);
break;
case PROP_FLOAT_X:
- g_value_set_int (value, dock->_priv->float_x);
+ g_value_set_int (value, dock->priv->float_x);
break;
case PROP_FLOAT_Y:
- g_value_set_int (value, dock->_priv->float_y);
+ g_value_set_int (value, dock->priv->float_y);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -459,10 +464,10 @@ gdl_dock_set_title (GdlDock *dock)
GdlDockObject *object = GDL_DOCK_OBJECT (dock);
gchar *title = NULL;
- if (!dock->_priv->window)
+ if (!dock->priv->window)
return;
- if (!dock->_priv->auto_title && object->long_name) {
+ if (!dock->priv->auto_title && object->long_name) {
title = object->long_name;
}
else if (object->master) {
@@ -475,12 +480,12 @@ gdl_dock_set_title (GdlDock *dock)
if (!title) {
/* set a default title in the long_name */
- dock->_priv->auto_title = TRUE;
+ dock->priv->auto_title = TRUE;
title = g_strdup_printf (
_("Dock #%d"), GDL_DOCK_MASTER (object->master)->dock_number++);
}
- gtk_window_set_title (GTK_WINDOW (dock->_priv->window), title);
+ gtk_window_set_title (GTK_WINDOW (dock->priv->window), title);
g_free (title);
}
@@ -500,7 +505,7 @@ gdl_dock_notify_cb (GObject *object,
if (long_name)
{
dock = GDL_DOCK (object);
- dock->_priv->auto_title = FALSE;
+ dock->priv->auto_title = FALSE;
gdl_dock_set_title (dock);
}
g_free (long_name);
@@ -511,9 +516,9 @@ gdl_dock_destroy (GtkWidget *object)
{
GdlDock *dock = GDL_DOCK (object);
- if (dock->_priv) {
- GdlDockPrivate *priv = dock->_priv;
- dock->_priv = NULL;
+ if (dock->priv) {
+ GdlDockPrivate *priv = dock->priv;
+ dock->priv = NULL;
if (priv->window) {
gtk_widget_destroy (priv->window);
@@ -633,8 +638,8 @@ gdl_dock_unmap (GtkWidget *widget)
gtk_widget_unmap (child);
}
- if (dock->_priv->window)
- gtk_widget_unmap (dock->_priv->window);
+ if (dock->priv->window)
+ gtk_widget_unmap (dock->priv->window);
}
static void
@@ -658,8 +663,8 @@ gdl_dock_show (GtkWidget *widget)
GTK_WIDGET_CLASS (gdl_dock_parent_class)->show (widget);
dock = GDL_DOCK (widget);
- if (dock->_priv->floating && dock->_priv->window)
- gtk_widget_show (dock->_priv->window);
+ if (dock->priv->floating && dock->priv->window)
+ gtk_widget_show (dock->priv->window);
if (GDL_DOCK_IS_CONTROLLER (dock)) {
gdl_dock_master_foreach_toplevel (GDL_DOCK_OBJECT_GET_MASTER (dock),
@@ -679,8 +684,8 @@ gdl_dock_hide (GtkWidget *widget)
GTK_WIDGET_CLASS (gdl_dock_parent_class)->hide (widget);
dock = GDL_DOCK (widget);
- if (dock->_priv->floating && dock->_priv->window)
- gtk_widget_hide (dock->_priv->window);
+ if (dock->priv->floating && dock->priv->window)
+ gtk_widget_hide (dock->priv->window);
if (GDL_DOCK_IS_CONTROLLER (dock)) {
gdl_dock_master_foreach_toplevel (GDL_DOCK_OBJECT_GET_MASTER (dock),
@@ -776,7 +781,7 @@ gdl_dock_reduce (GdlDockObject *object)
} else if (!GDL_DOCK_OBJECT_ATTACHED (dock)) {
/* if the user explicitly detached the object */
- if (dock->_priv->floating)
+ if (dock->priv->floating)
gtk_widget_hide (GTK_WIDGET (dock));
else {
GtkWidget *widget = GTK_WIDGET (object);
@@ -975,7 +980,7 @@ gdl_dock_reorder (GdlDockObject *object,
GdlDock *dock = GDL_DOCK (object);
gboolean handled = FALSE;
- if (dock->_priv->floating &&
+ if (dock->priv->floating &&
new_position == GDL_DOCK_FLOATING &&
dock->root == requestor) {
@@ -983,7 +988,7 @@ gdl_dock_reorder (GdlDockObject *object,
GdkRectangle *rect;
rect = g_value_get_boxed (other_data);
- gtk_window_move (GTK_WINDOW (dock->_priv->window),
+ gtk_window_move (GTK_WINDOW (dock->priv->window),
rect->x,
rect->y);
handled = TRUE;
@@ -1018,8 +1023,8 @@ gdl_dock_present (GdlDockObject *object,
{
GdlDock *dock = GDL_DOCK (object);
- if (dock->_priv->floating)
- gtk_window_present (GTK_WINDOW (dock->_priv->window));
+ if (dock->priv->floating)
+ gtk_window_present (GTK_WINDOW (dock->priv->window));
}
@@ -1337,19 +1342,19 @@ gdl_dock_xor_rect (GdlDock *dock,
GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (dock));
gdk_window_get_origin (window, &x, &y);
- if (!dock->_priv->area_window) {
- dock->_priv->area_window = gdl_preview_window_new ();
+ if (!dock->priv->area_window) {
+ dock->priv->area_window = gdl_preview_window_new ();
}
rect->x += x;
rect->y += y;
- gdl_preview_window_update (GDL_PREVIEW_WINDOW (dock->_priv->area_window), rect);
+ gdl_preview_window_update (GDL_PREVIEW_WINDOW (dock->priv->area_window), rect);
}
void
gdl_dock_xor_rect_hide (GdlDock *dock)
{
- if (dock->_priv->area_window)
- gtk_widget_hide (dock->_priv->area_window);
+ if (dock->priv->area_window)
+ gtk_widget_hide (dock->priv->area_window);
}
diff --git a/gdl/gdl-dock.h b/gdl/gdl-dock.h
index 981a70a..4eb01f8 100644
--- a/gdl/gdl-dock.h
+++ b/gdl/gdl-dock.h
@@ -47,7 +47,7 @@ struct _GdlDock {
GdlDockObject *root;
- GdlDockPrivate *_priv;
+ GdlDockPrivate *priv;
};
struct _GdlDockClass {
diff --git a/gdl/gdl-switcher.c b/gdl/gdl-switcher.c
index 448ae0b..62ce36a 100644
--- a/gdl/gdl-switcher.c
+++ b/gdl/gdl-switcher.c
@@ -674,10 +674,6 @@ gdl_switcher_dispose (GObject *object)
static void
gdl_switcher_finalize (GObject *object)
{
- GdlSwitcherPrivate *priv = GDL_SWITCHER (object)->priv;
-
- g_free (priv);
-
G_OBJECT_CLASS (gdl_switcher_parent_class)->finalize (object);
}
@@ -772,7 +768,9 @@ gdl_switcher_class_init (GdlSwitcherClass *klass)
GDL_TYPE_SWITCHER_STYLE,
GDL_SWITCHER_STYLE_BOTH,
G_PARAM_READWRITE));
-
+
+ g_type_class_add_private (object_class, sizeof (GdlSwitcherPrivate));
+
gtk_rc_parse_string ("style \"gdl-button-style\"\n"
"{\n"
"GtkWidget::focus-padding = 1\n"
@@ -790,8 +788,10 @@ gdl_switcher_init (GdlSwitcher *switcher)
gtk_widget_set_has_window (GTK_WIDGET (switcher), FALSE);
- priv = g_new0 (GdlSwitcherPrivate, 1);
- switcher->priv = priv;
+ switcher->priv = G_TYPE_INSTANCE_GET_PRIVATE (switcher,
+ GDL_TYPE_SWITCHER,
+ GdlSwitcherPrivate);
+ priv = switcher->priv;
priv->show = TRUE;
priv->buttons_height_request = -1;
@@ -813,8 +813,7 @@ gdl_switcher_init (GdlSwitcher *switcher)
GtkWidget *
gdl_switcher_new (void)
{
- GdlSwitcher *switcher = g_object_new (gdl_switcher_get_type (), NULL);
- return GTK_WIDGET (switcher);
+ return g_object_new (gdl_switcher_get_type (), NULL);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]