[Xfce4-commits] r26369 - xfce4-panel/trunk/plugins/systray
Nick Schermer
nick at xfce.org
Sun Nov 18 18:19:09 CET 2007
Author: nick
Date: 2007-11-18 17:19:08 +0000 (Sun, 18 Nov 2007)
New Revision: 26369
Modified:
xfce4-panel/trunk/plugins/systray/xfce-tray-dialogs.c
xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c
xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.h
xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c
Log:
* Fix issues with 2.10 invisible icons. They are now properly
hidden (not even the 1px icon that appeared in the old
version of the tray).
* The hack above also fixed initial icon requests :-), so the
previous commit was partly removed.
Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-dialogs.c
===================================================================
--- xfce4-panel/trunk/plugins/systray/xfce-tray-dialogs.c 2007-11-18 15:05:30 UTC (rev 26368)
+++ xfce4-panel/trunk/plugins/systray/xfce-tray-dialogs.c 2007-11-18 17:19:08 UTC (rev 26369)
@@ -188,9 +188,6 @@
/* set rows */
xfce_tray_widget_set_rows (XFCE_TRAY_WIDGET (plugin->tray), value);
-
- /* reset initial icon size */
- plugin->initial_size = -1;
}
Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c
===================================================================
--- xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c 2007-11-18 15:05:30 UTC (rev 26368)
+++ xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c 2007-11-18 17:19:08 UTC (rev 26369)
@@ -93,8 +93,10 @@
/* message */
if (running)
+ {
xfce_tray_plugin_message (GTK_MESSAGE_INFO, screen,
_("There is already a system tray running on this screen"));
+ }
return (!running);
}
@@ -178,13 +180,6 @@
{
gchar *name;
- /* initialize the size when needed */
- if (G_UNLIKELY (plugin->initial_size == -1))
- xfce_tray_plugin_size_changed (plugin, xfce_panel_plugin_get_size (plugin->panel_plugin));
-
- /* set size request */
- gtk_widget_set_size_request (icon, plugin->initial_size, plugin->initial_size);
-
/* get the application name */
name = xfce_tray_manager_get_application_name (icon);
@@ -241,7 +236,6 @@
plugin->panel_plugin = panel_plugin;
plugin->manager = NULL;
plugin->show_frame = TRUE;
- plugin->initial_size = -1;
/* create the frame */
plugin->frame = gtk_frame_new (NULL);
@@ -318,22 +312,9 @@
xfce_tray_plugin_size_changed (XfceTrayPlugin *plugin,
guint size)
{
- gint n_rows;
-
/* set the frame border size */
gtk_container_set_border_width (GTK_CONTAINER (plugin->frame), size > SMALL_PANEL_SIZE ? 1 : 0);
- /* get tray rows */
- n_rows = xfce_tray_widget_get_rows (XFCE_TRAY_WIDGET (plugin->tray));
-
- /* calculate the initial tray icon size */
- plugin->initial_size = (size
- - 2 * GTK_CONTAINER (plugin->frame)->border_width
- - 2 * GTK_CONTAINER (plugin->tray)->border_width
- - 2 * MAX (plugin->frame->style->xthickness, plugin->frame->style->ythickness)
- - XFCE_TRAY_WIDGET_SPACING * (n_rows - 1))
- / n_rows;
-
/* we handled the size of the plugin */
return TRUE;
}
Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.h
===================================================================
--- xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.h 2007-11-18 15:05:30 UTC (rev 26368)
+++ xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.h 2007-11-18 17:19:08 UTC (rev 26369)
@@ -34,9 +34,6 @@
GtkWidget *frame;
GtkWidget *tray;
- /* initial icon size */
- gint initial_size;
-
/* properties */
guint show_frame : 1;
};
Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c
===================================================================
--- xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c 2007-11-18 15:05:30 UTC (rev 26368)
+++ xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c 2007-11-18 17:19:08 UTC (rev 26369)
@@ -108,6 +108,9 @@
/* whether it could be hidden */
guint hidden : 1;
+ /* whether the icon is invisible */
+ guint invisible : 1;
+
/* the name of the applcation */
gchar *name;
};
@@ -235,17 +238,43 @@
{
child_info = li->data;
- /* ship hidden icons if needed */
- if (child_info->hidden == FALSE || tray->show_hidden == TRUE)
+ /* get the icons size request */
+ gtk_widget_size_request (child_info->widget, &child_requisition);
+
+ if (G_UNLIKELY (child_requisition.width == 1 || child_requisition.height == 1))
{
- /* get the icons size request */
- gtk_widget_size_request (child_info->widget, &child_requisition);
+ /* don't do anything with already invisible icons */
+ if (child_info->invisible == FALSE)
+ {
+ /* this icon should not be visible */
+ child_info->invisible = TRUE;
- /* get the child size (smallest icon) */
- child_size = MIN (child_size, MAX (child_requisition.width, child_requisition.height));
+ /* decrease the hidden counter if needed */
+ if (child_info->hidden)
+ tray->n_hidden_childeren--;
+ }
+ }
+ else
+ {
+ /* restore icon if it was previously invisible */
+ if (G_UNLIKELY (child_info->invisible))
+ {
+ /* visible icon */
+ child_info->invisible = FALSE;
- /* number of visible childeren */
- n_visible_childeren++;
+ /* update counter */
+ if (child_info->hidden)
+ tray->n_hidden_childeren++;
+ }
+
+ if (child_info->hidden == FALSE || tray->show_hidden == TRUE)
+ {
+ /* update the child size (smallest icon) */
+ child_size = MIN (child_size, MAX (child_requisition.width, child_requisition.height));
+
+ /* increase number of visible childeren */
+ n_visible_childeren++;
+ }
}
}
@@ -366,7 +395,7 @@
{
child_info = li->data;
- if (child_info->hidden && !tray->show_hidden)
+ if (child_info->invisible || (child_info->hidden && !tray->show_hidden))
{
/* put icons offscreen */
child_allocation.x = child_allocation.y = XFCE_TRAY_WIDGET_OFFSCREEN;
@@ -401,7 +430,6 @@
/* allocate widget size */
gtk_widget_size_allocate (child_info->widget, &child_allocation);
- gtk_widget_set_size_request (child_info->widget, child_size, child_size);
}
}
@@ -441,7 +469,7 @@
need_resize = !child_info->hidden;
/* update hidden counter */
- if (child_info->hidden)
+ if (child_info->hidden && !child_info->invisible)
tray->n_hidden_childeren--;
/* remove from list */
@@ -596,6 +624,7 @@
/* create child info */
child_info = panel_slice_new (XfceTrayWidgetChild);
child_info->widget = child;
+ child_info->invisible = FALSE;
child_info->name = g_strdup (name);
child_info->hidden = xfce_tray_widget_name_hidden (tray, child_info->name);
@@ -714,7 +743,7 @@
child_info->hidden = xfce_tray_widget_name_hidden (tray, child_info->name);
/* increase counter if needed */
- if (child_info->hidden)
+ if (child_info->hidden && !child_info->invisible)
n_hidden_childeren++;
}
More information about the Xfce4-commits
mailing list