[gnome-packagekit] Update the UI in gpk-prefs to reflect the changes in g-s-d



commit cc5120424af57a5b5ff49df9ae166590c0cba107
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jun 29 15:29:01 2012 +0100

    Update the UI in gpk-prefs to reflect the changes in g-s-d

 data/gpk-prefs.ui |  102 ++++++++++++++++++++++++++++-------------------------
 src/gpk-prefs.c   |   51 +++-----------------------
 2 files changed, 60 insertions(+), 93 deletions(-)
---
diff --git a/data/gpk-prefs.ui b/data/gpk-prefs.ui
index 4fc9169..8acae8a 100644
--- a/data/gpk-prefs.ui
+++ b/data/gpk-prefs.ui
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkDialog" id="dialog_prefs">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -21,11 +21,11 @@
             <child>
               <object class="GtkButton" id="button_help">
                 <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -38,10 +38,10 @@
             <child>
               <object class="GtkButton" id="button_check_now">
                 <property name="label" translatable="yes">_Check Now</property>
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -53,10 +53,10 @@
             <child>
               <object class="GtkButton" id="button_close">
                 <property name="label">gtk-close</property>
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -66,6 +66,12 @@
               </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="GtkNotebook" id="notebook_preferences">
@@ -82,12 +88,13 @@
                   <object class="GtkTable" id="table1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="n_rows">3</property>
+                    <property name="n_rows">2</property>
                     <property name="n_columns">2</property>
                     <property name="column_spacing">20</property>
                     <property name="row_spacing">9</property>
                     <child>
                       <object class="GtkComboBoxText" id="combobox_check">
+                        <property name="width_request">200</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="entry_text_column">0</property>
@@ -100,36 +107,6 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkComboBoxText" id="combobox_install">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="entry_text_column">0</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="y_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_install">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">_Automatically download:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">combobox_install</property>
-                      </object>
-                      <packing>
-                        <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="GtkLabel" id="label_check1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -153,8 +130,8 @@
                         <property name="mnemonic_widget">combobox_check</property>
                       </object>
                       <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</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>
@@ -168,8 +145,8 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</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>
@@ -182,14 +159,43 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="checkbutton_mobile_broadband">
-                    <property name="label" translatable="yes">Check for updates when using mobile broadband</property>
+                  <object class="GtkBox" id="box1">
                     <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="xalign">0</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">3</property>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_mobile_broadband">
+                        <property name="label" translatable="yes">Check for updates when using mobile broadband</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_battery_power">
+                        <property name="label" translatable="yes">Check for updates on battery power</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -233,7 +239,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
               </object>
@@ -364,10 +370,10 @@
                 <child>
                   <object class="GtkCheckButton" id="checkbutton_detail">
                     <property name="label" translatable="yes" comments="shows extra -source, -debuginfo, and -devel software sources">_Show debug and development software sources</property>
+                    <property name="use_action_appearance">False</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_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
diff --git a/src/gpk-prefs.c b/src/gpk-prefs.c
index b9ae720..6e9cf6d 100644
--- a/src/gpk-prefs.c
+++ b/src/gpk-prefs.c
@@ -158,20 +158,6 @@ gpk_prefs_upgrade_freq_combo_changed (GtkWidget *widget, GpkPrefsPrivate *priv)
 }
 
 /**
- * gpk_prefs_update_combo_changed:
- **/
-static void
-gpk_prefs_update_combo_changed (GtkWidget *widget, GpkPrefsPrivate *priv)
-{
-	GpkUpdateEnum update;
-
-	update = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
-	if (update == -1)
-		return;
-	g_settings_set_enum (priv->settings_gsd, GSD_SETTINGS_AUTO_UPDATE_TYPE, update);
-}
-
-/**
  * gpk_prefs_update_freq_combo_setup:
  **/
 static void
@@ -247,35 +233,6 @@ gpk_prefs_upgrade_freq_combo_setup (GpkPrefsPrivate *priv)
 }
 
 /**
- * gpk_prefs_auto_update_combo_setup:
- **/
-static void
-gpk_prefs_auto_update_combo_setup (GpkPrefsPrivate *priv)
-{
-	gboolean is_writable;
-	GpkUpdateEnum update;
-	GtkWidget *widget;
-
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "combobox_install"));
-	is_writable = g_settings_is_writable (priv->settings_gsd, GSD_SETTINGS_AUTO_UPDATE_TYPE);
-	update = g_settings_get_enum (priv->settings_gsd, GSD_SETTINGS_AUTO_UPDATE_TYPE);
-
-	/* do we have permission to write? */
-	gtk_widget_set_sensitive (widget, is_writable);
-
-	/* use a simple text model */
-	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), PK_UPDATE_ALL_TEXT);
-	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), PK_UPDATE_SECURITY_TEXT);
-	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), PK_UPDATE_NONE_TEXT);
-	/* we can do this as it's the same order */
-	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), update);
-
-	/* only do this after else we redraw the window */
-	g_signal_connect (G_OBJECT (widget), "changed",
-			  G_CALLBACK (gpk_prefs_update_combo_changed), priv);
-}
-
-/**
  * gpk_prefs_notify_network_state_cb:
  **/
 static void
@@ -850,13 +807,18 @@ gpk_pack_startup_cb (GtkApplication *application, GpkPrefsPrivate *priv)
 		goto out;
 	}
 
-	/* bind the mobile broadband checkbox */
+	/* bind the mobile broadband and battery checkbox */
 	if (priv->settings_gsd != NULL) {
 		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "checkbutton_mobile_broadband"));
 		g_settings_bind (priv->settings_gsd,
 				 GSD_SETTINGS_CONNECTION_USE_MOBILE,
 				 widget, "active",
 				 G_SETTINGS_BIND_DEFAULT);
+		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "checkbutton_battery_power"));
+		g_settings_bind (priv->settings_gsd,
+				 GSD_SETTINGS_UPDATE_BATTERY,
+				 widget, "active",
+				 G_SETTINGS_BIND_DEFAULT);
 	}
 
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_close"));
@@ -873,7 +835,6 @@ gpk_pack_startup_cb (GtkApplication *application, GpkPrefsPrivate *priv)
 	if (priv->settings_gsd != NULL) {
 		gpk_prefs_update_freq_combo_setup (priv);
 		gpk_prefs_upgrade_freq_combo_setup (priv);
-		gpk_prefs_auto_update_combo_setup (priv);
 	} else {
 		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "notebook_preferences"));
 		gtk_notebook_remove_page (GTK_NOTEBOOK (widget), 0);



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