Author: nick
Date: 2007-09-04 19:26:18 +0000 (Tue, 04 Sep 2007)
New Revision: 26043
Modified:
xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c
Log:
* Add signal to monitor the real panel size.
Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c
===================================================================
--- xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c 2007-09-04
09:01:59 UTC (rev 26042)
+++ xfce4-panel/trunk/plugins/systray/xfce-tray-plugin.c 2007-09-04
19:26:18 UTC (rev 26043)
@@ -46,6 +46,9 @@
XfceScreenPosition position);
static void xfce_tray_plugin_orientation_changed
(XfceTrayPlugin *plugin,
GtkOrientation orientation);
+static void xfce_tray_plugin_size_allocated (GtkWidget
*widget,
+ GtkAllocation
*allocation,
+
XfceTrayPlugin *plugin);
static gboolean xfce_tray_plugin_size_changed
(XfceTrayPlugin *plugin,
guint
size);
static void xfce_tray_plugin_read
(XfceTrayPlugin *plugin);
@@ -201,6 +204,10 @@
/* add the tray */
gtk_container_add (GTK_CONTAINER (plugin->frame), plugin->tray);
gtk_widget_show (plugin->tray);
+
+ /* signal to monitor the real panel size */
+ g_signal_connect (G_OBJECT (panel_plugin), "size-allocate",
+ G_CALLBACK (xfce_tray_plugin_size_allocated),
plugin);
}
else
{
@@ -244,13 +251,37 @@
+static void
+xfce_tray_plugin_size_allocated (GtkWidget *widget,
+ GtkAllocation *allocation,
+ XfceTrayPlugin *plugin)
+{
+ GtkOrientation orientation;
+ gint size;
+
+ /* get the orientation of the plugin */
+ orientation = xfce_panel_plugin_get_orientation (plugin->panel_plugin);
+
+ /* get the allocated size */
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ size = allocation->height;
+ else
+ size = allocation->width;
+
+ /* if the allocated size is bigger, resize the plugin again */
+ if (G_UNLIKELY (size > xfce_panel_plugin_get_size (plugin->panel_plugin)))
+ xfce_tray_plugin_size_changed (plugin, size);
+}
+
+
+
static gboolean
xfce_tray_plugin_size_changed (XfceTrayPlugin *plugin,
guint size)
{
/* set the frame border size */
gtk_container_set_border_width (GTK_CONTAINER (plugin->frame), size > 26 ?
1 : 0);
-
+
/* extract the frame from the size for the tray */
size -= size > 26 ? 6 : 4;
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits