[maemo-commits] [maemo-commits] r8972 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop libhildonwm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jan 5 16:29:15 EET 2007
Author: moimart
Date: 2007-01-05 16:29:13 +0200 (Fri, 05 Jan 2007)
New Revision: 8972

Added:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-marshalers.list
Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/Makefile.am
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window-view.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h
Log:

        * libhildondesktop/hn-app-switcher.c:
        * libhildonwm/hd-wm-watched-window.c:
        * libhildonwm/hd-wm-watched-window-view.c:
        * libhildonwm/hd-wm.[ch]:
        - Moved control of applications opened from appswitcher to
          hdwm.
        * libhildonwm/Makefile.am:
        * libhildonwm/hd-wm-marshalers.list:
        - Added marshalers for hdwm.
	* ChangeLog updated.




Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-05 14:29:13 UTC (rev 8972)
@@ -1,5 +1,17 @@
 2007-01-05  Moises Martinez  <moises.martinez at nokia.com>
 
+	* libhildondesktop/hn-app-switcher.c:
+	* libhildonwm/hd-wm-watched-window.c:
+	* libhildonwm/hd-wm-watched-window-view.c:
+	* libhildonwm/hd-wm.[ch]:
+	- Moved control of applications opened from appswitcher to
+	  hdwm.
+	* libhildonwm/Makefile.am:
+	* libhildonwm/hd-wm-marshalers.list:
+	- Added marshalers for hdwm.
+
+2007-01-05  Moises Martinez  <moises.martinez at nokia.com>
+
 	* updated headers in libhildondesktop
 
 2007-01-05  Karoliina Salminen  <karoliina.t.salminen at nokia.com>
@@ -120,7 +132,7 @@
 	- set the applet area as the legitimate child
 	- fixed allocation of the applet area
 
-2006-12-15  Moises Martinez <moises.martinzes at nokia.com>
+2006-12-15  Moises Martinez <moises.martinez at nokia.com>
 
 	* test/test4.c: test updated with refactored appswitcher.
 	* libhildondesktop/hn-app-switcher.[ch]:
@@ -145,7 +157,7 @@
 	* libhildondesktop/hildon-home-applet.[ch]: Removed
 	desktop_file property (replaced by desktop item id)
 
-2006-12-15  Moises Martinez <moises.martinzes at nokia.com>
+2006-12-15  Moises Martinez <moises.martinez at nokia.com>
 
 	* libhildondesktop/hn-app-switcher.c:
 	* libhildonwm/hd-wm.c:
@@ -224,14 +236,14 @@
 	* libhildondesktop/hildon-home-window.c:
 	  - use the new WM property to track thw work area changes
 
-2006-12-08  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-08  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/desktop-panel.c:
 	  - Set a default size for widgets.
 	* libhildondesktop/desktop-panel-window.c:
 	  - Show the container!!!!
 
-2006-12-08  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-08  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/desktop-panel-window.[ch]: Fixed partially dragging
 	of window.
@@ -254,7 +266,7 @@
 	* debian/libhildonwm*.install:
 	- added
 
-2006-12-05  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-05  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/hn_app_switcher.c: Added support for opening the
 	menu from hd-wm.
@@ -267,19 +279,19 @@
 	- added
 	- first version of the Debian packaging
 
-2006-12-05  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-05  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/hn_app_switcher.c: Added support for opening the
 	menu from hd-wm.
 	* libhildonwm/hd-wm.c: Code cleanup
 	* test/test4.c: updated.
 
-2006-12-05  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-05  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-wm.[ch]: Added a signal for requesting appswitchers
 	open their menu.
 
-2006-12-04  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-04  Moises Martinez  <moises.martinez at nokia.com>
 
 	* test/test4.c:
 	- Updated test. 4 application switcher working at the same time.
@@ -288,7 +300,7 @@
 	* libhildondesktop/hn-app-switcher.c:
 	- Code cleanup.
 
-2006-12-04  Moises Martinez  <moises.martinzes at nokia.com>
+2006-12-04  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-keys.c: Fixed shortcuts to active tn/ap buttons.
 	* libhildonwm/hd-wm.[ch]: 
@@ -361,11 +373,11 @@
 	config-file properties (with their respective accessor methods) and 
 	the select-plugins signal. 
 
-2006-11-27  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-27  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop: Added old app switcher with new interface.
 
-2006-11-27  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-27  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/*: Updated libhildonwm.
 
@@ -374,22 +386,22 @@
 	* libhildondesktop/libhildonmenu.c: Fixed a potential crash when
 	no Type = is provided.
 
-2006-11-27  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-27  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/libhildondesktop.h: Added macros for GTypeModule 
 	declarations
 
-2006-11-24  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-24  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-wm.c:
 	* libhildonwm/hd-wm-watched-window.c:
 	- Added more emission of signals for appswitchers
 
-2006-11-24  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-24  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-wm.[ch]: Moved to a more consistent GObject behavior.
 
-2006-11-23  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-23  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-wm.[ch]: Moved the hd-wm to a new API based on 
 	GObject that allows having more than one app switcher.
@@ -449,7 +461,7 @@
 
 	* src/hd-plugin-loader-legacy.[ch]: made _set_key_type public
 
-2006-11-22  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-22  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/*: Added libhildonwm to building system. Now it builds
 	but lacks of application switcher support (needs refactoring API for
@@ -462,7 +474,7 @@
 	data/Makefile.am: new data directory with default configuration files
 	that are installed on hildon-desktop global conf dir.
 
-2006-11-22  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-22  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-*.[ch]: First import of window managemente code.
 	- At this point the window management code is broken and there is no
@@ -494,7 +506,7 @@
 	the tasknavigator-item-wrapper
 	* libhildondesktop/tasknavigator-item.c: Made non-abstract
 
-2006-11-21  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-21  Moises Martinez  <moises.martinez at nokia.com>
 
 	* src/main.c: added locale.h header
 	* libhildondesktop/desktop-panel-window.c: Deleted debug messages.
@@ -590,18 +602,18 @@
 	implementation skel.
 	* src/Makefile.am: add hd-plugin-loader-factory.[ch] to build.
 
-2006-11-16  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-16  Moises Martinez  <moises.martinez at nokia.com>
 
 	* AUTHORS: Added Lucas Rocha as an author.
 
-2006-11-16  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-16  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm: This lib will be responsible for all the window 
 	management needed for hildon-desktop.
 	* window_management_dependencies: dependencies of old window 
 	management code
 
-2006-11-16  Moises Martinez  <moises.martinzes at nokia.com>
+2006-11-16  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/tasknavigator-item-socket.[ch]: Added 
 	implementation of desktop-item-socket for tasknavigator items.
@@ -622,7 +634,7 @@
 	* src/Makefile.am, src/main.c, configure.ac: Added hildon-desktop
 	app to the build
 
-2006-11-15  Moises Martinez <moises.martinzes at nokia.com>
+2006-11-15  Moises Martinez <moises.martinez at nokia.com>
 
 	* plugin_manager readme file added
 
@@ -634,19 +646,19 @@
 
 	* libhildondesktop/hildon-home-applet.c: Fixed realize and size_allocate
 
-2006-11-14  Moises Martinez <moises.martinzes at nokia.com>
+2006-11-14  Moises Martinez <moises.martinez at nokia.com>
 
 	* Now libhildondesktop builds ok
 
-2006-11-14  Moises Martinez <moises.martinzes at nokia.com>
+2006-11-14  Moises Martinez <moises.martinez at nokia.com>
 
 	* Renamed libdesktop to libhildondesktop
 
-2006-11-14  Moises Martinez <moises.martinzes at nokia.com>
+2006-11-14  Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/libdesktop.h: new global header file.
 
-2006-11-13  Moises Martinez <moises.martinzes at nokia.com>
+2006-11-13  Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/hildon-desktop-plugin.[ch]: GTypeModule child class
 	for plugins.
@@ -658,7 +670,7 @@
 	- added realize/map with visible window and event window when in
 	layout mode.
 
-2006-11-09  Moises Martinez <moises.martinzes at nokia.com>
+2006-11-09  Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/desktop-panel.[ch]: Added optional fixed sizes 
 	for added panel's button.
@@ -686,7 +698,7 @@
 	- added
 	- centralized all Hildon Home l10n strings
 
-2006-11-08 Moises Martinez <moises.martinzes at nokia.com>
+2006-11-08 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/desktop-panel-window.[ch]:
 	- Fixed dragging. 
@@ -695,7 +707,7 @@
 	* libdesktop/hildon-desktop-panel-item.c:
 	- Minor fixes
 
-2006-11-07 Moises Martinez <moises.martinzes at nokia.com>
+2006-11-07 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/statusbar-item.c:
 	- library is construct only property.
@@ -705,18 +717,18 @@
 	* libdesktop/tasknavigator-item-wrapper.[ch]:
  	- Subclass of TaskNavigatorItem that adds support for old API.
 
-2006-11-06 Moises Martinez <moises.martinzes at nokia.com>
+2006-11-06 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/hildon-desktop-panel-item.[ch]:
 	* libdesktop/statusbar-item.[ch]:
 	- StatusbarItem is a Panel Item.
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/statusbar-item-socket.c: Removing proxy 
         of GtkSocket's plug_removed signal
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/statusbar-item-socket.[ch]:
 	- Fixed building problems.
@@ -724,36 +736,36 @@
 	- Fixed proxy calling to GtkSocket methods plug_added 
 	and plug_removed
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/hildon-desktop-item.[ch]:
 	* libdesktop/statusbar-item-wrapper.[ch]:
 	* libdesktop/statusbar-item.c:
 	- Fixed building problems.
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/statusbar-item-wrapper.[ch]: 
 	- Fixed building problems.
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/hildon-desktop-item-socket.c:
 	- Changed _gtk_boolean_handled_accumulator to 
 	  g_signal_accumulator_true_handled.
 	* test/test1.c: Added test 
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/desktop-multiscreen.[ch]:
 	* libdesktop/desktop-panel-window.h:
 	- Fixed more building problems
 
-2006-10-31 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-31 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/desktop-panel-window.c: Fixed building problem
 	
-2006-10-30 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-30 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/desktop-multiscreen.[ch]:
 	* libdesktop/statusbar-item.[ch]:
@@ -764,32 +776,32 @@
 	* libdesktop/statusbar-item-socket.[ch]:
 	- Fixed a lot of build problems
 
-2006-10-30 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-30 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/desktop-panel-window.c: Added positioning and resizing
 	code.
 
-2006-10-30 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-30 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/statusbar-item-socket.[ch]: Implementation of
 	a hildon-desktop-item-socket for statusbar items.
 
-2006-10-20 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-20 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/statusbar-item-wrapper.[ch]: Added wrapper
 	for supporting statusbar's APIs.
 
-2006-10-20 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-20 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/libhildonmenu.[ch];
 	* libdesktop/hildon-thumb-menu-item.[ch]:
 	- Imported libhildonmenu from maemo-af-desktop.
 
-2006-10-19 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-19 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/hildon-desktop-item-socket.[ch]: Added GInterface 
 	for GtkSocket decoration in DesktopItems
 
-2006-10-19 Moises Martinez <moises.martinzes at nokia.com>
+2006-10-19 Moises Martinez <moises.martinez at nokia.com>
 
 	* libdesktop/*.[ch]:Inital Import

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c	2007-01-05 14:29:13 UTC (rev 8972)
@@ -139,7 +139,7 @@
 hn_app_switcher_add_info_cb (HDWM *hdwm, HDEntryInfo *entry_info, gpointer data);
 
 static void 
-hn_app_switcher_remove_info_cb (HDWM *hdwm, HDEntryInfo *entry_info, gpointer data);
+hn_app_switcher_remove_info_cb (HDWM *hdwm, gboolean removed_app, HDEntryInfo *entry_info, gpointer data);
 
 static void 
 hn_app_switcher_changed_info_cb (HDWM *hdwm, HDEntryInfo *entry_info, gpointer data);
@@ -432,7 +432,7 @@
 
   priv->active_menu_item = NULL;
   /* rebuild the menu */
-  for (l = priv->applications; l != NULL; l = l->next)
+  for (l = hd_wm_get_applications (app_switcher->hdwm); l != NULL; l = l->next)
   {
     GtkWidget *menu_item;
     const GList * children = hd_entry_info_get_children(l->data);
@@ -514,7 +514,7 @@
     if (event->keyval == GDK_Escape)
     {
       /* pass focus to the last active application */
-      hd_wm_focus_active_window (hd_wm_get_singleton ());
+      hd_wm_focus_active_window (app_switcher->hdwm);
     }
     else
     {
@@ -651,7 +651,7 @@
      * we skip the first four apps, which cause blinking of the app buttons,
      * not the menu button.
      */
-    for (k = priv->applications, i = 0; k != NULL; k = k->next, ++i)
+    for (k = hd_wm_get_applications (app_switcher->hdwm), i = 0; k != NULL; k = k->next, ++i)
     {
       if (i < priv->nitems)
         continue;
@@ -1148,7 +1148,7 @@
   /* show the main menu button only if there is at least
    * one application on the switcher
    */
-  if (priv->applications)
+  if (hd_wm_get_applications (HN_APP_SWITCHER (widget)->hdwm))
     gtk_widget_show (priv->main_button);
 
   /* show only the buttons linked to an application */
@@ -1162,7 +1162,7 @@
       gtk_widget_show (button);
   }
 }
-
+#if 0
 static HDEntryInfo *
 hn_app_switcher_find_app_for_child(HNAppSwitcher *app_switcher,
                                    HDEntryInfo *entry_info)
@@ -1182,7 +1182,7 @@
 
   return NULL;
 }
-
+#endif
 static void
 remove_entry_from_app_button (HNAppSwitcher *app_switcher,
 			      HDEntryInfo   *entry_info)
@@ -1190,6 +1190,8 @@
   HNAppSwitcherPrivate *priv = app_switcher->priv;
   gint pos;
 
+  if (entry_info == NULL) return;
+
   for (pos = 0; pos < priv->nitems; pos++)
   {
     GtkWidget *button = priv->buttons[pos];
@@ -1295,7 +1297,7 @@
   priv->buttons_group = NULL;
 
   /* then refresh the icons of the application buttons */
-  for (l = priv->applications, pos = 0;
+  for (l = hd_wm_get_applications (app_switcher->hdwm), pos = 0;
        l != NULL && pos < priv->nitems;
        l = l->next, pos++)
   {
@@ -1340,7 +1342,7 @@
   was_blinking = get_main_button_is_blinking (priv->main_button);
 
   is_urgent = FALSE;
-  for (l = priv->applications, pos = 0;
+  for (l = hd_wm_get_applications (app_switcher->hdwm), pos = 0;
        l != NULL;
        l = l->next, ++pos)
   {
@@ -1395,7 +1397,7 @@
   }
 
   /* hide the main button if no more applications are left */
-  if (!priv->applications)
+  if (!hd_wm_get_applications (app_switcher->hdwm))
   {
     g_debug ("Hiding main button icon");
 
@@ -1441,8 +1443,6 @@
 {
   HNAppSwitcher *app_switcher = HN_APP_SWITCHER (data);
   HNAppSwitcherPrivate *priv = app_switcher->priv;
-  HDWMWatchableApp *app;
-  HDEntryInfo * e;
   
   g_debug ("In hn_app_switcher_real_add_info");
 
@@ -1452,43 +1452,6 @@
     return;
   }
 
-  switch(entry_info->type)
-  {
-    case HD_ENTRY_WATCHED_WINDOW:
-    case HD_ENTRY_WATCHED_VIEW:
-      /*
-       * because initial windows get created before we have a chance to add
-       * the application item, we have to store orphan windows in temporary
-       * list and process them when the application item is added
-       */
-      g_debug ("Adding new child to AS ...");
-      app = hd_entry_info_get_app (entry_info);
-      e = hn_app_switcher_find_app_for_child (app_switcher, entry_info);
-
-      if (!e)
-      {
-        e = hd_wm_watchable_app_get_info(app);
-        if (!e)
-        {
-          g_warning ("Could not create HDEntryInfo for app.");
-          return;
-        }
-            
-        priv->applications = g_list_prepend (priv->applications, e);
-      }
-      g_debug ("add_child: %p %p",e,entry_info);        
-      hd_entry_info_add_child (e, entry_info);
-      break;
-    case HD_ENTRY_WATCHED_APP:
-      /* we handle adding of applications internally in AS */
-      g_warning("asked to append HD_ENTRY_WATCHED_APP "
-                "-- this should not happen");
-      return;
-    default:
-      g_warning("Unknown info type");
-      return;
-  }
-
   /* Play a sound */
   if (hn_as_sound_play_sample (priv->esd_socket, priv->start_sample) == -1)
   {
@@ -1515,44 +1478,15 @@
  * an entry has been remove from the application list
  */
 static void
-hn_app_switcher_remove_info_cb (HDWM *hdwm, HDEntryInfo *entry_info, gpointer data)
+hn_app_switcher_remove_info_cb (HDWM *hdwm, 
+				gboolean removed_app, 
+				HDEntryInfo *entry_info, 
+				gpointer data)
 {
   HNAppSwitcher *app_switcher = HN_APP_SWITCHER (data);
   HNAppSwitcherPrivate *priv = app_switcher->priv;
-  HDEntryInfo * info_parent = NULL;
-  gboolean removed_app = FALSE;
+  HDEntryInfo *info_parent = hd_entry_info_get_parent(entry_info);
   
-  switch (entry_info->type)
-  {
-    case HD_ENTRY_WATCHED_WINDOW:
-    case HD_ENTRY_WATCHED_VIEW:
-      g_debug ("removing child from AS ...");
-      info_parent = hd_entry_info_get_parent(entry_info);
-
-      if (!info_parent)
-      {
-        g_warning("An orphan HDEntryInfo !!!");
-        return;
-      }
-
-      if (!hd_entry_info_remove_child(info_parent, entry_info))
-      {
-        g_debug ("... no more children, removing app.");
-        priv->applications = g_list_remove (priv->applications,
-                                            info_parent);
-        removed_app = TRUE;
-      }
-        
-      break;
-    case HD_ENTRY_WATCHED_APP:
-      /* we handle adding/removing of applications internally in AS */
-      g_warning("asked to remove HD_ENTRY_WATCHED_APP -- this should not happen");
-      return;
-    default:
-      g_warning("Unknown info type");
-      return;
-  }
-  
   /* Play a sound */
   if (hn_as_sound_play_sample (priv->esd_socket, priv->end_sample) == -1)
   {
@@ -1577,36 +1511,6 @@
       priv->main_menu = NULL;
     }
 
-  if (removed_app)
-  {
-    /* we need to check that not all of the remaining apps are
-     * hibernating, and if they are, wake one of them up, because
-     * we will not receive current window msg from MB
-     */
-    GList * l;
-    gboolean all_asleep = TRUE;
-      
-    for (l = priv->applications; l != NULL; l = l->next)
-    {
-      HDEntryInfo * entry = l->data;
-      HDWMWatchableApp * app = hd_entry_info_get_app (entry);
-
-      if (app && !hd_wm_watchable_app_is_hibernating (app))
-      {
-        all_asleep = FALSE;
-        break;
-      }
-    }
-
-    if (all_asleep && priv->applications)
-    {
-      /*
-       * Unfortunately, we do not know which application is the
-       * most recently used one, so we just wake up the first one
-       */
-       hd_wm_top_item((HDEntryInfo*)priv->applications->data);
-    }
-  }
 }
 
 
@@ -1643,7 +1547,7 @@
 
     g_debug ("HDEntryInfo present and of type WATCHED_APP");
       
-    for (l = priv->applications, pos = 0;
+    for (l = hd_wm_get_applications (hdwm), pos = 0;
          l != NULL && pos < priv->nitems;
          l = l->next, pos++)
     {
@@ -1712,7 +1616,7 @@
     /* the remaining cases are more complicated and require that we know
      * the state of the associated button
      */
-    for (l = priv->applications, pos = 0;
+    for (l = hd_wm_get_applications (hdwm), pos = 0;
          l != NULL && pos < priv->nitems;
          l = l->next, pos++)
     {
@@ -1856,7 +1760,7 @@
 
      /* locate the associated button, and toggle it */
      active_pos = 0;
-     for (l = priv->applications, pos = 0;
+     for (l = hd_wm_get_applications (hdwm), pos = 0;
           l != NULL && pos < priv->nitems;
           l = l->next, pos++)
      {
@@ -1903,8 +1807,6 @@
   
   osso_deinitialize (priv->osso);
 
-  g_list_free (priv->applications);
-
   if (priv->home_info)
     hd_entry_info_free (priv->home_info);
 
@@ -2057,7 +1959,7 @@
   g_return_if_fail (func != NULL);
 
   priv = app_switcher->priv;
-  entries = priv->applications;
+  entries = hd_wm_get_applications (app_switcher->hdwm);
 
   for (l = entries; l != NULL; l = l->next)
   {
@@ -2073,11 +1975,11 @@
 hn_app_switcher_toggle_menu_button (HNAppSwitcher *app_switcher)
 {
   HNAppSwitcherPrivate *priv;
-
+  
   g_return_if_fail (HN_IS_APP_SWITCHER (app_switcher));
   priv = app_switcher->priv;
 
-  if (!priv->applications)
+  if (!hd_wm_get_applications (app_switcher->hdwm))
     return;
   
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->main_button), TRUE);

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/Makefile.am
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/Makefile.am	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/Makefile.am	2007-01-05 14:29:13 UTC (rev 8972)
@@ -28,6 +28,16 @@
 	-DLOCALEDIR=\"$(localedir)\" \
 	-DDESKTOPENTRYDIR=\"$(hildondesktopentrydir)\"
 
+hd-wm-marshalers.c:
+	        $(LIBTOOL) --mode=execute $(GLIB_GENMARSHAL) hd-wm-marshalers.list --body --header >> hd-wm-marshalers.c
+
+hd-wm-marshalers.h:
+	        $(LIBTOOL) --mode=execute $(GLIB_GENMARSHAL) hd-wm-marshalers.list --header >| hd-wm-marshalers.h
+
+BUILT_SOURCES = \
+	hd-wm-marshalers.c \
+	hd-wm-marshalers.h
+
 lib_LTLIBRARIES = libhildonwm.la
 
 libhildonwm_la_SOURCES = \

Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-marshalers.list
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-marshalers.list	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-marshalers.list	2007-01-05 14:29:13 UTC (rev 8972)
@@ -0,0 +1 @@
+VOID:BOOLEAN,POINTER

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window-view.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window-view.c	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window-view.c	2007-01-05 14:29:13 UTC (rev 8972)
@@ -127,7 +127,9 @@
    */
   HN_DBG("removing view info from AS");
 
-  g_signal_emit_by_name (hdwm,"entry_info_removed",view->info); 
+  gboolean removed_app = hd_wm_remove_applications (hdwm, view->info);
+
+  g_signal_emit_by_name (hdwm,"entry_info_removed",removed_app,view->info);
   /* FIXME: We cant free the info before the callback returns  
   hd_entry_info_free (view->info);*/ /*FIXME: MEMORY LEAKKKK*/
 

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window.c	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm-watched-window.c	2007-01-05 14:29:13 UTC (rev 8972)
@@ -611,9 +611,12 @@
            */
           if (hd_wm_watched_window_peek_info (win))
             {
+	      gboolean removed_app;
               HN_DBG("adding first view; removing window info from AS");
-            
-	      g_signal_emit_by_name (hdwm,"entry_info_removed",hd_wm_watched_window_peek_info (win)); 
+           
+	      removed_app = hd_wm_remove_applications (hdwm, hd_wm_watched_window_peek_info (win));
+ 
+	      g_signal_emit_by_name (hdwm,"entry_info_removed",removed_app,hd_wm_watched_window_peek_info (win)); 
 
               /*
                * since the window of multiviewed app does not figure in the AS,
@@ -1036,7 +1039,11 @@
     {
       /* only windows of multiwindow apps have their own info */
       HN_DBG("a window of multiwindow application; removing info from AS");
-      g_signal_emit_by_name (hdwm,"entry_info_removed",win->info);
+
+      gboolean removed_app = hd_wm_remove_applications (hdwm,win->info);
+ 
+      g_signal_emit_by_name (hdwm,"entry_info_removed",removed_app,win->info);
+      
       hd_entry_info_free (win->info);
       win->info = NULL;
     }

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c	2007-01-05 14:29:13 UTC (rev 8972)
@@ -54,6 +54,8 @@
 #include "hd-entry-info.h"
 #include "osso-manager.h"
 
+#include "hd-wm-marshalers.h"
+
 #define SAVE_METHOD      "save"
 #define KILL_APPS_METHOD "kill_app"
 #define TASKNAV_GENERAL_PATH "/com/nokia/tasknav"
@@ -195,6 +197,8 @@
   gboolean      has_focus;
   guint         dnotify_timeout_id;
   gboolean      modal_windows;
+
+  GList		*applications;
 };
 
 static HDWMPrivate *hdwmpriv = NULL; 			/* Singleton instance */
@@ -660,8 +664,8 @@
 		     G_SIGNAL_RUN_LAST,
 		     G_STRUCT_OFFSET (HDWMClass,entry_info_removed),
 		     NULL, NULL,
-		     g_cclosure_marshal_VOID__POINTER,
-		     G_TYPE_NONE, 1, G_TYPE_POINTER);
+		     g_cclosure_user_marshal_VOID__BOOLEAN_POINTER,
+		     G_TYPE_NONE, 2, G_TYPE_BOOLEAN, G_TYPE_POINTER);
 
   hdwm_signals[HDWM_ENTRY_INFO_STACK_CHANGED_SIGNAL] = 
 	g_signal_new("entry_info_stack_changed",
@@ -761,6 +765,8 @@
 #endif
   /* build our hash of watchable apps via .desktop key/values */
 
+  hdwm->priv->applications = NULL;
+  
   hdwm->priv->watched_apps = hd_wm_watchable_apps_init ();
 
   /* Initialize the common X atoms */
@@ -1613,6 +1619,159 @@
   return TRUE;
 }
 
+static HDEntryInfo *
+hd_wm_find_app_for_child (HDWM *hdwm, HDEntryInfo *entry_info)
+{
+  GList * l = hdwm->priv->applications;
+  HDWMWatchableApp *app = hd_entry_info_get_app(entry_info);
+        
+  while (l)
+  {
+    HDEntryInfo *e = (HDEntryInfo *)l->data;
+            
+    if (app == hd_entry_info_get_app(e))
+      return e;
+    l = g_list_next(l);
+  }
+
+  return NULL;
+}
+
+static void 
+hd_wm_add_applications (HDWM *hdwm, HDEntryInfo *entry_info)
+{
+  HDWMWatchableApp *app;
+  HDEntryInfo	   *e;
+
+  if (!entry_info)
+  {
+    g_warning ("No entry info provided!");
+    return;
+  }
+
+  switch(entry_info->type)
+  {
+    case HD_ENTRY_WATCHED_WINDOW:
+    case HD_ENTRY_WATCHED_VIEW:
+      /*
+       * because initial windows get created before we have a chance to add
+       * the application item, we have to store orphan windows in temporary
+       * list and process them when the application item is added
+       */
+      app = hd_entry_info_get_app (entry_info);
+      e   = hd_wm_find_app_for_child (hdwm,entry_info);
+
+      if (!e)
+      {
+        e = hd_wm_watchable_app_get_info(app);
+        if (!e)
+        {
+          g_warning ("Could not create HDEntryInfo for app.");
+          return;
+        }
+            
+        hdwm->priv->applications = g_list_prepend (hdwm->priv->applications, e);
+      }
+
+      g_debug ("add_child: %p %p",e,entry_info);        
+
+      hd_entry_info_add_child (e, entry_info);
+
+      break;
+      
+    case HD_ENTRY_WATCHED_APP:
+      /* we handle adding of applications internally in AS */
+      g_warning("asked to append HD_ENTRY_WATCHED_APP "
+                "-- this should not happen");
+      return;
+      
+    default:
+      g_warning("Unknown info type");
+      return;
+  }
+
+}
+
+gboolean  
+hd_wm_remove_applications (HDWM *hdwm, HDEntryInfo *entry_info)
+{
+  HDEntryInfo * info_parent = NULL;
+  gboolean removed_app = FALSE;
+	
+  switch (entry_info->type)
+  {
+    case HD_ENTRY_WATCHED_WINDOW:
+    case HD_ENTRY_WATCHED_VIEW:
+      g_debug ("removing child from AS ...");
+      info_parent = hd_entry_info_get_parent(entry_info);
+
+      if (!info_parent)
+      {
+        g_warning("An orphan HDEntryInfo !!!");
+        return FALSE;
+      }
+
+      if (!hd_entry_info_remove_child (info_parent, entry_info))
+      {
+        g_debug ("... no more children, removing app.");
+        hdwm->priv->applications = 
+	  g_list_remove (hdwm->priv->applications, info_parent);
+	
+        removed_app = TRUE;
+      }
+      break;
+      
+    case HD_ENTRY_WATCHED_APP:
+      /* we handle adding/removing of applications internally in AS */
+      g_warning("asked to remove HD_ENTRY_WATCHED_APP -- this should not happen");
+      return FALSE;
+      
+    default:
+      g_warning("Unknown info type");
+      return FALSE;
+  }
+
+  if (removed_app)
+  {
+    /* we need to check that not all of the remaining apps are
+     * hibernating, and if they are, wake one of them up, because
+     * we will not receive current window msg from MB
+     */
+    GList * l;
+    gboolean all_asleep = TRUE;
+      
+    for (l = hdwm->priv->applications; l != NULL; l = l->next)
+    {
+      HDEntryInfo * entry = l->data;
+      HDWMWatchableApp * app = hd_entry_info_get_app (entry);
+
+      if (app && !hd_wm_watchable_app_is_hibernating (app))
+      {
+        all_asleep = FALSE;
+        break;
+      }
+    }
+
+    if (all_asleep && hdwm->priv->applications)
+    {
+      /*
+       * Unfortunately, we do not know which application is the
+       * most recently used one, so we just wake up the first one
+       */
+       hd_wm_top_item ((HDEntryInfo*)hdwm->priv->applications->data);
+    }
+  }
+ 
+  return removed_app;
+}
+
+GList * 
+hd_wm_get_applications (HDWM *hdwm)
+{
+  return hdwm->priv->applications;
+}
+
+
 static void
 hd_wm_process_x_client_list (HDWM *hdwm)
 {
@@ -1705,7 +1864,8 @@
 	      if (!info)
                 {
 		  info  = hd_wm_watched_window_create_new_info (win);
-		  g_debug  ("Adding AS entry for view-less window\n");
+		  g_debug ("Adding AS entry for view-less window\n");
+		  hd_wm_add_applications (hdwm,info);
 		  g_signal_emit_by_name (hdwm,"entry_info_added",info);		
 	        }
 	    }

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h	2007-01-05 14:14:48 UTC (rev 8971)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h	2007-01-05 14:29:13 UTC (rev 8972)
@@ -240,6 +240,13 @@
 void
 hd_wm_get_work_area (HDWM *hdwm, GdkRectangle *work_area);
 
+GList * 
+hd_wm_get_applications (HDWM *hdwm);
+
+gboolean  
+hd_wm_remove_applications (HDWM *hdwm, HDEntryInfo *entry_info);
+
+
 /*
  * These are simple getters/setters that replace direct use of global
  * hnwm->something. In order to ensure that we do not incure performance


More information about the maemo-commits mailing list