[maemo-commits] [maemo-commits] r12554 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jun 29 16:16:48 EEST 2007
Author: moimart
Date: 2007-06-29 16:16:36 +0300 (Fri, 29 Jun 2007)
New Revision: 12554

Added:
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.h
Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/Makefile.am
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
   projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c
Log:
2007-06-29  Moises Martinez  <moises.martinez at nokia.com>

        * libhildondesktop/Makefile.am:
        * libhildondesktop/hildon-desktop-container.c:
        - New interface for creating composited containers (containers made
        out of more than one container)
        * libhildondesktop/hildon-desktop-panel-expandable.c:
        (hildon_desktop_panel_expandable_container_init),
        (hildon_desktop_panel_expandable_class_init),
        (hildon_desktop_panel_expandable_constructor),
        (hildon_desktop_panel_expandable_get_children),
        (hildon_desktop_panel_expandable_cadd),
        (hildon_desktop_panel_expandable_cremove),
        (hildon_desktop_panel_expandable_set_property),
        (hildon_desktop_panel_expandable_button_destroyed),
        (hildon_desktop_panel_expandable_add_button),
        (hildon_desktop_panel_expandable_add_in_extension),
        (hildon_desktop_panel_expandable_arrange_items),
        (hildon_desktop_panel_expandable_requeue_last_in_panel):
        - Fixing reorder when new configuration is loaded.
        * src/hd-plugin-manager.c: (hd_plugin_manager_sync):
        - Check if the container is a HildonDesktopContainer when syncing.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-29 12:54:43 UTC (rev 12553)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-29 13:16:36 UTC (rev 12554)
@@ -1,3 +1,26 @@
+2007-06-29  Moises Martinez  <moises.martinez at nokia.com>
+
+	* libhildondesktop/Makefile.am:
+	* libhildondesktop/hildon-desktop-container.c:
+	- New interface for creating composited containers (containers made
+	out of more than one container)
+	* libhildondesktop/hildon-desktop-panel-expandable.c:
+	(hildon_desktop_panel_expandable_container_init),
+	(hildon_desktop_panel_expandable_class_init),
+	(hildon_desktop_panel_expandable_constructor),
+	(hildon_desktop_panel_expandable_get_children),
+	(hildon_desktop_panel_expandable_cadd),
+	(hildon_desktop_panel_expandable_cremove),
+	(hildon_desktop_panel_expandable_set_property),
+	(hildon_desktop_panel_expandable_button_destroyed),
+	(hildon_desktop_panel_expandable_add_button),
+	(hildon_desktop_panel_expandable_add_in_extension),
+	(hildon_desktop_panel_expandable_arrange_items),
+	(hildon_desktop_panel_expandable_requeue_last_in_panel):
+	- Fixing reorder when new configuration is loaded.
+	* src/hd-plugin-manager.c: (hd_plugin_manager_sync):
+	- Check if the container is a HildonDesktopContainer when syncing.
+
 2007-06-29  Johan Bilien  <johan.bilien at nokia.com>
 
 	* libhildondesktop/hildon-desktop-home-item.c:

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/Makefile.am	2007-06-29 12:54:43 UTC (rev 12553)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/Makefile.am	2007-06-29 13:16:36 UTC (rev 12554)
@@ -16,6 +16,7 @@
 	hildon-desktop-popup-window.h \
 	hildon-desktop-popup-menu.h   \
 	hildon-desktop-panel.h        \
+	hildon-desktop-container.h    \
 	hildon-desktop-multiscreen.h  \
 	hildon-desktop-panel-expandable.h \
 	hildon-desktop-notification-manager.h \
@@ -88,6 +89,8 @@
 	hildon-desktop-item-plug.c           \
 	hildon-desktop-plugin.h              \
 	hildon-desktop-plugin.c              \
+	hildon-desktop-container.h	     \
+	hildon-desktop-container.c	     \
 	hildon-desktop-window.h              \
 	hildon-desktop-window.c              \
 	hildon-desktop-panel.h               \

Added: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.c	2007-06-29 12:54:43 UTC (rev 12553)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.c	2007-06-29 13:16:36 UTC (rev 12554)
@@ -0,0 +1,101 @@
+/*
+ * This file is part of maemo-af-desktop
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Author:  Moises Martinez <moises.martinez at nokia.com>
+ * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include "hildon-desktop-container.h"
+#include <gtk/gtkcontainer.h>
+
+static void hildon_desktop_container_base_init (gpointer g_class);
+
+GType 
+hildon_desktop_container_get_type (void)
+{
+  static GType container_type = 0;
+
+  if (!container_type)
+  {
+    static const GTypeInfo container_info =
+    {
+      sizeof (HildonDesktopContainerIface), /* class_size */
+      hildon_desktop_container_base_init,   /* base_init */
+      NULL,		/* base_finalize */
+      NULL,
+      NULL,		/* class_finalize */
+      NULL,		/* class_data */
+      0,
+      0,
+      NULL
+    };
+
+    container_type =
+      g_type_register_static (G_TYPE_INTERFACE, "HildonDesktopContainer",
+			      &container_info, 0);
+
+    g_type_interface_add_prerequisite (container_type, GTK_TYPE_CONTAINER);
+    
+  }
+
+  return container_type;
+}
+
+static void
+hildon_desktop_container_base_init (gpointer g_class)
+{
+  static gboolean initialized = FALSE;
+
+  if (!initialized)
+  {
+  /*FIXME: Do we have to initialize anything? */
+  }
+}
+
+GList *
+hildon_desktop_container_get_children (HildonDesktopContainer *container)
+{
+  HildonDesktopContainerIface *iface;
+
+  g_return_val_if_fail (HILDON_DESKTOP_IS_CONTAINER (container), NULL);
+
+  iface = HILDON_DESKTOP_CONTAINER_GET_IFACE (container);
+
+  g_return_val_if_fail (iface != NULL, NULL);
+  g_return_val_if_fail (iface->get_children != NULL, NULL);
+
+  return (* iface->get_children) (container); 
+}	
+
+void 
+hildon_desktop_container_remove (HildonDesktopContainer *container, GtkWidget *widget)
+{
+  HildonDesktopContainerIface *iface;
+
+  g_return_if_fail (HILDON_DESKTOP_IS_CONTAINER (container));
+
+  iface = HILDON_DESKTOP_CONTAINER_GET_IFACE (container);
+
+  g_return_if_fail (iface != NULL);
+  g_return_if_fail (iface->remove != NULL);
+
+  return (* iface->remove) (container,widget); 
+}

Added: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.h	2007-06-29 12:54:43 UTC (rev 12553)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-container.h	2007-06-29 13:16:36 UTC (rev 12554)
@@ -0,0 +1,58 @@
+/*
+ * This file is part of maemo-af-desktop
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Author:  Moises Martinez <moises.martinez at nokia.com>
+ * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __HILDON_DESKTOP_CONTAINER_H__
+#define __HILDON_DESKTOP_CONTAINER_H__
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define HILDON_DESKTOP_TYPE_CONTAINER           (hildon_desktop_container_get_type ())
+#define HILDON_DESKTOP_CONTAINER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), HILDON_DESKTOP_TYPE_CONTAINER, HildonDesktopContainer))
+#define HILDON_DESKTOP_IS_CONTAINER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_DESKTOP_TYPE_CONTAINER))
+#define HILDON_DESKTOP_CONTAINER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), HILDON_DESKTOP_TYPE_CONTAINER, HildonDesktopContainerIface))
+
+typedef struct _HildonDesktopContainer HildonDesktopContainer;
+typedef struct _HildonDesktopContainerIface HildonDesktopContainerIface;
+
+struct _HildonDesktopContainerIface
+{
+  GTypeInterface g_iface;
+	
+  GList *(*get_children) (HildonDesktopContainer *container);
+
+  void   (*remove) (HildonDesktopContainer *container, GtkWidget *widget);
+};
+
+GType hildon_desktop_container_get_type (void);
+
+GList *hildon_desktop_container_get_children (HildonDesktopContainer *container);
+void   hildon_desktop_container_remove (HildonDesktopContainer *container, GtkWidget *widget);
+
+G_END_DECLS
+
+#endif/*__HILDON_DESKTOP_CONTAINER_H__*/

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-06-29 12:54:43 UTC (rev 12553)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-06-29 13:16:36 UTC (rev 12554)
@@ -33,6 +33,7 @@
 #include <gdk/gdkx.h>
 #include <gdk/gdkevents.h>
 #include <libhildondesktop/statusbar-item-socket.h>
+#include <libhildondesktop/hildon-desktop-container.h>
 #include <gtk/gtkinvisible.h>
 #define SYSTEM_TRAY_REQUEST_DOCK    0
 #define SYSTEM_TRAY_BEGIN_MESSAGE   1
@@ -47,8 +48,14 @@
 #define HSB_ARROW_ICON_SIZE HSB_ITEM_WIDTH
 #define HSB_ARROW_ICON_NAME "qgn_stat_more"
 
-G_DEFINE_TYPE (HildonDesktopPanelExpandable, hildon_desktop_panel_expandable, HILDON_DESKTOP_TYPE_PANEL);
+#define gtk_container_parent_remove(container,widget) GTK_CONTAINER_CLASS(hildon_desktop_panel_expandable_parent_class)->remove(container,widget)
 
+static void hildon_desktop_panel_expandable_container_init (HildonDesktopContainerIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (HildonDesktopPanelExpandable, hildon_desktop_panel_expandable, HILDON_DESKTOP_TYPE_PANEL,
+			 G_IMPLEMENT_INTERFACE (HILDON_DESKTOP_TYPE_CONTAINER,
+                                                hildon_desktop_panel_expandable_container_init));
+
 enum 
 {
   SIGNAL_QUEUED_BUTTON,
@@ -103,7 +110,7 @@
 
 static void hildon_desktop_panel_expandable_cadd (GtkContainer *container, GtkWidget *widget);
 
-static void hildon_desktop_panel_expandable_cremove (GtkContainer *container, GtkWidget *widget);
+static void hildon_desktop_panel_expandable_cremove (HildonDesktopContainer *container, GtkWidget *widget);
 
 static void hildon_desktop_panel_expandable_add_button (HildonDesktopPanel *panel, GtkWidget *widget);
 
@@ -123,13 +130,25 @@
 
 static void hildon_desktop_panel_expandable_resize_notify (HildonDesktopPanelExpandable *panel);
 
+static void hildon_desktop_panel_expandable_requeue_last_in_panel (HildonDesktopPanelExpandable *panel);
+
 #ifdef SYSTRAY_SUPPORT
 static void hildon_desktop_panel_expandable_init_systray (HildonDesktopPanelExpandable *panel, gpointer data);
 static GdkFilterReturn hildon_desktop_x_event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer _panel);
 static void hildon_desktop_panel_embed_applet (HildonDesktopPanelExpandable *panel, Window wid);
 #endif
 
+static GList *
+hildon_desktop_panel_expandable_get_children (HildonDesktopContainer *container);
+
 static void 
+hildon_desktop_panel_expandable_container_init (HildonDesktopContainerIface *iface)
+{
+  iface->get_children = hildon_desktop_panel_expandable_get_children;
+  iface->remove = hildon_desktop_panel_expandable_cremove;
+}
+
+static void 
 hildon_desktop_panel_expandable_class_init (HildonDesktopPanelExpandableClass *panel_class)
 {
   GObjectClass      *object_class    = G_OBJECT_CLASS      (panel_class);
@@ -142,7 +161,6 @@
   hildon_panel_class->add_button = hildon_desktop_panel_expandable_add_button;
 
   container_class->add    = hildon_desktop_panel_expandable_cadd;
-  container_class->remove = hildon_desktop_panel_expandable_cremove;
 
   object_class->constructor  = hildon_desktop_panel_expandable_constructor;
   object_class->finalize     = hildon_desktop_panel_expandable_finalize;
@@ -152,7 +170,7 @@
 
   g_object_class_install_property (object_class,
                                    PROP_ITEMS_P_ROW,
-                                   g_param_spec_uint ("items_row",
+                                   g_param_spec_uint ("items-row",
                                                      "itemsrow",
                                                      "Number of items per row",
                                                      1,
@@ -184,8 +202,8 @@
   panel->priv = HILDON_DESKTOP_PANEL_EXPANDABLE_GET_PRIVATE (panel);
 
   panel->priv->items_p_row = 
-      panel->priv->n_items = 
-      panel->priv->current_position = 0;
+  panel->priv->n_items = 
+  panel->priv->current_position = 0;
   
   panel->priv->items = g_hash_table_new_full (g_str_hash,
 		  			      g_str_equal,
@@ -315,7 +333,7 @@
   gtk_widget_show (GTK_WIDGET (panel->priv->extension_table));
 
   g_signal_connect (object,
-		    "notify::items_row",
+		    "notify::items-row",
 		    G_CALLBACK (hildon_desktop_panel_expandable_resize_notify),
 		    NULL);
 
@@ -365,24 +383,69 @@
   G_OBJECT_CLASS (hildon_desktop_panel_expandable_parent_class)->finalize (object);
 }
 
+static GList *
+hildon_desktop_panel_expandable_get_children (HildonDesktopContainer *container)
+{
+  HildonDesktopPanelExpandable *panel = HILDON_DESKTOP_PANEL_EXPANDABLE (container);
+  GList *children_panel, *children_table, *l, *retval = NULL;
+
+  children_panel = gtk_container_get_children (GTK_CONTAINER (panel));
+  children_table = gtk_container_get_children (GTK_CONTAINER (panel->priv->extension_table));
+
+  for (l = children_panel ; l ; l = g_list_next (l))
+  {	 
+    if (panel->priv->arrow != l->data)
+      retval = g_list_append (retval, l->data);
+  }
+  for (l = children_table ; l ; l = g_list_next (l))
+    retval = g_list_append (retval, l->data);	  
+
+  return retval;
+}	
+
 static void 
 hildon_desktop_panel_expandable_cadd (GtkContainer *container, GtkWidget *widget)
 {
+  GList *children;	
   g_return_if_fail (HILDON_DESKTOP_IS_PANEL_EXPANDABLE (container));
 
+  children = gtk_container_get_children (container);
+/*
+  if (children && 
+      g_list_length (children) == 1 &&
+      children->data == HILDON_DESKTOP_PANEL_EXPANDABLE (container)->priv->arrow)
+  {
+    gtk_container_parent_remove (container,HILDON_DESKTOP_PANEL_EXPANDABLE (container)->priv->arrow);
+  }	  
+*/
+  if (widget == HILDON_DESKTOP_PANEL_EXPANDABLE (container)->priv->arrow)
+    return;	  
+
   hildon_desktop_panel_expandable_add_button (HILDON_DESKTOP_PANEL (container), widget);
 }
 
 static void 
-hildon_desktop_panel_expandable_cremove (GtkContainer *container, GtkWidget *widget)
+hildon_desktop_panel_expandable_cremove (HildonDesktopContainer *container, GtkWidget *widget)
 {
   HildonDesktopPanelExpandable *panel;
+  panel = HILDON_DESKTOP_PANEL_EXPANDABLE (container);
 
-  GTK_CONTAINER_CLASS (hildon_desktop_panel_expandable_parent_class)->remove (container, widget);
+  if (widget == panel->priv->arrow)
+  {	  
+    gtk_container_remove (GTK_CONTAINER (container), widget);
+    return;
+  }
 
-  panel = HILDON_DESKTOP_PANEL_EXPANDABLE (container);
+  panel->priv->n_items--; 
 
-  panel->priv->n_items--; 
+  if (panel->priv->n_items < panel->priv->items_p_row && panel->priv->arrow && panel->priv->arrow->parent == GTK_WIDGET (container))
+    gtk_container_remove (GTK_CONTAINER (container), panel->priv->arrow);	  
+
+  if (widget->parent == GTK_WIDGET (container))
+    gtk_container_remove (GTK_CONTAINER (container), widget);
+  else
+  if (widget->parent == GTK_WIDGET (panel->priv->extension_table))
+    gtk_container_remove (GTK_CONTAINER (panel->priv->extension_table), widget);
 }
 
 static void 
@@ -428,7 +491,7 @@
       new_items_p_row =  g_value_get_uint (value);
       
       if (panel->priv->items_p_row != 0 && panel->priv->items_p_row != new_items_p_row)
-	g_object_notify (object,"items_row");
+	g_object_notify (object,"items-row");
       
       panel->priv->items_p_row = new_items_p_row;
       break;
@@ -442,6 +505,9 @@
 static void 
 hildon_desktop_panel_expandable_button_destroyed (GtkWidget *widget, gpointer _panel)
 {
+  if (!widget && !_panel)
+    return;
+
   g_hash_table_remove (HILDON_DESKTOP_PANEL_EXPANDABLE (_panel)->priv->items,
 		       HILDON_DESKTOP_ITEM (widget)->id);
 }
@@ -475,9 +541,18 @@
 		    (gpointer)panel);
 
   g_object_set (G_OBJECT (item), "position", ex_panel->priv->current_position++, NULL);
+  
+  if ((ex_panel->priv->n_items+2) > ex_panel->priv->items_p_row && (ex_panel->priv->n_items+1) != ex_panel->priv->items_p_row)
+  { 
+    if (STATUSBAR_IS_ITEM (button) && !STATUSBAR_ITEM (button)->condition)
+      g_debug ("Statusbar: Item not visible %s",HILDON_DESKTOP_ITEM (button)->id);
+    else  
+    {	    
+      if ((ex_panel->priv->n_items) == ex_panel->priv->items_p_row)
+        hildon_desktop_panel_expandable_requeue_last_in_panel (ex_panel);	      
+      hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
+    }
 
-  if ((ex_panel->priv->n_items+1) > ex_panel->priv->items_p_row)
-  {
     if (ex_panel->priv->arrow == NULL)
     {
       GtkWidget *arrow = hildon_desktop_panel_expandable_add_arrow (ex_panel);
@@ -485,12 +560,7 @@
       HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,arrow);
       
       ex_panel->priv->arrow = arrow;
-    }
-  
-    if (STATUSBAR_IS_ITEM (button) && !STATUSBAR_ITEM (button)->condition)
-      g_debug ("Statusbar: Item not visible %s",HILDON_DESKTOP_ITEM (button)->id);
-    else  
-      hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
+    } 
   }
   else
   {
@@ -516,10 +586,11 @@
       gtk_object_sink (GTK_OBJECT (item));
       g_object_ref (G_OBJECT (item));
     }
-    
-    g_hash_table_insert (ex_panel->priv->items,
-			 HILDON_DESKTOP_ITEM (item)->id,
-			 (gpointer)item);
+
+    if (GTK_WIDGET (item) != ex_panel->priv->arrow)
+      g_hash_table_insert (ex_panel->priv->items,
+			   HILDON_DESKTOP_ITEM (item)->id,
+			   (gpointer)item);
   }
 }
 
@@ -531,13 +602,18 @@
 	left_attach,
 	right_attach,
 	top_attach,
-	bottom_attach;
+	bottom_attach,
+	division,
+	n_items;
 
-  g_debug ("Adding button in expandable extension");
+  n_items = panel->priv->n_items+1;
 
-  n_rows = (((panel->priv->n_items+1)/panel->priv->items_p_row) + 
-	   ((((panel->priv->n_items+1) % panel->priv->items_p_row) > 0) ? 1 : 0)) - 1;
-	
+  g_debug ("Adding button in expandable extension %d",(gint)((panel->priv->n_items+1) / panel->priv->items_p_row));
+
+  division = ((guint)((n_items+1) / panel->priv->items_p_row));
+
+  n_rows = division + (((n_items+1) % panel->priv->items_p_row) != 0) ? 1 : 0;
+  
   g_object_get (panel->priv->extension_table, "n-rows", &table_rows, NULL);
 
   if (n_rows > table_rows)
@@ -554,17 +630,11 @@
 
   if (1)/*HILDON_DESKTOP_PANEL (panel)->orient == GTK_ORIENTATION_HORIZONTAL)*/
   {	  
-    top_attach    = n_rows-1;
-    bottom_attach = n_rows;
+    top_attach    = division - 1;
+    bottom_attach = division;
 
-    if ((panel->priv->n_items % panel->priv->items_p_row) == 0)
-      left_attach = 0;
-    else 
-      left_attach = (((panel->priv->n_items+1) % panel->priv->items_p_row)) - 1;
+    left_attach = (((n_items+1) % panel->priv->items_p_row)) - 1;
 
-    if (left_attach == -1)
-      left_attach = panel->priv->items_p_row - 1;	    
-
     right_attach = left_attach + 1;
 
     g_debug ("nrows: %d left attach %d right attach %d top attach %d b attach %d",
@@ -635,7 +705,7 @@
       panel->priv->arrow = NULL;
 
     if (!STATUSBAR_IS_ITEM_SOCKET (l->data))
-      gtk_container_remove (GTK_CONTAINER (panel), GTK_WIDGET (l->data));
+      gtk_container_parent_remove (GTK_CONTAINER (panel), GTK_WIDGET (l->data));
   }
 
   for (l = children_table ; l ; l = g_list_next (l))
@@ -643,8 +713,8 @@
     if (!STATUSBAR_IS_ITEM_SOCKET (l->data))
     {	    
       g_object_ref (G_OBJECT (l->data));
-      gtk_container_remove (GTK_CONTAINER (panel->priv->extension_table),
-		    	    GTK_WIDGET (l->data));
+      gtk_container_parent_remove (GTK_CONTAINER (panel->priv->extension_table),
+		    	           GTK_WIDGET (l->data));
     }
   }
 
@@ -785,6 +855,26 @@
   hildon_desktop_panel_expandable_arrange_items (panel);  
 }
 
+static void 
+hildon_desktop_panel_expandable_requeue_last_in_panel (HildonDesktopPanelExpandable *panel)
+{
+  GList *children = gtk_container_get_children (GTK_CONTAINER (panel));
+  HildonDesktopPanelItem *item;
+
+  if (!children)
+    return;	  
+  
+  item = HILDON_DESKTOP_PANEL_ITEM ((g_list_last (children))->data);
+
+  g_object_ref (G_OBJECT (item));
+
+  gtk_container_parent_remove (GTK_CONTAINER (panel), GTK_WIDGET (item));
+
+  hildon_desktop_panel_expandable_add_in_extension (panel, item);
+
+  g_object_unref (G_OBJECT (item));
+}	
+
 #ifdef SYSTRAY_SUPPORT
 static void 
 hildon_desktop_panel_expandable_init_systray (HildonDesktopPanelExpandable *panel, gpointer data)

Modified: projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c	2007-06-29 12:54:43 UTC (rev 12553)
+++ projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c	2007-06-29 13:16:36 UTC (rev 12554)
@@ -30,6 +30,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <libhildondesktop/hildon-desktop-container.h>
+
 #include "hd-plugin-manager.h"
 #include "hd-ui-policy.h"
 #include "hd-plugin-loader.h"
@@ -257,14 +259,20 @@
   if (f_plugin_list == NULL)
     g_list_foreach (plugin_list, append_to_list, &f_plugin_list);
 
-  children = gtk_container_get_children (container);
+  if (HILDON_DESKTOP_IS_CONTAINER (container))
+    children = hildon_desktop_container_get_children (HILDON_DESKTOP_CONTAINER (container));
+  else
+    children = gtk_container_get_children (container);
 
   /* If keeping the order, we need to temporaly remove the loaded
      plugins from the container. */
   for (iter = children; keep_order && iter; iter = g_list_next (iter))
   {
     g_object_ref (iter->data);
-    gtk_container_remove (container, GTK_WIDGET (iter->data));
+    if (HILDON_DESKTOP_IS_CONTAINER (container))
+      hildon_desktop_container_remove (HILDON_DESKTOP_CONTAINER (container), GTK_WIDGET (iter->data));	    
+    else	     
+      gtk_container_remove (container, GTK_WIDGET (iter->data));
   }
 
   /* Add plugins to container if they are not already loaded */


More information about the maemo-commits mailing list