[maemo-commits] [maemo-commits] r11954 - in projects/haf/trunk/hildon-desktop: . data src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue May 29 18:04:22 EEST 2007
Author: lucasr
Date: 2007-05-29 18:04:20 +0300 (Tue, 29 May 2007)
New Revision: 11954

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/data/desktop.conf.in
   projects/haf/trunk/hildon-desktop/src/hd-config.h
   projects/haf/trunk/hildon-desktop/src/hd-desktop.c
   projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c
   projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.h
Log:
2007-05-29  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-desktop.c: read new configuration key "X-Is-Ordered" to
	define plugin manager behavior when syncing.
	* src/hd-plugin-manager.[ch]: make the plugin manager aware if the
	the order of plugin list should be kept or not when syncinc.
	* src/hd-config.h: new key desktop configuration key "X-Is-Ordered".
	* data/desktop.conf.in: mark Home as non-ordered and Statusbar and
	Task Navigator as ordered.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-29 13:03:36 UTC (rev 11953)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-05-29 15:04:20 UTC (rev 11954)
@@ -1,3 +1,13 @@
+2007-05-29  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-desktop.c: read new configuration key "X-Is-Ordered" to
+	define plugin manager behavior when syncing.
+	* src/hd-plugin-manager.[ch]: make the plugin manager aware if the
+	the order of plugin list should be kept or not when syncinc.
+	* src/hd-config.h: new key desktop configuration key "X-Is-Ordered".
+	* data/desktop.conf.in: mark Home as non-ordered and Statusbar and
+	Task Navigator as ordered.
+
 2007-05-29  Johan Bilien  <johan.bilien at nokia.com>
 
 	* src/hd-home-window.c: don't redirect the window here

Modified: projects/haf/trunk/hildon-desktop/data/desktop.conf.in
===================================================================
--- projects/haf/trunk/hildon-desktop/data/desktop.conf.in	2007-05-29 13:03:36 UTC (rev 11953)
+++ projects/haf/trunk/hildon-desktop/data/desktop.conf.in	2007-05-29 15:04:20 UTC (rev 11954)
@@ -6,17 +6,19 @@
 X-Size-Height=80
 X-Orientation=left
 X-UI-Policy=libtasknavigatorpolicy.so
+X-Is-Ordered=1
 X-Config-File=tasknavigator.conf
 X-Plugin-Dir=@hildonnavigatordesktopentrydir@
 
 [Home]
 X-Type=home
-X-Config-File=home.conf
-X-Plugin-Dir=@hildonhomedesktopentrydir@
 X-Padding-Left=10
 X-Padding-Right=10
 X-Padding-Top=12
 X-Padding-Bottom=10
+X-Is-Ordered=0
+X-Config-File=home.conf
+X-Plugin-Dir=@hildonhomedesktopentrydir@
 
 [Statusbar]
 X-Type=panel_expandable
@@ -25,6 +27,6 @@
 X-Size-Width=282
 X-Size-Height=50
 X-Orientation=top
+X-Is-Ordered=1
 X-Config-File=statusbar.conf
 X-Plugin-Dir=@hildonstatusbardesktopentrydir@
-

Modified: projects/haf/trunk/hildon-desktop/src/hd-config.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-config.h	2007-05-29 13:03:36 UTC (rev 11953)
+++ projects/haf/trunk/hildon-desktop/src/hd-config.h	2007-05-29 15:04:20 UTC (rev 11954)
@@ -33,6 +33,7 @@
 #define HD_DESKTOP_CONFIG_KEY_ORIENTATION   "X-Orientation"
 #define HD_DESKTOP_CONFIG_KEY_CONFIG_FILE   "X-Config-File"
 #define HD_DESKTOP_CONFIG_KEY_UI_POLICY     "X-UI-Policy"
+#define HD_DESKTOP_CONFIG_KEY_IS_ORDERED    "X-Is-Ordered"
 #define HD_DESKTOP_CONFIG_KEY_PLUGIN_DIR    "X-Plugin-Dir"
 
 #define HD_DESKTOP_CONFIG_KEY_PADDING_TOP       "X-Padding-Top"

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-05-29 13:03:36 UTC (rev 11953)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-05-29 15:04:20 UTC (rev 11954)
@@ -79,6 +79,7 @@
   GtkWidget              *container;
   HDDesktop              *desktop;
   HDUIPolicy             *policy;
+  gboolean                is_ordered;
   GnomeVFSMonitorHandle  *plugin_dir_monitor;
 } HDDesktopContainerInfo;
 
@@ -365,7 +366,8 @@
   hd_plugin_manager_sync (HD_PLUGIN_MANAGER (priv->pm), 
                           plugin_list, 
                           window->container,
-			  info->policy);
+			  info->policy,
+			  info->is_ordered);
 
   g_list_foreach (plugin_list, (GFunc) g_free , NULL);
   g_list_free (plugin_list); 
@@ -425,7 +427,8 @@
     hd_plugin_manager_sync (HD_PLUGIN_MANAGER (priv->pm),
                             selected_plugins,
                             window->container,
-			    info->policy);
+			    info->policy,
+			    info->is_ordered);
   }
 
   g_list_foreach (selected_plugins, (GFunc) g_free , NULL);
@@ -506,7 +509,8 @@
       hd_plugin_manager_sync (HD_PLUGIN_MANAGER (desktop->priv->pm), 
                               plugin_list, 
                               HILDON_DESKTOP_WINDOW (info->container)->container,
-			      info->policy);
+			      info->policy,
+			      info->is_ordered);
 
       g_free (config_file);
       g_list_foreach (plugin_list, (GFunc) g_free , NULL);
@@ -560,7 +564,8 @@
       hd_plugin_manager_sync (HD_PLUGIN_MANAGER (desktop->priv->pm), 
                               plugin_list, 
                               HILDON_DESKTOP_WINDOW (info->container)->container,
-			      info->policy);
+			      info->policy,
+			      info->is_ordered);
 
       g_free (config_file);
       g_list_foreach (plugin_list, (GFunc) g_free , NULL);
@@ -679,8 +684,21 @@
     GList *plugin_list = NULL;
     gchar *type, *container_config, *container_config_file, *plugin_dir;
     gchar *policy_module;
+    gboolean is_ordered;
     
     error = NULL;
+
+    is_ordered = g_key_file_get_boolean (keyfile, 
+                                         groups[i], 
+                                         HD_DESKTOP_CONFIG_KEY_IS_ORDERED,
+                                         &error);
+
+    if (error)
+    {
+      is_ordered = TRUE;
+      g_error_free (error);
+      error = NULL;
+    }
     
     policy_module = g_key_file_get_string (keyfile, 
                                            groups[i], 
@@ -1009,7 +1027,8 @@
     info->plugin_dir = g_strdup (plugin_dir);
     info->desktop = desktop;
     info->policy = policy;
-    
+    info->is_ordered = is_ordered;
+ 
     g_signal_connect (G_OBJECT (info->container), 
                       "select-plugins",
                       G_CALLBACK (hd_desktop_select_plugins),

Modified: projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c	2007-05-29 13:03:36 UTC (rev 11953)
+++ projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.c	2007-05-29 15:04:20 UTC (rev 11954)
@@ -242,7 +242,8 @@
 hd_plugin_manager_sync (HDPluginManager *pm, 
                         GList           *plugin_list, 
                         GtkContainer    *container,
-			HDUIPolicy      *policy)
+			HDUIPolicy      *policy,
+			gboolean         keep_order)
 {
   GList *children, *iter;
   GList *f_plugin_list = NULL;
@@ -258,7 +259,9 @@
 
   children = gtk_container_get_children (container);
 
-  for (iter = children; iter; iter = g_list_next (iter))
+  /* If keeping the order, we need to temporaly remove the loaded
+     plugins from the container. */
+  for (iter = children; keep_order && iter; iter = g_list_next (iter))
   {
     g_object_ref (iter->data);
     gtk_container_remove (container, GTK_WIDGET (iter->data));
@@ -275,11 +278,14 @@
     {
       if (g_file_test ((const gchar *) iter->data, G_FILE_TEST_EXISTS))
       {
-	gtk_widget_show (GTK_WIDGET (found->data));
-        gtk_container_add (container, GTK_WIDGET (found->data));
+	if (keep_order)
+        {
+	  gtk_widget_show (GTK_WIDGET (found->data));
+          gtk_container_add (container, GTK_WIDGET (found->data));
+	}
         children = g_list_remove_link (children, found);
       }
-      else
+      else if (policy != NULL)
       {
         hd_plugin_manager_handle_plugin_failure (pm, container, policy, position);
       }
@@ -288,7 +294,7 @@
     {
       if (!hd_plugin_manager_load_plugin (pm, 
 			      		  (const gchar *) iter->data, 
-					  container))
+					  container) && policy != NULL)
       {
         hd_plugin_manager_handle_plugin_failure (pm, container, policy, position);
       }

Modified: projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.h	2007-05-29 13:03:36 UTC (rev 11953)
+++ projects/haf/trunk/hildon-desktop/src/hd-plugin-manager.h	2007-05-29 15:04:20 UTC (rev 11954)
@@ -68,7 +68,8 @@
 void       hd_plugin_manager_sync       (HDPluginManager *pm,
                                          GList           *plugin_list, 
                                          GtkContainer    *container,
-					 HDUIPolicy      *policy);
+					 HDUIPolicy      *policy,
+					 gboolean         keep_order);
 
 G_END_DECLS
 


More information about the maemo-commits mailing list