[Xfce4-commits] <mousepad:master> Select the last saved colour scheme in the menu on application start.

Matthew Brush noreply at xfce.org
Sat May 5 21:31:47 CEST 2012


Updating branch refs/heads/master
         to 81eb018689978502e6a128436ed4cb8ab5de77cf (commit)
       from 6ceb27df8efb7b23acc73c147511721cbea45b20 (commit)

commit 81eb018689978502e6a128436ed4cb8ab5de77cf
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Wed Oct 5 15:59:11 2011 -0700

    Select the last saved colour scheme in the menu on application start.

 mousepad/mousepad-window.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 445ef66..07fddfe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3080,11 +3080,14 @@ mousepad_window_menu_color_schemes (MousepadWindow *window)
   GSList               *group = NULL;
   GList                *schemes, *iter;
   gint                  merge_id;
-  gchar                *name;
+  gchar                *name, *selected_color_scheme;
 
   /* lock menu updates */
   lock_menu_updates++;
 
+  /* get the previously saved colour scheme name */
+  g_object_get (window->preferences, "view-color-scheme", &selected_color_scheme, NULL);
+
   /* get list of schemes */
   schemes = mousepad_util_color_schemes_get_sorted ();
 
@@ -3131,6 +3134,10 @@ mousepad_window_menu_color_schemes (MousepadWindow *window)
       g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (mousepad_window_action_color_scheme), window);
       gtk_action_group_add_action_with_accel (window->action_group, GTK_ACTION (action), "");
 
+      /* activate the radio button if it was the last saved colour scheme */
+      if (g_strcmp0 (gtk_source_style_scheme_get_id (iter->data), selected_color_scheme) == 0)
+          gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+
       /* release the action */
       g_object_unref (G_OBJECT (action));
 


More information about the Xfce4-commits mailing list