[glade/composite-templates-new: 2/6] GladeWindow: Make the Editor Header bar optional in the view menu.



commit b1146ba15263ee5f4bd60446ca98293572f964ae
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Mon Apr 1 19:40:48 2013 +0900

    GladeWindow: Make the Editor Header bar optional in the view menu.
    
    Now the preference is saved in the keyfile.

 src/glade-callbacks.h |    1 +
 src/glade-window.c    |   35 ++++++++++++++++++++++++++++++++---
 src/glade.glade       |   38 ++++++++++++++++++++++++++------------
 3 files changed, 59 insertions(+), 15 deletions(-)
---
diff --git a/src/glade-callbacks.h b/src/glade-callbacks.h
index 18216d8..0962b68 100644
--- a/src/glade-callbacks.h
+++ b/src/glade-callbacks.h
@@ -50,6 +50,7 @@ void on_dock_action_toggled                 (GtkAction *action, GladeWindow *win
 void on_toolbar_visible_action_toggled      (GtkAction *action, GladeWindow *window);
 void on_statusbar_visible_action_toggled    (GtkAction *action, GladeWindow *window);
 void on_project_tabs_visible_action_toggled (GtkAction *action, GladeWindow *window);
+void on_editor_header_action_toggled        (GtkAction *action, GladeWindow *window);
 
 void on_palette_appearance_radioaction_changed (GtkRadioAction *action,
                                                 GtkRadioAction *current,
diff --git a/src/glade-window.c b/src/glade-window.c
index 6fab4f3..b1d3360 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -69,6 +69,7 @@
 #define CONFIG_KEY_SHOW_TOOLBAR     "show-toolbar"
 #define CONFIG_KEY_SHOW_TABS        "show-tabs"
 #define CONFIG_KEY_SHOW_STATUS      "show-statusbar"
+#define CONFIG_KEY_EDITOR_HEADER    "show-editor-header"
 
 #define GLADE_WINDOW_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object),  \
                                          GLADE_TYPE_WINDOW,                      \
@@ -124,7 +125,7 @@ struct _GladeWindowPrivate
       GtkAction *undo, *redo, *cut, *copy, *paste, *delete;
       GtkAction *previous_project, *next_project;
       GtkAction *use_small_icons, *icons_and_labels;
-      GtkAction *toolbar_visible, *project_tabs_visible, *statusbar_visible;
+      GtkAction *toolbar_visible, *project_tabs_visible, *statusbar_visible, *editor_header_visible;
       GtkAction *selector;
     } action;
 
@@ -2042,6 +2043,15 @@ on_project_tabs_visible_action_toggled (GtkAction *action, GladeWindow *window)
 }
 
 void
+on_editor_header_action_toggled (GtkAction *action, GladeWindow *window)
+{
+  if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+    glade_editor_show_class_field (window->priv->editor);
+  else
+    glade_editor_hide_class_field (window->priv->editor);
+}
+
+void
 on_reference_action_activate (GtkAction *action, GladeWindow *window)
 {
   if (glade_util_have_devhelp ())
@@ -2714,6 +2724,9 @@ save_windows_config (GladeWindow *window, GKeyFile *config)
 
   g_key_file_set_boolean (config, CONFIG_GROUP_WINDOWS, CONFIG_KEY_SHOW_TABS,
                           gtk_toggle_action_get_active (GTK_TOGGLE_ACTION 
(priv->action.project_tabs_visible)));
+
+  g_key_file_set_boolean (config, CONFIG_GROUP_WINDOWS, CONFIG_KEY_EDITOR_HEADER,
+                          gtk_toggle_action_get_active (GTK_TOGGLE_ACTION 
(priv->action.editor_header_visible)));
 }
 
 static void
@@ -2862,7 +2875,7 @@ static void
 glade_window_config_load (GladeWindow *window)
 {
   GKeyFile *config = glade_app_get_config ();
-  gboolean show_toolbar, show_tabs, show_status;
+  gboolean show_toolbar, show_tabs, show_status, show_header;
   GladeWindowPrivate *priv = window->priv;
   GError *error = NULL;
 
@@ -2897,6 +2910,15 @@ glade_window_config_load (GladeWindow *window)
       error = (g_error_free (error), NULL);
     }
 
+  if ((show_header =
+       g_key_file_get_boolean (config, CONFIG_GROUP_WINDOWS,
+                               CONFIG_KEY_EDITOR_HEADER, &error)) == FALSE &&
+      error != NULL)
+    {
+      show_header = TRUE;
+      error = (g_error_free (error), NULL);
+    }
+
   if (show_toolbar)
     gtk_widget_show (priv->toolbar);
   else
@@ -2907,12 +2929,19 @@ glade_window_config_load (GladeWindow *window)
   else
     gtk_widget_hide (priv->statusbar);
 
+  if (show_header)
+    glade_editor_show_class_field (priv->editor);
+  else
+    glade_editor_hide_class_field (priv->editor);
+
   gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->action.toolbar_visible), show_toolbar);
 
   gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->action.project_tabs_visible), show_tabs);
 
   gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->action.statusbar_visible), show_status);
 
+  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->action.editor_header_visible), show_header);
+
   /* Paned positions */
   load_paned_position (config, window->priv->left_pane, "left_pane", 200);
   load_paned_position (config, window->priv->center_pane, "center_pane", 400);
@@ -3082,7 +3111,6 @@ glade_window_constructed (GObject *object)
   priv->palettes_notebook = GET_OBJECT (builder, GTK_NOTEBOOK, "palettes_notebook");
   priv->inspectors_notebook = GET_OBJECT (builder, GTK_NOTEBOOK, "inspectors_notebook");
   priv->editor = GET_OBJECT (builder, GLADE_EDITOR, "editor");
-  glade_editor_hide_class_field (priv->editor);
   priv->statusbar = GET_OBJECT (builder, GTK_WIDGET, "statusbar");
   priv->toolbar = GET_OBJECT (builder, GTK_WIDGET, "toolbar");
   priv->search_entry = GET_OBJECT (builder, GTK_ENTRY, "search_entry");
@@ -3127,6 +3155,7 @@ glade_window_constructed (GObject *object)
   priv->action.toolbar_visible = GET_OBJECT (builder, GTK_ACTION, "toolbar_visible_action");
   priv->action.project_tabs_visible = GET_OBJECT (builder, GTK_ACTION, "project_tabs_visible_action");
   priv->action.statusbar_visible = GET_OBJECT (builder, GTK_ACTION, "statusbar_visible_action");
+  priv->action.editor_header_visible = GET_OBJECT (builder, GTK_ACTION, "editor_header_action");
   priv->action.selector = GET_OBJECT (builder, GTK_ACTION, "selector_radioaction");
   
   gtk_container_add (GTK_CONTAINER (window), vbox);
diff --git a/src/glade.glade b/src/glade.glade
index 39f3020..2eb54a6 100644
--- a/src/glade.glade
+++ b/src/glade.glade
@@ -1,12 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires gtk+ 3.8 -->
   <object class="GtkAccelGroup" id="accelgroup"/>
-  <object class="GtkActionGroup" id="project_list_actiongroup">
-    <property name="accel_group">accelgroup</property>
-    <signal name="connect-proxy" handler="on_actiongroup_connect_proxy" swapped="no"/>
-    <signal name="disconnect-proxy" handler="on_actiongroup_disconnect_proxy" swapped="no"/>
-  </object>
   <object class="GtkActionGroup" id="pointer_mode_actiongroup">
     <property name="accel_group">accelgroup</property>
     <child>
@@ -171,6 +166,11 @@
       <accelerator key="Page_Down" modifiers="GDK_CONTROL_MASK"/>
     </child>
   </object>
+  <object class="GtkActionGroup" id="project_list_actiongroup">
+    <property name="accel_group">accelgroup</property>
+    <signal name="connect-proxy" handler="on_actiongroup_connect_proxy" swapped="no"/>
+    <signal name="disconnect-proxy" handler="on_actiongroup_disconnect_proxy" swapped="no"/>
+  </object>
   <object class="GtkActionGroup" id="static_actiongroup">
     <property name="name">static_actiongroup</property>
     <property name="accel_group">accelgroup</property>
@@ -324,6 +324,14 @@
         <property name="group">icons_only_radioaction</property>
       </object>
     </child>
+    <child>
+      <object class="GtkToggleAction" id="editor_header_action">
+        <property name="label" translatable="yes">_Editor Header</property>
+        <property name="tooltip" translatable="yes">Show the header in the property editor</property>
+        <property name="active">True</property>
+        <signal name="toggled" handler="on_editor_header_action_toggled" swapped="no"/>
+      </object>
+    </child>
   </object>
   <object class="GtkAboutDialog" id="about_dialog">
     <property name="can_focus">False</property>
@@ -365,8 +373,8 @@ Sun GNOME Documentation Team &lt;gdocteam sun com&gt;</property>
     <property name="artists">Vincent Geddes &lt;vgeddes gnome org&gt;
 Andreas Nilsson &lt;andreas andreasn se&gt;</property>
     <property name="logo_icon_name">glade</property>
-    <signal name="delete-event" handler="gtk_widget_hide" swapped="no"/>
     <signal name="delete-event" handler="gtk_true" swapped="no"/>
+    <signal name="delete-event" handler="gtk_widget_hide" swapped="no"/>
     <signal name="response" handler="gtk_widget_hide" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox" id="aboutdialog-vbox1">
@@ -639,6 +647,13 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
                   </object>
                 </child>
                 <child>
+                  <object class="GtkCheckMenuItem" id="editor_header_menuitem">
+                    <property name="related_action">editor_header_action</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                </child>
+                <child>
                   <object class="GtkMenuItem" id="imagemenuitem23">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
@@ -676,12 +691,11 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
                           </object>
                         </child>
                         <child>
-                          <object class="GtkImageMenuItem" id="use_small_icons_menuitem">
+                          <object class="GtkCheckMenuItem" id="use_small_icons_menuitem">
                             <property name="related_action">use_small_icons_action</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="use_underline">True</property>
-                            <property name="use_stock">True</property>
                           </object>
                         </child>
                       </object>
@@ -1065,8 +1079,8 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
                     <property name="show_border">False</property>
                     <property name="scrollable">True</property>
                     <signal name="page-added" handler="on_notebook_tab_added" swapped="no"/>
-                    <signal name="switch-page" handler="on_notebook_switch_page" swapped="no"/>
                     <signal name="page-removed" handler="on_notebook_tab_removed" swapped="no"/>
+                    <signal name="switch-page" handler="on_notebook_switch_page" swapped="no"/>
                   </object>
                 </child>
               </object>
@@ -1144,8 +1158,8 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Glade Preferences</property>
     <property name="type_hint">dialog</property>
-    <signal name="delete-event" handler="gtk_widget_hide" swapped="no"/>
     <signal name="delete-event" handler="gtk_true" swapped="no"/>
+    <signal name="delete-event" handler="gtk_widget_hide" swapped="no"/>
     <signal name="response" handler="gtk_widget_hide" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -1315,8 +1329,8 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
     <property name="type_hint">dialog</property>
     <property name="transient_for">preferences_dialog</property>
     <property name="action">select-folder</property>
-    <signal name="delete-event" handler="gtk_widget_hide" swapped="no"/>
     <signal name="delete-event" handler="gtk_true" swapped="no"/>
+    <signal name="delete-event" handler="gtk_widget_hide" swapped="no"/>
     <signal name="response" handler="on_preferences_filechooserdialog_response" 
object="catalog_path_comboboxtext" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox" id="filechooserdialog-vbox1">


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