]> git.armaanb.net Git - chorizo.git/commitdiff
No longer use GtkAction when constructing the context menu
authorPeter Hofmann <scm@uninformativ.de>
Thu, 11 Jan 2018 15:59:56 +0000 (16:59 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Thu, 11 Jan 2018 16:01:11 +0000 (17:01 +0100)
Thanks to @jun7 for helping me out!

Closes #54.

CHANGES
browser.c

diff --git a/CHANGES b/CHANGES
index f57e9a5230f4ae3e945e1e5f70c600493528d950..dc4fa221ee59dba9128d9b7845616d3958cc2354 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Release history for lariza
 
+next
+  [Fixed]
+  - Compilation warnings regarding deprecated API calls (GtkAction) have
+    been addressed. Thanks to @jun7 on GitHub!
+
 v17.11  2017-11-16
   [Added]
   - You can now set the following environment variable to have console
index 969d98188fa43a33261d54b54e82951848573bb8..00697d16021f1af7bc5766e191d2ab5f505bc68c 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -32,7 +32,7 @@ static void downloadmanager_cancel(GtkToolButton *, gpointer data);
 static gboolean downloadmanager_delete(GtkWidget *, gpointer);
 static void downloadmanager_setup(void);
 static gchar *ensure_uri_scheme(const gchar *);
-static void external_handler_run(GtkAction *, gpointer);
+static void external_handler_run(gpointer);
 static void grab_environment_configuration(void);
 static void hover_web_view(WebKitWebView *, WebKitHitTestResult *, guint, gpointer);
 static gboolean key_common(GtkWidget *, GdkEvent *, gpointer);
@@ -563,15 +563,13 @@ ensure_uri_scheme(const gchar *t)
 }
 
 void
-external_handler_run(GtkAction *action, gpointer data)
+external_handler_run(gpointer data)
 {
     struct Client *c = (struct Client *)data;
     gchar *argv[] = { "lariza-external-handler", "-u", NULL, NULL };
     GPid pid;
     GError *err = NULL;
 
-    (void)action;
-
     argv[2] = c->external_handler_uri;
     if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
                        &pid, &err))
@@ -711,7 +709,7 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data)
                         g_free(c->external_handler_uri);
                     c->external_handler_uri = g_strdup(
                         webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)));
-                    external_handler_run(NULL, c);
+                    external_handler_run(c);
                     return TRUE;
             }
         }
@@ -914,7 +912,7 @@ menu_web_view(WebKitWebView *web_view, WebKitContextMenu *menu, GdkEvent *ev,
               WebKitHitTestResult *ht, gpointer data)
 {
     struct Client *c = (struct Client *)data;
-    GtkAction *action = NULL;
+    GSimpleAction *action = NULL;
     WebKitContextMenuItem *mi = NULL;
     const gchar *uri = NULL;
 
@@ -934,12 +932,14 @@ menu_web_view(WebKitWebView *web_view, WebKitContextMenu *menu, GdkEvent *ev,
         if (c->external_handler_uri != NULL)
             g_free(c->external_handler_uri);
         c->external_handler_uri = g_strdup(uri);
-        action = gtk_action_new("external_handler", "Open with external handler",
-                                NULL, NULL);
-        g_signal_connect(G_OBJECT(action), "activate",
-                         G_CALLBACK(external_handler_run), data);
-        mi = webkit_context_menu_item_new(action);
+        action = g_simple_action_new("external_handler", NULL);
+        g_signal_connect_swapped(G_OBJECT(action), "activate",
+                                 G_CALLBACK(external_handler_run), data);
+        mi = webkit_context_menu_item_new_from_gaction(G_ACTION(action),
+                                                       "Open with external handler",
+                                                       NULL);
         webkit_context_menu_append(menu, mi);
+        g_object_unref(action);
     }
 
     /* FALSE = Show the menu. (TRUE = Don't ever show it.) */