[gedit/wip/redesign2: 2/12] Update settings code to the new gaction stuff



commit b35dc28035c4427056812d5d30e78a5b73fcf169
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 4 10:02:29 2014 +0100

    Update settings code to the new gaction stuff

 gedit/gedit-settings.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/gedit/gedit-settings.c b/gedit/gedit-settings.c
index 7191004..287756f 100644
--- a/gedit/gedit-settings.c
+++ b/gedit/gedit-settings.c
@@ -306,8 +306,7 @@ on_syntax_highlighting_changed (GSettings     *settings,
                                const gchar   *key,
                                GeditSettings *gs)
 {
-       const GList *windows;
-       GList *docs, *l;
+       GList *docs, *windows, *l;
        gboolean enable;
 
        enable = g_settings_get_boolean (settings, key);
@@ -316,27 +315,19 @@ on_syntax_highlighting_changed (GSettings     *settings,
 
        for (l = docs; l != NULL; l = g_list_next (l))
        {
-               gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data),
-                                                       enable);
+               gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data), enable);
        }
 
        g_list_free (docs);
 
        /* update the sensitivity of the Higlight Mode menu item */
        windows = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
-       while (windows != NULL)
+       for (l = windows; l != NULL; l = g_list_next (l))
        {
-               GtkUIManager *ui;
-               GtkAction *a;
-
-               ui = gedit_window_get_ui_manager (GEDIT_WINDOW (windows->data));
-
-               a = gtk_ui_manager_get_action (ui,
-                                              "/MenuBar/ViewMenu/ViewHighlightModeMenu");
-
-               gtk_action_set_sensitive (a, enable);
+               GAction *action;
 
-               windows = g_list_next (windows);
+               action = g_action_map_lookup_action (G_ACTION_MAP (l->data), "highlight_mode");
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enable);
        }
 }
 


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