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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jul 3 17:51:49 EEST 2007
Author: moimart
Date: 2007-07-03 17:51:36 +0300 (Tue, 03 Jul 2007)
New Revision: 12633

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
Log:
2007-07-03  Moises Martinez  <moises.martinez at nokia.com>

        * libhildondesktop/hildon-desktop-panel-expandable.c:
        (hildon_desktop_panel_expandable_cadd),
        (hildon_desktop_panel_expandable_cremove),
        (hildon_desktop_panel_expandable_add_button),
        (hildon_desktop_panel_expandable_add_in_extension),
        (hildon_desktop_panel_expandable_requeue_last_in_panel):
        - Some further fixes for statusbar.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-07-03 14:46:44 UTC (rev 12632)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-07-03 14:51:36 UTC (rev 12633)
@@ -1,6 +1,16 @@
 2007-07-03  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/hildon-desktop-panel-expandable.c:
+	(hildon_desktop_panel_expandable_cadd),
+	(hildon_desktop_panel_expandable_cremove),
+	(hildon_desktop_panel_expandable_add_button),
+	(hildon_desktop_panel_expandable_add_in_extension),
+	(hildon_desktop_panel_expandable_requeue_last_in_panel):
+	- Some further fixes for statusbar.
+
+2007-07-03  Moises Martinez  <moises.martinez at nokia.com>
+
+	* libhildondesktop/hildon-desktop-panel-expandable.c:
 	- Fixed debug macro
 	* libhildondesktop/hildon-desktop-popup-window.c:
 	(hildon_desktop_popup_window_visibility_notify),

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-07-03 14:46:44 UTC (rev 12632)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-07-03 14:51:36 UTC (rev 12633)
@@ -40,9 +40,9 @@
 #define SYSTEM_TRAY_CANCEL_MESSAGE  2
 #endif
 
-#define STATUSBAR_DEBUG 0
+#define STATUSBAR_DEBUG 1
 #if (STATUSBAR_DEBUG)
-#define sb_debug(o,a...) g_debug("sb" o,##a);
+#define sb_debug(o,a...) g_debug("sb: " o,##a)
 #else
 #define sb_debug(o,a...) do{} while (0)
 #endif
@@ -411,14 +411,7 @@
   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;	  
 
@@ -430,7 +423,16 @@
 {
   HildonDesktopPanelExpandable *panel;
   panel = HILDON_DESKTOP_PANEL_EXPANDABLE (container);
+  GList *mylist = NULL, *l;
 
+  g_hash_table_foreach (panel->priv->items,
+                        (GHFunc)hildon_desktop_panel_expandable_hash_adding,
+                        (gpointer)&mylist);
+
+  if (panel->priv->n_items == 10)
+    for (l = mylist; l ; l = l->next)	  
+       sb_debug ("name: %s",HILDON_DESKTOP_ITEM (l->data)->id);
+
   if (widget == panel->priv->arrow)
   {	  
     gtk_container_remove (GTK_CONTAINER (container), widget);
@@ -438,7 +440,7 @@
   }
 
   if (STATUSBAR_IS_ITEM (widget) && !STATUSBAR_ITEM (widget)->condition)
-    sb_debug ("This item doesn't count");
+    sb_debug ("This item doesn't count.");
   else  
   if (panel->priv->n_items > 0)	  
     panel->priv->n_items--;
@@ -546,7 +548,6 @@
   /* gtk_widget_set_size_request (button, item_width, item_height);*/
   gtk_widget_set_size_request (GTK_BIN (button)->child, item_width, item_height);
   
-
   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)
@@ -556,26 +557,27 @@
     else  
     {	    
       if ((ex_panel->priv->n_items) == ex_panel->priv->items_p_row)
-      {	      
+      {	     
         hildon_desktop_panel_expandable_requeue_last_in_panel (ex_panel);
+
+	if (ex_panel->priv->arrow == NULL)
+        {
+          GtkWidget *arrow = hildon_desktop_panel_expandable_add_arrow (ex_panel);
+      
+          HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,arrow);
+      
+           ex_panel->priv->arrow = arrow;
+        }
+	
 	hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
-	ex_panel->priv->n_items--;
       }	
       else
       {	      
-        ex_panel->priv->n_items++;	      
         hildon_desktop_panel_expandable_add_in_extension (ex_panel, item);
       }
     }
 
-    if (ex_panel->priv->arrow == NULL)
-    {
-      GtkWidget *arrow = hildon_desktop_panel_expandable_add_arrow (ex_panel);
-	    
-      HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,arrow);
-      
-      ex_panel->priv->arrow = arrow;
-    } 
+     
   }
   else
   {
@@ -583,8 +585,8 @@
       sb_debug ("Statusbar: Item not visible %s",HILDON_DESKTOP_ITEM (button)->id);
     else
     {
+      HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,button);
       ex_panel->priv->n_items++;
-      HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,button);
     }
   }
   
@@ -626,7 +628,7 @@
 	division,
 	n_items;
 
-  n_items = panel->priv->n_items;
+  n_items = (panel->priv->arrow != NULL) ? panel->priv->n_items+1 : panel->priv->n_items;
 
   division = ((guint)((n_items+1) / panel->priv->items_p_row));
 
@@ -876,21 +878,28 @@
 static void 
 hildon_desktop_panel_expandable_requeue_last_in_panel (HildonDesktopPanelExpandable *panel)
 {
-  GList *children = gtk_container_get_children (GTK_CONTAINER (panel));
+  GList *l, *children = gtk_container_get_children (GTK_CONTAINER (panel));
   HildonDesktopPanelItem *item;
 
   if (!children)
-    return;	  
+    return;
+
+  l = g_list_last (children);
+
+  while (GTK_WIDGET (l->data) == panel->priv->arrow)
+    l = l->prev;	  
   
-  item = HILDON_DESKTOP_PANEL_ITEM ((g_list_last (children))->data);
+  item = HILDON_DESKTOP_PANEL_ITEM (l->data);
 
   g_object_ref (G_OBJECT (item));
 
-  gtk_container_parent_remove (GTK_CONTAINER (panel), GTK_WIDGET (item));
+  gtk_container_remove (GTK_CONTAINER (panel), GTK_WIDGET (item));
 
   hildon_desktop_panel_expandable_add_in_extension (panel, item);
+  
+  g_object_unref (G_OBJECT (item));
 
-  g_object_unref (G_OBJECT (item));
+  panel->priv->n_items--;
 }	
 
 #ifdef SYSTRAY_SUPPORT


More information about the maemo-commits mailing list