[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 33/37: Avoid running clipman history multiple times

noreply at xfce.org noreply at xfce.org
Mon Mar 23 23:30:28 CET 2020


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-clipman-plugin.

commit 5a08e1b84900b005d22e620ceed65c9a2258852a
Author: Florian Schüller <florian.schueller at gmail.com>
Date:   Sun Mar 22 01:25:15 2020 +0100

    Avoid running clipman history multiple times
    
    This also fixes that the "first" application crashes if
    a second instance is started during shutdown of the "first" application
---
 panel-plugin/xfce4-clipman-history.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/panel-plugin/xfce4-clipman-history.c b/panel-plugin/xfce4-clipman-history.c
index 8a66d24..ab703db 100644
--- a/panel-plugin/xfce4-clipman-history.c
+++ b/panel-plugin/xfce4-clipman-history.c
@@ -460,6 +460,7 @@ main (gint argc, gchar *argv[])
 {
   GtkApplication *app;
   int status;
+  GError *error = NULL;
 
   if (!clipman_history_clipman_daemon_running ())
     {
@@ -470,8 +471,23 @@ main (gint argc, gchar *argv[])
   /* Setup translation domain */
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
 
+
   app = gtk_application_new ("org.xfce.clipman.history", G_APPLICATION_FLAGS_NONE);
 
+  g_application_register (G_APPLICATION (app), NULL, &error);
+  if (error != NULL)
+    {
+      g_warning ("Unable to register GApplication: %s", error->message);
+      g_error_free (error);
+      error = NULL;
+    }
+
+  if (g_application_get_is_remote (G_APPLICATION (app)))
+    {
+      g_warning ("%s already running", argv[0]);
+      return FALSE;
+    }
+
   g_signal_connect (app, "activate", G_CALLBACK (clipman_history_activate), NULL);
   status = g_application_run (G_APPLICATION (app), argc, argv);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list