]> git.sur5r.net Git - glabels/commitdiff
Use accessor functions instead direct access
authorJim Evins <evins@snaught.com>
Fri, 9 Oct 2009 03:57:33 +0000 (23:57 -0400)
committerJim Evins <evins@snaught.com>
Fri, 9 Oct 2009 04:06:48 +0000 (00:06 -0400)
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
src/combo-util.c
src/merge-properties-dialog.c
src/new-label-dialog.c
src/prefs-dialog.c

index 5e72928b76fb18279a4b5282d5cdaa7fad6d2732..01e3b77d4d9259c56b2b679b99c584d8f596a83b 100644 (file)
@@ -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;
index 0ca90f1f5e7d45617e010fbde291940ded83eb94..b3f5ed5d3789315b1148437a38029486c4ec06a2 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "combo-util.h"
 
+#include <string.h>
+
 #include <libglabels/libglabels.h>
 
 
index c1c9c3549e87a7685024e25f9d14c91b6508d7ff..7141dc985956358726cda4ea155d528f49f91ed7 100644 (file)
@@ -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));
index 015f099107ea59d8d48d45754bf691bfeab57c78..c77e8cb55917043f17fe653b0ff04ba09c999b8b 100644 (file)
@@ -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 (_("<b>Media type</b>"));
         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);
index c2d44e1cbd007986ce71267563b26c956e70e107..7deff673582b442538ed327db317b599002bec23 100644 (file)
@@ -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", &notebook,
                                      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);   
 }