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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri May 11 17:41:40 EEST 2007
Author: moimart
Date: 2007-05-11 17:41:40 +0300 (Fri, 11 May 2007)
New Revision: 11614

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c
Log:

	* libhildondesktop/hildon-desktop-popup-menu.c:
        - Fixed problem with scrolling.
        - When resizing parent with scroll controls, resize it as big as the
        screen.
	* ChangeLog updated.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-11 14:40:10 UTC (rev 11613)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-11 14:41:40 UTC (rev 11614)
@@ -1,3 +1,10 @@
+2007-05-11  Moises Martinez  <moises.martinez at nokia.com>
+
+	* libhildondesktop/hildon-desktop-popup-menu.c:
+	- Fixed problem with scrolling.
+	- When resizing parent with scroll controls, resize it as big as the
+	screen.
+
 2007-05-11  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* libhildondesktop/hildon-desktop-popup-menu.c: fixed sizing and

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-05-11 14:40:10 UTC (rev 11613)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-05-11 14:41:40 UTC (rev 11614)
@@ -337,16 +337,29 @@
   GtkAdjustment *adj = 
     gtk_viewport_get_vadjustment 
       (GTK_VIEWPORT (menu->priv->viewport));
+  GtkRequisition req;
+  gdouble upper_hack;
 
   if (widget == menu->priv->scroll_up)
     delta *= -1;
   
   position = gtk_adjustment_get_value (adj);
 
-  if ((gint)(position + (gdouble)delta) <= menu->priv->upper_hack)
-    gtk_adjustment_set_value (adj, position + (gdouble)delta); 	 
+  GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (menu));
 
-  g_debug ("min: %lf max: %lf current: %lf", adj->lower,adj->upper, adj->value);
+  if (parent && GTK_IS_WINDOW (parent))
+  {		  
+    gtk_widget_size_request (parent, &req);
+  	  
+    upper_hack = adj->upper - (req.height - menu->priv->item_height);
+
+    if ((gint)(position + (gdouble)delta) <= upper_hack)
+      gtk_adjustment_set_value (adj, position + (gdouble)delta); 	
+    else
+      gtk_adjustment_set_value (adj, upper_hack);	    
+
+    g_debug ("min: %lf max: %lf current: %lf upper_hack: %lf", adj->lower,adj->upper, adj->value, menu->priv->upper_hack);
+ }
 }	
 
 static gboolean 
@@ -489,7 +502,6 @@
   gint d_height = 0;
   gboolean show_scroll_controls = FALSE;
   GtkRequisition req;
-  gint separators = 0;
   gint screen_height = gdk_screen_height ();
 
   GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (menu));
@@ -498,9 +510,6 @@
 
   for (l=children; l != NULL; l = g_list_next (l))
   {
-     if (GTK_IS_SEPARATOR_MENU_ITEM (l->data))
-       separators++;	     
-	  
      gtk_widget_size_request (GTK_WIDGET (l->data), &req);
 
      d_height += req.height;
@@ -517,12 +526,7 @@
   {	  
     hildon_desktop_popup_menu_show_controls (menu);	  
     gtk_widget_set_size_request 
-       (menu->priv->viewport, -1, d_height - menu->priv->item_height);
-
-    if (separators == 0)
-      separators++;	    
-    
-    menu->priv->upper_hack = d_height - menu->priv->item_height*separators;
+       (menu->priv->viewport, -1, screen_height - menu->priv->item_height);/*d_height - menu->priv->item_height);*/
   }
   else
   {	  
@@ -536,7 +540,11 @@
   if (menu->priv->resize_parent && GTK_IS_WINDOW (parent))
   {	  
     gtk_widget_size_request (parent, &req);
-    gtk_widget_set_size_request (parent, req.width, d_height);
+    gtk_widget_set_size_request (parent,
+		    		 req.width,
+				 show_scroll_controls ? 
+				 screen_height : 
+				 (d_height - menu->priv->item_height));
 
     if (GTK_WIDGET_MAPPED (parent))
     {	    
@@ -547,7 +555,11 @@
     }
 
     if (GTK_WIDGET_REALIZED (parent))
-      gdk_window_resize (parent->window, req.width, d_height); 
+      gdk_window_resize (parent->window,
+		         req.width,
+			 show_scroll_controls ? 
+			 screen_height : 
+			 (d_height - menu->priv->item_height)); 
   }
 
   g_list_free (children);


More information about the maemo-commits mailing list