[file-roller] batch add: simplified the code removing useless variables



commit 2436a7e8fc36d4c020b566d1947b1571d5a49da2
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Aug 4 09:33:33 2011 +0200

    batch add: simplified the code removing useless variables

 data/ui/batch-add-files.ui |  211 ++++++++++++++++++++++----------------------
 src/dlg-batch-add.c        |  136 ++++++++++++-----------------
 2 files changed, 162 insertions(+), 185 deletions(-)
---
diff --git a/data/ui/batch-add-files.ui b/data/ui/batch-add-files.ui
index 13f2cdf..f46edb1 100644
--- a/data/ui/batch-add-files.ui
+++ b/data/ui/batch-add-files.ui
@@ -1,43 +1,114 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.14"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkDialog" id="batch_add_files_dialog">
+  <object class="GtkDialog" id="dialog">
+    <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Compress</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
     <property name="type_hint">normal</property>
     <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox11">
+      <object class="GtkBox" id="dialog-vbox11">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area11">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="a_cancel_button">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="a_add_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="image_position">top</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="a_help_button">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkHBox" id="hbox28">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="border_width">5</property>
             <property name="spacing">18</property>
             <child>
-              <object class="GtkImage" id="a_add_image">
+              <object class="GtkImage" id="archive_icon_image">
                 <property name="width_request">64</property>
                 <property name="height_request">64</property>
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="yalign">0</property>
               </object>
               <packing>
                 <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
               <object class="GtkVBox" id="vbox8">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
+                <property name="can_focus">False</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkTable" id="table5">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="n_rows">2</property>
                     <property name="n_columns">2</property>
                     <property name="column_spacing">12</property>
@@ -45,6 +116,7 @@
                     <child>
                       <object class="GtkLabel" id="a_archive_label">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">_Filename:</property>
                         <property name="use_underline">True</property>
@@ -59,6 +131,7 @@
                     <child>
                       <object class="GtkLabel" id="a_location_label">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">_Location:</property>
                         <property name="use_underline">True</property>
@@ -74,8 +147,9 @@
                     <child>
                       <object class="GtkFileChooserButton" id="a_location_filechooserbutton">
                         <property name="visible">True</property>
-                        <property name="local_only">False</property>
+                        <property name="can_focus">False</property>
                         <property name="action">select-folder</property>
+                        <property name="local_only">False</property>
                         <property name="title" translatable="yes">Location</property>
                         <property name="width_chars">15</property>
                       </object>
@@ -84,13 +158,13 @@
                         <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
                         <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkHBox" id="hbox30">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkEntry" id="a_add_to_entry">
@@ -99,17 +173,22 @@
                             <property name="activates_default">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkHBox" id="a_archive_type_box">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <placeholder/>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -117,12 +196,13 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
                         <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -134,10 +214,12 @@
                     <child>
                       <object class="GtkAlignment" id="alignment2">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="top_padding">6</property>
                         <child>
                           <object class="GtkTable" id="table6">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="n_rows">3</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">12</property>
@@ -145,6 +227,7 @@
                             <child>
                               <object class="GtkLabel" id="a_password_label">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">_Password:</property>
                                 <property name="use_underline">True</property>
@@ -160,7 +243,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="visibility">False</property>
-                                <property name="invisible_char">&#x25CF;</property>
+                                <property name="invisible_char">â</property>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -174,7 +257,9 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
+                                <property name="xalign">0</property>
                                 <property name="draw_indicator">True</property>
                               </object>
                               <packing>
@@ -182,13 +267,13 @@
                                 <property name="right_attach">2</property>
                                 <property name="top_attach">1</property>
                                 <property name="bottom_attach">2</property>
-                                <property name="x_options">GTK_FILL</property>
                                 <property name="y_options"></property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkHBox" id="a_volume_box">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkCheckButton" id="a_volume_checkbutton">
@@ -196,6 +281,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
@@ -217,12 +303,14 @@
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                                 <child>
                                   <object class="GtkLabel" id="label50">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="label" translatable="yes" comments="MB means megabytes">MB</property>
                                   </object>
                                   <packing>
@@ -249,115 +337,30 @@
                     <child type="label">
                       <object class="GtkLabel" id="label48">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">_Other Options</property>
                         <property name="use_underline">True</property>
                       </object>
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area11">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="a_cancel_button">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="a_add_button">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">False</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment1">
-                    <property name="visible">True</property>
-                    <property name="xscale">0</property>
-                    <property name="yscale">0</property>
-                    <child>
-                      <object class="GtkHBox" id="hbox29">
-                        <property name="visible">True</property>
-                        <property name="spacing">2</property>
-                        <child>
-                          <object class="GtkImage" id="a_create_image">
-                            <property name="visible">True</property>
-                            <property name="stock">gtk-ok</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label45">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">C_reate</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="a_help_button">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
             <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
@@ -369,9 +372,9 @@
     </action-widgets>
   </object>
   <object class="GtkAdjustment" id="volume_adjustment">
-    <property name="value">10</property>
     <property name="lower">0.10000000000000001</property>
     <property name="upper">9999999999</property>
+    <property name="value">10</property>
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">10</property>
   </object>
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c
index d469e45..eeac95f 100644
--- a/src/dlg-batch-add.c
+++ b/src/dlg-batch-add.c
@@ -37,6 +37,7 @@
 
 #define ARCHIVE_ICON_SIZE (48)
 #define BAD_CHARS "/\\*"
+#define GET_WIDGET(x) (_gtk_builder_get_widget (data->builder, (x)))
 
 
 typedef struct {
@@ -45,20 +46,7 @@ typedef struct {
 	GSettings  *settings_general;
 	GtkBuilder *builder;
 	int        *supported_types;
-
-	GtkWidget  *dialog;
-	GtkWidget  *a_add_to_entry;
-	GtkWidget  *a_location_filechooserbutton;
-	GtkWidget  *add_image;
-	GtkWidget  *a_archive_type_combo_box;
-	GtkWidget  *a_other_options_expander;
-	GtkWidget  *a_password_entry;
-	GtkWidget  *a_password_label;
-	GtkWidget  *a_encrypt_header_checkbutton;
-	GtkWidget  *a_volume_checkbutton;
-	GtkWidget  *a_volume_spinbutton;
-	GtkWidget  *a_volume_box;
-
+	GtkWidget  *archive_type_combo_box;
 	GList      *file_list;
 	gboolean    add_clicked;
 	const char *last_mime_type;
@@ -71,7 +59,7 @@ get_ext (DialogData *data)
 {
 	int idx;
 
-	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->a_archive_type_combo_box));
+	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
 
 	return mime_type_desc[data->supported_types[idx]].default_ext;
 }
@@ -83,8 +71,8 @@ destroy_cb (GtkWidget  *widget,
 	    DialogData *data)
 {
 	g_settings_set_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION, get_ext (data));
-	/*g_settings_set_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (data->a_other_options_expander)));*/
-	g_settings_set_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
+	/*g_settings_set_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander"))));*/
+	g_settings_set_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton"))));
 
 	if (! data->add_clicked) {
 		fr_window_pop_message (data->window);
@@ -103,27 +91,27 @@ set_archive_options (DialogData *data)
 {
 	int idx;
 
-	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->a_archive_type_combo_box));
+	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
 	if (mime_type_desc[data->supported_types[idx]].capabilities & FR_COMMAND_CAN_ENCRYPT) {
 		const char *pwd;
 
-		pwd = gtk_entry_get_text (GTK_ENTRY (data->a_password_entry));
+		pwd = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("a_password_entry")));
 		if (pwd != NULL) {
 			if (strcmp (pwd, "") != 0) {
 				fr_window_set_password (data->window, pwd);
 				if (mime_type_desc[data->supported_types[idx]].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER)
-					fr_window_set_encrypt_header (data->window, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
+					fr_window_set_encrypt_header (data->window, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton"))));
 			}
 		}
 	}
 
 	if ((mime_type_desc[data->supported_types[idx]].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES)
-	    && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_volume_checkbutton)))
+	    && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_volume_checkbutton"))))
 	{
 		double value;
 		int    size;
 
-		value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton));
+		value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")));
 		size = floor (value * MEGABYTE);
 		g_settings_set_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE, size);
 		fr_window_set_volume_size (data->window, (guint) size);
@@ -135,7 +123,7 @@ static void
 help_clicked_cb (GtkWidget  *widget,
 		 DialogData *data)
 {
-	show_help_dialog (GTK_WINDOW (data->dialog), "file-roller-fmgr-add");
+	show_help_dialog (GTK_WINDOW (GET_WIDGET ("dialog")), "file-roller-fmgr-add");
 }
 
 
@@ -156,7 +144,7 @@ add_clicked_cb (GtkWidget  *widget,
 
 	/* Collect data */
 
-	archive_name = g_uri_escape_string (gtk_entry_get_text (GTK_ENTRY (data->a_add_to_entry)), NULL, FALSE);
+	archive_name = g_uri_escape_string (gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("a_add_to_entry"))), NULL, FALSE);
 
 	/* Check whether the user entered a valid archive name. */
 
@@ -198,7 +186,7 @@ add_clicked_cb (GtkWidget  *widget,
 
 	/* Check directory existence. */
 
-	archive_dir = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->a_location_filechooserbutton));
+	archive_dir = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (GET_WIDGET ("a_location_filechooserbutton")));
 	if (archive_dir == NULL) {
 		g_free (archive_dir);
 		g_free (archive_name);
@@ -232,7 +220,7 @@ add_clicked_cb (GtkWidget  *widget,
 		msg = g_strdup_printf (_("Destination folder \"%s\" does not exist.\n\nDo you want to create it?"), folder_name);
 		g_free (folder_name);
 
-		d = _gtk_message_dialog_new (GTK_WINDOW (data->dialog),
+		d = _gtk_message_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
 					     GTK_DIALOG_MODAL,
 					     GTK_STOCK_DIALOG_QUESTION,
 					     msg,
@@ -319,7 +307,7 @@ add_clicked_cb (GtkWidget  *widget,
 		GtkWidget *d;
 		int        r;
 
-		d = _gtk_message_dialog_new (GTK_WINDOW (data->dialog),
+		d = _gtk_message_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
 					     GTK_DIALOG_MODAL,
 					     GTK_STOCK_DIALOG_QUESTION,
 					     _("The archive is already present.  Do you want to overwrite it?"),
@@ -355,7 +343,7 @@ add_clicked_cb (GtkWidget  *widget,
 		}
 	}
 	set_archive_options (data);
-	gtk_widget_destroy (data->dialog);
+	gtk_widget_destroy (GET_WIDGET ("dialog"));
 
 	fr_window_archive_new (window, archive_file);
 
@@ -372,11 +360,11 @@ update_sensitivity_for_mime_type (DialogData *data,
 	int i;
 
 	if (mime_type == NULL) {
-		gtk_widget_set_sensitive (data->a_password_entry, FALSE);
-		gtk_widget_set_sensitive (data->a_password_label, FALSE);
-		gtk_widget_set_sensitive (data->a_encrypt_header_checkbutton, FALSE);
-		gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), TRUE);
-		gtk_widget_set_sensitive (data->a_volume_box, FALSE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_password_entry"), FALSE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_password_label"), FALSE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), FALSE);
+		gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), TRUE);
+		gtk_widget_set_sensitive (GET_WIDGET ("a_volume_box"), FALSE);
 		return;
 	}
 
@@ -385,15 +373,15 @@ update_sensitivity_for_mime_type (DialogData *data,
 			gboolean sensitive;
 
 			sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT;
-			gtk_widget_set_sensitive (data->a_password_entry, sensitive);
-			gtk_widget_set_sensitive (data->a_password_label, sensitive);
+			gtk_widget_set_sensitive (GET_WIDGET ("a_password_entry"), sensitive);
+			gtk_widget_set_sensitive (GET_WIDGET ("a_password_label"), sensitive);
 
 			sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER;
-			gtk_widget_set_sensitive (data->a_encrypt_header_checkbutton, sensitive);
-			gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), ! sensitive);
+			gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), sensitive);
+			gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), ! sensitive);
 
 			sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES;
-			gtk_widget_set_sensitive (data->a_volume_box, sensitive);
+			gtk_widget_set_sensitive (GET_WIDGET ("a_volume_box"), sensitive);
 
 			break;
 		}
@@ -410,7 +398,7 @@ archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
 
 	mime_type = mime_type_desc[data->supported_types[idx]].mime_type;
 
-	gtk_image_set_from_pixbuf (GTK_IMAGE (data->add_image), get_mime_type_pixbuf (mime_type, ARCHIVE_ICON_SIZE, NULL));
+	gtk_image_set_from_pixbuf (GTK_IMAGE (GET_WIDGET ("a_add_image")), get_mime_type_pixbuf (mime_type, ARCHIVE_ICON_SIZE, NULL));
 	update_sensitivity_for_mime_type (data, mime_type);
 }
 
@@ -423,7 +411,7 @@ update_archive_type_combo_box_from_ext (DialogData  *data,
 	int i;
 
 	if (ext == NULL) {
-		gtk_combo_box_set_active (GTK_COMBO_BOX (data->a_archive_type_combo_box), 0);
+		gtk_combo_box_set_active (GTK_COMBO_BOX (data->archive_type_combo_box), 0);
 		return;
 	}
 
@@ -433,14 +421,14 @@ update_archive_type_combo_box_from_ext (DialogData  *data,
 			break;
 		}
 
-	gtk_combo_box_set_active (GTK_COMBO_BOX (data->a_archive_type_combo_box), idx);
+	gtk_combo_box_set_active (GTK_COMBO_BOX (data->archive_type_combo_box), idx);
 }
 
 
 static void
 update_sensitivity (DialogData *data)
 {
-	gtk_widget_set_sensitive (data->a_volume_spinbutton, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_volume_checkbutton)));
+	gtk_widget_set_sensitive (GET_WIDGET ("a_volume_spinbutton"), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_volume_checkbutton"))));
 }
 
 
@@ -495,37 +483,23 @@ dlg_batch_add_files (FrWindow *window,
 
 	/* Get the widgets. */
 
-	data->dialog = _gtk_builder_get_widget (data->builder, "batch_add_files_dialog");
-	data->a_add_to_entry = _gtk_builder_get_widget (data->builder, "a_add_to_entry");
-	data->a_location_filechooserbutton = _gtk_builder_get_widget (data->builder, "a_location_filechooserbutton");
-	data->a_password_entry = _gtk_builder_get_widget (data->builder, "a_password_entry");
-	data->a_password_label = _gtk_builder_get_widget (data->builder, "a_password_label");
-	data->a_other_options_expander = _gtk_builder_get_widget (data->builder, "a_other_options_expander");
-	data->a_encrypt_header_checkbutton = _gtk_builder_get_widget (data->builder, "a_encrypt_header_checkbutton");
-
-	data->a_volume_checkbutton = _gtk_builder_get_widget (data->builder, "a_volume_checkbutton");
-	data->a_volume_spinbutton = _gtk_builder_get_widget (data->builder, "a_volume_spinbutton");
-	data->a_volume_box = _gtk_builder_get_widget (data->builder, "a_volume_box");
-
-	add_button = _gtk_builder_get_widget (data->builder, "a_add_button");
-	cancel_button = _gtk_builder_get_widget (data->builder, "a_cancel_button");
-	help_button = _gtk_builder_get_widget (data->builder, "a_help_button");
-	a_archive_type_box = _gtk_builder_get_widget (data->builder, "a_archive_type_box");
-
-	data->add_image = _gtk_builder_get_widget (data->builder, "a_add_image");
+	add_button = GET_WIDGET ("a_add_button");
+	cancel_button = GET_WIDGET ("a_cancel_button");
+	help_button = GET_WIDGET ("a_help_button");
+	a_archive_type_box = GET_WIDGET ("a_archive_type_box");
 
 	/* Set widgets data. */
 
 	size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-	gtk_size_group_add_widget (size_group, _gtk_builder_get_widget (data->builder, "a_archive_label"));
-	gtk_size_group_add_widget (size_group, _gtk_builder_get_widget (data->builder, "a_location_label"));
-	gtk_size_group_add_widget (size_group, _gtk_builder_get_widget (data->builder, "a_password_label"));
+	gtk_size_group_add_widget (size_group, GET_WIDGET ("a_archive_label"));
+	gtk_size_group_add_widget (size_group, GET_WIDGET ("a_location_label"));
+	gtk_size_group_add_widget (size_group, GET_WIDGET ("a_password_label"));
 
 	gtk_button_set_use_stock (GTK_BUTTON (add_button), TRUE);
 	gtk_button_set_label (GTK_BUTTON (add_button), FR_STOCK_CREATE_ARCHIVE);
-	gtk_expander_set_expanded (GTK_EXPANDER (data->a_other_options_expander), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
-	gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton), (double) g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
+	gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander")), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
+	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")), (double) g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
 
 	first_filename = (char*) file_list->data;
 	parent = remove_level_from_path (first_filename);
@@ -540,18 +514,18 @@ dlg_batch_add_files (FrWindow *window,
 		}
 	}
 
-	_gtk_entry_set_filename_text (GTK_ENTRY (data->a_add_to_entry), automatic_name);
+	_gtk_entry_set_filename_text (GTK_ENTRY (GET_WIDGET ("a_add_to_entry")), automatic_name);
 	g_free (automatic_name);
 
 	if (check_permissions (parent, R_OK | W_OK))
-		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->a_location_filechooserbutton), parent);
+		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (GET_WIDGET ("a_location_filechooserbutton")), parent);
 	else
-		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->a_location_filechooserbutton), get_home_uri ());
+		gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (GET_WIDGET ("a_location_filechooserbutton")), get_home_uri ());
 	g_free (parent);
 
 	/* archive type combobox */
 
-	data->a_archive_type_combo_box = gtk_combo_box_text_new ();
+	data->archive_type_combo_box = gtk_combo_box_text_new ();
 	if (data->single_file)
 		data->supported_types = single_file_save_type;
 	else
@@ -559,22 +533,22 @@ dlg_batch_add_files (FrWindow *window,
 	sort_mime_types_by_extension (data->supported_types);
 
 	for (i = 0; data->supported_types[i] != -1; i++)
-		gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->a_archive_type_combo_box),
+		gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->archive_type_combo_box),
 					        mime_type_desc[data->supported_types[i]].default_ext);
 
-	gtk_box_pack_start (GTK_BOX (a_archive_type_box), data->a_archive_type_combo_box, TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (a_archive_type_box), data->archive_type_combo_box, TRUE, TRUE, 0);
 	gtk_widget_show_all (a_archive_type_box);
 
 	/* Set the signals handlers. */
 
-	g_signal_connect (G_OBJECT (data->dialog),
+	g_signal_connect (GET_WIDGET ("dialog"),
 			  "destroy",
 			  G_CALLBACK (destroy_cb),
 			  data);
 	g_signal_connect_swapped (G_OBJECT (cancel_button),
 				  "clicked",
 				  G_CALLBACK (gtk_widget_destroy),
-				  G_OBJECT (data->dialog));
+				  G_OBJECT (GET_WIDGET ("dialog")));
 	g_signal_connect (G_OBJECT (add_button),
 			  "clicked",
 			  G_CALLBACK (add_clicked_cb),
@@ -583,15 +557,15 @@ dlg_batch_add_files (FrWindow *window,
 			  "clicked",
 			  G_CALLBACK (help_clicked_cb),
 			  data);
-	g_signal_connect (G_OBJECT (data->a_archive_type_combo_box),
+	g_signal_connect (G_OBJECT (data->archive_type_combo_box),
 			  "changed",
 			  G_CALLBACK (archive_type_combo_box_changed_cb),
 			  data);
-	g_signal_connect (G_OBJECT (data->a_password_entry),
+	g_signal_connect (GET_WIDGET ("a_password_entry"),
 			  "changed",
 			  G_CALLBACK (password_entry_changed_cb),
 			  data);
-	g_signal_connect (G_OBJECT (data->a_volume_checkbutton),
+	g_signal_connect (GET_WIDGET ("a_volume_checkbutton"),
 			  "toggled",
 			  G_CALLBACK (volume_toggled_cb),
 			  data);
@@ -602,12 +576,12 @@ dlg_batch_add_files (FrWindow *window,
 	update_archive_type_combo_box_from_ext (data, default_ext);
 	g_free (default_ext);
 
-	gtk_widget_grab_focus (data->a_add_to_entry);
-	gtk_editable_select_region (GTK_EDITABLE (data->a_add_to_entry),
+	gtk_widget_grab_focus (GET_WIDGET ("a_add_to_entry"));
+	gtk_editable_select_region (GTK_EDITABLE (GET_WIDGET ("a_add_to_entry")),
 				    0, -1);
 
 	update_sensitivity (data);
 
-	gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
-	gtk_window_present (GTK_WINDOW (data->dialog));
+	gtk_window_set_modal (GTK_WINDOW (GET_WIDGET ("dialog")), FALSE);
+	gtk_window_present (GTK_WINDOW (GET_WIDGET ("dialog")));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]