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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Aug 22 13:50:52 EEST 2007
Author: lucasr
Date: 2007-08-22 13:50:50 +0300 (Wed, 22 Aug 2007)
New Revision: 13334

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c
Log:
2007-08-22  Lucas Rocha  <lucas.rocha at nokia.com>

	* libhildondesktop/hildon-desktop-popup-window.c
	(hildon_desktop_popup_window_button_release_event): fix wrong behavior
	when clicking outside the popup window.
	* libhildondesktop/hildon-desktop-popup-menu.c
	(hildon_desktop_popup_menu_init,
	hildon_desktop_popup_menu_update_scroll_buttons,
	hildon_desktop_popup_menu_scroll_cb): correctly update the state of
	scroll buttons depending on the position of the scrolling. 
	Fixes NB#65438.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-22 10:11:15 UTC (rev 13333)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-22 10:50:50 UTC (rev 13334)
@@ -1,6 +1,18 @@
 2007-08-22  Lucas Rocha  <lucas.rocha at nokia.com>
 
+	* libhildondesktop/hildon-desktop-popup-window.c
+	(hildon_desktop_popup_window_button_release_event): fix wrong behavior
+	when clicking outside the popup window.
 	* libhildondesktop/hildon-desktop-popup-menu.c
+	(hildon_desktop_popup_menu_init,
+	hildon_desktop_popup_menu_update_scroll_buttons,
+	hildon_desktop_popup_menu_scroll_cb): correctly update the state of
+	scroll buttons depending on the position of the scrolling. 
+	Fixes NB#65438.
+
+2007-08-22  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* libhildondesktop/hildon-desktop-popup-menu.c
 	(hildon_desktop_popup_menu_parent_size,
 	hildon_desktop_popup_menu_size_allocate): fix strange resizing of menu
 	items when adding/removing items from the menu.

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-08-22 10:11:15 UTC (rev 13333)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-08-22 10:50:50 UTC (rev 13334)
@@ -103,6 +103,7 @@
 static gboolean hildon_desktop_popup_menu_release_event (GtkWidget *widget, GdkEventButton *event);
 static gboolean hildon_desktop_popup_menu_key_press_event (GtkWidget *widget, GdkEventKey *event);
 static void hildon_desktop_popup_menu_scroll_cb (GtkWidget *widget, HildonDesktopPopupMenu *menu);
+static void hildon_desktop_popup_menu_adjustment_changed (GtkAdjustment *adj, HildonDesktopPopupMenu *menu);
 
 static void 
 hildon_desktop_popup_menu_init (HildonDesktopPopupMenu *menu)
@@ -219,8 +220,9 @@
                                        guint n_params,
                                        GObjectConstructParam *params)
 {
+  HildonDesktopPopupMenu *menu;
+  GtkAdjustment *adj;
   GObject *object;
-  HildonDesktopPopupMenu *menu;
 
   object = G_OBJECT_CLASS (hildon_desktop_popup_menu_parent_class)->constructor (gtype,
                                                                                  n_params,
@@ -236,6 +238,18 @@
 
   gtk_widget_show (menu->priv->viewport);
 
+  adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (menu->priv->viewport));
+  
+  g_signal_connect (adj,
+                    "value-changed",
+                    G_CALLBACK (hildon_desktop_popup_menu_adjustment_changed), 
+                    menu);
+
+  g_signal_connect (adj,
+                    "changed",
+                    G_CALLBACK (hildon_desktop_popup_menu_adjustment_changed), 
+                    menu);
+
   gtk_widget_push_composite_child ();
 
   menu->priv->box_items = gtk_vbox_new (FALSE, 0); /* FIXME: add spacing decoration */
@@ -491,6 +505,27 @@
 }
 
 static void 
+hildon_desktop_popup_menu_update_scroll_buttons (HildonDesktopPopupMenu *menu)
+{
+  GtkAdjustment *adj;
+
+  adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (menu->priv->viewport));
+
+  gtk_widget_set_sensitive (menu->priv->scroll_up, 
+		            (adj->value > 0));
+
+  gtk_widget_set_sensitive (menu->priv->scroll_down, 
+		            (adj->value < adj->upper - adj->page_size));
+}
+
+static void 
+hildon_desktop_popup_menu_adjustment_changed (GtkAdjustment *adj, 
+					      HildonDesktopPopupMenu *menu)
+{
+  hildon_desktop_popup_menu_update_scroll_buttons (menu);
+}
+
+static void 
 hildon_desktop_popup_menu_scroll_cb (GtkWidget *widget, HildonDesktopPopupMenu *menu)
 {
   GtkRequisition req;
@@ -690,10 +725,13 @@
     gtk_box_pack_start (GTK_BOX (menu),
 		        menu->priv->box_buttons,
 		        FALSE, FALSE, 0);
+
     gtk_widget_show (menu->priv->box_buttons);
-    
+
     menu->priv->controls_on = TRUE;
 
+    hildon_desktop_popup_menu_update_scroll_buttons (menu);
+
     g_signal_emit_by_name (menu, "show-controls", TRUE);
   }
 }
@@ -922,6 +960,7 @@
     {
       gtk_item_select (GTK_ITEM (item));
       menu->priv->selected_item = item;
+      hildon_desktop_menu_check_scroll_item (menu);
     }
     else
       gtk_item_deselect (GTK_ITEM (l->data));	    
@@ -960,9 +999,10 @@
 
       gtk_item_select (GTK_ITEM (l->data));
       menu->priv->selected_item = GTK_MENU_ITEM (l->data);
+      hildon_desktop_menu_check_scroll_item (menu);
       break;
     }	    
-  }	  
+  }
 }	
 
 void

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c	2007-08-22 10:11:15 UTC (rev 13333)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c	2007-08-22 10:50:50 UTC (rev 13334)
@@ -818,8 +818,8 @@
   }
   
   /* Event outside of popup or in button area, close in clean way */
-  if (!in_panes_area || !in_window_area)
-  {	  
+  if (!in_panes_area && !in_window_area)
+  {	 
     hildon_desktop_popup_window_popdown (popup);
 #if defined(MAEMO_CHANGES) && defined(HAVE_XTEST)
     /* This hack sends an extra button-event in order to not lose the event


More information about the maemo-commits mailing list