[Xfce4-commits] [apps/xfce4-taskmanager] 01/01: Fix the refresh rate menu

noreply at xfce.org noreply at xfce.org
Sat Nov 29 11:11:47 CET 2014


This is an automated email from the git hooks/post-receive script.

landry pushed a commit to branch master
in repository apps/xfce4-taskmanager.

commit 18311141d06effaf849a49b664f76b0b789c845a
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Wed Nov 12 00:19:41 2014 +0000

    Fix the refresh rate menu
    
    1. Make all of the items into radio items, not just the one for
       the current refresh rate.
    
    2. Add all the items into a group, so that only one can be checked.
    
    3. Only fire the signal handler when the item is activated, not
       when it is deactivated.
---
 src/settings-tool-button.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/settings-tool-button.c b/src/settings-tool-button.c
index a44b7d4..468185f 100644
--- a/src/settings-tool-button.c
+++ b/src/settings-tool-button.c
@@ -73,8 +73,11 @@ show_settings_dialog (XtmSettingsToolButton *button)
 static void
 refresh_rate_toggled (GtkCheckMenuItem *mi, XtmSettings *settings)
 {
-	guint refresh_rate = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (mi), "refresh-rate"));
-	g_object_set (settings, "refresh-rate", refresh_rate, NULL);
+	if(mi->active)
+	{
+		guint refresh_rate = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (mi), "refresh-rate"));
+		g_object_set (settings, "refresh-rate", refresh_rate, NULL);
+	}
 }
 
 static void
@@ -82,18 +85,16 @@ menu_refresh_rate_append_item (GtkMenu *menu, gchar *title, guint refresh_rate,
 {
 	GtkWidget *mi;
 	guint cur_refresh_rate;
+	static GSList *group = NULL;
 
 	g_object_get (settings, "refresh-rate", &cur_refresh_rate, NULL);
 
+	mi = gtk_radio_menu_item_new_with_label (group, title);
+	group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (mi));
 	if (cur_refresh_rate == refresh_rate)
 	{
-		mi = gtk_radio_menu_item_new_with_label (NULL, title);
 		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), TRUE);
 	}
-	else
-	{
-		mi = gtk_menu_item_new_with_label (title);
-	}
 	gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
 	g_object_set_data (G_OBJECT (mi), "refresh-rate", GUINT_TO_POINTER (refresh_rate));
 	g_signal_connect (mi, "activate", G_CALLBACK (refresh_rate_toggled), settings);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list