summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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",