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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu May 10 17:56:49 EEST 2007
Author: moimart
Date: 2007-05-10 17:56:48 +0300 (Thu, 10 May 2007)
New Revision: 11582

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-menu.h
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c
   projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c
Log:

	* src/hd-switcher-menu.c:
        - Implemented jumping from pane to pane. Unfortunately you cannot jump
        to menu item at same height.
        * libhildondesktop/hildon-desktop-popup-menu.[ch]:
        - Added select first item method.
        - If item to select is NULL, deselect everything.
        * libhildondesktop/hildon-desktop-popup-window.c:
        - "You shall not compare integers and unsigned integers without a
        casting".
	* ChangeLog updated.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-10 14:51:16 UTC (rev 11581)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-10 14:56:48 UTC (rev 11582)
@@ -1,5 +1,17 @@
 2007-05-10  Moises Martinez  <moises.martinez at nokia.com>
 
+	* src/hd-switcher-menu.c:
+	- Implemented jumping from pane to pane. Unfortunately you cannot jump
+	to menu item at same height.
+	* libhildondesktop/hildon-desktop-popup-menu.[ch]:
+	- Added select first item method.
+	- If item to select is NULL, deselect everything.
+	* libhildondesktop/hildon-desktop-popup-window.c:
+	- "You shall not compare integers and unsigned integers without a
+	casting".
+
+2007-05-10  Moises Martinez  <moises.martinez at nokia.com>
+
 	* src/hd-switcher-menu-item.c:
 	- Close notification when activated.
 	* src/hd-switcher-menu.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-05-10 14:51:16 UTC (rev 11581)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c	2007-05-10 14:56:48 UTC (rev 11582)
@@ -400,8 +400,6 @@
       break;
   }
   
-  g_debug ("key press event %p",l);
-
   if (l == NULL)
     return FALSE;   
   
@@ -627,25 +625,44 @@
   GList *children = NULL, *l;
 
   g_assert (HILDON_DESKTOP_IS_POPUP_MENU (menu));
-  g_return_if_fail (GTK_IS_MENU_ITEM (item));
 
   children = gtk_container_get_children (GTK_CONTAINER (menu->priv->box_items));
 
   for (l = children; l != NULL; l = g_list_next (l))
   {
-    if (l->data == item)
+    if (l->data && l->data == item)
     {
       gtk_item_select (GTK_ITEM (item));
       menu->priv->selected_item = item;
     }
     else
-      gtk_item_deselect (GTK_ITEM (item));	    
+      gtk_item_deselect (GTK_ITEM (l->data));	    
   }
 
   g_list_free (children);
 } 
 
 void
+hildon_desktop_popup_menu_select_first_item (HildonDesktopPopupMenu *menu)
+{
+  GList *children = NULL, *l;
+
+  g_assert (HILDON_DESKTOP_IS_POPUP_MENU (menu));
+
+  children = gtk_container_get_children (GTK_CONTAINER (menu->priv->box_items));
+
+  for (l = children; l != NULL; l = g_list_next (l))
+  {	  
+    if (!GTK_IS_SEPARATOR_MENU_ITEM (l->data))
+    {
+      gtk_item_select (GTK_ITEM (l->data));
+      menu->priv->selected_item = GTK_MENU_ITEM (l->data);
+      break;
+    }	    
+  }	  
+}	
+
+void
 hildon_desktop_popup_menu_activate_item (HildonDesktopPopupMenu *menu, GtkMenuItem *item)
 {	
   GList *children = NULL, *l;

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.h	2007-05-10 14:51:16 UTC (rev 11581)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.h	2007-05-10 14:56:48 UTC (rev 11582)
@@ -72,6 +72,9 @@
 void
 hildon_desktop_popup_menu_select_item (HildonDesktopPopupMenu *menu, GtkMenuItem *item);
 
+void 
+hildon_desktop_popup_menu_select_first_item (HildonDesktopPopupMenu *menu);
+
 void
 hildon_desktop_popup_menu_activate_item (HildonDesktopPopupMenu *menu, GtkMenuItem *item);
 

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c	2007-05-10 14:51:16 UTC (rev 11581)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-window.c	2007-05-10 14:56:48 UTC (rev 11582)
@@ -901,18 +901,18 @@
 hildon_desktop_popup_window_jump_to_pane (HildonDesktopPopupWindow *popup, gint pane)
 {
   g_assert (HILDON_DESKTOP_IS_POPUP_WINDOW (popup));
-
-  if (pane >= popup->priv->n_extra_panes)
+  
+  if (pane >= (gint) popup->priv->n_extra_panes)
     pane = popup->priv->n_extra_panes -1;	  
-	
+  
   if (GTK_WIDGET_VISIBLE (GTK_WIDGET (popup)))
   {
     if (pane <= -1)
-    {
+    { 
       if (popup->priv->have_xgrab)	    
         return;
       else
-      {
+      { 
         gtk_grab_remove (popup->priv->pane_with_grab);	      
 
 	popup_grab_on_window (GTK_WIDGET (popup)->window, GDK_CURRENT_TIME, TRUE);
@@ -924,7 +924,7 @@
       }
     }
     else
-    {
+    { 
       GtkWidget *widget_with_grab;
 	    
       if (popup->priv->have_xgrab)

Modified: projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c	2007-05-10 14:51:16 UTC (rev 11581)
+++ projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c	2007-05-10 14:56:48 UTC (rev 11582)
@@ -269,11 +269,60 @@
 
     return TRUE;
   }
+  else
+  if (event->keyval == GDK_Right ||
+      event->keyval == GDK_KP_Right)
+  {
+    GList *notifications =
+     hildon_desktop_popup_menu_get_children 
+       (switcher->priv->menu_notifications);
 
+    if (notifications)    
+    {	  
+      hildon_desktop_popup_window_jump_to_pane 
+        (switcher->priv->popup_window, 0);	    
+
+      hildon_desktop_popup_menu_select_item
+        (switcher->priv->menu_applications, NULL);
+
+      hildon_desktop_popup_menu_select_first_item 
+        (switcher->priv->menu_notifications);	    
+
+      g_list_free (notifications);
+      
+      return TRUE;
+    }
+
+    g_list_free (notifications);
+  }	  
+
   return FALSE;
 }
 
 static gboolean 
+hd_switcher_menu_popup_window_pane_keypress_cb (GtkWidget      *widget,
+	                                        GdkEventKey    *event,
+        	                                HDSwitcherMenu *switcher)
+{
+  if (event->keyval == GDK_Left ||
+      event->keyval == GDK_KP_Left)
+  {
+    hildon_desktop_popup_window_jump_to_pane
+      (switcher->priv->popup_window, -1);
+
+    hildon_desktop_popup_menu_select_item
+      (switcher->priv->menu_notifications, NULL);
+
+    hildon_desktop_popup_menu_select_first_item
+      (switcher->priv->menu_applications);
+
+    return TRUE;
+  } 
+
+  return FALSE;
+}
+
+static gboolean 
 hd_switcher_menu_switcher_keypress_cb (GtkWidget      *widget,
 				       GdkEventKey    *event,
 				       HDSwitcherMenu *switcher)
@@ -381,6 +430,11 @@
 		    G_CALLBACK (hd_switcher_menu_popup_window_keypress_cb),
 		    (gpointer)switcher);
 
+  g_signal_connect (hildon_desktop_popup_window_get_pane (switcher->priv->popup_window, 0),
+		    "key-press-event",
+		    G_CALLBACK (hd_switcher_menu_popup_window_pane_keypress_cb),
+		    (gpointer)switcher);
+
   g_signal_connect (button,
 		    "key-press-event",
 		    G_CALLBACK (hd_switcher_menu_switcher_keypress_cb),
@@ -1174,9 +1228,6 @@
   hildon_desktop_popup_menu_add_item
     (switcher->priv->menu_notifications, GTK_MENU_ITEM (menu_item));
 
-  hildon_desktop_popup_menu_select_item 
-    (switcher->priv->menu_notifications, GTK_MENU_ITEM (menu_item));	  
-  
   hd_switcher_menu_replace_blinking_icon (switcher, icon);
   switcher->priv->last_urgent_info = NULL;
 


More information about the maemo-commits mailing list