diff options
-rw-r--r-- | gtk/gtkcellarea.c | 97 | ||||
-rw-r--r-- | gtk/gtkcellarea.h | 3 |
2 files changed, 31 insertions, 69 deletions
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index eb4db09263..8592db6234 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -554,6 +554,8 @@ typedef struct { gboolean is_expanded; } AttributeData; +typedef struct _GtkCellAreaPrivate GtkCellAreaPrivate; + struct _GtkCellAreaPrivate { /* The GtkCellArea bookkeeps any connected @@ -614,10 +616,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkCellArea, gtk_cell_area, G_TYPE_INITIALLY_U static void gtk_cell_area_init (GtkCellArea *area) { - GtkCellAreaPrivate *priv; - - area->priv = gtk_cell_area_get_instance_private (area); - priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); priv->cell_info = g_hash_table_new_full (g_direct_hash, g_direct_equal, @@ -894,7 +893,7 @@ static void gtk_cell_area_finalize (GObject *object) { GtkCellArea *area = GTK_CELL_AREA (object); - GtkCellAreaPrivate *priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); /* All cell renderers should already be removed at this point, * just kill our (empty) hash tables here. @@ -951,7 +950,7 @@ gtk_cell_area_get_property (GObject *object, GParamSpec *pspec) { GtkCellArea *area = GTK_CELL_AREA (object); - GtkCellAreaPrivate *priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); switch (prop_id) { @@ -1019,7 +1018,7 @@ gtk_cell_area_real_event (GtkCellArea *area, const GdkRectangle *cell_area, GtkCellRendererState flags) { - GtkCellAreaPrivate *priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); gboolean retval = FALSE; GdkEventType event_type = gdk_event_get_event_type (event); @@ -1247,13 +1246,10 @@ gtk_cell_area_real_apply_attributes (GtkCellArea *area, gboolean is_expander, gboolean is_expanded) { - - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); AttributeData data; GtkTreePath *path; - priv = area->priv; - /* Feed in data needed to apply to every renderer */ data.area = area; data.model = tree_model; @@ -1379,7 +1375,7 @@ gtk_cell_area_real_activate (GtkCellArea *area, GtkCellRendererState flags, gboolean edit_only) { - GtkCellAreaPrivate *priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); GdkRectangle renderer_area; GtkCellRenderer *activate_cell = NULL; GtkCellRendererMode mode; @@ -1512,7 +1508,7 @@ gtk_cell_area_clear_attributes (GtkCellLayout *cell_layout, GtkCellRenderer *renderer) { GtkCellArea *area = GTK_CELL_AREA (cell_layout); - GtkCellAreaPrivate *priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); CellInfo *info; info = g_hash_table_lookup (priv->cell_info, renderer); @@ -1614,14 +1610,12 @@ void gtk_cell_area_remove (GtkCellArea *area, GtkCellRenderer *renderer) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); GList *renderers, *l; g_return_if_fail (GTK_IS_CELL_AREA (area)); g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); - priv = area->priv; - /* Remove any custom attributes and custom cell data func here first */ g_hash_table_remove (priv->cell_info, renderer); @@ -2155,7 +2149,7 @@ gtk_cell_area_attribute_connect (GtkCellArea *area, const gchar *attribute, gint column) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); CellInfo *info; CellAttribute *cell_attribute; @@ -2164,7 +2158,6 @@ gtk_cell_area_attribute_connect (GtkCellArea *area, g_return_if_fail (attribute != NULL); g_return_if_fail (gtk_cell_area_has_renderer (area, renderer)); - priv = area->priv; info = g_hash_table_lookup (priv->cell_info, renderer); if (!info) @@ -2221,7 +2214,7 @@ gtk_cell_area_attribute_disconnect (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *attribute) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); CellInfo *info; CellAttribute *cell_attribute; GSList *node; @@ -2231,7 +2224,6 @@ gtk_cell_area_attribute_disconnect (GtkCellArea *area, g_return_if_fail (attribute != NULL); g_return_if_fail (gtk_cell_area_has_renderer (area, renderer)); - priv = area->priv; info = g_hash_table_lookup (priv->cell_info, renderer); if (info) @@ -2265,12 +2257,11 @@ gtk_cell_area_attribute_get_column (GtkCellArea *area, GtkCellRenderer *renderer, const gchar *attribute) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); CellInfo *info; CellAttribute *cell_attribute; GSList *node; - priv = area->priv; info = g_hash_table_lookup (priv->cell_info, renderer); if (info) @@ -2331,12 +2322,10 @@ gtk_cell_area_apply_attributes (GtkCellArea *area, const gchar * gtk_cell_area_get_current_path_string (GtkCellArea *area) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL); - priv = area->priv; - return priv->current_path; } @@ -2877,13 +2866,11 @@ void gtk_cell_area_set_focus_cell (GtkCellArea *area, GtkCellRenderer *renderer) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_if_fail (GTK_IS_CELL_AREA (area)); g_return_if_fail (renderer == NULL || GTK_IS_CELL_RENDERER (renderer)); - priv = area->priv; - if (priv->focus_cell != renderer) { if (priv->focus_cell) @@ -2916,12 +2903,10 @@ gtk_cell_area_set_focus_cell (GtkCellArea *area, GtkCellRenderer * gtk_cell_area_get_focus_cell (GtkCellArea *area) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL); - priv = area->priv; - return priv->focus_cell; } @@ -2948,7 +2933,7 @@ gtk_cell_area_add_focus_sibling (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellRenderer *sibling) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); GList *siblings; g_return_if_fail (GTK_IS_CELL_AREA (area)); @@ -2964,8 +2949,6 @@ gtk_cell_area_add_focus_sibling (GtkCellArea *area, * at a time. */ - priv = area->priv; - siblings = g_hash_table_lookup (priv->focus_siblings, renderer); if (siblings) @@ -2991,7 +2974,7 @@ gtk_cell_area_remove_focus_sibling (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellRenderer *sibling) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); GList *siblings; g_return_if_fail (GTK_IS_CELL_AREA (area)); @@ -2999,8 +2982,6 @@ gtk_cell_area_remove_focus_sibling (GtkCellArea *area, g_return_if_fail (GTK_IS_CELL_RENDERER (sibling)); g_return_if_fail (gtk_cell_area_is_focus_sibling (area, renderer, sibling)); - priv = area->priv; - siblings = g_hash_table_lookup (priv->focus_siblings, renderer); siblings = g_list_copy (siblings); @@ -3028,15 +3009,13 @@ gtk_cell_area_is_focus_sibling (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellRenderer *sibling) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); GList *siblings, *l; g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), FALSE); g_return_val_if_fail (GTK_IS_CELL_RENDERER (sibling), FALSE); - priv = area->priv; - siblings = g_hash_table_lookup (priv->focus_siblings, renderer); for (l = siblings; l; l = l->next) @@ -3064,13 +3043,11 @@ const GList * gtk_cell_area_get_focus_siblings (GtkCellArea *area, GtkCellRenderer *renderer) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL); g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), NULL); - priv = area->priv; - return g_hash_table_lookup (priv->focus_siblings, renderer); } @@ -3133,8 +3110,10 @@ gtk_cell_area_add_editable (GtkCellArea *area, GtkCellEditable *editable, const GdkRectangle *cell_area) { + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); + g_signal_emit (area, cell_area_signals[SIGNAL_ADD_EDITABLE], 0, - renderer, editable, cell_area, area->priv->current_path); + renderer, editable, cell_area, priv->current_path); } static void @@ -3149,7 +3128,7 @@ static void cell_area_remove_widget_cb (GtkCellEditable *editable, GtkCellArea *area) { - GtkCellAreaPrivate *priv = area->priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_assert (priv->edit_widget == editable); g_assert (priv->edited_cell != NULL); @@ -3166,13 +3145,11 @@ static void gtk_cell_area_set_edited_cell (GtkCellArea *area, GtkCellRenderer *renderer) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_if_fail (GTK_IS_CELL_AREA (area)); g_return_if_fail (renderer == NULL || GTK_IS_CELL_RENDERER (renderer)); - priv = area->priv; - if (priv->edited_cell != renderer) { if (priv->edited_cell) @@ -3191,13 +3168,11 @@ static void gtk_cell_area_set_edit_widget (GtkCellArea *area, GtkCellEditable *editable) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_if_fail (GTK_IS_CELL_AREA (area)); g_return_if_fail (editable == NULL || GTK_IS_CELL_EDITABLE (editable)); - priv = area->priv; - if (priv->edit_widget != editable) { if (priv->edit_widget) @@ -3234,12 +3209,10 @@ gtk_cell_area_set_edit_widget (GtkCellArea *area, GtkCellRenderer * gtk_cell_area_get_edited_cell (GtkCellArea *area) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL); - priv = area->priv; - return priv->edited_cell; } @@ -3255,12 +3228,10 @@ gtk_cell_area_get_edited_cell (GtkCellArea *area) GtkCellEditable * gtk_cell_area_get_edit_widget (GtkCellArea *area) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL); - priv = area->priv; - return priv->edit_widget; } @@ -3289,16 +3260,14 @@ gtk_cell_area_activate_cell (GtkCellArea *area, const GdkRectangle *cell_area, GtkCellRendererState flags) { + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); GtkCellRendererMode mode; - GtkCellAreaPrivate *priv; g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), FALSE); g_return_val_if_fail (cell_area != NULL, FALSE); - priv = area->priv; - if (!gtk_cell_renderer_get_sensitive (renderer)) return FALSE; @@ -3380,12 +3349,10 @@ void gtk_cell_area_stop_editing (GtkCellArea *area, gboolean canceled) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); g_return_if_fail (GTK_IS_CELL_AREA (area)); - priv = area->priv; - if (priv->edited_cell) { GtkCellEditable *edit_widget = g_object_ref (priv->edit_widget); @@ -3533,14 +3500,12 @@ _gtk_cell_area_set_cell_data_func_with_proxy (GtkCellArea *area, GDestroyNotify destroy, gpointer proxy) { - GtkCellAreaPrivate *priv; + GtkCellAreaPrivate *priv = gtk_cell_area_get_instance_private (area); CellInfo *info; g_return_if_fail (GTK_IS_CELL_AREA (area)); g_return_if_fail (GTK_IS_CELL_RENDERER (cell)); - priv = area->priv; - info = g_hash_table_lookup (priv->cell_info, cell); /* Note we do not take a reference to the proxy, the proxy is a GtkCellLayout diff --git a/gtk/gtkcellarea.h b/gtk/gtkcellarea.h index 51f63e71c4..ee199fb6cf 100644 --- a/gtk/gtkcellarea.h +++ b/gtk/gtkcellarea.h @@ -41,7 +41,6 @@ G_BEGIN_DECLS typedef struct _GtkCellArea GtkCellArea; typedef struct _GtkCellAreaClass GtkCellAreaClass; -typedef struct _GtkCellAreaPrivate GtkCellAreaPrivate; typedef struct _GtkCellAreaContext GtkCellAreaContext; /** @@ -95,8 +94,6 @@ struct _GtkCellArea { /*< private >*/ GInitiallyUnowned parent_instance; - - GtkCellAreaPrivate *priv; }; |