Updating branch refs/heads/andrzejr/deskbar-length-adjust
         to f284ad33fe00ed3d9cdb5b14040e7d282b13ee38 (commit)
       from ef2cb2d7b5e5d3da18574387e2612ede2df67a72 (commit)

commit f284ad33fe00ed3d9cdb5b14040e7d282b13ee38
Author: Andrzej <[email protected]>
Date:   Tue Dec 20 02:05:39 2011 +0900

    xfce-panel-plugin: added a virtual method xfce_panel_plugin_lenght_adjust
    
    This method is to be used for asking shrinking plugins to adjust their 
length based on the proposed length of the allocation area. This can be used 
for example to limit their minimum sizes or implement more complex sizing 
policies (such as non-continuous resizing during shrinking). A default noop 
implementation is provided in the xfce-panel-plugin so the change should be 
transparent to other plugins.
    
    TODO add support for the same functionality in the external plugins.

 libxfce4panel/xfce-panel-plugin.c |   39 +++++++++++++++++++++++++++++++++++++
 libxfce4panel/xfce-panel-plugin.h |    5 +++-
 2 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin.c 
b/libxfce4panel/xfce-panel-plugin.c
index 80adb0f..acf20b0 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -113,6 +113,8 @@ static void          xfce_panel_plugin_take_window_notify   
  (gpointer
                                                                GObject         
                 *where_the_object_was);
 static void          xfce_panel_plugin_menu_item_destroy      (GtkWidget       
                 *item,
                                                                XfcePanelPlugin 
                 *plugin);
+static gint          xfce_panel_plugin_real_length_adjust     (XfcePanelPlugin 
                 *plugin,
+                                                               gint            
                  length);
 
 
 
@@ -216,6 +218,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
   g_type_class_add_private (klass, sizeof (XfcePanelPluginPrivate));
 
   klass->construct = NULL;
+  klass->length_adjust = xfce_panel_plugin_real_length_adjust;
 
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->constructor = xfce_panel_plugin_constructor;
@@ -2728,5 +2731,41 @@ xfce_panel_plugin_save_location (XfcePanelPlugin *plugin,
 
 
 
+static gint
+xfce_panel_plugin_real_length_adjust (XfcePanelPlugin *plugin,
+                                      gint             length)
+{
+  return length;
+}
+
+
+
+/**
+ * xfce_panel_plugin_length_adjust:
+ * @plugin : an #XfcePanelPlugin.
+ * @length : a proposed length of the allocated area.
+ *
+ * To be called back from the itembar object for shrinking plugins.
+ * Returns an adjusted length of allocated area.
+ * Reimplement this method to implement more complex sizing policies
+ * such as minimum size, non-continuous resizing etc.
+ *
+ * Returns: an adjusted length of the allocated area.
+ *          In the default implementation the adjusted length is equal
+ *          to the proposed length.
+ *
+ * Since: 4.10
+ **/
+gint
+xfce_panel_plugin_length_adjust (XfcePanelPlugin *plugin,
+                                 gint             length)
+{
+  g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), length);
+
+  return XFCE_PANEL_PLUGIN_GET_CLASS (plugin)->length_adjust (plugin, length);
+}
+
+
+
 #define __XFCE_PANEL_PLUGIN_C__
 #include <libxfce4panel/libxfce4panel-aliasdef.c>
diff --git a/libxfce4panel/xfce-panel-plugin.h 
b/libxfce4panel/xfce-panel-plugin.h
index 37c3a63..715ef55 100644
--- a/libxfce4panel/xfce-panel-plugin.h
+++ b/libxfce4panel/xfce-panel-plugin.h
@@ -132,10 +132,11 @@ struct _XfcePanelPluginClass
                                        XfcePanelPluginMode mode);
   void     (*nrows_changed)           (XfcePanelPlugin    *plugin,
                                        guint               rows);
+  gint     (*length_adjust)           (XfcePanelPlugin    *plugin,
+                                       gint                length);
 
   /*< private >*/
   void (*reserved1) (void);
-  void (*reserved2) (void);
 };
 
 
@@ -243,6 +244,8 @@ gchar                *xfce_panel_plugin_lookup_rc_file      
(XfcePanelPlugin   *
 
 gchar                *xfce_panel_plugin_save_location       (XfcePanelPlugin   
*plugin,
                                                              gboolean          
 create) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+gint                  xfce_panel_plugin_length_adjust       (XfcePanelPlugin   
*plugin,
+                                                             gint              
 length);
 
 G_END_DECLS
 
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to