[epiphany/wip/gtkaction-to-gaction] Update function headers for app menu entries



commit 147e669336abb71e6a7511dcd287909230391f5a
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Fri Jul 1 21:44:13 2016 +0300

    Update function headers for app menu entries

 src/bookmarks/ephy-bookmarks-editor.c |    8 +-
 src/ephy-shell.c                      |   18 +-
 src/window-commands.c                 |  403 +++++++++++++++++----------------
 src/window-commands.h                 |   45 +++--
 4 files changed, 250 insertions(+), 224 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 3852944..7b2bdbc 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -143,6 +143,12 @@ enum {
 
 static GParamSpec *obj_properties[LAST_PROP];
 
+static void
+help_about (GtkAction *action, EphyWindow *window)
+{
+  window_cmd_show_about (NULL, NULL, window);
+}
+
 static const GtkActionEntry ephy_bookmark_popup_entries [] = {
   /* Toplevel */
   { "File", NULL, N_("_File") },
@@ -199,7 +205,7 @@ static const GtkActionEntry ephy_bookmark_popup_entries [] = {
     G_CALLBACK (cmd_help_contents) },
   { "HelpAbout", NULL, N_("_About"), NULL,
     N_("Display credits for the web browser creators"),
-    G_CALLBACK (window_cmd_help_about) },
+    G_CALLBACK (help_about) },
 };
 
 static const GtkToggleActionEntry ephy_bookmark_toggle_entries [] = {
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index e050180..8187ae3 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -143,7 +143,7 @@ new_window (GSimpleAction *action,
             GVariant      *parameter,
             gpointer       user_data)
 {
-  window_cmd_file_new_window (NULL, NULL);
+  window_cmd_new_window (NULL, NULL, NULL);
 }
 
 static void
@@ -151,7 +151,7 @@ new_incognito_window (GSimpleAction *action,
                       GVariant      *parameter,
                       gpointer       user_data)
 {
-  window_cmd_file_new_incognito_window (NULL, NULL);
+  window_cmd_new_incognito_window (NULL, NULL, NULL);
 }
 
 static void
@@ -159,7 +159,7 @@ reopen_closed_tab (GSimpleAction *action,
                    GVariant      *parameter,
                    gpointer       user_data)
 {
-  window_cmd_undo_close_tab (NULL, NULL);
+  window_cmd_reopen_closed_tab (NULL, NULL, NULL);
 }
 
 static void
@@ -167,7 +167,7 @@ show_bookmarks (GSimpleAction *action,
                 GVariant      *parameter,
                 gpointer       user_data)
 {
-  window_cmd_edit_bookmarks (NULL, NULL);
+  window_cmd_show_bookmarks (NULL, NULL, NULL);
 }
 
 static void
@@ -179,7 +179,7 @@ show_history (GSimpleAction *action,
 
   window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
 
-  window_cmd_edit_history (NULL, EPHY_WINDOW (window));
+  window_cmd_show_history (NULL, NULL, EPHY_WINDOW (window));
 }
 
 static void
@@ -191,7 +191,7 @@ show_preferences (GSimpleAction *action,
 
   window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
 
-  window_cmd_edit_preferences (NULL, EPHY_WINDOW (window));
+  window_cmd_show_preferences (NULL, NULL, EPHY_WINDOW (window));
 }
 
 static void
@@ -203,7 +203,7 @@ show_help (GSimpleAction *action,
 
   window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
 
-  window_cmd_help_contents (NULL, GTK_WIDGET (window));
+  window_cmd_show_help (NULL, NULL, GTK_WIDGET (window));
 }
 
 static void
@@ -215,7 +215,7 @@ show_about (GSimpleAction *action,
 
   window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
 
-  window_cmd_help_about (NULL, GTK_WIDGET (window));
+  window_cmd_show_about (NULL, NULL, GTK_WIDGET (window));
 }
 
 static void
@@ -223,7 +223,7 @@ quit_application (GSimpleAction *action,
                   GVariant      *parameter,
                   gpointer       user_data)
 {
-  window_cmd_file_quit (NULL, NULL);
+  window_cmd_quit (NULL, NULL, NULL);
 }
 
 static GActionEntry app_entries[] = {
diff --git a/src/window-commands.c b/src/window-commands.c
index 55d79ba..358f8d0 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -62,6 +62,213 @@
 #define FAVICON_SIZE 16
 
 void
+window_cmd_new_window (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       user_data)
+{
+  EphyEmbed *embed;
+  EphyWindow *new_window = ephy_window_new ();
+
+  embed = ephy_shell_new_tab (ephy_shell_get_default (),
+                              new_window, NULL, 0);
+  ephy_web_view_load_homepage (ephy_embed_get_web_view (embed));
+  ephy_window_activate_location (new_window);
+}
+
+void
+window_cmd_new_incognito_window (GSimpleAction *action,
+                                 GVariant      *parameter,
+                                 gpointer       user_data)
+{
+  ephy_open_incognito_window (NULL);
+}
+
+void
+window_cmd_show_bookmarks (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       user_data)
+{
+  GtkWidget *bwindow;
+
+  bwindow = ephy_shell_get_bookmarks_editor (ephy_shell_get_default ());
+  gtk_window_present (GTK_WINDOW (bwindow));
+}
+
+void
+window_cmd_show_history (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       user_data)
+{
+  GtkWidget *hwindow;
+
+  hwindow = ephy_shell_get_history_window (ephy_shell_get_default ());
+
+  if (GTK_WINDOW (user_data) != gtk_window_get_transient_for (GTK_WINDOW (hwindow)))
+    gtk_window_set_transient_for (GTK_WINDOW (hwindow),
+                                  GTK_WINDOW (user_data));
+  gtk_window_present (GTK_WINDOW (hwindow));
+}
+
+void
+window_cmd_show_preferences (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
+{
+  GtkWindow *dialog;
+
+  dialog = GTK_WINDOW (ephy_shell_get_prefs_dialog (ephy_shell_get_default ()));
+
+  if (GTK_WINDOW (user_data) != gtk_window_get_transient_for (dialog))
+    gtk_window_set_transient_for (dialog,
+                                  GTK_WINDOW (user_data));
+
+  gtk_window_present (dialog);
+}
+
+void
+window_cmd_show_help (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
+{
+  ephy_gui_help (GTK_WIDGET (user_data), NULL);
+}
+
+#define ABOUT_GROUP "About"
+
+void
+window_cmd_show_about (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       user_data)
+{
+  EphyWindow *window = EPHY_WINDOW (user_data);
+  char *comments = NULL;
+  GKeyFile *key_file;
+  GError *error = NULL;
+  char **list, **authors, **contributors, **past_authors, **artists, **documenters;
+  gsize n_authors, n_contributors, n_past_authors, n_artists, n_documenters, i, j;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_file (key_file, DATADIR G_DIR_SEPARATOR_S "about.ini",
+                                  0, &error)) {
+    g_warning ("Couldn't load about data: %s\n", error->message);
+    g_error_free (error);
+    return;
+  }
+
+  list = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors",
+                                     &n_authors, NULL);
+  contributors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Contributors",
+                                             &n_contributors, NULL);
+  past_authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "PastAuthors",
+                                             &n_past_authors, NULL);
+
+#define APPEND(_to, _from) \
+  _to[i++] = g_strdup (_from);
+
+#define APPEND_STRV_AND_FREE(_to, _from) \
+  if (_from) \
+  { \
+    for (j = 0; _from[j] != NULL; ++j) \
+    { \
+      _to[i++] = _from[j]; \
+    } \
+    g_free (_from); \
+  }
+
+  authors = g_new (char *, (list ? n_authors : 0) +
+                   (contributors ? n_contributors : 0) +
+                   (past_authors ? n_past_authors : 0) + 7 + 1);
+  i = 0;
+  APPEND_STRV_AND_FREE (authors, list);
+  APPEND (authors, "");
+  APPEND (authors, _("Contact us at:"));
+  APPEND (authors, "<epiphany-list gnome org>");
+  APPEND (authors, "");
+  APPEND (authors, _("Contributors:"));
+  APPEND_STRV_AND_FREE (authors, contributors);
+  APPEND (authors, "");
+  APPEND (authors, _("Past developers:"));
+  APPEND_STRV_AND_FREE (authors, past_authors);
+  authors[i++] = NULL;
+
+  list = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Artists", &n_artists, NULL);
+
+  artists = g_new (char *, (list ? n_artists : 0) + 4 + 1);
+  i = 0;
+  APPEND_STRV_AND_FREE (artists, list);
+  artists[i++] = NULL;
+
+  list = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Documenters", &n_documenters, NULL);
+
+  documenters = g_new (char *, (list ? n_documenters : 0) + 3 + 1);
+  i = 0;
+  APPEND_STRV_AND_FREE (documenters, list);
+  APPEND (documenters, "");
+  APPEND (documenters, _("Contact us at:"));
+  APPEND (documenters, "<gnome-doc-list gnome org>");
+  documenters[i++] = NULL;
+
+#undef APPEND
+#undef APPEND_STRV_AND_FREE
+
+  g_key_file_free (key_file);
+
+  comments = g_strdup_printf (_("A simple, clean, beautiful view of the web.\n"
+                                "Powered by WebKit %d.%d.%d"),
+                              webkit_get_major_version (),
+                              webkit_get_minor_version (),
+                              webkit_get_micro_version ());
+
+  gtk_show_about_dialog (window ? GTK_WINDOW (window) : NULL,
+                         "program-name", _("Web"),
+                         "version", VERSION,
+                         "copyright", "Copyright © 2002–2004 Marco Pesenti Gritti\n"
+                         "Copyright © 2003–2014 The Web Developers",
+                         "artists", artists,
+                         "authors", authors,
+                         "comments", comments,
+                         "documenters", documenters,
+                         /* Translators: This is a special message that shouldn't be translated
+                          * literally. It is used in the about box to give credits to
+                          * the translators.
+                          * Thus, you should translate it to your name and email address.
+                          * You should also include other translators who have contributed to
+                          * this translation; in that case, please write each of them on a separate
+                          * line seperated by newlines (\n).
+                          */
+                         "translator-credits", _("translator-credits"),
+                         "logo-icon-name", "web-browser",
+                         "website", "https://wiki.gnome.org/Apps/Web";,
+                         "website-label", _("Web Website"),
+                         "license-type", GTK_LICENSE_GPL_2_0,
+                         "wrap-license", TRUE,
+                         NULL);
+
+  g_free (comments);
+  g_strfreev (artists);
+  g_strfreev (authors);
+  g_strfreev (documenters);
+}
+
+void
+window_cmd_quit (GSimpleAction *action,
+                 GVariant      *parameter,
+                 gpointer       user_data)
+{
+  if (ephy_shell_close_all_windows (ephy_shell_get_default ()))
+    g_application_quit (g_application_get_default ());
+}
+
+void
+window_cmd_reopen_closed_tab (GSimpleAction *action,
+                              GVariant      *parameter,
+                              gpointer       user_data)
+{
+  ephy_session_undo_close_tab (ephy_shell_get_session (ephy_shell_get_default ()));
+}
+
+
+void
 window_cmd_navigation (GSimpleAction *action,
                        GVariant      *parameter,
                        gpointer       user_data)
@@ -224,80 +431,6 @@ void window_cmd_combined_stop_reload (GSimpleAction *action,
 }
 
 void
-window_cmd_undo_close_tab (GtkAction  *action,
-                           EphyWindow *window)
-{
-  ephy_session_undo_close_tab (ephy_shell_get_session (ephy_shell_get_default ()));
-}
-
-void
-window_cmd_file_quit (GtkAction  *action,
-                      EphyWindow *window)
-{
-  if (ephy_shell_close_all_windows (ephy_shell_get_default ()))
-    g_application_quit (g_application_get_default ());
-}
-
-void
-window_cmd_file_new_window (GtkAction  *action,
-                            EphyWindow *window)
-{
-  EphyEmbed *embed;
-  EphyWindow *new_window = ephy_window_new ();
-
-  embed = ephy_shell_new_tab (ephy_shell_get_default (),
-                              new_window, NULL, 0);
-  ephy_web_view_load_homepage (ephy_embed_get_web_view (embed));
-  ephy_window_activate_location (new_window);
-}
-
-void
-window_cmd_file_new_incognito_window (GtkAction  *action,
-                                      EphyWindow *window)
-{
-  ephy_open_incognito_window (NULL);
-}
-
-void
-window_cmd_edit_bookmarks (GtkAction  *action,
-                           EphyWindow *window)
-{
-  GtkWidget *bwindow;
-
-  bwindow = ephy_shell_get_bookmarks_editor (ephy_shell_get_default ());
-  gtk_window_present (GTK_WINDOW (bwindow));
-}
-
-void
-window_cmd_edit_history (GtkAction  *action,
-                         EphyWindow *window)
-{
-  GtkWidget *hwindow;
-
-  hwindow = ephy_shell_get_history_window (ephy_shell_get_default ());
-
-  if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (hwindow)))
-    gtk_window_set_transient_for (GTK_WINDOW (hwindow),
-                                  GTK_WINDOW (window));
-  gtk_window_present (GTK_WINDOW (hwindow));
-}
-
-void
-window_cmd_edit_preferences (GtkAction  *action,
-                             EphyWindow *window)
-{
-  GtkWindow *dialog;
-
-  dialog = GTK_WINDOW (ephy_shell_get_prefs_dialog (ephy_shell_get_default ()));
-
-  if (GTK_WINDOW (window) != gtk_window_get_transient_for (dialog))
-    gtk_window_set_transient_for (dialog,
-                                  GTK_WINDOW (window));
-
-  gtk_window_present (dialog);
-}
-
-void
 window_cmd_file_new_tab (GSimpleAction *action,
                          GVariant      *parameter,
                          gpointer       user_data)
@@ -1464,128 +1597,6 @@ window_cmd_view_toggle_inspector (GSimpleAction *action,
 }
 
 void
-window_cmd_help_contents (GtkAction *action,
-                          GtkWidget *window)
-{
-  ephy_gui_help (window, NULL);
-}
-
-#define ABOUT_GROUP "About"
-
-void
-window_cmd_help_about (GtkAction *action,
-                       GtkWidget *window)
-{
-  char *comments = NULL;
-  GKeyFile *key_file;
-  GError *error = NULL;
-  char **list, **authors, **contributors, **past_authors, **artists, **documenters;
-  gsize n_authors, n_contributors, n_past_authors, n_artists, n_documenters, i, j;
-
-  key_file = g_key_file_new ();
-  if (!g_key_file_load_from_file (key_file, DATADIR G_DIR_SEPARATOR_S "about.ini",
-                                  0, &error)) {
-    g_warning ("Couldn't load about data: %s\n", error->message);
-    g_error_free (error);
-    return;
-  }
-
-  list = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors",
-                                     &n_authors, NULL);
-  contributors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Contributors",
-                                             &n_contributors, NULL);
-  past_authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "PastAuthors",
-                                             &n_past_authors, NULL);
-
-#define APPEND(_to, _from) \
-  _to[i++] = g_strdup (_from);
-
-#define APPEND_STRV_AND_FREE(_to, _from) \
-  if (_from) \
-  { \
-    for (j = 0; _from[j] != NULL; ++j) \
-    { \
-      _to[i++] = _from[j]; \
-    } \
-    g_free (_from); \
-  }
-
-  authors = g_new (char *, (list ? n_authors : 0) +
-                   (contributors ? n_contributors : 0) +
-                   (past_authors ? n_past_authors : 0) + 7 + 1);
-  i = 0;
-  APPEND_STRV_AND_FREE (authors, list);
-  APPEND (authors, "");
-  APPEND (authors, _("Contact us at:"));
-  APPEND (authors, "<epiphany-list gnome org>");
-  APPEND (authors, "");
-  APPEND (authors, _("Contributors:"));
-  APPEND_STRV_AND_FREE (authors, contributors);
-  APPEND (authors, "");
-  APPEND (authors, _("Past developers:"));
-  APPEND_STRV_AND_FREE (authors, past_authors);
-  authors[i++] = NULL;
-
-  list = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Artists", &n_artists, NULL);
-
-  artists = g_new (char *, (list ? n_artists : 0) + 4 + 1);
-  i = 0;
-  APPEND_STRV_AND_FREE (artists, list);
-  artists[i++] = NULL;
-
-  list = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Documenters", &n_documenters, NULL);
-
-  documenters = g_new (char *, (list ? n_documenters : 0) + 3 + 1);
-  i = 0;
-  APPEND_STRV_AND_FREE (documenters, list);
-  APPEND (documenters, "");
-  APPEND (documenters, _("Contact us at:"));
-  APPEND (documenters, "<gnome-doc-list gnome org>");
-  documenters[i++] = NULL;
-
-#undef APPEND
-#undef APPEND_STRV_AND_FREE
-
-  g_key_file_free (key_file);
-
-  comments = g_strdup_printf (_("A simple, clean, beautiful view of the web.\n"
-                                "Powered by WebKit %d.%d.%d"),
-                              webkit_get_major_version (),
-                              webkit_get_minor_version (),
-                              webkit_get_micro_version ());
-
-  gtk_show_about_dialog (window ? GTK_WINDOW (window) : NULL,
-                         "program-name", _("Web"),
-                         "version", VERSION,
-                         "copyright", "Copyright © 2002–2004 Marco Pesenti Gritti\n"
-                         "Copyright © 2003–2014 The Web Developers",
-                         "artists", artists,
-                         "authors", authors,
-                         "comments", comments,
-                         "documenters", documenters,
-                         /* Translators: This is a special message that shouldn't be translated
-                          * literally. It is used in the about box to give credits to
-                          * the translators.
-                          * Thus, you should translate it to your name and email address.
-                          * You should also include other translators who have contributed to
-                          * this translation; in that case, please write each of them on a separate
-                          * line seperated by newlines (\n).
-                          */
-                         "translator-credits", _("translator-credits"),
-                         "logo-icon-name", "web-browser",
-                         "website", "https://wiki.gnome.org/Apps/Web";,
-                         "website-label", _("Web Website"),
-                         "license-type", GTK_LICENSE_GPL_2_0,
-                         "wrap-license", TRUE,
-                         NULL);
-
-  g_free (comments);
-  g_strfreev (artists);
-  g_strfreev (authors);
-  g_strfreev (documenters);
-}
-
-void
 window_cmd_load_location (GtkAction  *action,
                           EphyWindow *window)
 {
diff --git a/src/window-commands.h b/src/window-commands.h
index bdf6ce6..077093f 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -24,6 +24,33 @@
 
 G_BEGIN_DECLS
 
+void window_cmd_new_window                (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_new_incognito_window      (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_show_bookmarks            (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_show_history              (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_show_preferences          (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_show_help                 (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_show_about                (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_quit                      (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
+void window_cmd_reopen_closed_tab         (GSimpleAction *action,
+                                           GVariant      *parameter,
+                                           gpointer       user_data);
 void window_cmd_navigation                (GSimpleAction *action,
                                            GVariant      *parameter,
                                            gpointer       user_data);
@@ -39,8 +66,6 @@ void window_cmd_view_reload               (GSimpleAction *action,
 void window_cmd_combined_stop_reload      (GSimpleAction *action,
                                            GVariant      *parameter,
                                            gpointer       user_data);
-void window_cmd_undo_close_tab            (GtkAction *action,
-                                           EphyWindow *window);
 void window_cmd_file_new_tab              (GSimpleAction *action,
                                            GVariant      *parameter,
                                            gpointer       user_data);
@@ -107,24 +132,8 @@ void window_cmd_view_page_source          (GSimpleAction *action,
 void window_cmd_view_toggle_inspector     (GSimpleAction *action,
                                            GVariant      *parameter,
                                            gpointer       user_data);
-void window_cmd_help_contents             (GtkAction  *action,
-                                           GtkWidget  *window);
-void window_cmd_help_about                (GtkAction  *action,
-                                           GtkWidget  *window);
 void window_cmd_load_location             (GtkAction  *action,
                                            EphyWindow *window);
-void window_cmd_file_quit                 (GtkAction  *action,
-                                           EphyWindow *window);
-void window_cmd_edit_bookmarks            (GtkAction  *action,
-                                           EphyWindow *window);
-void window_cmd_edit_history              (GtkAction  *action,
-                                           EphyWindow *window);
-void window_cmd_file_new_window           (GtkAction  *action,
-                                           EphyWindow *window);
-void window_cmd_file_new_incognito_window (GtkAction  *action,
-                                           EphyWindow *window);
-void window_cmd_edit_preferences          (GtkAction  *action,
-                                           EphyWindow *window);
 void window_cmd_edit_select_all           (GSimpleAction *action,
                                            GVariant      *parameter,
                                            gpointer       user_data);


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