From 99f93aa8c094622c67927a6f89d824e37056bb7f Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 03 Oct 2018 23:59:25 -0400 Subject: MqTabLabel: Add rename tab button to popover Also rearrange the button grid. --- diff --git a/src/tab-label.c b/src/tab-label.c index 9d91d6c..0448c52 100644 --- a/src/tab-label.c +++ b/src/tab-label.c @@ -241,13 +241,6 @@ create_name_popover(MqTabLabel *tab_label) } static void -reload_tab_clicked_cb(GtkWidget G_GNUC_UNUSED *button, MqTabLabel *tab_label) -{ - webkit_web_view_reload(tab_label->web_view); - gtk_widget_hide(tab_label->popover); -} - -static void duplicate_clicked_cb(GtkWidget G_GNUC_UNUSED *button, G_GNUC_UNUSED MqTabLabel *tab_label) { @@ -272,6 +265,20 @@ close_clicked_cb(GtkWidget G_GNUC_UNUSED *button, MqTabLabel *tab_label) } static void +rename_tab_clicked_cb(GtkWidget G_GNUC_UNUSED *button, MqTabLabel *tab_label) +{ + gtk_widget_hide(tab_label->popover); + create_name_popover(tab_label); +} + +static void +reload_tab_clicked_cb(GtkWidget G_GNUC_UNUSED *button, MqTabLabel *tab_label) +{ + webkit_web_view_reload(tab_label->web_view); + gtk_widget_hide(tab_label->popover); +} + +static void new_tab_clicked_cb(GtkWidget G_GNUC_UNUSED *button, MqTabLabel *tab_label) { mq_notebook_insert_sibling( @@ -297,8 +304,8 @@ undo_close_clicked_cb(GtkWidget G_GNUC_UNUSED *button, /* TODO */ } -#define BUTTON_ROWS 2 -#define BUTTON_COLS 4 +#define BUTTON_ROWS 3 +#define BUTTON_COLS 3 #define BTN(Y, X) buttons[Y * BUTTON_COLS + X] #define NEW_BTN(Y, X, ID, ICON, TOOLTIP) \ G_STMT_START { \ @@ -323,20 +330,21 @@ create_tab_popover(GtkWidget *widget, MqTabLabel *tab_label) /* Set up buttons. */ /* Y,X,ID, ICON, TOOLTIP */ - NEW_BTN(0,0,reload_tab, "view-refresh", _("Reload tab")); - NEW_BTN(0,1,duplicate, "edit-copy", _("Duplicate tab")); - NEW_BTN(0,2,move_to_win,"window-new", _("Move tab to new window")); - NEW_BTN(0,3,close, "window-close", _("Close tab")); - NEW_BTN(1,0,new_tab, "tab-new-symbolic",_("New tab")); - NEW_BTN(1,1,new_window, "window-new", _("New window")); - NEW_BTN(1,2,undo_close, "edit-undo", _("Undo close tab")); + NEW_BTN(0,0,duplicate, "edit-copy", _("Duplicate tab")); + NEW_BTN(0,1,move_to_win,"window-new", _("Move tab to new window")); + NEW_BTN(0,2,close, "window-close", _("Close tab")); + NEW_BTN(1,0,reload_tab, "view-refresh", _("Reload tab")); + NEW_BTN(1,1,rename_tab, "insert-text", _("Rename tab")); + NEW_BTN(2,0,new_tab, "tab-new-symbolic",_("New tab")); + NEW_BTN(2,1,new_window, "window-new", _("New window")); + NEW_BTN(2,2,undo_close, "edit-undo", _("Undo close tab")); /* TODO: Duplicate tab */ - gtk_widget_set_sensitive(BTN(0, 1), FALSE); + gtk_widget_set_sensitive(BTN(0, 0), FALSE); /* TODO: Move tab to new window */ - gtk_widget_set_sensitive(BTN(0, 2), FALSE); + gtk_widget_set_sensitive(BTN(0, 1), FALSE); /* TODO: Undo close tab */ - gtk_widget_set_sensitive(BTN(1, 2), FALSE); + gtk_widget_set_sensitive(BTN(2, 2), FALSE); /* Set up the popover. */ tab_label->popover = gtk_popover_new(widget); -- cgit v0.9.1