summaryrefslogtreecommitdiffstats
path: root/src/tab-chrome.c
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-08 03:57:10 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-08 03:57:10 (EDT)
commit927c4ea37ca967e61831164bb4b7ea33e28e0d9d (patch)
treef67399f4aa945e827863dcc6de4b4062de928a8b /src/tab-chrome.c
parent66b94a7112f6379b0e30ad7a8917ab146e374a20 (diff)
downloadmarquee-927c4ea37ca967e61831164bb4b7ea33e28e0d9d.zip
marquee-927c4ea37ca967e61831164bb4b7ea33e28e0d9d.tar.gz
marquee-927c4ea37ca967e61831164bb4b7ea33e28e0d9d.tar.bz2
MqTabChrome: Add a home button to the navigation bar
Diffstat (limited to 'src/tab-chrome.c')
-rw-r--r--src/tab-chrome.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 39efff7..3a57f4b 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -312,6 +312,24 @@ uri_activate_cb(GtkEntry *entry, MqTabChrome *chrome)
}
static void
+home_clicked_cb(GtkToolButton G_GNUC_UNUSED *toolbutton,
+ MqTabChrome *chrome)
+{
+ const gchar *uri;
+ gchar *rw_uri;
+
+ uri = mq_config_get_string(chrome->config, "tabs.home");
+
+ if (g_str_has_prefix(uri, "about:")) {
+ rw_uri = g_strconcat("mq-about:", uri + strlen("about:"), NULL);
+ webkit_web_view_load_uri(chrome->web_view, rw_uri);
+ g_free(rw_uri);
+ } else {
+ webkit_web_view_load_uri(chrome->web_view, uri);
+ }
+}
+
+static void
zoom_out_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqTabChrome *chrome)
{
webkit_web_view_set_zoom_level(chrome->web_view,
@@ -463,6 +481,7 @@ navigation_toolbar_new(MqTabChrome *chrome, const gchar *uri)
GtkToolItem *back_forward_tool_item;
GtkWidget *back_forward_event_box;
GtkToolItem *uri_tool_item;
+ GtkToolItem *home_button;
navigation_toolbar = GTK_TOOLBAR(gtk_toolbar_new());
@@ -539,6 +558,15 @@ navigation_toolbar_new(MqTabChrome *chrome, const gchar *uri)
pango_attr_list_insert(chrome->hovered_link_style,
pango_attr_style_new(PANGO_STYLE_ITALIC));
+ /* Home button */
+ home_button = gtk_tool_button_new(gtk_image_new_from_icon_name(
+ "go-home", GTK_ICON_SIZE_SMALL_TOOLBAR), "Home");
+ gtk_widget_set_tooltip_text(GTK_WIDGET(home_button),
+ "Load the home page");
+ g_signal_connect(home_button, "clicked",
+ G_CALLBACK(home_clicked_cb), chrome);
+ gtk_toolbar_insert(navigation_toolbar, home_button, -1);
+
/* Menu button */
chrome->menu_button = gtk_tool_button_new(
gtk_image_new_from_icon_name("open-menu-symbolic",