[gedit] replace-open-button: re-create simple Open Recent menu button (UI)
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] replace-open-button: re-create simple Open Recent menu button (UI)
- Date: Wed, 27 Nov 2019 14:25:09 +0000 (UTC)
commit 1ee984a4147931e2f7d76837eecdef8c5ddfdd97
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Nov 26 10:58:01 2019 +0100
replace-open-button: re-create simple Open Recent menu button (UI)
Just the UI as a first step.
gedit/gedit-window.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 6f91fdb90..44b4c423f 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2644,19 +2644,32 @@ sync_fullscreen_actions (GeditWindow *window,
}
static void
-init_open_button (GeditWindow *window)
+init_open_buttons (GeditWindow *window)
{
- GtkWidget *open_button;
+ GtkWidget *hgrid;
+ GtkStyleContext *style_context;
+ GtkWidget *open_dialog_button;
+ GtkWidget *open_recent_button;
- open_button = gtk_button_new_with_mnemonic (_("_Open"));
- gtk_widget_set_tooltip_text (open_button, _("Open a file"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (open_button), "win.open");
- gtk_widget_show (open_button);
+ hgrid = gtk_grid_new ();
+ style_context = gtk_widget_get_style_context (hgrid);
+ gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_LINKED);
+
+ open_dialog_button = gtk_button_new_with_mnemonic (_("_Open"));
+ gtk_widget_set_tooltip_text (open_dialog_button, _("Open a file"));
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (open_dialog_button), "win.open");
+
+ 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.
+
+ gtk_container_add (GTK_CONTAINER (hgrid), open_dialog_button);
+ gtk_container_add (GTK_CONTAINER (hgrid), open_recent_button);
+ gtk_widget_show_all (hgrid);
- /* Add before the New Tab button. */
gtk_container_add_with_properties (GTK_CONTAINER (window->priv->headerbar),
- open_button,
- "position", 0,
+ hgrid,
+ "position", 0, /* The first on the left. */
NULL);
}
@@ -2688,7 +2701,7 @@ gedit_window_init (GeditWindow *window)
window->priv->message_bus = gedit_message_bus_new ();
gtk_widget_init_template (GTK_WIDGET (window));
- init_open_button (window);
+ init_open_buttons (window);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]