diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-13 02:33:46 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-13 02:33:46 (EDT) |
commit | 45e10b6706a683d7541ed227a306e0336eed2dd6 (patch) | |
tree | 0bc1b6b4d834464ff59260444aa3a68d2a95cee0 | |
parent | 3d395133aeed47b08c6f8baecb71c64b2ffa173d (diff) | |
download | marquee-45e10b6706a683d7541ed227a306e0336eed2dd6.zip marquee-45e10b6706a683d7541ed227a306e0336eed2dd6.tar.gz marquee-45e10b6706a683d7541ed227a306e0336eed2dd6.tar.bz2 |
MqTabChrome: Use MqStopReloadButton
-rw-r--r-- | src/tab-chrome.c | 57 | ||||
-rw-r--r-- | src/tab-chrome.h | 3 |
2 files changed, 4 insertions, 56 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c index faedcfd..aa7ed19 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -28,22 +28,12 @@ #include "tab-chrome.h" #include "tab.h" #include "back-forward-button-box.h" +#include "stop-reload-button.h" #include "uri-entry.h" #include "main-menu.h" #include "find-toolbar.h" static void -stop_reload_clicked_cb(GtkToolButton G_GNUC_UNUSED *toolbutton, - MqTabChrome *chrome) -{ - if (webkit_web_view_is_loading(WEBKIT_WEB_VIEW(chrome->web_view))) { - webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(chrome->web_view)); - } else { - webkit_web_view_reload(WEBKIT_WEB_VIEW(chrome->web_view)); - } -} - -static void home_clicked_cb(GtkToolButton G_GNUC_UNUSED *toolbutton, MqTabChrome *chrome) { @@ -54,37 +44,12 @@ home_clicked_cb(GtkToolButton G_GNUC_UNUSED *toolbutton, mq_web_view_load_uri(chrome->web_view, uri); } -static void -loading_cb(MqWebView *web_view, GParamSpec G_GNUC_UNUSED *paramspec, - MqTabChrome *chrome) -{ - if (webkit_web_view_is_loading(WEBKIT_WEB_VIEW(web_view))) { - gtk_tool_button_set_icon_widget( - GTK_TOOL_BUTTON(chrome->stop_reload_button), - chrome->stop_icon); - gtk_tool_button_set_label( - GTK_TOOL_BUTTON(chrome->stop_reload_button), "Stop"); - gtk_widget_set_tooltip_text( - GTK_WIDGET(chrome->stop_reload_button), - "Stop loading the current page"); - } else { - gtk_tool_button_set_icon_widget( - GTK_TOOL_BUTTON(chrome->stop_reload_button), - chrome->reload_icon); - gtk_tool_button_set_label( - GTK_TOOL_BUTTON(chrome->stop_reload_button), "Reload"); - gtk_widget_set_tooltip_text( - GTK_WIDGET(chrome->stop_reload_button), - "Reload the current page"); - } - gtk_widget_show_all(GTK_WIDGET(chrome->stop_reload_button)); -} - static GtkWidget * navigation_toolbar_new(MqTabChrome *chrome, const gchar *uri) { GtkToolbar *navigation_toolbar; GtkToolItem *back_forward_tool_item; + GtkToolItem *stop_reload_button; GtkToolItem *uri_tool_item; GtkToolItem *home_button; GtkToolItem *menu_button; @@ -97,19 +62,8 @@ navigation_toolbar_new(MqTabChrome *chrome, const gchar *uri) gtk_toolbar_insert(navigation_toolbar, back_forward_tool_item, -1); /* Stop/reload button */ - chrome->stop_icon = gtk_image_new_from_icon_name("process-stop", - GTK_ICON_SIZE_SMALL_TOOLBAR); - g_object_ref_sink(chrome->stop_icon); - chrome->reload_icon = gtk_image_new_from_icon_name("view-refresh", - GTK_ICON_SIZE_SMALL_TOOLBAR); - g_object_ref_sink(chrome->reload_icon); - chrome->stop_reload_button = gtk_tool_button_new(chrome->stop_icon, - "Stop"); - gtk_widget_set_tooltip_text(GTK_WIDGET(chrome->stop_reload_button), - "Stop loading the current page"); - g_signal_connect(chrome->stop_reload_button, "clicked", - G_CALLBACK(stop_reload_clicked_cb), chrome); - gtk_toolbar_insert(navigation_toolbar, chrome->stop_reload_button, -1); + stop_reload_button = mq_stop_reload_button_new(chrome->web_view); + gtk_toolbar_insert(navigation_toolbar, stop_reload_button, -1); /* URI bar */ uri_tool_item = mq_uri_entry_new(chrome->web_view, uri); @@ -131,9 +85,6 @@ navigation_toolbar_new(MqTabChrome *chrome, const gchar *uri) gtk_widget_set_hexpand(GTK_WIDGET(navigation_toolbar), TRUE); - g_signal_connect(chrome->web_view, "notify::is-loading", - G_CALLBACK(loading_cb), chrome); - return GTK_WIDGET(navigation_toolbar); } diff --git a/src/tab-chrome.h b/src/tab-chrome.h index e8293ea..fdff7bd 100644 --- a/src/tab-chrome.h +++ b/src/tab-chrome.h @@ -35,9 +35,6 @@ struct MqTabChrome { MqConfig *config; MqTab *tab; GtkWidget *container; - GtkWidget *stop_icon; - GtkWidget *reload_icon; - GtkToolItem *stop_reload_button; MqFindToolbar *find_toolbar; MqWebView *web_view; }; |