[maemo-commits] [maemo-commits] r10968 - in projects/haf/trunk/hildon-desktop: . libhildonwm src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Apr 4 17:32:59 EEST 2007
Author: moimart
Date: 2007-04-04 17:32:58 +0300 (Wed, 04 Apr 2007)
New Revision: 10968

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
   projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
Log:

	* libhildonwm/hd-wm.c: Fixed some hdwm->keys cases left.
        * src/hn-app-switcher.c: Menu thumb fixed when no entries are added.
	* ChangeLog updated.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-04-04 13:08:38 UTC (rev 10967)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-04-04 14:32:58 UTC (rev 10968)
@@ -1,3 +1,8 @@
+2007-04-04  Moises Martinez  <moises.martinez at nokia.com>
+
+	* libhildonwm/hd-wm.c: Fixed some hdwm->keys cases left.
+	* src/hn-app-switcher.c: Menu thumb fixed when no entries are added.
+
 2007-04-04  Johan Bilien  <johan.bilien at nokia.com>
 
 	* configure.ac: 0.0.4

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-04-04 13:08:38 UTC (rev 10967)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-04-04 14:32:58 UTC (rev 10968)
@@ -2402,6 +2402,10 @@
   if (((XEvent*)xevent)->type == KeyPress)
   {
     XKeyEvent *kev = (XKeyEvent *)xevent;
+
+    if (!hdwm->keys)
+      return GDK_FILTER_CONTINUE;
+    
     hdwm->priv->shortcut = hd_keys_handle_keypress (hdwm->keys, kev->keycode, kev->state); 
 
     if (hdwm->priv->shortcut != NULL &&
@@ -2423,7 +2427,7 @@
       hdwm->priv->power_key_timeout = 0;
     }
 
-    if (hdwm->priv->shortcut != NULL)
+    if (hdwm->keys != NULL && hdwm->priv->shortcut != NULL)
     {
       if (!hd_wm_modal_windows_present())
         hdwm->priv->shortcut->action_func (hdwm->keys, hdwm->priv->shortcut->action_func_data);

Modified: projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c	2007-04-04 13:08:38 UTC (rev 10967)
+++ projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c	2007-04-04 14:32:58 UTC (rev 10968)
@@ -213,6 +213,7 @@
   /* pointer location */
   guint pointer_on_button : 1;
   guint is_thumbable : 1;
+  gboolean force_thumb : 1;
   guint was_thumbable : 1;
 
   guint menu_button_timeout;
@@ -532,7 +533,13 @@
   HNAppSwitcherPrivate *priv = app_switcher->priv;
   GList *menu_children, *l;
   GtkWidget *separator;
-  
+
+  if (priv->force_thumb)
+  {	  
+    priv->is_thumbable = TRUE;
+    priv->force_thumb = FALSE;
+  }
+
   /* we must dispose the old contents of the menu first */
   menu_children = gtk_container_get_children (GTK_CONTAINER (priv->main_menu));
   for (l = menu_children; l != NULL; l = l->next)
@@ -587,7 +594,7 @@
     gtk_widget_destroy (priv->main_home_item);
     priv->main_home_item = NULL;
   }
-  
+ 
   g_assert (priv->home_info); 
   priv->main_home_item = hn_app_menu_item_new (priv->home_info,
 		                               FALSE,
@@ -841,7 +848,7 @@
 
   gtk_widget_realize (priv->main_menu);
 
-  if (priv->is_thumbable)
+  if (priv->is_thumbable || priv->force_thumb)
     gtk_widget_set_name (gtk_widget_get_toplevel (priv->main_menu),
                          "hildon-menu-window-thumb");
   else
@@ -1091,8 +1098,15 @@
 {
   HNAppSwitcher *app_switcher = HN_APP_SWITCHER (data);
 
-  app_switcher->priv->is_thumbable = TRUE;
+  if (app_switcher->priv->main_menu && 
+      !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (app_switcher->priv->main_button)))
+  {
+    gtk_widget_destroy (app_switcher->priv->main_menu);
+    app_switcher->priv->main_menu = NULL;
+  }
 
+  app_switcher->priv->force_thumb = TRUE;
+
   hn_app_switcher_toggle_menu_button (app_switcher);
 }
 
@@ -1473,6 +1487,16 @@
   gtk_widget_set_sensitive (priv->buttons[pos], TRUE);
 }
 
+static void 
+hn_app_switcher_destroy_main_menu (HNAppSwitcher *app_switcher)
+{
+  if (app_switcher->priv->main_menu)
+  {
+    gtk_widget_destroy (app_switcher->priv->main_menu);
+    app_switcher->priv->main_menu = NULL;
+  }
+}
+
 static gboolean
 refresh_buttons (gpointer user_data)
 {
@@ -1665,11 +1689,8 @@
    * now that the application list is tainted by a new entry;
    * destroying the menu widget will call the detach function
    */
-  if (priv->main_menu)
-  {
-    gtk_widget_destroy (priv->main_menu);
-    priv->main_menu = NULL;
-  }
+
+  hn_app_switcher_destroy_main_menu (app_switcher);
 }
 
 /* Class closure for the "remove" signal; this is called each time
@@ -1703,12 +1724,8 @@
    * now that the application list is tainted by delete entry;
    * destroying the menu widget will call the detach function
    */
-  if (priv->main_menu)
-  {
-      gtk_widget_destroy (priv->main_menu);
-      priv->main_menu = NULL;
-    }
 
+  hn_app_switcher_destroy_main_menu (app_switcher);
 }
 
 
@@ -1728,12 +1745,9 @@
   /* all changes have potential impact on the the main menu; app menus are
    * created on the fly, so we do not have to worry about menu changes there
    */
-  if (priv->main_menu)
-  {
-    gtk_widget_destroy (priv->main_menu);
-    priv->main_menu = NULL;
-  }
 
+  /* hn_app_switcher_destroy_main_menu (app_switcher);*/
+
   /*
    * If we are given an entry info and it of the app type, we just need to
    * update at most one button
@@ -1921,11 +1935,7 @@
 
   g_debug ("In hn_app_switcher_real_changed_stack");
 
-  if (priv->main_menu)
-  {
-    gtk_widget_destroy (priv->main_menu);
-    priv->main_menu = NULL;
-  }
+  hn_app_switcher_destroy_main_menu (app_switcher);
   
   if (!entry_info || !hd_entry_info_is_active (entry_info))
   {
@@ -2116,6 +2126,8 @@
   
   app_switcher->priv->buttons_group = NULL;
 
+  app_switcher->priv->force_thumb = FALSE;
+
   gtk_widget_set_name (GTK_WIDGET (app_switcher), AS_BOX_NAME);
   
   /* set base properties of the app-switcher widget */


More information about the maemo-commits mailing list