[gnome-software] Adjust primary button behaviour



commit cf1868e741cc61612ac2e074bfed987888bd62cb
Author: Florian Brosch <flo brosch gmail com>
Date:   Wed Jan 23 16:32:29 2013 +0100

    Adjust primary button behaviour

 src/gnome-software.ui |    6 +++---
 src/gs-main.c         |   18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 0fdbd4a..8787094 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -55,7 +55,7 @@
                           <class name="linked"/>
                         </style>
                         <child>
-                          <object class="GtkButton" id="button_new">
+                          <object class="GtkToggleButton" id="button_new">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
@@ -77,7 +77,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_installed">
+                          <object class="GtkToggleButton" id="button_installed">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
@@ -99,7 +99,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button_updates">
+                          <object class="GtkToggleButton" id="button_updates">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
diff --git a/src/gs-main.c b/src/gs-main.c
index 68a5d5e..3151169 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -69,6 +69,7 @@ typedef struct {
 	EggListBox		*list_box_updates;
 	GtkWidget		*os_update_widget;
 	GtkCssProvider		*provider;
+	gboolean		ignore_primary_buttons;
 } GsMainPrivate;
 
 static void gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode);
@@ -928,6 +929,22 @@ gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode)
 {
 	GtkWidget *widget;
 
+	if (priv->ignore_primary_buttons)
+		return;
+
+	priv->ignore_primary_buttons = TRUE;
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_new"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), mode == GS_MAIN_MODE_NEW);
+
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_installed"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), mode == GS_MAIN_MODE_INSTALLED);
+
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_updates"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), mode == GS_MAIN_MODE_UPDATES);
+	priv->ignore_primary_buttons = FALSE;
+
+	widget = NULL;
+
 	switch (mode) {
 	case GS_MAIN_MODE_NEW:
 		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_all"));
@@ -1306,6 +1323,7 @@ main (int argc, char **argv)
 	g_option_context_free (context);
 
 	priv = g_new0 (GsMainPrivate, 1);
+	priv->ignore_primary_buttons = FALSE;
 
 	/* we want the large icon size according to the width of the window */
 	priv->custom_icon_size = gtk_icon_size_register ("custom",



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