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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jul 27 11:34:19 EEST 2007
Author: lucasr
Date: 2007-07-27 11:34:17 +0300 (Fri, 27 Jul 2007)
New Revision: 12870

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c
   projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
Log:
2007-07-27  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-applications-menu.c (hd_applications_menu_create_menu,
	hd_applications_menu_categories_motion_notify): make the categories
	pane behave like normal menus by activating menu items when the
	pointer passes over. Fixes NB#62108


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-07-27 08:33:27 UTC (rev 12869)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-07-27 08:34:17 UTC (rev 12870)
@@ -1,3 +1,10 @@
+2007-07-27  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-applications-menu.c (hd_applications_menu_create_menu,
+	hd_applications_menu_categories_motion_notify): make the categories
+	pane behave like normal menus by activating menu items when the
+	pointer passes over. Fixes NB#62108
+
 2007-07-27  Johan Bilien  <johan.bilien at nokia.com>
 
 	* libhildondesktop/hildon-home-area.c:

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-07-27 08:33:27 UTC (rev 12869)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-07-27 08:34:17 UTC (rev 12870)
@@ -669,7 +669,7 @@
   gint screen_height = gdk_screen_height ();
 
   GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (menu));
-
+ 
   children = gtk_container_get_children (GTK_CONTAINER (menu->priv->box_items));
 
   for (l = children; l != NULL; l = g_list_next (l))

Modified: projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-07-27 08:33:27 UTC (rev 12869)
+++ projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-07-27 08:34:17 UTC (rev 12870)
@@ -787,6 +787,49 @@
   g_list_free (menu_items);
 }
 
+static gboolean 
+hd_applications_menu_categories_motion_notify (GtkWidget      *widget,
+					       GdkEventMotion *event,
+					       HDApplicationsMenu *button)
+{
+  HildonDesktopPopupMenu *menu = HILDON_DESKTOP_POPUP_MENU (widget);
+  GList *menu_items = NULL, *l;
+  gint w,h,x,y;
+
+  gtk_widget_get_pointer (GTK_WIDGET (widget), &x, &y);
+
+  w = widget->allocation.width;
+  h = widget->allocation.height;
+
+  if (!((x >= 0) && (x <= w) && (y >= 0) && (y <= h)))
+    return TRUE;    	 
+
+  menu_items = 
+    hildon_desktop_popup_menu_get_children (menu);
+
+  for (l = menu_items; l != NULL; l = g_list_next (l))
+    gtk_item_deselect (GTK_ITEM (l->data));	  
+
+  for (l = menu_items; l != NULL; l = g_list_next (l))
+  {
+    gtk_widget_get_pointer (GTK_WIDGET (l->data), &x, &y);
+
+    w = GTK_WIDGET (l->data)->allocation.width;
+    h = GTK_WIDGET (l->data)->allocation.height;
+
+    if ((x >= 0) && (x <= w) && (y >= 0) && (y <= h))
+    {	    
+      hildon_desktop_popup_menu_select_item (menu, GTK_MENU_ITEM (l->data));
+      button->priv->focus_applications = TRUE;
+      gtk_menu_item_activate (GTK_MENU_ITEM (l->data));
+    }
+  }
+
+  g_list_free (menu_items);
+
+  return TRUE;
+}
+
 static void
 hd_applications_menu_create_menu (HDApplicationsMenu *button)
 {
@@ -824,6 +867,11 @@
 		  		    	     "resize-parent", FALSE,
 				    	     NULL));
 
+  g_signal_connect (G_OBJECT (button->priv->menu_categories),
+		    "motion-notify-event",
+		    G_CALLBACK (hd_applications_menu_categories_motion_notify),
+		    button);
+  
   gtk_widget_show (GTK_WIDGET (button->priv->menu_categories));
 
   gtk_widget_set_name (GTK_WIDGET (button->priv->menu_categories), 


More information about the maemo-commits mailing list