[maemo-commits] [maemo-commits] r9292 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jan 24 15:09:21 EET 2007
Author: moimart
Date: 2007-01-24 15:09:20 +0200 (Wed, 24 Jan 2007)
New Revision: 9292

Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
Log:

	* libhildondesktop/hildon-desktop-panel-expandable.c:
        - Fixed few wrong behaviors
	* ChangeLog updated.



Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-24 13:04:36 UTC (rev 9291)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-24 13:09:20 UTC (rev 9292)
@@ -1,3 +1,8 @@
+2007-01-24  Moises Martinez  <moises.martinez at nokia.com>
+
+	* libhildondesktop/hildon-desktop-panel-expandable.c: 
+	- Fixed few wrong behaviors
+
 2007-01-24  Johan Bilien  <johan.bilien at nokia.com>
 
 	* src/others-button.c: Position menu according to panel orientation

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-01-24 13:04:36 UTC (rev 9291)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-01-24 13:09:20 UTC (rev 9292)
@@ -47,6 +47,8 @@
   GtkTable  *extension_table;
 
   gboolean   extension_opened;
+
+  GtkWidget *arrow;
 };
 
 enum
@@ -81,7 +83,7 @@
 
 static void hildon_desktop_panel_expandable_add_in_extension (HildonDesktopPanelExpandable *panel, HildonDesktopPanelItem *item);
 
-static void hildon_desktop_panel_expandable_add_arrow (HildonDesktopPanelExpandable *panel);
+static GtkWidget *hildon_desktop_panel_expandable_add_arrow (HildonDesktopPanelExpandable *panel);
 
 static void hildon_desktop_panel_expandable_arrow_toggled (GtkToggleButton *button, gpointer _panel);
 
@@ -194,7 +196,7 @@
   switch (prop_id)
   {
     case PROP_ITEMS_P_ROW:
-      g_value_set_int (value, panel->priv->items_p_row);
+      g_value_set_uint (value, panel->priv->items_p_row);
       break;
 
     default:
@@ -218,7 +220,7 @@
   switch (prop_id)
   {
     case PROP_ITEMS_P_ROW:
-      panel->priv->items_p_row = g_value_get_int (value);
+      panel->priv->items_p_row = g_value_get_uint (value);
       break;
 
     default:
@@ -232,7 +234,9 @@
 {
   HildonDesktopPanelItem *item = HILDON_DESKTOP_PANEL_ITEM (button);
   HildonDesktopPanelExpandable *ex_panel = HILDON_DESKTOP_PANEL_EXPANDABLE (panel);
-	
+
+  g_debug ("Adding button in expandable %d %d",ex_panel->priv->items_p_row,ex_panel->priv->n_items+1);
+  
   if (STATUSBAR_IS_ITEM (button))
   {
     g_signal_connect (STATUSBAR_ITEM (item),
@@ -241,9 +245,16 @@
 		      (gpointer)ex_panel);
   }
 
-  if (ex_panel->priv->items_p_row >= (ex_panel->priv->n_items+1))
+  if ((ex_panel->priv->n_items+1) >= ex_panel->priv->items_p_row)
   {
-    hildon_desktop_panel_expandable_add_arrow (ex_panel);
+    GtkWidget *arrow =  hildon_desktop_panel_expandable_add_arrow (ex_panel);
+
+    if (ex_panel->priv->arrow == NULL)
+    {
+      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);
   }
   else
@@ -265,6 +276,8 @@
 	top_attach,
 	bottom_attach;
 
+  g_debug ("Adding button in expandable extension");
+
   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);
 	
@@ -307,6 +320,8 @@
   {
     if (HILDON_DESKTOP_IS_PANEL_ITEM (l->data)) /* For arrow */
       g_object_ref (G_OBJECT (l->data));
+    else
+      panel->priv->arrow = NULL;
     gtk_container_remove (GTK_CONTAINER (panel), GTK_WIDGET (l->data));
   }
 
@@ -332,7 +347,7 @@
 }
 
 
-static void 
+static GtkWidget * 
 hildon_desktop_panel_expandable_add_arrow (HildonDesktopPanelExpandable *panel)
 {
   GtkWidget *arrow_button, *arrow_image;
@@ -367,6 +382,10 @@
 		    "toggled",
 		    G_CALLBACK (hildon_desktop_panel_expandable_arrow_toggled),
 		    (gpointer)panel);
+
+  gtk_widget_show_all (arrow_button);
+
+  return arrow_button;
 }
 
 static void 


More information about the maemo-commits mailing list