[gedit] Remove gedit-open-menu-button



commit b6a692f907517503ef3be2f694f13149625398b4
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Mar 15 19:59:48 2014 +0100

    Remove gedit-open-menu-button
    
    It is a pretty much empty class and we can do everything from the ui
    file.

 gedit/Makefile.am              |    2 -
 gedit/gedit-open-menu-button.c |  158 ----------------------------------------
 gedit/gedit-open-menu-button.h |   57 --------------
 gedit/gedit-window-private.h   |    6 +-
 gedit/gedit-window.c           |   42 ++++-------
 gedit/gedit-window.ui          |   29 +++++++-
 6 files changed, 43 insertions(+), 251 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 997e254..74da2ee 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -125,7 +125,6 @@ gedit_NOINST_H_FILES =                              \
        gedit/gedit-multi-notebook.h            \
        gedit/gedit-notebook.h                  \
        gedit/gedit-notebook-popup-menu.h       \
-       gedit/gedit-open-menu-button.h          \
        gedit/gedit-plugins-engine.h            \
        gedit/gedit-preferences-dialog.h        \
        gedit/gedit-print-job.h                 \
@@ -204,7 +203,6 @@ gedit_libgedit_c_files =                    \
        gedit/gedit-multi-notebook.c            \
        gedit/gedit-notebook.c                  \
        gedit/gedit-notebook-popup-menu.c       \
-       gedit/gedit-open-menu-button.c          \
        gedit/gedit-plugins-engine.c            \
        gedit/gedit-preferences-dialog.c        \
        gedit/gedit-print-job.c                 \
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 0f169c0..84abee6 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -59,7 +59,7 @@ struct _GeditWindowPrivate
        GtkWidget      *fullscreen_controls;
        GtkWidget      *fullscreen_eventbox;
        GtkWidget      *fullscreen_headerbar;
-       GtkWidget      *fullscreen_open_menu;
+       GtkWidget      *fullscreen_recent_menu;
        GtkMenuButton  *fullscreen_gear_button;
        gboolean        fullscreen_controls_setup;
 
@@ -80,11 +80,9 @@ struct _GeditWindowPrivate
        GtkWidget      *side_headerbar;
        GtkWidget      *headerbar;
        GtkWidget      *open_button;
-       GtkWidget      *open_menu;
+       GtkWidget      *recent_menu;
        GtkMenuButton  *gear_button;
 
-       /* recent files */
-
        gint            num_tabs_with_error;
 
        gint            width;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 5701ca6..998b13d 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -41,7 +41,6 @@
 #include "gedit-utils.h"
 #include "gedit-commands.h"
 #include "gedit-debug.h"
-#include "gedit-open-menu-button.h"
 #include "gedit-documents-panel.h"
 #include "gedit-plugins-engine.h"
 #include "gedit-window-activatable.h"
@@ -405,7 +404,7 @@ gedit_window_class_init (GeditWindowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, titlebar_paned);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_headerbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, headerbar);
-       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, open_menu);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, recent_menu);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_button);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, hpaned);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_panel);
@@ -417,7 +416,7 @@ gedit_window_class_init (GeditWindowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_controls);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_eventbox);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_headerbar);
-       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_open_menu);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_recent_menu);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_gear_button);
 }
 
@@ -789,25 +788,6 @@ recent_chooser_item_activated (GtkRecentChooser *chooser,
 }
 
 static void
-setup_headerbar_open_button (GeditWindow *window)
-{
-       GtkMenu *recent_menu;
-
-       g_settings_bind (window->priv->ui_settings,
-                        GEDIT_SETTINGS_MAX_RECENTS,
-                        window->priv->open_menu,
-                        "limit",
-                        G_SETTINGS_BIND_GET);
-
-       recent_menu = gtk_menu_button_get_popup (GTK_MENU_BUTTON (window->priv->open_menu));
-
-       g_signal_connect (recent_menu,
-                         "item-activated",
-                         G_CALLBACK (recent_chooser_item_activated),
-                         window);
-}
-
-static void
 on_language_selector_shown (GeditHighlightModeSelector *sel,
                             GeditWindow                *window)
 {
@@ -1792,20 +1772,17 @@ static void
 fullscreen_controls_setup (GeditWindow *window)
 {
        GeditWindowPrivate *priv = window->priv;
-       GtkMenu *recent_menu;
 
        if (priv->fullscreen_controls_setup)
                return;
 
        g_settings_bind (window->priv->ui_settings,
                         GEDIT_SETTINGS_MAX_RECENTS,
-                        window->priv->fullscreen_open_menu,
+                        window->priv->fullscreen_recent_menu,
                         "limit",
                         G_SETTINGS_BIND_GET);
 
-       recent_menu = gtk_menu_button_get_popup (GTK_MENU_BUTTON (window->priv->fullscreen_open_menu));
-
-       g_signal_connect (recent_menu,
+       g_signal_connect (window->priv->fullscreen_recent_menu,
                          "item-activated",
                          G_CALLBACK (recent_chooser_item_activated),
                          window);
@@ -2854,7 +2831,16 @@ gedit_window_init (GeditWindow *window)
                                "position",
                                G_BINDING_DEFAULT | G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
 
-       setup_headerbar_open_button (window);
+       g_settings_bind (window->priv->ui_settings,
+                        GEDIT_SETTINGS_MAX_RECENTS,
+                        window->priv->recent_menu,
+                        "limit",
+                        G_SETTINGS_BIND_GET);
+
+       g_signal_connect (window->priv->recent_menu,
+                         "item-activated",
+                         G_CALLBACK (recent_chooser_item_activated),
+                         window);
 
        gear_menu = _gedit_app_get_window_menu (GEDIT_APP (g_application_get_default ())),
        gtk_menu_button_set_menu_model (window->priv->gear_button, gear_menu);
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index 71906cc..e6b6842 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -53,9 +53,10 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GeditOpenMenuButton" id="open_menu">
+                  <object class="GtkMenuButton" id="open_menu">
                     <property name="visible">True</property>
                     <property name="tooltip_text" translatable="yes">Open a recently used file</property>
+                    <property name="popup">recent_menu</property>
                     <style>
                       <class name="image-button"/>
                     </style>
@@ -341,12 +342,19 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GeditOpenMenuButton" id="fullscreen_open_menu">
+                          <object class="GtkMenuButton" id="fullscreen_open_menu">
                             <property name="visible">True</property>
                             <property name="tooltip_text" translatable="yes">Open a recently used 
file</property>
+                            <property name="popup">fullscreen_recent_menu</property>
                             <style>
                               <class name="image-button"/>
                             </style>
+                            <child internal-child="accessible">
+                              <object class="AtkObject" id="fullscreen_open_menu_a11y">
+                                <property name="accessible-name" translatable="yes">Recent files</property>
+                                <property name="accessible-description" translatable="yes">Open a recently 
used file</property>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
@@ -452,5 +460,22 @@
       <widget name="side_panel"/>
     </widgets>
   </object>
+  <object class="GtkRecentFilter" id="recent_filter">
+    <applications>
+      <application>gedit</application>
+    </applications>
+  </object>
+  <object class="GtkRecentChooserMenu" id="recent_menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="filter">recent_filter</property>
+    <property name="limit">10</property>
+  </object>
+  <object class="GtkRecentChooserMenu" id="fullscreen_recent_menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="filter">recent_filter</property>
+    <property name="limit">10</property>
+  </object>
 </interface>
 


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