[maemo-commits] [maemo-commits] r9192 - in projects/haf/trunk/maemo-af-desktop: . hildon-navigator

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jan 19 15:46:58 EET 2007
Author: moimart
Date: 2007-01-19 15:46:57 +0200 (Fri, 19 Jan 2007)
New Revision: 9192

Modified:
   projects/haf/trunk/maemo-af-desktop/ChangeLog
   projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c
Log:

	* hildon-navigator/hildon-navigator-panel.c:
        - Set default plugins if the .desktop file doesn't have
          enough entries. Fixes: NB#50698.



Modified: projects/haf/trunk/maemo-af-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-af-desktop/ChangeLog	2007-01-19 13:27:34 UTC (rev 9191)
+++ projects/haf/trunk/maemo-af-desktop/ChangeLog	2007-01-19 13:46:57 UTC (rev 9192)
@@ -1,3 +1,9 @@
+2007-01-19  Moises Martinez <moises.martinez at nokia.com>
+
+	* hildon-navigator/hildon-navigator-panel.c:
+	- Set default plugins if the .desktop file doesn't have 
+	  enough entries. Fixes: NB#50698.
+
 2007-01-19  Johan Bilien <johan.bilien at nokia.com>
 
 	* configure.ac: 2.9.99.17

Modified: projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c	2007-01-19 13:27:34 UTC (rev 9191)
+++ projects/haf/trunk/maemo-af-desktop/hildon-navigator/hildon-navigator-panel.c	2007-01-19 13:46:57 UTC (rev 9192)
@@ -197,6 +197,52 @@
   panel_class->peek_plugins           = hn_panel_peek_plugins;
 }
 
+static void 
+hn_panel_send_recovery_plugin_message (void)
+{
+   DBusConnection *connection;
+   DBusMessage    *message;
+   DBusError       dbus_error;
+   gint pid,timeout,init;
+   gchar *strmsg = g_strdup (_("tncpa_ib_default_plugin_restored"));
+
+   pid     = getpid();
+   timeout = 3000;
+   init    = 0;
+
+   dbus_error_init (&dbus_error);
+   connection = dbus_bus_get( DBUS_BUS_SESSION, &dbus_error );
+
+   message = dbus_message_new_method_call
+	     ("com.nokia.statusbar",
+	      "/com/nokia/statusbar", 
+	      "com.nokia.statusbar", 
+	      "delayed_infobanner");
+
+   if (message)
+   {
+     dbus_message_append_args (message, 
+		      	       DBUS_TYPE_INT32, 
+			       &pid,
+			       DBUS_TYPE_INT32,
+			       &init,
+			       DBUS_TYPE_INT32, 
+			       &timeout,
+			       DBUS_TYPE_STRING, 
+			       &strmsg,
+			       DBUS_TYPE_INVALID);
+
+      dbus_connection_send (connection, message, NULL);
+
+      dbus_connection_flush (connection);
+
+  }
+
+  dbus_message_unref(message);
+
+  g_free (strmsg);
+}
+
 static GList * 
 hn_panel_get_plugins_from_file (HildonNavigatorPanel *panel,
 				gchar *filename, 
@@ -209,6 +255,8 @@
   HildonNavigatorItem *plugin = NULL;
   HildonNavigatorPanelPrivate *priv;
   GError *error = NULL;
+  gint position;
+  gboolean mandatory;
 
   g_assert (panel);
 
@@ -250,8 +298,6 @@
   while (groups[i] != NULL)
   {
     gchar *library = NULL;
-    gint position;
-    gboolean mandatory;
   
     library = g_key_file_get_string(keyfile, groups[i],
                                     PLUGIN_KEY_LIB, &error);
@@ -315,50 +361,11 @@
 
 	  if (plugin)
 	  {
-            DBusConnection *connection;
-	    DBusMessage    *message;
-	    DBusError       dbus_error;
-	    gint pid,timeout,init;
-	    gchar *strmsg = g_strdup (_("tncpa_ib_default_plugin_restored"));
-
-	    pid     = getpid();
-	    timeout = 3000;
-	    init    = 0;
-
-	    dbus_error_init (&dbus_error);
-	    connection = dbus_bus_get( DBUS_BUS_SESSION, &dbus_error );
-
-	    message = dbus_message_new_method_call
-		      ("com.nokia.statusbar",
-		       "/com/nokia/statusbar", 
-		       "com.nokia.statusbar", 
-		       "delayed_infobanner");
-
-	    if (message)
-	    {
-	      dbus_message_append_args (message, 
-			      	        DBUS_TYPE_INT32, 
-					&pid,
-					DBUS_TYPE_INT32,
-					&init,
-					DBUS_TYPE_INT32, 
-					&timeout,
-					DBUS_TYPE_STRING, 
-					&strmsg,
-					DBUS_TYPE_INVALID);
-
-	      dbus_connection_send (connection, message, NULL);
-
-	      dbus_connection_flush (connection);
-	    }
-
-	    dbus_message_unref(message);
-		  
+	    hn_panel_send_recovery_plugin_message ();
+	  
 	    priv->default_items[j].used = TRUE;
 	    position  = i;
 	    mandatory = FALSE;
-	    
-	    g_free (strmsg);
 	  }
 	  break;
 	}
@@ -388,11 +395,37 @@
     if (allow_mandatory)
       g_object_set (G_OBJECT (plugin), "mandatory", mandatory,NULL);
 
-    list = g_list_append(list, plugin);
+    list = g_list_append (list, plugin);
 
     i++;
   }
 
+  if (i<HN_MAX_DEFAULT)
+  {
+    for (j=0;j<HN_MAX_DEFAULT;j++)
+    {
+      if (priv->default_items[j].used == FALSE)
+      {
+        plugin = 
+	  hildon_navigator_item_new 
+	    (priv->default_items[j].name,priv->default_items[j].library);
+
+	if (plugin)
+	{
+	  hn_panel_send_recovery_plugin_message ();
+	  
+	  priv->default_items[j].used = TRUE;
+	  position  = i;
+	  mandatory = FALSE;
+
+	  g_object_set (G_OBJECT (plugin), "position", (guint)position,NULL);
+
+	  list = g_list_append (list,plugin);
+	}
+      }	      
+    }
+  }
+
   g_strfreev(groups);
   g_key_file_free(keyfile);
   g_list_free (bad_plugins);


More information about the maemo-commits mailing list