[gedit] Allow enabling auto-indent using the bottom button.



commit bf3d39e5586746fa6888bb2d879207b458494347
Author: Steve Frécinaux <code istique net>
Date:   Tue Feb 11 01:11:48 2014 +0100

    Allow enabling auto-indent using the bottom button.

 gedit/gedit-menu.ui  |    6 ++++++
 gedit/gedit-window.c |    9 +++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-menu.ui b/gedit/gedit-menu.ui
index 7522054..473d5ae 100644
--- a/gedit/gedit-menu.ui
+++ b/gedit/gedit-menu.ui
@@ -281,6 +281,12 @@
   <menu id="tab_width_menu">
     <section>
       <item>
+        <attribute name="label" translatable="yes">Automatic Indentation</attribute>
+        <attribute name="action">win.auto-indent</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
         <attribute name="label">2</attribute>
         <attribute name="action">win.tab-width</attribute>
         <attribute name="target" type="u">2</attribute>
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 79c51ab..0749a2b 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -1190,16 +1190,21 @@ sync_current_tab_actions (GeditWindow *window,
                          GeditView   *old_view,
                          GeditView   *new_view)
 {
-       GPropertyAction *action;
-
        if (old_view)
        {
+               g_action_map_remove_action (G_ACTION_MAP (window), "auto-indent");
                g_action_map_remove_action (G_ACTION_MAP (window), "tab-width");
                g_action_map_remove_action (G_ACTION_MAP (window), "use-spaces");
        }
 
        if (new_view)
        {
+               GPropertyAction *action;
+
+               action = g_property_action_new ("auto-indent", new_view, "auto-indent");
+               g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (action));
+               g_object_unref (action);
+
                action = g_property_action_new ("tab-width", new_view, "tab-width");
                g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (action));
                g_object_unref (action);


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