From 544dc087601a3de0c5fb42ce45112a3360acb18a Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 19 Aug 2012 15:32:48 +0200 Subject: [PATCH] Introduce a merged NextForward akin to StopReload Fixes: https://bugs.launchpad.net/midori/+bug/823736 --- midori/midori-browser.c | 33 +++++++++++++++++++++++++-------- midori/midori-websettings.c | 2 +- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index f3514302..a74d2c29 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -320,16 +320,11 @@ _midori_browser_update_interface (MidoriBrowser* browser, gboolean loading = midori_view_get_load_status (view) != MIDORI_LOAD_FINISHED; gboolean can_reload = midori_view_can_reload (view); GtkAction* action; - GSList* proxies; _action_set_sensitive (browser, "Reload", can_reload); _action_set_sensitive (browser, "Stop", can_reload && loading); _action_set_sensitive (browser, "Back", midori_view_can_go_back (view)); _action_set_sensitive (browser, "Forward", midori_view_can_go_forward (view)); - proxies = gtk_action_get_proxies (_action_by_name (browser, "Forward")); - for (; proxies != NULL; proxies = g_slist_next (proxies)) - if (GTK_IS_TOOL_ITEM (proxies->data)) - gtk_widget_set_visible (proxies->data, midori_view_can_go_forward (view)); _action_set_sensitive (browser, "Previous", midori_view_get_previous_page (view) != NULL); _action_set_sensitive (browser, "Next", @@ -373,6 +368,23 @@ _midori_browser_update_interface (MidoriBrowser* browser, "tooltip", _("Stop loading the current page"), NULL); } + action = _action_by_name (browser, "NextForward"); + if (midori_view_can_go_forward (view)) + { + g_object_set (action, + "stock-id", GTK_STOCK_GO_FORWARD, + "tooltip", _("Go forward to the next page"), + "sensitive", TRUE, NULL); + } + else + { + g_object_set (action, + "stock-id", GTK_STOCK_MEDIA_NEXT, + "tooltip", _("Go to the next sub-page"), + "sensitive", midori_view_get_next_page (view) != NULL, NULL); + } + + #if HAVE_HILDON #if HILDON_CHECK_VERSION (2, 2, 0) hildon_gtk_window_set_progress_indicator (GTK_WINDOW (browser), loading); @@ -2999,7 +3011,7 @@ midori_browser_get_toolbar_actions (MidoriBrowser* browser) static const gchar* actions[] = { "WindowNew", "TabNew", "Open", "SaveAs", "Print", "Find", "Fullscreen", "Preferences", "Window", "Bookmarks", - "ReloadStop", "ZoomIn", "TabClose", + "ReloadStop", "ZoomIn", "TabClose", "NextForward", "ZoomOut", "Separator", "Back", "Forward", "Homepage", "Panel", "Trash", "Search", "BookmarkAdd", "Previous", "Next", NULL }; @@ -3882,9 +3894,11 @@ _action_navigation_activate (GtkAction* action, return FALSE; view = MIDORI_VIEW (tab); - name = gtk_action_get_name (action); + if (!strcmp (name, "NextForward")) + name = midori_view_can_go_forward (view) ? "Forward" : "Next"; + if (g_str_equal (name, "Back")) { if (middle_click) @@ -5667,7 +5681,7 @@ static const GtkActionEntry entries[] = NULL, "Escape", N_("Stop loading the current page"), G_CALLBACK (_action_reload_stop_activate) }, { "ReloadStop", GTK_STOCK_STOP, - NULL, "r", + NULL, "", N_("Reload the current page"), G_CALLBACK (_action_reload_stop_activate) }, { "ZoomIn", GTK_STOCK_ZOOM_IN, NULL, "plus", @@ -5719,6 +5733,9 @@ static const GtkActionEntry entries[] = NULL, "Right", /* i18n: Visit the following logical page, ie. in a forum or blog */ N_("Go to the next sub-page"), G_CALLBACK (_action_navigation_activate) }, + { "NextForward", GTK_STOCK_MEDIA_NEXT, + NULL, "", + N_("Go to the next sub-page"), G_CALLBACK (_action_navigation_activate) }, { "Homepage", GTK_STOCK_HOME, N_("_Homepage"), "Home", N_("Go to your homepage"), G_CALLBACK (_action_navigation_activate) }, diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index e1768b3c..b9dea7f2 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -547,7 +547,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) "toolbar-items", _("Toolbar Items"), _("The items to show on the toolbar"), - "TabNew,Back,Forward,Next,ReloadStop,BookmarkAdd,Location,Search,Trash,CompactMenu", + "TabNew,Back,NextForward,ReloadStop,BookmarkAdd,Location,Search,Trash,CompactMenu", flags)); g_object_class_install_property (gobject_class, -- 2.39.5