[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 02/02: Show info/warning dialogs if clipman is (not) running
noreply at xfce.org
noreply at xfce.org
Tue Mar 24 17:11:30 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 bd0d772b2bf5202d33fcb4e898db1267fb9acc5f
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Tue Mar 24 17:10:12 2020 +0100
Show info/warning dialogs if clipman is (not) running
---
panel-plugin/Makefile.am | 8 ++++++--
panel-plugin/common.c | 40 ++++++++++++++++++++++++++++++++++++
panel-plugin/common.h | 3 +++
panel-plugin/main-status-icon.c | 2 +-
panel-plugin/plugin.c | 10 +--------
panel-plugin/plugin.h | 2 +-
panel-plugin/xfce4-clipman-history.c | 5 +----
panel-plugin/xfce4-popup-clipman.c | 3 +++
8 files changed, 56 insertions(+), 17 deletions(-)
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 4d05183..4df7025 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -28,6 +28,7 @@ endif
xfce4_popup_clipman_SOURCES = \
xfce4-popup-clipman.c \
+ common.c \
common.h \
$(NULL)
@@ -36,12 +37,14 @@ xfce4_popup_clipman_CFLAGS = \
@LIBX11_CFLAGS@ \
@GDKX_CFLAGS@ \
@GTK_CFLAGS@ \
+ @LIBXFCE4UI_CFLAGS@ \
$(NULL)
xfce4_popup_clipman_LDADD = \
@LIBX11_LIBS@ \
@GDKX_LIBS@ \
@GTK_LIBS@ \
+ @LIBXFCE4UI_LIBS@ \
$(NULL)
#
@@ -51,6 +54,7 @@ xfce4_popup_clipman_LDADD = \
xfce4_clipman_history_SOURCES = \
xfce4-clipman-history.c \
actions.c \
+ common.c \
common.h \
collector.c \
history.c \
@@ -117,7 +121,7 @@ xfce4_clipman_settings_LDADD = \
xfce4_clipman_SOURCES = \
main-status-icon.c \
- common.h \
+ common.c common.h \
plugin.c plugin.h \
actions.c actions.h \
collector.c collector.h \
@@ -160,7 +164,7 @@ plugin_LTLIBRARIES = libclipman.la
libclipman_la_SOURCES = \
main-panel-plugin.c \
- common.h \
+ common.c common.h \
plugin.c plugin.h \
actions.c actions.h \
collector.c collector.h \
diff --git a/panel-plugin/common.c b/panel-plugin/common.c
new file mode 100644
index 0000000..fc81b5c
--- /dev/null
+++ b/panel-plugin/common.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Simon Steinbeiß <simon at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <gtk/gtk.h>
+
+#include <libxfce4ui/libxfce4ui.h>
+
+#include <common.h>
+
+void
+clipman_common_show_info_dialog (void)
+{
+ xfce_dialog_show_info (NULL,
+ _("Could not start the Clipboard Manager Daemon because it is already running."),
+ _("The Xfce Clipboard Manager is already running."));
+}
+
+void
+clipman_common_show_warning_dialog (void)
+{
+ xfce_dialog_show_warning (NULL,
+ _("You can launch it with 'xfce4-clipman'."),
+ "%s",
+ _("The Clipboard Manager Daemon is not running."));
+}
diff --git a/panel-plugin/common.h b/panel-plugin/common.h
index b151d02..17c7427 100644
--- a/panel-plugin/common.h
+++ b/panel-plugin/common.h
@@ -55,3 +55,6 @@
#define ACTION_GROUP_SELECTION 0
#define ACTION_GROUP_MANUAL 1
+
+void clipman_common_show_info_dialog (void);
+void clipman_common_show_warning_dialog (void);
diff --git a/panel-plugin/main-status-icon.c b/panel-plugin/main-status-icon.c
index d0dc1e3..a5ab586 100644
--- a/panel-plugin/main-status-icon.c
+++ b/panel-plugin/main-status-icon.c
@@ -73,7 +73,7 @@ main (gint argc,
if (g_application_get_is_remote (G_APPLICATION (app)))
{
g_message ("Primary instance org.xfce.clipman already running");
- plugin_daemon_show_info_dialog ();
+ clipman_common_show_info_dialog ();
g_object_unref (app);
return FALSE;
}
diff --git a/panel-plugin/plugin.c b/panel-plugin/plugin.c
index 38e84f1..b6d7878 100644
--- a/panel-plugin/plugin.c
+++ b/panel-plugin/plugin.c
@@ -55,14 +55,6 @@ clipboard_manager_ownership_exists (void)
return XGetSelectionOwner (display, atom);
}
-void
-plugin_daemon_show_info_dialog (void)
-{
- xfce_dialog_show_info (NULL,
- _("Could not start the Clipboard Manager Daemon because it is already running."),
- _("The Xfce Clipboard Manager is already running."));
-}
-
/*
* Plugin functions
*/
@@ -95,7 +87,7 @@ plugin_register (void)
if (g_application_get_is_remote (G_APPLICATION (plugin->app)))
{
g_message ("Primary instance org.xfce.clipman already running");
- plugin_daemon_show_info_dialog ();
+ clipman_common_show_info_dialog ();
g_object_unref (plugin->app);
return FALSE;
}
diff --git a/panel-plugin/plugin.h b/panel-plugin/plugin.h
index a4e4169..14814da 100644
--- a/panel-plugin/plugin.h
+++ b/panel-plugin/plugin.h
@@ -28,6 +28,7 @@
#include <x11-clipboard-manager/daemon.h>
#include "actions.h"
+#include "common.h"
#include "collector.h"
#include "history.h"
@@ -63,7 +64,6 @@ struct _MyPlugin
* Plugin functions
*/
-void plugin_daemon_show_info_dialog (void);
MyPlugin* plugin_register ();
void plugin_load (MyPlugin *plugin);
void plugin_save (MyPlugin *plugin);
diff --git a/panel-plugin/xfce4-clipman-history.c b/panel-plugin/xfce4-clipman-history.c
index ace12c6..00aa56f 100644
--- a/panel-plugin/xfce4-clipman-history.c
+++ b/panel-plugin/xfce4-clipman-history.c
@@ -494,10 +494,7 @@ main (gint argc, gchar *argv[])
if (!clipman_history_clipman_daemon_running ())
{
g_warning ("The clipboard daemon is not running, exiting. You can launch it with 'xfce4-clipman'.");
- xfce_dialog_show_warning (NULL,
- _("You can launch it with 'xfce4-clipman'."),
- "%s",
- _("The Clipboard Manager Daemon is not running."));
+ clipman_common_show_warning_dialog ();
return FALSE;
}
diff --git a/panel-plugin/xfce4-popup-clipman.c b/panel-plugin/xfce4-popup-clipman.c
index fef6478..0a8d1bc 100644
--- a/panel-plugin/xfce4-popup-clipman.c
+++ b/panel-plugin/xfce4-popup-clipman.c
@@ -25,6 +25,8 @@
#include <gtk/gtk.h>
+#include <common.h>
+
/* Initial code was taken from xfwm4/src/menu.c:grab_available().
* TODO replace deprecated GTK/GDK functions.
@@ -92,6 +94,7 @@ main (gint argc, gchar *argv[])
else
{
g_warning ("Unable to find the primary instance org.xfce.clipman");
+ clipman_common_show_warning_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