[epiphany/wip/gtkaction-to-gaction: 43/57] Use GAction for 'Go Location'



commit 5acb21d416c386a52c42967cb9374d959f281f12
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Fri Jul 1 21:12:21 2016 +0300

    Use GAction for 'Go Location'

 src/ephy-lockdown.c   |   21 +++++++--------------
 src/ephy-window.c     |   19 ++-----------------
 src/window-commands.c |   15 ++++++++-------
 src/window-commands.h |    5 +++--
 4 files changed, 20 insertions(+), 40 deletions(-)
---
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index a4a83e4..6d4e413 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -98,23 +98,21 @@ typedef struct {
   const char *prop;
 } BindAction;
 
-static const BindAction window_actions[] = {
-  { EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, "GoLocation", "sensitive" },
-};
-
 static const BindAction app_actions[] = {
   { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "new-window", "enabled" },
   { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "new-incognito", "enabled" }
 };
 
-static const BindAction new_window_actions[] = {
+static const BindAction window_actions[] = {
+  { EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, "location", "enabled"},
+
   { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "bookmark-page", "enabled" },
 
-  { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "save-as", "enabled" },
+  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "fullscreen", "enabled" },
 
   { EPHY_PREFS_LOCKDOWN_PRINTING, "print", "enabled" },
 
-  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "fullscreen", "enabled" }
+  { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "save-as", "enabled" }
 };
 
 static const BindAction popup_actions[] = {
@@ -286,11 +284,6 @@ window_added_cb (GtkApplication *application,
 
   manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (EPHY_WINDOW (window)));
 
-  action_group = find_action_group (manager, "WindowActions");
-  bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
-                             action_group, window_actions,
-                             G_N_ELEMENTS (window_actions));
-
   new_action_group = G_ACTION_GROUP (G_APPLICATION (gtk_window_get_application (GTK_WINDOW (window))));
   new_bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
                              new_action_group, app_actions,
@@ -300,8 +293,8 @@ window_added_cb (GtkApplication *application,
                                                   "win");
   new_bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
                              new_action_group,
-                             new_window_actions,
-                             G_N_ELEMENTS (new_window_actions));
+                             window_actions,
+                             G_N_ELEMENTS (window_actions));
 
   action_group = find_action_group (manager, "PopupsActions");
   bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 262bb72..006866e 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -74,13 +74,6 @@
 static void ephy_window_view_popup_windows_cb (GtkAction  *action,
                                                EphyWindow *window);
 
-static const GtkActionEntry ephy_menu_entries [] = {
-  /* Go actions. */
-
-  { "GoLocation", NULL, N_("_Location…"), "<control>L", NULL,
-    G_CALLBACK (window_cmd_go_location) },
-};
-
 static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
 {
   { "ViewPopupWindows", NULL, N_("Popup _Windows"), NULL, NULL,
@@ -153,13 +146,6 @@ static const struct {
   gboolean fromToolbar;
 } extra_keybindings [] = {
   { GDK_KEY_Home, GDK_MOD1_MASK, "FileHome", TRUE },
-  /* Go */
-  { GDK_KEY_l, GDK_CONTROL_MASK, "GoLocation", FALSE },
-  { GDK_KEY_F6, 0, "GoLocation", FALSE },
-#ifdef HAVE_X11_XF86KEYSYM_H
-  { XF86XK_Go, 0, "GoLocation", FALSE },
-  { XF86XK_OpenURL, 0, "GoLocation", FALSE },
-#endif /* HAVE_X11_XF86KEYSYM_H */
 };
 
 const struct {
@@ -191,6 +177,7 @@ const struct {
   { "win.select-all", { "<Primary>A", NULL } },
 
   { "win.send-to", { "Send", NULL } },
+  { "win.location", { "<Primary>L", "F6", "Go", "OpenURL", NULL } },
 
   /* Toggle actions */
   { "win.browse-with-caret", { "F7", NULL } },
@@ -960,6 +947,7 @@ static const GActionEntry window_entries [] =
   { "select-all", window_cmd_edit_select_all },
 
   { "send-to", window_cmd_file_send_to },
+  { "location", window_cmd_go_location },
 
   /* Toggle actions */
   { "browse-with-caret", activate_toggle, NULL, "false", window_cmd_change_browse_with_caret },
@@ -1001,8 +989,6 @@ setup_ui_manager (EphyWindow *window)
 
   action_group = gtk_action_group_new ("WindowActions");
   gtk_action_group_set_translation_domain (action_group, NULL);
-  gtk_action_group_add_actions (action_group, ephy_menu_entries,
-                                G_N_ELEMENTS (ephy_menu_entries), window);
   gtk_action_group_add_toggle_actions (action_group,
                                        ephy_menu_toggle_entries,
                                        G_N_ELEMENTS (ephy_menu_toggle_entries),
@@ -2843,7 +2829,6 @@ ephy_window_state_event (GtkWidget           *widget,
   return FALSE;
 }
 
-
 static void
 ephy_window_finalize (GObject *object)
 {
diff --git a/src/window-commands.c b/src/window-commands.c
index 6a3dd3b..be120ba 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -231,13 +231,6 @@ window_cmd_undo_close_tab (GtkAction  *action,
 }
 
 void
-window_cmd_go_location (GtkAction  *action,
-                        EphyWindow *window)
-{
-  ephy_window_activate_location (window);
-}
-
-void
 window_cmd_file_quit (GtkAction  *action,
                       EphyWindow *window)
 {
@@ -1707,6 +1700,14 @@ window_cmd_file_send_to (GSimpleAction *action,
 }
 
 void
+window_cmd_go_location (GSimpleAction *action,
+                        GVariant      *value,
+                        gpointer       user_data)
+{
+  ephy_window_activate_location (user_data);
+}
+
+void
 window_cmd_change_browse_with_caret (GSimpleAction *action,
                                      GVariant      *state,
                                      gpointer       user_data)
diff --git a/src/window-commands.h b/src/window-commands.h
index 6d79b84..04194d0 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -39,8 +39,6 @@ void window_cmd_view_reload               (GSimpleAction *action,
 void window_cmd_combined_stop_reload      (GSimpleAction *action,
                                            GVariant      *parameter,
                                            gpointer       user_data);
-void window_cmd_go_location               (GtkAction  *action,
-                                           EphyWindow *window);
 void window_cmd_undo_close_tab            (GtkAction *action,
                                            EphyWindow *window);
 void window_cmd_file_new_tab              (GSimpleAction *action,
@@ -135,6 +133,9 @@ void window_cmd_edit_select_all           (GSimpleAction *action,
 void window_cmd_file_send_to              (GSimpleAction *action,
                                            GVariant      *value,
                                            gpointer       user_data);
+void window_cmd_go_location               (GSimpleAction *action,
+                                           GVariant      *value,
+                                           gpointer       user_data);
 void window_cmd_change_browse_with_caret  (GSimpleAction *action,
                                            GVariant      *state,
                                            gpointer       user_data);


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