[Xfce4-commits] <xfce4-panel:master> Make the systray takeover selection.
Nick Schermer
noreply at xfce.org
Thu Jun 3 20:52:02 CEST 2010
Updating branch refs/heads/master
to 52a008791b654dab104ca88ea10b771c86dbf23e (commit)
from 1a74095b4985b02d79b449a8b5034395a5687dea (commit)
commit 52a008791b654dab104ca88ea10b771c86dbf23e
Author: Nick Schermer <nick at xfce.org>
Date: Thu Jun 3 20:47:49 2010 +0200
Make the systray takeover selection.
This instead of ignoring the startup. Since your plugin
is unique now, it won't give problems when one panel is
running. It also makes the systray restart after a crash
work better, since most of the time is takes a while (in
cpu cycles) before the selection is released of the crashing
plugin.
plugins/systray/systray-manager.c | 2 +
plugins/systray/systray-manager.h | 2 +
plugins/systray/systray.c | 50 +++++++++++++----------------------
plugins/systray/systray.desktop.in | 1 +
4 files changed, 24 insertions(+), 31 deletions(-)
diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c
index 8581970..11731b1 100644
--- a/plugins/systray/systray-manager.c
+++ b/plugins/systray/systray-manager.c
@@ -266,6 +266,7 @@ systray_manager_new (void)
+#if 0
gboolean
systray_manager_check_running (GdkScreen *screen)
{
@@ -291,6 +292,7 @@ systray_manager_check_running (GdkScreen *screen)
/* return result */
return (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), selection_atom) != None);
}
+#endif
diff --git a/plugins/systray/systray-manager.h b/plugins/systray/systray-manager.h
index d4c1cdb..892c8ee 100644
--- a/plugins/systray/systray-manager.h
+++ b/plugins/systray/systray-manager.h
@@ -54,7 +54,9 @@ GQuark systray_manager_error_quark (void);
SystrayManager *systray_manager_new (void) G_GNUC_MALLOC;
+#if 0
gboolean systray_manager_check_running (GdkScreen *screen);
+#endif
gboolean systray_manager_register (SystrayManager *manager,
GdkScreen *screen,
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index 9825759..8283c70 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
- * Copyright (c) 2007-2009 Nick Schermer <nick at xfce.org>
+ * Copyright (c) 2007-2010 Nick Schermer <nick at xfce.org>
*
* This library 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
@@ -260,38 +260,27 @@ systray_plugin_screen_changed (GtkWidget *widget,
plugin->manager = NULL;
}
- /* check if not another systray is running on this screen */
+ /* create a new manager and register this screen */
+ plugin->manager = systray_manager_new ();
+ g_signal_connect (G_OBJECT (plugin->manager), "icon-added",
+ G_CALLBACK (systray_plugin_icon_added), plugin);
+ g_signal_connect (G_OBJECT (plugin->manager), "icon-removed",
+ G_CALLBACK (systray_plugin_icon_removed), plugin);
+ g_signal_connect (G_OBJECT (plugin->manager), "lost-selection",
+ G_CALLBACK (systray_plugin_lost_selection), plugin);
+
+ /* try to register the systray */
screen = gtk_widget_get_screen (widget);
- if (G_LIKELY (!systray_manager_check_running (screen)))
+ if (systray_manager_register (plugin->manager, screen, &error))
{
- /* create a new manager and register this screen */
- plugin->manager = systray_manager_new ();
-
- /* hookup signals */
- g_signal_connect (G_OBJECT (plugin->manager), "icon-added",
- G_CALLBACK (systray_plugin_icon_added), plugin);
- g_signal_connect (G_OBJECT (plugin->manager), "icon-removed",
- G_CALLBACK (systray_plugin_icon_removed), plugin);
- g_signal_connect (G_OBJECT (plugin->manager), "lost-selection",
- G_CALLBACK (systray_plugin_lost_selection), plugin);
-
- if (systray_manager_register (plugin->manager, screen, &error))
- {
- /* send the plugin orientation */
- systray_plugin_orientation_changed (XFCE_PANEL_PLUGIN (plugin),
- xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)));
- }
- else
- {
- /* TODO handle error and leave the plugin */
- g_message ("Failed to register the systray manager %s", error->message);
- g_error_free (error);
- }
+ /* send the plugin orientation */
+ systray_plugin_orientation_changed (XFCE_PANEL_PLUGIN (plugin),
+ xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)));
}
else
{
- /* TODO, error and leave the plugin */
- g_message ("already a notification area running");
+ xfce_dialog_show_error (NULL, error, _("Unable the start the notification area"));
+ g_error_free (error);
}
}
@@ -549,9 +538,8 @@ systray_plugin_lost_selection (SystrayManager *manager,
/* create fake error and show it */
error.message = _("Most likely another widget took over the function "
- "of a notification area. This plugin will close.");
- xfce_dialog_show_error (NULL, &error,
- _("The notification area lost selection"));
+ "of a notification area. This area will be unused.");
+ xfce_dialog_show_error (NULL, &error, _("The notification area lost selection"));
}
diff --git a/plugins/systray/systray.desktop.in b/plugins/systray/systray.desktop.in
index 2be7df2..eca9aab 100644
--- a/plugins/systray/systray.desktop.in
+++ b/plugins/systray/systray.desktop.in
@@ -6,3 +6,4 @@ _Comment=Area where notification icons appear
Icon=applications-system
X-XFCE-Module=systray
X-XFCE-Internal=FALSE
+X-XFCE-Unique=SCREEN
More information about the Xfce4-commits
mailing list