[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 12/37: Avoid warnings on startup and do shutdown

noreply at xfce.org noreply at xfce.org
Mon Mar 23 23:30:07 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 164fc4d90b1926b8982618961ac932c2bbcb02ed
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Tue Mar 17 00:58:26 2020 +0100

    Avoid warnings on startup and do shutdown
---
 panel-plugin/xfce4-clipman-history.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/xfce4-clipman-history.c b/panel-plugin/xfce4-clipman-history.c
index d377af7..b5d2558 100644
--- a/panel-plugin/xfce4-clipman-history.c
+++ b/panel-plugin/xfce4-clipman-history.c
@@ -280,7 +280,7 @@ static void
 clipman_history_dialog_finalize (MyPlugin *plugin)
 {
   plugin_save (plugin);
-  gtk_main_quit ();
+  g_application_quit(G_APPLICATION(plugin->app));
 }
 
 static void
@@ -302,6 +302,12 @@ clipman_history_dialog_delete_event (GtkWidget *widget,
   return TRUE;
 }
 
+/* dummy function as we don't want to activate */
+static void
+activate (GApplication *app, gpointer      user_data)
+{
+}
+
 gint
 main (gint argc, gchar *argv[])
 {
@@ -313,8 +319,8 @@ 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", 0);
-  g_signal_connect_swapped (app, "activate", G_CALLBACK (gtk_window_present), dialog);
+  app = gtk_application_new ("org.xfce.clipman.history", G_APPLICATION_FLAGS_NONE);
+  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
   g_application_run (G_APPLICATION (app), argc, argv);
 
   g_application_register (G_APPLICATION (app), NULL, &error);
@@ -332,6 +338,7 @@ main (gint argc, gchar *argv[])
       return FALSE;
     }
 
+  plugin->app = app;
   xfconf_init (NULL);
   plugin->channel = xfconf_channel_new_with_property_base ("xfce4-panel", "/plugins/clipman");
   plugin->history = clipman_history_get ();
@@ -344,13 +351,17 @@ main (gint argc, gchar *argv[])
   xfconf_g_property_bind (plugin->channel, "/tweaks/reorder-items",
                           G_TYPE_BOOLEAN, plugin->history, "reorder-items");
 
+  plugin->menu = clipman_menu_new ();
+  xfconf_g_property_bind (plugin->channel, "/tweaks/paste-on-activate",
+                          G_TYPE_UINT, plugin->menu, "paste-on-activate");
+
   plugin_load (plugin);
 
   dialog = clipman_history_dialog_init (plugin);
   g_signal_connect (G_OBJECT (dialog), "delete-event", G_CALLBACK (clipman_history_dialog_delete_event), plugin);
   g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (clipman_history_dialog_response), plugin);
   gtk_window_present (GTK_WINDOW (dialog));
-  gtk_main ();
+  gtk_dialog_run(GTK_DIALOG(dialog));
 
   return FALSE;
 }

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


More information about the Xfce4-commits mailing list