[Xfce4-commits] <xfce4-panel:devel> * Save plugins in the panel_application_save() function. * Remove save from plugin_dispose(). * Add autosave timeout that runs every 10 minutes. * Some small cleanups

Nick Schermer nick at xfce.org
Tue Aug 11 20:22:15 CEST 2009


Updating branch refs/heads/devel
         to 6f857b4daa7863eeee51aa370b58ce7e1382064b (commit)
       from becbb87004cb3689e9039b75b4f49a334ecc9e88 (commit)

commit 6f857b4daa7863eeee51aa370b58ce7e1382064b
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Jun 20 18:54:43 2008 +0200

    * Save plugins in the panel_application_save() function.
    * Remove save from plugin_dispose().
    * Add autosave timeout that runs every 10 minutes.
    * Some small cleanups

 libxfce4panel/xfce-panel-plugin-provider.c |   31 +++++-
 libxfce4panel/xfce-panel-plugin-provider.h |    3 +
 libxfce4panel/xfce-panel-plugin.c          |   32 ++++++-
 panel/panel-application.c                  |   52 +++++++++-
 panel/panel-itembar.c                      |  146 ++++++++++++++--------------
 panel/panel-itembar.h                      |    6 +-
 6 files changed, 181 insertions(+), 89 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin-provider.c b/libxfce4panel/xfce-panel-plugin-provider.c
index 7819be8..7395a13 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.c
+++ b/libxfce4panel/xfce-panel-plugin-provider.c
@@ -125,7 +125,7 @@ xfce_panel_plugin_provider_base_init (gpointer klass)
 const gchar *
 xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider)
 {
-  g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
+  panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
 
   return (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->get_name) (provider);
 }
@@ -135,7 +135,7 @@ xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider)
 const gchar *
 xfce_panel_plugin_provider_get_id (XfcePanelPluginProvider *provider)
 {
-  g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
+  panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
 
   return (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->get_id) (provider);
 }
@@ -146,7 +146,7 @@ void
 xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider,
                                      gint                     size)
 {
-  g_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
 
   (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->set_size) (provider, size);
 }
@@ -157,7 +157,7 @@ void
 xfce_panel_plugin_provider_set_orientation (XfcePanelPluginProvider *provider,
                                             GtkOrientation           orientation)
 {
-  g_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
 
   (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->set_orientation) (provider, orientation);
 }
@@ -168,7 +168,28 @@ void
 xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider,
                                                 XfceScreenPosition       screen_position)
 {
-  g_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
 
   (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->set_screen_position) (provider, screen_position);
 }
+
+
+
+void
+xfce_panel_plugin_provider_set_opacity (XfcePanelPluginProvider *provider,
+                                        gdouble                  opacity)
+{
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+
+  (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->set_opacity) (provider, opacity);
+}
+
+
+
+void
+xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider)
+{
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+
+  (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->save) (provider);
+}
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index 8d68eed..0f99b3c 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -71,6 +71,7 @@ struct _XfcePanelPluginProviderIface
                                        XfceScreenPosition       screen_position);
   void         (*set_opacity)         (XfcePanelPluginProvider *provider,
                                        gdouble                  opacity);
+  void         (*save)                (XfcePanelPluginProvider *provider);
 };
 
 GType        xfce_panel_plugin_provider_get_type            (void) G_GNUC_CONST;
@@ -91,6 +92,8 @@ void         xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProv
 void         xfce_panel_plugin_provider_set_opacity         (XfcePanelPluginProvider *provider,
                                                              gdouble                  opacity);
 
+void         xfce_panel_plugin_provider_save                (XfcePanelPluginProvider *provider);
+
 G_END_DECLS
 
 #endif /* !__XFCE_PANEL_PLUGIN_PROVIDER_H__ */
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 19b974c..9caff29 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -63,6 +63,9 @@ static void         xfce_panel_plugin_set_orientation      (XfcePanelPluginProvi
                                                             GtkOrientation                orientation);
 static void         xfce_panel_plugin_set_screen_position  (XfcePanelPluginProvider      *provider,
                                                             XfceScreenPosition            screen_position);
+static void         xfce_panel_plugin_set_opacity          (XfcePanelPluginProvider      *provider,
+                                                            gdouble                       opacity);
+static void         xfce_panel_plugin_save                 (XfcePanelPluginProvider      *provider);
 static void         xfce_panel_plugin_take_window_notify   (gpointer                      data,
                                                             GObject                      *where_the_object_was);
 
@@ -370,6 +373,8 @@ xfce_panel_plugin_provider_init (XfcePanelPluginProviderIface *iface)
   iface->set_size = xfce_panel_plugin_set_size;
   iface->set_orientation = xfce_panel_plugin_set_orientation;
   iface->set_screen_position = xfce_panel_plugin_set_screen_position;
+  iface->set_opacity = xfce_panel_plugin_set_opacity;
+  iface->save = xfce_panel_plugin_save;
 }
 
 
@@ -461,9 +466,6 @@ xfce_panel_plugin_set_property (GObject      *object,
 static void
 xfce_panel_plugin_dispose (GObject *object)
 {
-  /* let the plugin save its configuration */
-  g_signal_emit (G_OBJECT (object), plugin_signals[SAVE], 0);
-
   /* allow the plugin to cleanup */
   g_signal_emit (G_OBJECT (object), plugin_signals[FREE_DATA], 0);
 
@@ -905,7 +907,7 @@ xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider,
 {
   XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider);
 
-  g_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
 
   /* check if update is required */
   //~ if (G_LIKELY (xfce_panel_plugin_get_screen_position (plugin) != screen_position))
@@ -921,6 +923,28 @@ xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider,
 
 
 static void
+xfce_panel_plugin_set_opacity (XfcePanelPluginProvider *provider,
+                               gdouble                  opacity)
+{
+  //XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider);
+
+  //panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
+}
+
+
+
+static void
+xfce_panel_plugin_save (XfcePanelPluginProvider *provider)
+{
+  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
+
+  /* emit signal */
+  g_signal_emit (G_OBJECT (provider), plugin_signals[SAVE], 0);
+}
+
+
+
+static void
 xfce_panel_plugin_take_window_notify (gpointer  data,
                                       GObject  *where_the_object_was)
 {
diff --git a/panel/panel-application.c b/panel/panel-application.c
index a099bc8..5162b3a 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -42,6 +42,7 @@
 #include <panel/panel-glue.h>
 
 #define PANEL_CONFIG_PATH "xfce4" G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "panels.new.xml"
+#define AUTOSAVE_INTERVAL (10 * 60)
 
 
 
@@ -52,6 +53,7 @@ static void panel_application_load (PanelApplication *application);
 static void panel_application_load_set_property (PanelWindow *window, const gchar *name, const gchar *value);
 static void panel_application_load_start_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer  user_data, GError **error);
 static void panel_application_load_end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error);
+static gboolean panel_application_save_timeout (gpointer user_data);
 static gchar *panel_application_save_xml_contents (PanelApplication *application);
 static void panel_application_window_destroyed (GtkWidget *window, PanelApplication *application);
 
@@ -73,6 +75,9 @@ struct _PanelApplication
 
   /* internal list of opened dialogs */
   GSList  *dialogs;
+
+  /* autosave timeout */
+  guint    autosave_timeout_id;
 };
 
 typedef enum
@@ -131,6 +136,13 @@ panel_application_init (PanelApplication *application)
 
   /* load setup */
   panel_application_load (application);
+
+  /* start the autosave timeout */
+#if GLIB_CHECK_VERSION (2, 14, 0)
+  application->autosave_timeout_id = g_timeout_add_seconds (AUTOSAVE_INTERVAL, panel_application_save_timeout, application);
+#else
+  application->autosave_timeout_id = g_timeout_add (AUTOSAVE_INTERVAL * 1000, panel_application_save_timeout, application);
+#endif
 }
 
 
@@ -143,6 +155,9 @@ panel_application_finalize (GObject *object)
 
   panel_return_if_fail (application->dialogs == NULL);
 
+  /* stop the autosave timeout */
+  g_source_remove (application->autosave_timeout_id);
+
   /* destroy the windows if they are still opened */
   for (li = application->windows; li != NULL; li = li->next)
     {
@@ -584,6 +599,23 @@ panel_application_load_end_element (GMarkupParseContext  *context,
 
 
 
+static gboolean
+panel_application_save_timeout (gpointer user_data)
+{
+  panel_return_val_if_fail (PANEL_IS_APPLICATION (user_data), FALSE);
+
+  GDK_THREADS_ENTER ();
+
+  /* save */
+  panel_application_save (PANEL_APPLICATION (user_data));
+
+  GDK_THREADS_LEAVE ();
+
+  return TRUE;
+}
+
+
+
 static gchar *
 panel_application_save_xml_contents (PanelApplication *application)
 {
@@ -736,10 +768,12 @@ panel_application_get (void)
 void
 panel_application_save (PanelApplication *application)
 {
-  gchar    *filename;
-  gchar    *contents;
-  gboolean  succeed;
-  GError   *error = NULL;
+  gchar     *filename;
+  gchar     *contents;
+  gboolean   succeed;
+  GError    *error = NULL;
+  GSList    *li;
+  GtkWidget *itembar;
 
   panel_return_if_fail (PANEL_IS_APPLICATION (application));
 
@@ -770,6 +804,16 @@ panel_application_save (PanelApplication *application)
       /* print warning */
       g_critical ("Failed to create panel configuration file");
     }
+
+  /* save the settings of all plugins */
+  for (li = application->windows; li != NULL; li = li->next)
+    {
+      /* get the itembar */
+      itembar = gtk_bin_get_child (GTK_BIN (li->data));
+
+      /* save all the plugins on the itembar */
+      gtk_container_foreach (GTK_CONTAINER (itembar), (GtkCallback) xfce_panel_plugin_provider_save, NULL);
+    }
 }
 
 
diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index 3785978..8363945 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -36,38 +36,38 @@
 static void      panel_itembar_class_init       (PanelItembarClass *klass);
 static void      panel_itembar_init             (PanelItembar      *itembar);
 static void      panel_itembar_set_property     (GObject           *object,
-                                                 guint              prop_id, 
-                                                 const GValue      *value, 
+                                                 guint              prop_id,
+                                                 const GValue      *value,
                                                  GParamSpec        *pspec);
 static void      panel_itembar_finalize         (GObject           *object);
 static void      panel_itembar_realize          (GtkWidget         *widget);
 static void      panel_itembar_unrealize        (GtkWidget         *widget);
 static void      panel_itembar_map              (GtkWidget         *widget);
 static void      panel_itembar_unmap            (GtkWidget         *widget);
-static gboolean  panel_itembar_expose_event     (GtkWidget         *widget, 
+static gboolean  panel_itembar_expose_event     (GtkWidget         *widget,
                                                  GdkEventExpose    *event);
-static void      panel_itembar_size_request     (GtkWidget         *widget, 
+static void      panel_itembar_size_request     (GtkWidget         *widget,
                                                  GtkRequisition    *requisition);
-static void      panel_itembar_size_allocate    (GtkWidget         *widget, 
+static void      panel_itembar_size_allocate    (GtkWidget         *widget,
                                                  GtkAllocation     *allocation);
-static gboolean  panel_itembar_drag_motion      (GtkWidget         *widget, 
-                                                 GdkDragContext    *drag_context, 
-                                                 gint               drag_x,      
-                                                 gint               drag_y, 
+static gboolean  panel_itembar_drag_motion      (GtkWidget         *widget,
+                                                 GdkDragContext    *drag_context,
+                                                 gint               drag_x,
+                                                 gint               drag_y,
                                                  guint              time);
-static void      panel_itembar_drag_leave       (GtkWidget         *widget, 
-                                                 GdkDragContext    *drag_context, 
+static void      panel_itembar_drag_leave       (GtkWidget         *widget,
+                                                 GdkDragContext    *drag_context,
                                                  guint              time);
-static void      panel_itembar_add              (GtkContainer      *container, 
+static void      panel_itembar_add              (GtkContainer      *container,
                                                  GtkWidget         *child);
-static void      panel_itembar_remove           (GtkContainer      *container, 
+static void      panel_itembar_remove           (GtkContainer      *container,
                                                  GtkWidget         *child);
-static void      panel_itembar_forall           (GtkContainer      *container, 
-                                                 gboolean           include_internals, 
-                                                 GtkCallback        callback, 
+static void      panel_itembar_forall           (GtkContainer      *container,
+                                                 gboolean           include_internals,
+                                                 GtkCallback        callback,
                                                  gpointer           callback_data);
 static GType     panel_itembar_child_type       (GtkContainer      *container);
-static void      panel_itembar_set_orientation  (PanelItembar      *itembar, 
+static void      panel_itembar_set_orientation  (PanelItembar      *itembar,
                                                  GtkOrientation     orientation);
 
 
@@ -80,10 +80,10 @@ struct _PanelItembarClass
 struct _PanelItembar
 {
   GtkContainer __parent__;
-  
+
   /* window to send all events to the itembar */
   GdkWindow      *event_window;
-  
+
   /* dnd highlight line */
   GdkWindow      *highlight_window;
 
@@ -92,7 +92,7 @@ struct _PanelItembar
 
   /* internal list of children */
   GSList         *children;
-  
+
   /* current sensitivity state */
   guint           sensitive : 1;
 };
@@ -188,13 +188,13 @@ panel_itembar_init (PanelItembar *itembar)
   itembar->highlight_window = NULL;
   itembar->sensitive = TRUE;
   itembar->orientation = GTK_ORIENTATION_HORIZONTAL;
-  
+
   /* setup */
   GTK_WIDGET_SET_FLAGS (GTK_WIDGET (itembar), GTK_NO_WINDOW);
 
   /* don't redraw on allocation */
   gtk_widget_set_redraw_on_allocate (GTK_WIDGET (itembar), FALSE);
-  
+
   /* set the itembar drag destination targets */
   gtk_drag_dest_set (GTK_WIDGET (itembar), GTK_DEST_DEFAULT_MOTION,
                      drop_targets, G_N_ELEMENTS (drop_targets),
@@ -240,10 +240,10 @@ panel_itembar_realize (GtkWidget *widget)
 {
   PanelItembar  *itembar = PANEL_ITEMBAR (widget);
   GdkWindowAttr  attributes;
-  
+
   /* let gtk handle it's own realation first */
   (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->realize) (widget);
-  
+
   /* setup the window attributes */
   attributes.x = widget->allocation.x;
   attributes.y = widget->allocation.y;
@@ -252,10 +252,10 @@ panel_itembar_realize (GtkWidget *widget)
   attributes.wclass = GDK_INPUT_ONLY;
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.event_mask = gtk_widget_get_events (widget);
-  
+
   /* allocate the event window */
   itembar->event_window = gdk_window_new (GDK_WINDOW (widget->window), &attributes, GDK_WA_X | GDK_WA_Y);
-  
+
   /* set the window user data */
   gdk_window_set_user_data (GDK_WINDOW (itembar->event_window), widget);
 }
@@ -266,7 +266,7 @@ static void
 panel_itembar_unrealize (GtkWidget *widget)
 {
   PanelItembar *itembar = PANEL_ITEMBAR (widget);
-  
+
   /* destroy the event window */
   if (G_LIKELY (itembar->event_window))
     {
@@ -274,7 +274,7 @@ panel_itembar_unrealize (GtkWidget *widget)
       gdk_window_destroy (itembar->event_window);
       itembar->event_window = NULL;
     }
-    
+
   (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->unrealize) (widget);
 }
 
@@ -284,13 +284,13 @@ static void
 panel_itembar_map (GtkWidget *widget)
 {
   PanelItembar *itembar = PANEL_ITEMBAR (widget);
-  
+
   /* show the event window */
   if (G_LIKELY (itembar->event_window))
     gdk_window_show (itembar->event_window);
-  
+
   (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->map) (widget);
-  
+
   /* raise the window if we're in insensitive mode */
   if (G_UNLIKELY (!itembar->sensitive && itembar->event_window))
     gdk_window_raise (itembar->event_window);
@@ -302,11 +302,11 @@ static void
 panel_itembar_unmap (GtkWidget *widget)
 {
   PanelItembar *itembar = PANEL_ITEMBAR (widget);
-  
+
   /* hide the event window */
   if (G_LIKELY (itembar->event_window))
     gdk_window_hide (itembar->event_window);
-  
+
   (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->unmap) (widget);
 }
 
@@ -317,13 +317,13 @@ panel_itembar_expose_event (GtkWidget      *widget,
                             GdkEventExpose *event)
 {
   PanelItembar *itembar = PANEL_ITEMBAR (widget);
-  
+
   (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->expose_event) (widget, event);
-  
+
   /* keep our event window on top */
   if (itembar->sensitive == FALSE && itembar->event_window)
     gdk_window_raise (itembar->event_window);
-    
+
   return TRUE;
 }
 
@@ -389,10 +389,10 @@ panel_itembar_size_allocate (GtkWidget     *widget,
 
   /* set widget allocation */
   widget->allocation = *allocation;
-  
+
   /* allocate the event window */
   if (G_LIKELY (itembar->event_window))
-    gdk_window_move_resize (GDK_WINDOW (itembar->event_window), allocation->x, 
+    gdk_window_move_resize (GDK_WINDOW (itembar->event_window), allocation->x,
                             allocation->y, allocation->width, allocation->height);
 
   /* get the border width */
@@ -547,7 +547,7 @@ panel_itembar_drag_motion (GtkWidget      *widget,
   gint           x = 0, y = 0;
   gint           width, height;
   gboolean       is_horizontal;
-  
+
   if (G_UNLIKELY (itembar->highlight_window == NULL))
     {
       /* setup window attributes */
@@ -558,24 +558,24 @@ panel_itembar_drag_motion (GtkWidget      *widget,
       attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
       attributes.width = HIGHLIGHT_THINKNESS;
       attributes.height = HIGHLIGHT_THINKNESS;
-      
+
       /* allocate window */
-      itembar->highlight_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, 
+      itembar->highlight_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
                                                   GDK_WA_VISUAL | GDK_WA_COLORMAP);
-      
+
       /* set user data */
       gdk_window_set_user_data (itembar->highlight_window, widget);
-      
+
       /* set window background */
       gdk_window_set_background (itembar->highlight_window, &widget->style->fg[widget->state]);
     }
-    
+
   /* get orientaion */
   is_horizontal = !!(itembar->orientation == GTK_ORIENTATION_HORIZONTAL);
-    
+
   /* get the drop index */
   drop_index = panel_itembar_get_drop_index (itembar, drag_x, drag_y);
-  
+
   /* get the nth child */
   child = panel_itembar_get_nth_child (itembar, drop_index);
   if (G_LIKELY (child))
@@ -590,32 +590,32 @@ panel_itembar_drag_motion (GtkWidget      *widget,
     {
       /* get the last child */
       child = panel_itembar_get_nth_child (itembar, g_slist_length (itembar->children) - 1);
-      
+
       /* get coordinate at end of the child */
       if (is_horizontal)
         x = child->allocation.x + child->allocation.width;
       else
         y = child->allocation.y + child->allocation.height;
     }
-    
+
   /* get size of the hightlight */
   width = is_horizontal ? HIGHLIGHT_THINKNESS : widget->allocation.width;
   height = is_horizontal ? widget->allocation.height : HIGHLIGHT_THINKNESS;
-  
+
   /* show line between the two children */
   x += HIGHLIGHT_THINKNESS / 2;
   y += HIGHLIGHT_THINKNESS / 2;
-  
+
   /* keep the heightlight window inside the itembar */
   x = CLAMP (x, widget->allocation.x, widget->allocation.x + widget->allocation.width - HIGHLIGHT_THINKNESS);
   y = CLAMP (y, widget->allocation.y, widget->allocation.y + widget->allocation.height - HIGHLIGHT_THINKNESS);
-  
+
   /* move the hightlight window */
   gdk_window_move_resize (itembar->highlight_window, x, y, width, height);
-  
+
   /* show the window */
   gdk_window_show (itembar->highlight_window);
-  
+
   return TRUE;
 }
 
@@ -627,7 +627,7 @@ panel_itembar_drag_leave (GtkWidget      *widget,
                           guint           time)
 {
   PanelItembar *itembar = PANEL_ITEMBAR (widget);
-  
+
   /* destroy the drag highlight window */
   if (G_LIKELY (itembar->highlight_window))
     {
@@ -757,13 +757,13 @@ panel_itembar_set_sensitive (PanelItembar *itembar,
 {
   PanelItembarChild *child;
   GSList            *li;
-  
+
   panel_return_if_fail (PANEL_IS_ITEMBAR (itembar));
   panel_return_if_fail (itembar->event_window == NULL || GDK_IS_WINDOW (itembar->event_window));
-  
+
   /* set internal value */
   itembar->sensitive = !!sensitive;
-  
+
   /* raise or lower the event window */
   if (G_LIKELY (itembar->event_window))
     {
@@ -772,13 +772,13 @@ panel_itembar_set_sensitive (PanelItembar *itembar,
       else
         gdk_window_raise (itembar->event_window);
     }
-    
+
   /* walk the children */
   for (li = itembar->children; li != NULL; li = li->next)
     {
       /* get child */
       child = li->data;
-      
+
       /* set widget sensitivity */
       gtk_widget_set_sensitive (child->widget, sensitive);
     }
@@ -939,7 +939,7 @@ panel_itembar_get_child_index (PanelItembar *itembar,
   panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), -1);
   panel_return_val_if_fail (GTK_IS_WIDGET (widget), -1);
   panel_return_val_if_fail (widget->parent == GTK_WIDGET (itembar), -1);
-  
+
   /* walk the children to find the child widget */
   for (idx = 0, li = itembar->children; li != NULL; li = li->next, idx++)
     {
@@ -973,7 +973,7 @@ panel_itembar_get_nth_child (PanelItembar *itembar,
 
 
 
-guint           
+guint
 panel_itembar_get_drop_index (PanelItembar  *itembar,
                               gint           x,
                               gint           y)
@@ -983,29 +983,29 @@ panel_itembar_get_drop_index (PanelItembar  *itembar,
   GtkAllocation     *allocation;
   gboolean           is_horizontal;
   guint              idx;
-  
+
   panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), 0);
-  
+
   /* add the itembar position */
   x += GTK_WIDGET (itembar)->allocation.x;
   y += GTK_WIDGET (itembar)->allocation.y;
-  
+
   /* whether the itembar is horizontal */
   is_horizontal = !!(itembar->orientation == GTK_ORIENTATION_HORIZONTAL);
-  
+
   for (li = itembar->children, idx = 0; li != NULL; li = li->next, idx++)
     {
       child = li->data;
-      
+
       /* get the child allocation */
       allocation = &(child->widget->allocation);
-      
+
       /* check if the drop index is before the half of the allocation */
       if ((is_horizontal && x < (allocation->x + allocation->width / 2))
           || (!is_horizontal && y < (allocation->y + allocation->height / 2)))
         break;
     }
-    
+
   return idx;
 }
 
@@ -1019,21 +1019,21 @@ panel_itembar_get_child_at_position (PanelItembar *itembar,
   PanelItembarChild *child;
   GSList            *li;
   GtkAllocation     *allocation;
-  
+
   panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), NULL);
-  
+
   for (li = itembar->children; li != NULL; li = li->next)
     {
       child = li->data;
-      
+
       /* get the child allocation */
       allocation = &(child->widget->allocation);
-      
+
       /* check if the coordinate is inside the allocation */
       if (x >= allocation->x && x <= (allocation->x + allocation->width)
           && y >= allocation->y && y <= (allocation->y + allocation->height))
         return child->widget;
     }
-    
+
   return NULL;
 }
diff --git a/panel/panel-itembar.h b/panel/panel-itembar.h
index bb60c60..d7c1c5e 100644
--- a/panel/panel-itembar.h
+++ b/panel/panel-itembar.h
@@ -58,18 +58,18 @@ void            panel_itembar_set_child_expand      (PanelItembar   *itembar,
                                                      GtkWidget      *widget,
                                                      gboolean        expand);
 
-guint           panel_itembar_get_n_children        (PanelItembar   *itembar);
+GSList         *panel_itembar_get_children          (PanelItembar   *itembar);
 
 gint            panel_itembar_get_child_index       (PanelItembar   *itembar,
                                                      GtkWidget      *widget);
 
 GtkWidget      *panel_itembar_get_nth_child         (PanelItembar   *itembar,
                                                      guint           idx);
-                                                     
+
 guint           panel_itembar_get_drop_index        (PanelItembar   *itembar,
                                                      gint            x,
                                                      gint            y);
-                                                
+
 GtkWidget      *panel_itembar_get_child_at_position (PanelItembar   *itembar,
                                                      gint            x,
                                                      gint            y);



More information about the Xfce4-commits mailing list