[gedit] replace-open-button: set Open Recent menu with Amtk



commit f1a58a70bcb83a95038383faf1d6ef220dfb79fd
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 26 13:44:49 2019 +0100

    replace-open-button: set Open Recent menu with Amtk

 gedit/gedit-window.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 44b4c423f..5f69d29d3 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2643,6 +2643,15 @@ sync_fullscreen_actions (GeditWindow *window,
        g_object_unref (action);
 }
 
+static void
+init_amtk_application_window (GeditWindow *gedit_window)
+{
+       AmtkApplicationWindow *amtk_window;
+
+       amtk_window = amtk_application_window_get_from_gtk_application_window (GTK_APPLICATION_WINDOW 
(gedit_window));
+       amtk_application_window_set_statusbar (amtk_window, GTK_STATUSBAR (gedit_window->priv->statusbar));
+}
+
 static void
 init_open_buttons (GeditWindow *window)
 {
@@ -2650,6 +2659,8 @@ init_open_buttons (GeditWindow *window)
        GtkStyleContext *style_context;
        GtkWidget *open_dialog_button;
        GtkWidget *open_recent_button;
+       AmtkApplicationWindow *amtk_window;
+       GtkWidget *recent_menu;
 
        hgrid = gtk_grid_new ();
        style_context = gtk_widget_get_style_context (hgrid);
@@ -2661,7 +2672,10 @@ init_open_buttons (GeditWindow *window)
 
        open_recent_button = gtk_menu_button_new ();
        gtk_widget_set_tooltip_text (open_recent_button, _("Open a recently used file"));
-       // gtk_menu_button_set_popup(); to set a GtkMenu.
+
+       amtk_window = amtk_application_window_get_from_gtk_application_window (GTK_APPLICATION_WINDOW 
(window));
+       recent_menu = amtk_application_window_create_open_recent_menu (amtk_window);
+       gtk_menu_button_set_popup (GTK_MENU_BUTTON (open_recent_button), recent_menu);
 
        gtk_container_add (GTK_CONTAINER (hgrid), open_dialog_button);
        gtk_container_add (GTK_CONTAINER (hgrid), open_recent_button);
@@ -2701,6 +2715,7 @@ gedit_window_init (GeditWindow *window)
        window->priv->message_bus = gedit_message_bus_new ();
 
        gtk_widget_init_template (GTK_WIDGET (window));
+       init_amtk_application_window (window);
        init_open_buttons (window);
 
        g_action_map_add_action_entries (G_ACTION_MAP (window),


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