[gedit/wip/redesign2: 13/19] Move setting to show the status bar to the prefs dialog



commit eb5c5c6055c0d31f132a17042b1020aed38241d7
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 4 10:50:12 2014 +0100

    Move setting to show the status bar to the prefs dialog

 gedit/gedit-app.c                 |    5 -----
 gedit/gedit-menu.ui               |    4 ----
 gedit/gedit-preferences-dialog.c  |   11 ++++++++++-
 gedit/gedit-preferences-dialog.ui |   17 +++++++++++++++++
 4 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 34fb787..ad6c6c0 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -475,11 +475,6 @@ gedit_app_startup (GApplication *application)
                                                 app);
 
                action = g_settings_create_action (app->priv->ui_settings,
-                                                  "statusbar-visible");
-               g_action_map_add_action (G_ACTION_MAP (app), action);
-               g_object_unref (action);
-
-               action = g_settings_create_action (app->priv->ui_settings,
                                                   "side-panel-visible");
                g_action_map_add_action (G_ACTION_MAP (app), action);
                g_object_unref (action);
diff --git a/gedit/gedit-menu.ui b/gedit/gedit-menu.ui
index 260dfb1..6520d4a 100644
--- a/gedit/gedit-menu.ui
+++ b/gedit/gedit-menu.ui
@@ -10,10 +10,6 @@
     </section>
     <section>
       <item>
-        <attribute name="label" translatable="yes">_Statusbar</attribute>
-        <attribute name="action">app.statusbar-visible</attribute>
-      </item>
-      <item>
         <attribute name="label" translatable="yes">Side _Panel</attribute>
         <attribute name="action">app.side-panel-visible</attribute>
         <attribute name="accel">F9</attribute>
diff --git a/gedit/gedit-preferences-dialog.c b/gedit/gedit-preferences-dialog.c
index 4c10afd..f4b2a2a 100644
--- a/gedit/gedit-preferences-dialog.c
+++ b/gedit/gedit-preferences-dialog.c
@@ -73,6 +73,7 @@ enum
 struct _GeditPreferencesDialogPrivate
 {
        GSettings       *editor;
+       GSettings       *uisettings; /* unfortunately our settings are split for historical reasons */
 
        GtkWidget       *notebook;
 
@@ -110,6 +111,7 @@ struct _GeditPreferencesDialogPrivate
        GtkWidget       *auto_save_spinbutton;
 
        GtkWidget       *display_line_numbers_checkbutton;
+       GtkWidget       *display_statusbar_checkbutton;
 
        /* Right margin */
        GtkWidget       *right_margin_checkbutton;
@@ -132,6 +134,7 @@ gedit_preferences_dialog_dispose (GObject *object)
        GeditPreferencesDialog *dlg = GEDIT_PREFERENCES_DIALOG (object);
 
        g_clear_object (&dlg->priv->editor);
+       g_clear_object (&dlg->priv->uisettings);
 
        G_OBJECT_CLASS (gedit_preferences_dialog_parent_class)->dispose (object);
 }
@@ -172,6 +175,7 @@ gedit_preferences_dialog_class_init (GeditPreferencesDialogClass *klass)
                                                     "/org/gnome/gedit/ui/gedit-preferences-dialog.ui");
        gtk_widget_class_bind_template_child_private (widget_class, GeditPreferencesDialog, notebook);
        gtk_widget_class_bind_template_child_private (widget_class, GeditPreferencesDialog, 
display_line_numbers_checkbutton);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditPreferencesDialog, 
display_statusbar_checkbutton);
        gtk_widget_class_bind_template_child_private (widget_class, GeditPreferencesDialog, 
right_margin_checkbutton);
        gtk_widget_class_bind_template_child_private (widget_class, GeditPreferencesDialog, 
right_margin_position_grid);
        gtk_widget_class_bind_template_child_private (widget_class, GeditPreferencesDialog, 
right_margin_position_spinbutton);
@@ -332,7 +336,6 @@ setup_view_page (GeditPreferencesDialog *dlg)
                                GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), split_button_state);
                        gtk_toggle_button_set_inconsistent (
                                GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), TRUE);
-
        }
 
        gtk_toggle_button_set_active (
@@ -353,6 +356,11 @@ setup_view_page (GeditPreferencesDialog *dlg)
                         dlg->priv->highlight_current_line_checkbutton,
                         "active",
                         G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+       g_settings_bind (dlg->priv->uisettings,
+                        GEDIT_SETTINGS_STATUSBAR_VISIBLE,
+                        dlg->priv->display_statusbar_checkbutton,
+                        "active",
+                        G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
        g_settings_bind (dlg->priv->editor,
                         GEDIT_SETTINGS_DISPLAY_RIGHT_MARGIN,
                         dlg->priv->right_margin_checkbutton,
@@ -1098,6 +1106,7 @@ gedit_preferences_dialog_init (GeditPreferencesDialog *dlg)
 
        dlg->priv = gedit_preferences_dialog_get_instance_private (dlg);
        dlg->priv->editor = g_settings_new ("org.gnome.gedit.preferences.editor");
+       dlg->priv->uisettings = g_settings_new ("org.gnome.gedit.preferences.ui");
 
        gtk_widget_init_template (GTK_WIDGET (dlg));
 
diff --git a/gedit/gedit-preferences-dialog.ui b/gedit/gedit-preferences-dialog.ui
index 2ec2416..fa87c20 100644
--- a/gedit/gedit-preferences-dialog.ui
+++ b/gedit/gedit-preferences-dialog.ui
@@ -154,6 +154,23 @@
                         <property name="height">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkCheckButton" id="display_statusbar_checkbutton">
+                        <property name="label" translatable="yes">Display _Statusbar</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>


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