From cf622f9277e6db8bc641b7c39a53163712bdd064 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Thu, 8 Oct 2009 23:57:33 -0400 Subject: [PATCH] Use accessor functions instead direct access Replaced several occurances of directly accessing widget fields with the use of accessor functions. This round only hit some of the low-hanging fruit -- several modules still contain many such accesses. --- src/color-combo-menu.c | 2 +- src/combo-util.c | 2 ++ src/merge-properties-dialog.c | 9 ++++++--- src/new-label-dialog.c | 8 +++++--- src/prefs-dialog.c | 7 +++++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/color-combo-menu.c b/src/color-combo-menu.c index 5e72928b..01e3b77d 100644 --- a/src/color-combo-menu.c +++ b/src/color-combo-menu.c @@ -367,7 +367,7 @@ custom_menu_item_activate_cb (glColorComboMenu *this) custom_dialog = gtk_color_selection_dialog_new (_("Custom Color")); - colorsel = GTK_COLOR_SELECTION_DIALOG (custom_dialog)->colorsel; + colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (custom_dialog)); color.red = GL_COLOR_F_RED (this->priv->color) * 65535; color.green = GL_COLOR_F_GREEN (this->priv->color) * 65535; color.blue = GL_COLOR_F_BLUE (this->priv->color) * 65535; diff --git a/src/combo-util.c b/src/combo-util.c index 0ca90f1f..b3f5ed5d 100644 --- a/src/combo-util.c +++ b/src/combo-util.c @@ -22,6 +22,8 @@ #include "combo-util.h" +#include + #include diff --git a/src/merge-properties-dialog.c b/src/merge-properties-dialog.c index c1c9c354..7141dc98 100644 --- a/src/merge-properties-dialog.c +++ b/src/merge-properties-dialog.c @@ -146,12 +146,15 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog) static gchar *object_ids[] = { "merge_properties_vbox", NULL }; GError *error = NULL; GtkWidget *vbox; + GtkWidget *merge_properties_vbox; gl_debug (DEBUG_MERGE, "START"); dialog->priv = g_new0 (glMergePropertiesDialogPrivate, 1); - gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD1); + vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + + gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD1); gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE); gtk_dialog_add_button (GTK_DIALOG (dialog), @@ -173,7 +176,7 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog) } gl_builder_util_get_widgets (builder, - "merge_properties_vbox", &vbox, + "merge_properties_vbox", &merge_properties_vbox, "type_combo", &dialog->priv->type_combo, "location_vbox", &dialog->priv->location_vbox, "treeview", &dialog->priv->treeview, @@ -181,7 +184,7 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog) "unselect_all_button", &dialog->priv->unselect_all_button, NULL); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + gtk_container_add (GTK_CONTAINER (vbox), merge_properties_vbox); dialog->priv->builder = builder; gl_combo_util_add_text_model (GTK_COMBO_BOX (dialog->priv->type_combo)); diff --git a/src/new-label-dialog.c b/src/new-label-dialog.c index 015f0991..c77e8cb5 100644 --- a/src/new-label-dialog.c +++ b/src/new-label-dialog.c @@ -87,7 +87,8 @@ gl_new_label_dialog_class_init (glNewLabelDialogClass *class) static void gl_new_label_dialog_init (glNewLabelDialog *dialog) { - GtkWidget *label; + GtkWidget *vbox; + GtkWidget *label; GtkWidget *frame; gchar *name; @@ -108,13 +109,14 @@ gl_new_label_dialog_init (glNewLabelDialog *dialog) gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); label = gtk_label_new (_("Media type")); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); frame = gtk_frame_new (""); gtk_frame_set_label_widget (GTK_FRAME (frame), label); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); - gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), frame, FALSE, FALSE, GL_HIG_PAD1); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, GL_HIG_PAD1); dialog->priv->media_select = gl_wdgt_media_select_new (); gtk_container_add (GTK_CONTAINER (frame), dialog->priv->media_select); @@ -124,7 +126,7 @@ gl_new_label_dialog_init (glNewLabelDialog *dialog) frame = gtk_frame_new (""); gtk_frame_set_label_widget (GTK_FRAME (frame), label); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); - gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), frame, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); dialog->priv->rotate_label = gl_rotate_label_button_new (); gtk_container_add (GTK_CONTAINER (frame), dialog->priv->rotate_label); diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index c2d44e1c..7deff673 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -230,15 +230,18 @@ gl_prefs_dialog_new (GtkWindow *parent) static void gl_prefs_dialog_construct (glPrefsDialog *dialog) { + GtkWidget *vbox; GtkWidget *notebook; g_return_if_fail (GL_IS_PREFS_DIALOG (dialog)); g_return_if_fail (dialog->priv != NULL); + vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gl_builder_util_get_widgets (dialog->priv->builder, "prefs_notebook", ¬ebook, NULL); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); construct_locale_page (dialog); construct_object_page (dialog); @@ -246,7 +249,7 @@ gl_prefs_dialog_construct (glPrefsDialog *dialog) update_locale_page_from_prefs (dialog); update_object_page_from_prefs (dialog); - gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); + gtk_widget_show_all (vbox); } -- 2.39.5