Author: jasper
Date: 2007-10-01 19:21:50 +0000 (Mon, 01 Oct 2007)
New Revision: 26124

Modified:
   xfce4-panel/trunk/ChangeLog
   xfce4-panel/trunk/libxfce4panel/xfce-panel-plugin-iface.c
   xfce4-panel/trunk/panel/panel-properties.c
   xfce4-panel/trunk/plugins/windowlist/windowlist.c
Log:
* libxfce4panel/xfce-panel-plugin-iface.c,
  panel/panel-properties.c: To prevent panel items from increasing the
  panel size, set the height of the XfceItembar instead of setting the
  size specifically for all items.
* libxfce4panel/xfce-panel-plugin-iface.c: Allow attach_widget to be
  NULL in call to xfce_panel_plugin_position_widget() and fix up the
  API documentation. Patch by Diego Ongaro and a few bits from me.
* plugins/windowlist/windowlist.c: fix for popup menu at pointer
  position. Another patch by Diego.


Modified: xfce4-panel/trunk/ChangeLog
===================================================================
--- xfce4-panel/trunk/ChangeLog 2007-10-01 19:05:51 UTC (rev 26123)
+++ xfce4-panel/trunk/ChangeLog 2007-10-01 19:21:50 UTC (rev 26124)
@@ -1,3 +1,15 @@
+2007-10-01 21:21 jasper
+
+        * libxfce4panel/xfce-panel-plugin-iface.c,
+          panel/panel-properties.c: To prevent panel items from increasing the
+          panel size, set the height of the XfceItembar instead of setting the
+          size specifically for all items.
+        * libxfce4panel/xfce-panel-plugin-iface.c: Allow attach_widget to be
+          NULL in call to xfce_panel_plugin_position_widget() and fix up the
+          API documentation. Patch by Diego Ongaro and a few bits from me.
+        * plugins/windowlist/windowlist.c: fix for popup menu at pointer
+          position. Another patch by Diego.
+
 2007-09-30 20:14 jasper
 
        * libxfce4panel/xfce-panel-plugin-iface.c,

Modified: xfce4-panel/trunk/libxfce4panel/xfce-panel-plugin-iface.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-panel-plugin-iface.c   2007-10-01 
19:05:51 UTC (rev 26123)
+++ xfce4-panel/trunk/libxfce4panel/xfce-panel-plugin-iface.c   2007-10-01 
19:21:50 UTC (rev 26124)
@@ -343,9 +343,7 @@
 _xfce_panel_plugin_signal_size (XfcePanelPlugin *plugin,
                                 gint             size)
 {
-    gboolean       handled = FALSE;
-    GtkOrientation orientation;
-    gint           width, height;
+    gboolean handled = FALSE;
 
     _panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
 
@@ -358,20 +356,6 @@
         /* size was not handled by the plugin, so we set it */
         gtk_widget_set_size_request (GTK_WIDGET (plugin), size, size);
     }
-    else
-    {
-        /* get the orientation of the panel */
-        orientation = xfce_panel_plugin_get_orientation (plugin);
-
-        /* get the requested plugin size */
-        gtk_widget_get_size_request (GTK_WIDGET (plugin), &width, &height);
-
-        /* force the plugin size */
-        if (orientation == GTK_ORIENTATION_HORIZONTAL)
-            gtk_widget_set_size_request (GTK_WIDGET (plugin), width, size);
-        else
-            gtk_widget_set_size_request (GTK_WIDGET (plugin), size, height);
-    }
 }
 
 
@@ -705,7 +689,7 @@
 
 
 /**
- * _xfce_panel_plugin_move:
+ * xfce_panel_plugin_move:
  * @plugin : a #XfcePanelPlugin
  *
  * Ask the panel to start a move operation.
@@ -724,7 +708,15 @@
  * @menu   : a #GtkMenu that will be opened
  *
  * Register an open menu. This will make sure the panel will properly handle
- * its autohide behaviour.
+ * its autohide behaviour. You have to call this function every time the menu
+ * is opened (e.g. using gtk_popup_menu()).
+ *
+ * If you want to open the menu aligned to the side of the panel (and the
+ * plugin), you should use xfce_panel_plugin_position_menu() as
+ * #GtkMenuPositionFunc. This callback function will take care of calling
+ * xfce_panel_plugin_register_menu() as well.
+ *
+ * See also: xfce_panel_plugin_position_menu().
  **/
 void
 xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin,
@@ -1336,11 +1328,13 @@
  * @x             : return location for the x coordinate
  * @y             : return location for the y coordinate
  *
- * The menu widget is positioned relative to the plugin. This function is
- *  intended for custom menu widgets. 
+ * The menu widget is positioned relative to @attach_widget.
+ * If @attach_widget is NULL, the menu widget is instead positioned
+ * relative to @panel_plugin.
  *
+ * This function is intended for custom menu widgets. 
  * For a regular #GtkMenu you should use xfce_panel_plugin_position_menu()
- *  instead (as callback argument to gtk_menu_popup()).
+ * instead (as callback argument to gtk_menu_popup()).
  *
  * See also: xfce_panel_plugin_position_menu().
  **/
@@ -1356,10 +1350,13 @@
     GdkRectangle    geom;
     gint            mon;
 
-    g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
-    g_return_if_fail (GTK_IS_WIDGET (menu_widget));
-    g_return_if_fail (GTK_IS_WIDGET (attach_widget));
+    _panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
+    _panel_return_if_fail (GTK_IS_WIDGET (menu_widget));
+    _panel_return_if_fail (attach_widget == NULL || GTK_IS_WIDGET 
(attach_widget));
 
+    if (attach_widget == NULL)
+        attach_widget = GTK_WIDGET (plugin);
+
     if (!GTK_WIDGET_REALIZED (menu_widget))
         gtk_widget_realize (menu_widget);
 
@@ -1416,14 +1413,14 @@
  * @panel_plugin : a pointer to an #XfcePanelPlugin 
  *
  * Function to be used as #GtkMenuPositionFunc in a call to gtk_menu_popup(). 
- *  As data argument it needs an #XfcePanelPlugin.
+ * As data argument it needs an #XfcePanelPlugin.
  *
- * The menu is normally positioned relative to @attach_widget. If you want the
- *  menu to be positioned relative to another widget, you can use 
- *  gtk_menu_attach_to_widget() to explicitly set a 'parent' widget.
+ * The menu is normally positioned relative to @panel_plugin. If you want the
+ * menu to be positioned relative to another widget, you can use 
+ * gtk_menu_attach_to_widget() to explicitly set a 'parent' widget.
  *
  * As a convenience, xfce_panel_plugin_position_menu() calls 
- *  xfce_panel_plugin_register_menu() for the menu.
+ * xfce_panel_plugin_register_menu() for the menu.
  *
  * <example>
  * void
@@ -1438,7 +1435,7 @@
  * </example>
  *
  * For a custom widget that will be used as a popup menu, use 
- *  xfce_panel_plugin_position_widget() instead.
+ * xfce_panel_plugin_position_widget() instead.
  *
  * See also: gtk_menu_popup().
  **/
@@ -1452,8 +1449,7 @@
     XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (panel_plugin);
     GtkWidget       *attach_widget;
 
-    if ((attach_widget = gtk_menu_get_attach_widget (menu)) == NULL)
-        attach_widget = GTK_WIDGET (plugin);
+    attach_widget = gtk_menu_get_attach_widget (menu);
 
     xfce_panel_plugin_position_widget (plugin, 
                                        GTK_WIDGET (menu), 

Modified: xfce4-panel/trunk/panel/panel-properties.c
===================================================================
--- xfce4-panel/trunk/panel/panel-properties.c  2007-10-01 19:05:51 UTC (rev 
26123)
+++ xfce4-panel/trunk/panel/panel-properties.c  2007-10-01 19:21:50 UTC (rev 
26124)
@@ -1297,6 +1297,15 @@
 
     priv = panel->priv;
 
+    if (xfce_screen_position_is_horizontal (priv->screen_position))
+    {
+        gtk_widget_set_size_request (priv->itembar, -1, size);
+    }
+    else
+    {
+        gtk_widget_set_size_request (priv->itembar, size, -1);
+    }
+
     if (size != priv->size)
     {
         priv->size = size;

Modified: xfce4-panel/trunk/plugins/windowlist/windowlist.c
===================================================================
--- xfce4-panel/trunk/plugins/windowlist/windowlist.c   2007-10-01 19:05:51 UTC 
(rev 26123)
+++ xfce4-panel/trunk/plugins/windowlist/windowlist.c   2007-10-01 19:21:50 UTC 
(rev 26124)
@@ -656,7 +656,8 @@
     gtk_widget_show_all (menu);
 
     gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
-                    xfce_panel_plugin_position_menu, wl->plugin,
+                    at_pointer ? NULL : xfce_panel_plugin_position_menu,
+                    at_pointer ? NULL : wl->plugin,
                     ev ? ev->button : 0, 
                     ev ? ev->time : gtk_get_current_event_time());
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to