diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-06-01 21:01:33 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-07-13 19:40:45 +0200 |
commit | 6736c085b30faa63eb5ed129ec53fed9a56b7e6b (patch) | |
tree | b108449f063bffab074987c1beb4964f9dfbd4dc /gtk | |
parent | b71d539fd065ec851932f8ed9d92da9c2e58df14 (diff) | |
download | gtk+-6736c085b30faa63eb5ed129ec53fed9a56b7e6b.tar.gz |
Use accessor functions to access GtkCellRendererText
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcellrendereraccel.c | 4 | ||||
-rw-r--r-- | gtk/gtkcellrenderercombo.c | 20 | ||||
-rw-r--r-- | gtk/gtkcellrendererspin.c | 11 |
3 files changed, 25 insertions, 10 deletions
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c index e66ab2bcf0..829c513b1f 100644 --- a/gtk/gtkcellrendereraccel.c +++ b/gtk/gtkcellrendereraccel.c @@ -585,6 +585,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell, GtkWidget *label; GtkWidget *eventbox; GdkDevice *device, *keyb, *pointer; + gboolean editable; guint32 time; celltext = GTK_CELL_RENDERER_TEXT (cell); @@ -592,7 +593,8 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell, priv = accel->priv; /* If the cell isn't editable we return NULL. */ - if (celltext->editable == FALSE) + g_object_get (celltext, "editable", &editable, NULL); + if (editable == FALSE) return NULL; g_return_val_if_fail (widget->window != NULL, NULL); diff --git a/gtk/gtkcellrenderercombo.c b/gtk/gtkcellrenderercombo.c index 2c7c29401c..82f41d12e6 100644 --- a/gtk/gtkcellrenderercombo.c +++ b/gtk/gtkcellrenderercombo.c @@ -399,18 +399,21 @@ find_text (GtkTreeModel *model, { GtkCellRendererComboPriv *priv; SearchData *search_data = (SearchData *)data; - gchar *text; + gchar *text, *cell_text; priv = search_data->cell->priv; gtk_tree_model_get (model, iter, priv->text_column, &text, -1); - if (text && GTK_CELL_RENDERER_TEXT (search_data->cell)->text && - strcmp (text, GTK_CELL_RENDERER_TEXT (search_data->cell)->text) == 0) + g_object_get (GTK_CELL_RENDERER_TEXT (search_data->cell), + "text", &cell_text, + NULL); + if (text && cell_text && g_strcmp0 (text, cell_text) == 0) { search_data->iter = *iter; search_data->found = TRUE; } + g_free (cell_text); g_free (text); return search_data->found; @@ -430,9 +433,12 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell, GtkWidget *combo; SearchData search_data; GtkCellRendererComboPriv *priv; + gboolean editable; + gchar *text; cell_text = GTK_CELL_RENDERER_TEXT (cell); - if (cell_text->editable == FALSE) + g_object_get (cell_text, "editable", &editable, NULL); + if (editable == FALSE) return NULL; cell_combo = GTK_CELL_RENDERER_COMBO (cell); @@ -450,9 +456,11 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell, gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo), priv->text_column); - if (cell_text->text) + g_object_get (cell_text, "text", &text, NULL); + if (text) gtk_entry_set_text (GTK_ENTRY (GTK_BIN (combo)->child), - cell_text->text); + text); + g_free (text); } else { diff --git a/gtk/gtkcellrendererspin.c b/gtk/gtkcellrendererspin.c index a514657e5d..536152d65c 100644 --- a/gtk/gtkcellrendererspin.c +++ b/gtk/gtkcellrendererspin.c @@ -301,11 +301,14 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell, GtkCellRendererSpinPrivate *priv; GtkCellRendererText *cell_text; GtkWidget *spin; + gboolean editable; + gchar *text; cell_text = GTK_CELL_RENDERER_TEXT (cell); priv = GTK_CELL_RENDERER_SPIN (cell)->priv; - if (!cell_text->editable) + g_object_get (cell_text, "editable", &editable, NULL); + if (!editable) return NULL; if (!priv->adjustment) @@ -318,9 +321,11 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell, G_CALLBACK (gtk_cell_renderer_spin_button_press_event), NULL); - if (cell_text->text) + g_object_get (cell_text, "text", &text, NULL); + if (text) gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), - g_ascii_strtod (cell_text->text, NULL)); + g_ascii_strtod (text, NULL)); + g_free (text); g_object_set_data_full (G_OBJECT (spin), GTK_CELL_RENDERER_SPIN_PATH, g_strdup (path), g_free); |