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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jun 8 14:49:33 EEST 2007
Author: moimart
Date: 2007-06-08 14:49:29 +0300 (Fri, 08 Jun 2007)
New Revision: 12203

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.h
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.h
   projects/haf/trunk/hildon-desktop/src/hd-config.h
   projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-default.c
   projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-legacy.c
Log:
2007-06-08  Moises Martinez  <moises.martinez at nokia.com>

        * src/hd-config.h: Added mandatory key
        * src/hd-plugin-loader-legacy.c:
        * src/hd-plugin-loader-default.c:
        - Parse the mandatory key from plugin's .desktop file.
        * libhildondesktop/hildon-desktop-item.[ch]:
        - Added mandatory property.
        * libhildondesktop/statusbar-item.[ch]:
        - Removed mandatory property and move it out to HildonDesktopItem.
        * libhildondesktop/hildon-desktop-panel-expandable.c:
        - Check out mandatory property in HildonDesktopItem not StatusbarItem.
	* ChangeLog updated.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-08 11:49:29 UTC (rev 12203)
@@ -1,3 +1,16 @@
+2007-06-08  Moises Martinez  <moises.martinez at nokia.com>
+
+	* src/hd-config.h: Added mandatory key
+	* src/hd-plugin-loader-legacy.c:
+	* src/hd-plugin-loader-default.c:
+	- Parse the mandatory key from plugin's .desktop file.
+	* libhildondesktop/hildon-desktop-item.[ch]:
+	- Added mandatory property.
+	* libhildondesktop/statusbar-item.[ch]:
+	- Removed mandatory property and move it out to HildonDesktopItem.
+	* libhildondesktop/hildon-desktop-panel-expandable.c:
+	- Check out mandatory property in HildonDesktopItem not StatusbarItem.
+
 2007-06-07  Johan Bilien  <johan.bilien at nokia.com>
 
 	* configure.ac: 0.0.17

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.c	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.c	2007-06-08 11:49:29 UTC (rev 12203)
@@ -41,7 +41,8 @@
 {
   PROP_0,
   PROP_ID,
-  PROP_NAME
+  PROP_NAME,
+  PROP_MANDATORY
 };
 
 static gint desktop_signals[N_SIGNALS];
@@ -100,6 +101,14 @@
                                                        "Name of the plugin, not widget",
                                                        "HildonDesktopItem",
                                                        G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_MANDATORY,
+                                   g_param_spec_boolean("mandatory",
+					   		"mandatory",
+                                                        "plugin that cant'be destroyed",
+                                                        FALSE,
+                                                        G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
+
 }
 
 static void 
@@ -200,10 +209,16 @@
       g_free (item->id);
       item->id = g_strdup (g_value_get_string (value));
       break;
+      
     case PROP_NAME:	   
       g_free (item->name);
       item->name     = g_strdup (g_value_get_string (value));
       break;
+
+    case PROP_MANDATORY:
+      item->mandatory = g_value_get_boolean (value);
+      break;
+      
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -227,9 +242,15 @@
     case PROP_ID:
       g_value_set_string (value,item->id);
       break;
+      
     case PROP_NAME:
       g_value_set_string (value,item->name);
       break;
+ 
+    case PROP_MANDATORY:
+      g_value_set_boolean (value,item->mandatory);
+      break;
+      
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;						

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.h	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-item.h	2007-06-08 11:49:29 UTC (rev 12203)
@@ -48,6 +48,8 @@
   gchar	       *id;
 
   gchar	       *name;
+
+  gboolean      mandatory;
   
   GdkRectangle  geometry;
 };

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c	2007-06-08 11:49:29 UTC (rev 12203)
@@ -665,7 +665,7 @@
 
     if (STATUSBAR_IS_ITEM (l->data) && !STATUSBAR_ITEM (l->data)->condition)
       g_debug ("not unreffing");
-    else if (STATUSBAR_IS_ITEM (l->data) && STATUSBAR_ITEM (l->data)->mandatory)
+    else if (STATUSBAR_IS_ITEM (l->data) && HILDON_DESKTOP_ITEM (l->data)->mandatory)
       g_debug ("not unreffing");
     else
       g_object_unref (G_OBJECT (l->data));

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.c	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.c	2007-06-08 11:49:29 UTC (rev 12203)
@@ -36,7 +36,6 @@
 {
   SB_PROP_0,
   SB_PROP_CONDITION,
-  SB_PROP_MANDATORY
 };
 
 static gint statusbar_signals[SB_ITEM_SIGNALS];
@@ -101,13 +100,6 @@
 		     G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 
   g_object_class_install_property (object_class,
-                                   SB_PROP_MANDATORY,
-                                   g_param_spec_boolean("mandatory",
-					   		"mandatory",
-                                                        "plugin that cant'be destroyed",
-                                                        FALSE,
-                                                        G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
-  g_object_class_install_property (object_class,
                                    SB_PROP_CONDITION,
                                    g_param_spec_boolean("condition",
 					   		"condition",
@@ -142,9 +134,7 @@
     case SB_PROP_CONDITION:
       g_value_set_boolean (value,sbitem->condition);
       break;
-    case SB_PROP_MANDATORY:
-      g_value_set_boolean (value,sbitem->mandatory);
-      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -162,9 +152,7 @@
       sbitem->condition = g_value_get_boolean (value);
       g_object_notify (object, "condition");
       break;
-    case SB_PROP_MANDATORY:
-      sbitem->mandatory = g_value_get_boolean (value);
-      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.h	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/statusbar-item.h	2007-06-08 11:49:29 UTC (rev 12203)
@@ -53,7 +53,6 @@
 
     gint position;
     
-    gboolean mandatory;
     gboolean condition;
 };
 

Modified: projects/haf/trunk/hildon-desktop/src/hd-config.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-config.h	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/src/hd-config.h	2007-06-08 11:49:29 UTC (rev 12203)
@@ -56,6 +56,7 @@
 #define HD_PLUGIN_CONFIG_KEY_NAME           "Name"
 #define HD_PLUGIN_CONFIG_KEY_TYPE           "Type"
 #define HD_PLUGIN_CONFIG_KEY_PATH           "X-Path"
+#define HD_PLUGIN_CONFIG_KEY_MANDATORY      "Mandatory"
 
 #define HD_PLUGIN_CONFIG_KEY_HOME_APPLET    "X-home-applet"
 #define HD_PLUGIN_CONFIG_KEY_HOME_APPLET_RESIZABLE "X-home-applet-resizable"

Modified: projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-default.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-default.c	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-default.c	2007-06-08 11:49:29 UTC (rev 12203)
@@ -27,6 +27,7 @@
 #endif
 
 #include <libhildondesktop/hildon-desktop-plugin.h>
+#include <libhildondesktop/hildon-desktop-item.h>
 
 #include "hd-plugin-loader-default.h"
 #include "hd-config.h"
@@ -48,10 +49,11 @@
   HDPluginLoaderDefaultPrivate *priv;
   HildonDesktopPlugin *plugin; 
   GKeyFile *keyfile;
-  GList *objects = NULL;
+  GList *objects = NULL, *l;
   GError *keyfile_error = NULL;
   gchar *module_file = NULL;
   gchar *module_path = NULL;
+  gboolean mandatory;
 
   g_return_val_if_fail (HD_IS_PLUGIN_LOADER_DEFAULT (loader), NULL);
 
@@ -71,6 +73,18 @@
     return NULL;
   }
 
+  mandatory = g_key_file_get_boolean (keyfile,
+		  		      HD_PLUGIN_CONFIG_GROUP,
+				      HD_PLUGIN_CONFIG_KEY_MANDATORY,
+				      &keyfile_error);
+
+  if (keyfile_error)
+  {
+    mandatory = FALSE;
+    g_error_free (keyfile_error);
+    keyfile_error = NULL;
+  }    
+
   if (g_path_is_absolute (module_file))
   {
     module_path = module_file;
@@ -104,6 +118,10 @@
 
   objects = hildon_desktop_plugin_get_objects (plugin);
 
+  for (l = objects; l != NULL; l = g_list_next (l))
+    if (HILDON_DESKTOP_IS_ITEM (l->data))
+      g_object_set (G_OBJECT (l->data), "mandatory", mandatory, NULL);	    
+
   g_type_module_unuse (G_TYPE_MODULE (plugin));
 
   g_free (module_path);

Modified: projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-legacy.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-legacy.c	2007-06-08 11:43:09 UTC (rev 12202)
+++ projects/haf/trunk/hildon-desktop/src/hd-plugin-loader-legacy.c	2007-06-08 11:49:29 UTC (rev 12203)
@@ -640,6 +640,7 @@
   gchar            *lib_name;
   gchar            *stripped;
   gchar            *entry_name;
+  gboolean	    mandatory;
   GKeyFile         *keyfile;
   struct SBSymbols symbols = {0};
   gpointer          module_data;
@@ -662,6 +663,18 @@
       return NULL;
     }
 
+  mandatory = g_key_file_get_boolean (keyfile,
+		  		      HD_PLUGIN_CONFIG_GROUP,
+			      	      HD_PLUGIN_CONFIG_KEY_MANDATORY,
+				      &local_error);
+
+  if (local_error)
+    {
+      mandatory = FALSE;
+      g_error_free (local_error);
+      local_error = NULL;
+    }      
+
   /* Derive the plugin name from it's library file ... */
   stripped = g_strndup (lib_name + 3, strlen (lib_name) - 6);
   entry_name = g_strdup_printf ("%s_entry", stripped);
@@ -692,7 +705,9 @@
       return NULL;
     }
 
-  item = g_object_new (STATUSBAR_TYPE_ITEM, NULL);
+  item = g_object_new (STATUSBAR_TYPE_ITEM, 
+		       "mandatory", mandatory,
+		       NULL);
 
   module_data = symbols.initialize (item, &module_widget);
 


More information about the maemo-commits mailing list