[glade/modern-ui: 12/34] GladeWindow: remove unused view actions



commit b0ffaabcb71c43987314a2661d323d5cad099452
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Sun Jun 11 17:22:46 2017 -0300

    GladeWindow: remove unused view actions

 src/glade-window.c |  147 +--------------------------------------------------
 src/glade.glade    |   38 -------------
 2 files changed, 3 insertions(+), 182 deletions(-)
---
diff --git a/src/glade-window.c b/src/glade-window.c
index 4718a56..27d7320 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -65,10 +65,6 @@
 #define CONFIG_KEY_WIDTH            "width"
 #define CONFIG_KEY_HEIGHT           "height"
 #define CONFIG_KEY_MAXIMIZED        "maximized"
-#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 CONFIG_GROUP_LOAD_SAVE      "Load and Save"
 #define CONFIG_KEY_BACKUP           "backup"
@@ -101,13 +97,11 @@ struct _GladeWindowPrivate
   GtkAction *save_action, *quit_action;
   GtkAction *undo_action, *redo_action, *cut_action, *copy_action, *paste_action, *delete_action;
   GtkAction *previous_project_action, *next_project_action;
-  GtkAction *toolbar_visible_action, *project_tabs_visible_action, *statusbar_visible_action, 
*editor_header_visible_action;
   GtkAction *selector_radioaction;
 
   GtkActionGroup *project_actiongroup;      /* All the project actions */
   GtkActionGroup *pointer_mode_actiongroup;
   GtkActionGroup *static_actiongroup;
-  GtkActionGroup *view_actiongroup;
   
   GtkRecentManager *recent_manager;
   GtkWidget *recent_menu;
@@ -1431,22 +1425,12 @@ confirm_close_project (GladeWindow *window, GladeProject *project)
 }
 
 static void
-glade_window_notebook_set_show_tabs (GladeWindow *window, gboolean show)
+glade_window_notebook_tabs_update (GladeWindow *window)
 {
-  GladeWindowPrivate *priv = window->priv;
   GList *projects = glade_app_get_projects ();
-    
-  if (projects == NULL || g_list_next (projects) == NULL)
-    show = FALSE;
 
-  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), show);
-}
-
-static void
-glade_window_notebook_tabs_update (GladeWindow *window)
-{
-  GtkToggleAction *tabs = GTK_TOGGLE_ACTION (window->priv->project_tabs_visible_action);
-  glade_window_notebook_set_show_tabs (window, gtk_toggle_action_get_active (tabs));
+  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook),
+                              !(projects == NULL || g_list_next (projects) == NULL));
 }
 
 static void
@@ -1787,42 +1771,6 @@ on_open_recent_action_item_activated (GtkRecentChooser *chooser,
 }
 
 static void
-on_toolbar_visible_action_toggled (GtkAction *action, GladeWindow *window)
-{
-  if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
-    gtk_widget_show (window->priv->toolbar);
-  else
-    gtk_widget_hide (window->priv->toolbar);
-}
-
-static void
-on_statusbar_visible_action_toggled (GtkAction *action, GladeWindow *window)
-{
-  if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
-    gtk_widget_show (window->priv->statusbar);
-  else
-    gtk_widget_hide (window->priv->statusbar);
-}
-
-static void
-on_project_tabs_visible_action_toggled (GtkAction *action, GladeWindow *window)
-{
-  if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
-    glade_window_notebook_set_show_tabs (window, TRUE);
-  else
-    glade_window_notebook_set_show_tabs (window, FALSE);
-}
-
-static void
-on_editor_header_visible_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);
-}
-
-static void
 on_reference_action_activate (GtkAction *action, GladeWindow *window)
 {
   if (glade_util_have_devhelp ())
@@ -2462,22 +2410,6 @@ save_windows_config (GladeWindow *window, GKeyFile *config)
   maximized = gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_MAXIMIZED;
 
   key_file_set_window_position (config, &priv->position, "main", maximized);
-
-  g_key_file_set_boolean (config,
-                          CONFIG_GROUP_WINDOWS,
-                          CONFIG_KEY_SHOW_TOOLBAR,
-                          gtk_widget_get_visible (priv->toolbar));
-
-  g_key_file_set_boolean (config,
-                          CONFIG_GROUP_WINDOWS,
-                          CONFIG_KEY_SHOW_STATUS,
-                          gtk_widget_get_visible (priv->statusbar));
-
-  g_key_file_set_boolean (config, CONFIG_GROUP_WINDOWS, CONFIG_KEY_SHOW_TABS,
-                          gtk_toggle_action_get_active (GTK_TOGGLE_ACTION 
(priv->project_tabs_visible_action)));
-
-  g_key_file_set_boolean (config, CONFIG_GROUP_WINDOWS, CONFIG_KEY_EDITOR_HEADER,
-                          gtk_toggle_action_get_active (GTK_TOGGLE_ACTION 
(priv->editor_header_visible_action)));
 }
 
 static void
@@ -2611,73 +2543,10 @@ static void
 glade_window_config_load (GladeWindow *window)
 {
   GKeyFile *config = glade_app_get_config ();
-  gboolean show_toolbar, show_tabs, show_status, show_header;
-  GladeWindowPrivate *priv = window->priv;
-  GError *error = NULL;
 
   /* Initial main dimensions */
   glade_window_set_initial_size (window, config);
 
-  /* toolbar and tabs */
-  if ((show_toolbar =
-       g_key_file_get_boolean (config, CONFIG_GROUP_WINDOWS,
-                               CONFIG_KEY_SHOW_TOOLBAR, &error)) == FALSE &&
-      error != NULL)
-    {
-      show_toolbar = TRUE;
-      error = (g_error_free (error), NULL);
-    }
-
-  if ((show_tabs =
-       g_key_file_get_boolean (config, CONFIG_GROUP_WINDOWS,
-                               CONFIG_KEY_SHOW_TABS, &error)) == FALSE &&
-      error != NULL)
-    {
-      show_tabs = TRUE;
-      error = (g_error_free (error), NULL);
-    }
-
-  if ((show_status =
-       g_key_file_get_boolean (config, CONFIG_GROUP_WINDOWS,
-                               CONFIG_KEY_SHOW_STATUS, &error)) == FALSE &&
-      error != NULL)
-    {
-      show_status = TRUE;
-      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
-    gtk_widget_hide (priv->toolbar);
-
-  if (show_status)
-    gtk_widget_show (priv->statusbar);
-  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->toolbar_visible_action), show_toolbar);
-
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->project_tabs_visible_action), show_tabs);
-
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->statusbar_visible_action), show_status);
-
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->editor_header_visible_action), show_header);
-
   /* Paned positions */
   load_paned_position (config, window->priv->left_paned, "left_pane", 200);
   load_paned_position (config, window->priv->center_paned, "center_pane", 400);
@@ -2766,7 +2635,6 @@ glade_window_constructed (GObject *object)
   action_group_setup_callbacks (priv->project_actiongroup, priv->accelgroup, window);
   action_group_setup_callbacks (priv->pointer_mode_actiongroup, priv->accelgroup, window);
   action_group_setup_callbacks (priv->static_actiongroup, priv->accelgroup, window);
-  action_group_setup_callbacks (priv->view_actiongroup, priv->accelgroup, window);
 
   /* status bar */
   priv->statusbar_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (priv->statusbar), "general");
@@ -2909,7 +2777,6 @@ glade_window_class_init (GladeWindowClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, project_actiongroup);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, pointer_mode_actiongroup);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, static_actiongroup);
-  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, view_actiongroup);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, quit_menuitem);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, properties_menuitem);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, about_menuitem);
@@ -2925,10 +2792,6 @@ glade_window_class_init (GladeWindowClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, delete_action);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, previous_project_action);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, next_project_action);
-  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, toolbar_visible_action);
-  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, project_tabs_visible_action);
-  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, statusbar_visible_action);
-  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, editor_header_visible_action);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, selector_radioaction);
 
   /* Callbacks */
@@ -2950,10 +2813,6 @@ glade_window_class_init (GladeWindowClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, on_registration_action_activate);
 
   gtk_widget_class_bind_template_callback (widget_class, on_open_recent_action_item_activated);
-  gtk_widget_class_bind_template_callback (widget_class, on_toolbar_visible_action_toggled);
-  gtk_widget_class_bind_template_callback (widget_class, on_statusbar_visible_action_toggled);
-  gtk_widget_class_bind_template_callback (widget_class, on_project_tabs_visible_action_toggled);
-  gtk_widget_class_bind_template_callback (widget_class, on_editor_header_visible_action_toggled);
   gtk_widget_class_bind_template_callback (widget_class, on_selector_radioaction_changed);
   gtk_widget_class_bind_template_callback (widget_class, on_actiongroup_connect_proxy);
   gtk_widget_class_bind_template_callback (widget_class, on_actiongroup_disconnect_proxy);
diff --git a/src/glade.glade b/src/glade.glade
index 4e04619..ad74610 100644
--- a/src/glade.glade
+++ b/src/glade.glade
@@ -259,44 +259,6 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
       <accelerator key="Page_Down" modifiers="GDK_CONTROL_MASK"/>
     </child>
   </object>
-  <object class="GtkActionGroup" id="view_actiongroup">
-    <property name="name">view_actiongroup</property>
-    <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"/>
-    <child>
-      <object class="GtkToggleAction" id="statusbar_visible_action">
-        <property name="label" translatable="yes">_Statusbar</property>
-        <property name="tooltip" translatable="yes">Show the statusbar</property>
-        <property name="active">True</property>
-        <signal name="toggled" handler="on_statusbar_visible_action_toggled" swapped="no"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkToggleAction" id="toolbar_visible_action">
-        <property name="label" translatable="yes">Tool_bar</property>
-        <property name="tooltip" translatable="yes">Show the toolbar</property>
-        <property name="active">True</property>
-        <signal name="toggled" handler="on_toolbar_visible_action_toggled" swapped="no"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkToggleAction" id="project_tabs_visible_action">
-        <property name="label" translatable="yes">Project _Tabs</property>
-        <property name="tooltip" translatable="yes">Show notebook tabs for loaded projects</property>
-        <property name="active">True</property>
-        <signal name="toggled" handler="on_project_tabs_visible_action_toggled" swapped="no"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkToggleAction" id="editor_header_visible_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_visible_action_toggled" swapped="no"/>
-      </object>
-    </child>
-  </object>
   <object class="GtkRecentFilter" id="recentfilter">
     <mime-types>
       <mime-type>application/x-glade</mime-type>


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