[epiphany] Add "Reload All Tabs" options to tab menu



commit 8ddaeb36a2d48f9ca6e520a1bf779132990b75c6
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Wed Dec 19 11:00:27 2018 +0100

    Add "Reload All Tabs" options to tab menu
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/118

 src/ephy-window.c                          |  5 +++++
 src/resources/gtk/notebook-context-menu.ui |  6 +++++-
 src/window-commands.c                      | 22 ++++++++++++++++++++++
 src/window-commands.h                      |  3 +++
 4 files changed, 35 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0dcc2654b..5afd29876 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -821,6 +821,7 @@ static const GActionEntry tab_entries [] = {
   { "close-others", window_cmd_tabs_close_others },
   { "reload", window_cmd_tabs_reload },
   { "reopen", window_cmd_tabs_reopen_closed_tab },
+  { "reload-all", window_cmd_tabs_reload_all_tabs },
 };
 
 static const GActionEntry toolbar_entries [] = {
@@ -2471,6 +2472,10 @@ show_notebook_popup_menu (GtkNotebook    *notebook,
                                          "close-others");
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action), n_pages > 1);
 
+    action = g_action_map_lookup_action (G_ACTION_MAP (action_group),
+                                         "reload-all");
+    g_simple_action_set_enabled (G_SIMPLE_ACTION (action), n_pages > 1);
+
     gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *)event);
   } else {
     tab = GTK_WIDGET (window->active_embed);
diff --git a/src/resources/gtk/notebook-context-menu.ui b/src/resources/gtk/notebook-context-menu.ui
index aaaf8c878..7990fa491 100644
--- a/src/resources/gtk/notebook-context-menu.ui
+++ b/src/resources/gtk/notebook-context-menu.ui
@@ -8,7 +8,11 @@
         <attribute name="action">tab.reload</attribute>
       </item>
       <item>
-        <attribute name="label" translatable="yes">Du_plicate</attribute>
+        <attribute name="label" translatable="yes">Reload _All Tabs</attribute>
+        <attribute name="action">tab.reload-all</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Duplicate</attribute>
         <attribute name="action">tab.duplicate</attribute>
       </item>
       <item>
diff --git a/src/window-commands.c b/src/window-commands.c
index 4ca50374c..3b844913e 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -2461,6 +2461,28 @@ window_cmd_tabs_reload (GSimpleAction *action,
   webkit_web_view_reload (view);
 }
 
+void
+window_cmd_tabs_reload_all_tabs (GSimpleAction *action,
+                                 GVariant      *parameter,
+                                 gpointer       user_data)
+{
+  EphyWindow *window = user_data;
+  EphyEmbed *embed;
+  WebKitWebView *view;
+  GtkWidget *notebook;
+  int n_pages;
+
+  notebook = ephy_window_get_notebook (window);
+  n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+
+  for (int i = 0; i < n_pages; i++) {
+    embed = EPHY_EMBED (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), i));
+
+    view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+    webkit_web_view_reload (view);
+  }
+}
+
 void
 window_cmd_tabs_reopen_closed_tab (GSimpleAction *action,
                                    GVariant      *parameter,
diff --git a/src/window-commands.h b/src/window-commands.h
index 9a52cb1cd..1ad38c2f4 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -191,6 +191,9 @@ void window_cmd_tabs_close_right                (GSimpleAction *action,
 void window_cmd_tabs_reload                     (GSimpleAction *action,
                                                  GVariant      *parameter,
                                                  gpointer       user_data);
+void window_cmd_tabs_reload_all_tabs            (GSimpleAction *action,
+                                                 GVariant      *parameter,
+                                                 gpointer       user_data);
 void window_cmd_tabs_reopen_closed_tab          (GSimpleAction *action,
                                                  GVariant      *parameter,
                                                  gpointer       user_data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]