[Xfce4-commits] <xfce4-panel:devel> Some systray fixes.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:35:04 CEST 2009
Updating branch refs/heads/devel
to b591bb2a19ef062401b79afbe8afbbe3c4c41abb (commit)
from f50280ee7bab09396b9317f8cb622ea041ecf11f (commit)
commit b591bb2a19ef062401b79afbe8afbbe3c4c41abb
Author: Nick Schermer <nick at xfce.org>
Date: Fri Jun 19 17:00:49 2009 +0200
Some systray fixes.
plugins/systray/systray-manager.c | 32 +++++++++++++++++---------------
plugins/systray/systray.c | 7 +++++--
plugins/tasklist/tasklist-widget.c | 16 ++++++++--------
3 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c
index c1de20c..d5d1512 100644
--- a/plugins/systray/systray-manager.c
+++ b/plugins/systray/systray-manager.c
@@ -238,6 +238,8 @@ systray_manager_finalize (GObject *object)
{
SystrayManager *manager = XFCE_SYSTRAY_MANAGER (object);
+ panel_return_if_fail (manager->invisible == NULL);
+
/* destroy the hash table */
g_hash_table_destroy (manager->sockets);
@@ -295,8 +297,8 @@ systray_manager_check_running (GdkScreen *screen)
gboolean
systray_manager_register (SystrayManager *manager,
- GdkScreen *screen,
- GError **error)
+ GdkScreen *screen,
+ GError **error)
{
GdkDisplay *display;
gchar *selection_name;
@@ -434,7 +436,7 @@ systray_manager_unregister (SystrayManager *manager)
panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager));
/* leave when there is no invisible window */
- if (invisible == NULL)
+ if (G_UNLIKELY (invisible == NULL))
return;
panel_return_if_fail (GTK_IS_INVISIBLE (invisible));
@@ -446,21 +448,21 @@ systray_manager_unregister (SystrayManager *manager)
/* remove our handling of the selection if we're the owner */
owner = gdk_selection_owner_get_for_display (display, manager->selection_atom);
- if (owner == invisible->window)
- {
- /* reset the selection owner */
- gdk_selection_owner_set_for_display (display,
- NULL,
- manager->selection_atom,
- gdk_x11_get_server_time (invisible->window),
- TRUE);
- }
+ if (owner != invisible->window
+ || !gdk_selection_owner_set_for_display (display,
+ NULL,
+ manager->selection_atom,
+ gdk_x11_get_server_time (invisible->window),
+ TRUE))
+ panel_assert_not_reached ();
/* remove window filter */
- gdk_window_remove_filter (invisible->window, systray_manager_window_filter, manager);
+ gdk_window_remove_filter (invisible->window,
+ systray_manager_window_filter, manager);
/* remove all sockets from the hash table */
- g_hash_table_foreach (manager->sockets, systray_manager_remove_socket, manager);
+ g_hash_table_foreach (manager->sockets,
+ systray_manager_remove_socket, manager);
/* destroy and unref the invisible window */
manager->invisible = NULL;
@@ -684,7 +686,7 @@ systray_manager_handle_dock_request (SystrayManager *manager,
panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible));
/* check if we already have this window */
- if (g_hash_table_lookup (manager->sockets, GUINT_TO_POINTER (window)))
+ if (g_hash_table_lookup (manager->sockets, GUINT_TO_POINTER (window)) != NULL)
return;
/* create the socket */
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index fbf89a6..a86f3a4 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -323,8 +323,11 @@ systray_plugin_free_data (XfcePanelPlugin *panel_plugin)
systray_plugin_screen_changed, NULL);
/* release the manager */
- if (G_LIKELY (plugin->manager))
- g_object_unref (G_OBJECT (plugin->manager));
+ if (G_LIKELY (plugin->manager != NULL))
+ {
+ systray_manager_unregister (plugin->manager);
+ g_object_unref (G_OBJECT (plugin->manager));
+ }
}
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 1be7722..858e864 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1399,11 +1399,11 @@ tasklist_button_enter_notify_event (GtkWidget *button,
/* connect signal to destroy the window when the user leaves the button */
g_signal_connect (G_OBJECT (button), "leave-notify-event",
- G_CALLBACK (tasklist_button_leave_notify_event), child);
+ G_CALLBACK (tasklist_button_leave_notify_event), child);
/* monitor geometry changes */
g_signal_connect (G_OBJECT (child->window), "geometry-changed",
- G_CALLBACK (tasklist_button_geometry_changed), child);
+ G_CALLBACK (tasklist_button_geometry_changed), child);
return FALSE;
}
@@ -1490,9 +1490,9 @@ xfce_tasklist_button_new (XfceTasklistChild *child)
gtk_button_set_relief (GTK_BUTTON (child->button),
child->tasklist->button_relief);
g_signal_connect (G_OBJECT (child->button), "enter-notify-event",
- G_CALLBACK (tasklist_button_enter_notify_event), child);
+ G_CALLBACK (tasklist_button_enter_notify_event), child);
g_signal_connect (G_OBJECT (child->button), "button-press-event",
- G_CALLBACK (tasklist_button_button_press_event), child);
+ G_CALLBACK (tasklist_button_button_press_event), child);
child->box = xfce_hvbox_new (child->tasklist->horizontal ?
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, FALSE, 6);
@@ -1529,13 +1529,13 @@ xfce_tasklist_button_new (XfceTasklistChild *child)
/* monitor window changes */
g_signal_connect (G_OBJECT (window), "icon-changed",
- G_CALLBACK (tasklist_button_icon_changed), child);
+ G_CALLBACK (tasklist_button_icon_changed), child);
g_signal_connect (G_OBJECT (window), "name-changed",
- G_CALLBACK (tasklist_button_name_changed), child);
+ G_CALLBACK (tasklist_button_name_changed), child);
g_signal_connect (G_OBJECT (window), "state-changed",
- G_CALLBACK (tasklist_button_state_changed), child);
+ G_CALLBACK (tasklist_button_state_changed), child);
g_signal_connect (G_OBJECT (window), "workspace-changed",
- G_CALLBACK (tasklist_button_workspace_changed), child);
+ G_CALLBACK (tasklist_button_workspace_changed), child);
/* poke functions */
tasklist_button_icon_changed (window, child);
More information about the Xfce4-commits
mailing list