[maemo-commits] [maemo-commits] r8361 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . data libhildondesktop src

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Mon Nov 27 17:36:03 EET 2006
Author: lucasr
Date: 2006-11-27 17:36:01 +0200 (Mon, 27 Nov 2006)
New Revision: 8361

Added:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.h
Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/data/desktop.conf
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-select-applets-dialog.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-titlebar.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-window.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.h
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.h
Log:
2006-11-27  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-plugin-manager.[ch]: now Plugin Manager just loads/syncs from a
	plugin desktop file list. Desktop is reponsible for loading/saving
	containers conf files.
	* src/hd-desktop.c, src/hd-select-plugins-dialog.[ch], src/Makefile.am: 
	implement plugin selection dialog base on a select-plugins signal emited 
	from Hildon Desktop Window.
	* libhildondesktop/hildon-desktop-window.[ch]: added plugin-dir and
	config-file properties (with their respective accessor methods) and 
	the select-plugins signal. 


Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2006-11-27 15:36:01 UTC (rev 8361)
@@ -1,3 +1,15 @@
+2006-11-27  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-plugin-manager.[ch]: now Plugin Manager just loads/syncs from a
+	plugin desktop file list. Desktop is reponsible for loading/saving
+	containers conf files.
+	* src/hd-desktop.c, src/hd-select-plugins-dialog.[ch], src/Makefile.am: 
+	implement plugin selection dialog base on a select-plugins signal emited 
+	from Hildon Desktop Window.
+	* libhildondesktop/hildon-desktop-window.[ch]: added plugin-dir and
+	config-file properties (with their respective accessor methods) and 
+	the select-plugins signal. 
+
 2006-11-27  Moises Martinez  <moises.martinzes at nokia.com>
 
 	* libhildondesktop: Added old app switcher with new interface.

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/data/desktop.conf
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/data/desktop.conf	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/data/desktop.conf	2006-11-27 15:36:01 UTC (rev 8361)
@@ -6,7 +6,9 @@
 X-Size-Height=80
 X-Orientation=vertical
 X-Config-File=tasknavigator.conf
+X-Plugin-Dir=/usr/share/applications/hildon-navigator
 
 [Home]
 X-Type=home
 X-Config-File=home.conf
+X-Plugin-Dir=/usr/share/applications/hildon-home

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -45,7 +45,7 @@
   N_SIGNALS
 };
 
-static gint desktop_signals[N_SIGNALS];
+static gint signals[N_SIGNALS];
 
 static void desktop_panel_class_init         (DesktopPanelClass *panel_class);
 static void desktop_panel_init               (DesktopPanel *panel);
@@ -100,7 +100,7 @@
   object_class->get_property = desktop_panel_get_property;
   object_class->set_property = desktop_panel_set_property;
 
-  desktop_signals[SIGNAL_FLIP] =
+  signals[SIGNAL_FLIP] =
         g_signal_new("desktop_panel_flip",
                      G_OBJECT_CLASS_TYPE(object_class),
                      G_SIGNAL_RUN_FIRST,

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -25,38 +25,161 @@
 
 #include "hildon-desktop-window.h" 
 
+#define HILDON_DESKTOP_WINDOW_GET_PRIVATE(object) \
+        (G_TYPE_INSTANCE_GET_PRIVATE ((object), HILDON_DESKTOP_TYPE_WINDOW, HildonDesktopWindowPrivate))
+
 G_DEFINE_TYPE (HildonDesktopWindow, hildon_desktop_window, GTK_TYPE_WINDOW);
 
+enum {
+  PROP_0,
+  PROP_CONFIG_FILE,
+  PROP_PLUGIN_DIR
+};
+
+enum {
+  SIGNAL_SELECT_PLUGINS,
+  N_SIGNALS
+};
+
+static gint signals[N_SIGNALS];  
+
+struct _HildonDesktopWindowPrivate 
+{
+  gchar *config_file;
+  gchar *plugin_dir;
+};
+
 static void 
 hildon_desktop_window_finalize (GObject *object)
 {
   HildonDesktopWindow *desktop_window;
+  HildonDesktopWindowPrivate *priv;
 
   desktop_window = HILDON_DESKTOP_WINDOW (object);
 
+  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (desktop_window);
+
   if (desktop_window->container)
   {
     g_object_unref (desktop_window->container);
     desktop_window = NULL;
   }
 
+  if (priv->config_file)
+  {
+    g_free (priv->config_file);
+    priv->config_file = NULL;
+  }
+
+  if (priv->plugin_dir)
+  {
+    g_free (priv->plugin_dir);
+    priv->plugin_dir = NULL;
+  }
+
   G_OBJECT_CLASS (hildon_desktop_window_parent_class)->finalize (object);
 }
 
 static void
-hildon_desktop_window_class_init (HildonDesktopWindowClass *desktopwindow_class)
+hildon_desktop_window_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
 {
-  GObjectClass *g_object_class = G_OBJECT_CLASS (desktopwindow_class);
+  switch (prop_id)
+  {
+    case PROP_CONFIG_FILE:
+      hildon_desktop_window_set_config_file (
+                               HILDON_DESKTOP_WINDOW (object),
+                               (gchar *) g_value_get_string (value));
+      break;
 
-  g_object_class->finalize = hildon_desktop_window_finalize;
+    case PROP_PLUGIN_DIR:
+      hildon_desktop_window_set_plugin_dir (
+                               HILDON_DESKTOP_WINDOW (object),
+                               (gchar *) g_value_get_string (value));
+      break;
+
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
 }
 
+static void
+hildon_desktop_window_get_property (GObject      *object,
+                                    guint         prop_id,
+                                    GValue       *value,
+                                    GParamSpec   *pspec)
+{
+  HildonDesktopWindowPrivate *priv;
+ 
+  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (object);
+
+  switch (prop_id)
+  {
+    case PROP_CONFIG_FILE:
+        g_value_set_string (value, priv->config_file);
+        break;
+
+    case PROP_PLUGIN_DIR:
+        g_value_set_string (value, priv->plugin_dir);
+        break;
+
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
+}
+
 static void 
 hildon_desktop_window_init (HildonDesktopWindow *desktop_window)
 {
+  desktop_window->priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (desktop_window);
+
   desktop_window->container = NULL;
+
+  desktop_window->priv->plugin_dir = NULL;
 }
 
+static void
+hildon_desktop_window_class_init (HildonDesktopWindowClass *desktopwindow_class)
+{
+  GParamSpec *pspec;
+  GObjectClass *g_object_class = G_OBJECT_CLASS (desktopwindow_class);
+
+  g_object_class->finalize     = hildon_desktop_window_finalize;
+  g_object_class->set_property = hildon_desktop_window_set_property;
+  g_object_class->get_property = hildon_desktop_window_get_property;
+
+  signals[SIGNAL_SELECT_PLUGINS] =
+        g_signal_new ("select-plugins",
+                      G_OBJECT_CLASS_TYPE (g_object_class),
+                      G_SIGNAL_RUN_FIRST,
+		      G_STRUCT_OFFSET (HildonDesktopWindowClass, select_plugins),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE, 0);
+
+  pspec = g_param_spec_pointer ("plugin-dir",
+                                "Plugin Directory",
+                                "Plugin Directory",
+                                G_PARAM_READWRITE);
+
+  g_object_class_install_property (g_object_class,
+                                   PROP_PLUGIN_DIR,
+                                   pspec);
+
+  pspec = g_param_spec_pointer ("config-file",
+                                "Config File",
+                                "Config File",
+                                G_PARAM_READWRITE);
+
+  g_object_class_install_property (g_object_class,
+                                   PROP_CONFIG_FILE,
+                                   pspec);
+
+  g_type_class_add_private (g_object_class, sizeof (HildonDesktopWindowPrivate));
+}
+
 void 
 hildon_desktop_window_set_sensitive (HildonDesktopWindow *window, gboolean sensitive)
 {
@@ -68,3 +191,63 @@
 {
 /* TODO: */
 }
+
+const gchar * 
+hildon_desktop_window_get_config_file (HildonDesktopWindow *window)
+{
+  HildonDesktopWindowPrivate *priv;
+
+  g_return_val_if_fail (window != NULL, NULL);
+  g_return_val_if_fail (HILDON_DESKTOP_IS_WINDOW (window), NULL);
+
+  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
+
+  return priv->config_file;
+}
+
+void
+hildon_desktop_window_set_config_file (HildonDesktopWindow *window, 
+                                       gchar               *config_file)
+{
+  HildonDesktopWindowPrivate *priv;
+
+  g_return_if_fail (window != NULL);
+  g_return_if_fail (HILDON_DESKTOP_IS_WINDOW (window));
+
+  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
+
+  if (priv->config_file)
+    g_free (priv->config_file);
+
+  priv->config_file = g_strdup (config_file);
+}
+
+const gchar * 
+hildon_desktop_window_get_plugin_dir (HildonDesktopWindow *window)
+{
+  HildonDesktopWindowPrivate *priv;
+
+  g_return_val_if_fail (window != NULL, NULL);
+  g_return_val_if_fail (HILDON_DESKTOP_IS_WINDOW (window), NULL);
+
+  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
+
+  return priv->plugin_dir;
+}
+
+void
+hildon_desktop_window_set_plugin_dir (HildonDesktopWindow *window, 
+                                      gchar               *plugin_dir)
+{
+  HildonDesktopWindowPrivate *priv;
+
+  g_return_if_fail (window != NULL);
+  g_return_if_fail (HILDON_DESKTOP_IS_WINDOW (window));
+
+  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
+
+  if (priv->plugin_dir)
+    g_free (priv->plugin_dir);
+
+  priv->plugin_dir = g_strdup (plugin_dir);
+}

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h	2006-11-27 15:36:01 UTC (rev 8361)
@@ -32,6 +32,7 @@
 
 typedef struct _HildonDesktopWindow HildonDesktopWindow;
 typedef struct _HildonDesktopWindowClass HildonDesktopWindowClass;
+typedef struct _HildonDesktopWindowPrivate HildonDesktopWindowPrivate;
 
 #define HILDON_DESKTOP_TYPE_WINDOW ( hildon_desktop_window_get_type() )
 #define HILDON_DESKTOP_WINDOW(obj) (GTK_CHECK_CAST (obj, HILDON_DESKTOP_TYPE_WINDOW, HildonDesktopWindow))
@@ -41,30 +42,43 @@
 
 struct _HildonDesktopWindow
 {
-    GtkWindow 	    parent;
+    GtkWindow 	                  parent;
 
-    GtkContainer   *container;
+    HildonDesktopWindowPrivate   *priv;
+    GtkContainer                 *container;
 };
 
 struct _HildonDesktopWindowClass
 {
     GtkWindowClass parent_class;
 
-    void (*set_sensitive) (HildonDesktopWindow *window,
-			   gboolean sensitive);
+    void (*select_plugins) (HildonDesktopWindow *window);
+
+    void (*set_sensitive)  (HildonDesktopWindow *window,
+			    gboolean sensitive);
     
-    void (*set_focus)     (HildonDesktopWindow *window,
-			   gboolean focus);
+    void (*set_focus)      (HildonDesktopWindow *window,
+			    gboolean focus);
 };
 
-GType  hildon_desktop_window_get_type       (void);
+GType          hildon_desktop_window_get_type         (void);
 
-void   hildon_desktop_window_set_sensitive  (HildonDesktopWindow *window, 
-                                             gboolean             sensitive);
+void           hildon_desktop_window_set_sensitive    (HildonDesktopWindow *window, 
+                                                       gboolean             sensitive);
 
-void   hildon_desktop_window_set_focus      (HildonDesktopWindow *window, 
-                                             gboolean             focus);
+void           hildon_desktop_window_set_focus        (HildonDesktopWindow *window, 
+                                                       gboolean             focus);
 
+const gchar*   hildon_desktop_window_get_config_file  (HildonDesktopWindow *window);
+
+void           hildon_desktop_window_set_config_file  (HildonDesktopWindow *window, 
+                                                       gchar               *config_file);
+
+const gchar*   hildon_desktop_window_get_plugin_dir   (HildonDesktopWindow *window);
+
+void           hildon_desktop_window_set_plugin_dir   (HildonDesktopWindow *window, 
+                                                       gchar               *plugin_dir);
+
 G_END_DECLS
 
 #endif

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-select-applets-dialog.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-select-applets-dialog.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-select-applets-dialog.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -129,7 +129,6 @@
   return dialog;
 }
 
-
 static
 void hildon_home_select_applets_dialog_applet_toggled 
                                 (GtkCellRendererToggle *cell_renderer,

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-titlebar.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-titlebar.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-titlebar.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -772,10 +772,12 @@
   gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
   hildon_gtk_widget_set_logical_font (priv->label,
                                       HILDON_HOME_TITLEBAR_MENU_LABEL_FONT);
+  /*
   hildon_gtk_widget_set_logical_color (priv->label,
                                        GTK_RC_FG,
                                        GTK_STATE_NORMAL,
                                        HILDON_HOME_TITLEBAR_MENU_LABEL_COLOR);
+  */
   gtk_container_add (GTK_CONTAINER (align), priv->label);
   gtk_widget_show (priv->label);
 

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-window.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-window.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-window.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -166,36 +166,7 @@
 titlebar_select_applets_activate_cb (HildonHomeTitlebar *titlebar,
                                      HildonHomeWindow   *window)
 {
-  GtkWidget *dialog;
-  gint response;
-  HildonHomeWindowPrivate *priv = window->priv;
-  g_debug ("select applets activate\n");
-
-  if (priv->is_lowmem)
-    {
-      hildon_banner_show_information (NULL,
-                                      NULL,
-                                      HH_LOW_MEMORY_TEXT);
-      return;
-    }
-
-  hildon_home_area_sync_to_list (HILDON_HOME_AREA (priv->applet_area),
-                                 priv->plugin_list);
-
-  dialog = hildon_home_select_applets_dialog_new_with_model 
-                                    (GTK_TREE_MODEL (priv->plugin_list),
-                                     priv->osso_context);
-
-  response = gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_destroy (dialog);
-  
-  if (response != GTK_RESPONSE_OK)
-    return;
-
-  hildon_home_area_sync_from_list (
-                          HILDON_HOME_AREA (priv->applet_area),
-                          priv->plugin_list);
-
+  g_signal_emit_by_name (window, "select-plugins", NULL);
 }
 
 static void
@@ -337,7 +308,6 @@
                           priv->plugin_list);
 }
 
-
 static void
 area_layout_mode_ended (HildonHomeArea *area,
                         HildonHomeWindow   *window)

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am	2006-11-27 15:36:01 UTC (rev 8361)
@@ -41,12 +41,15 @@
 		          hd-desktop.h                \
 		          hd-plugin-manager.c         \
 		          hd-plugin-manager.h         \
-				  hd-plugin-loader-factory.c  \
+			  hd-plugin-loader-factory.c  \
 		          hd-plugin-loader-factory.h  \
-				  hd-plugin-loader.c          \
+			  hd-plugin-loader.c          \
 		          hd-plugin-loader.h          \
-				  hd-plugin-loader-legacy.c   \
-				  hd-plugin-loader-legacy.h
+			  hd-plugin-loader-legacy.c   \
+			  hd-plugin-loader-legacy.h   \
+			  hd-select-plugins-dialog.c  \
+			  hd-select-plugins-dialog.h  \
+			  hd-config.h
 
 HOME_SOURCES = hd-home-window.c \
 			   hd-home-window.h

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -33,8 +33,11 @@
 #include <gtk/gtk.h>
 
 #include <libhildondesktop/desktop-panel-window.h>
+#include <libhildondesktop/hildon-desktop-window.h>
 
 #include "hd-desktop.h"
+#include "hd-select-plugins-dialog.h"
+#include "hd-config.h"
 #include "hd-plugin-manager.h"
 #include "hd-home-window.h"
 
@@ -46,23 +49,6 @@
 #define HD_DESKTOP_CONFIG_FILE         "desktop.conf"
 #define HD_DESKTOP_CONFIG_USER_PATH    ".osso/hildon-desktop/"
 
-#define HD_DESKTOP_KEY_TYPE            "X-Type"
-#define HD_DESKTOP_KEY_POSITION_X      "X-Position-X"
-#define HD_DESKTOP_KEY_POSITION_Y      "X-Position-Y"
-#define HD_DESKTOP_KEY_SIZE_WIDTH      "X-Size-Width"
-#define HD_DESKTOP_KEY_SIZE_HEIGHT     "X-Size-Height"
-#define HD_DESKTOP_KEY_ORIENTATION     "X-Orientation"
-#define HD_DESKTOP_KEY_CONFIG_FILE     "X-Config-File"
-
-#define HD_CONTAINER_TYPE_HOME         "home"
-#define HD_CONTAINER_TYPE_PANEL_FIXED  "panel_fixed"
-#define HD_CONTAINER_TYPE_PANEL_BOX    "panel_box"
-
-#define HD_WINDOW_ORIENTATION_NORTH    "north"
-#define HD_WINDOW_ORIENTATION_SOUTH    "south"
-#define HD_WINDOW_ORIENTATION_WEST     "west"
-#define HD_WINDOW_ORIENTATION_EAST     "east"
-
 struct _HDDesktopPrivate 
 {
   gchar      *config_path;
@@ -73,6 +59,76 @@
 
 static void hd_desktop_load_containers (HDDesktop *desktop);
 
+static GList *
+hd_desktop_plugin_list_from_conf (const gchar *config_file)
+{
+  GKeyFile *keyfile;
+  gchar **groups;
+  GList *plugin_list = NULL;
+  GError *error = NULL;
+  gint i;
+
+  g_return_val_if_fail (config_file != NULL, NULL);
+
+  keyfile = g_key_file_new ();
+
+  g_key_file_load_from_file (keyfile,
+                             config_file,
+                             G_KEY_FILE_NONE,
+                             &error);
+
+  if (error)
+  {
+    g_warning ("Error loading container configuration file: %s", error->message);
+    g_error_free (error);
+
+    return NULL;
+  }
+
+  groups = g_key_file_get_groups (keyfile, NULL);
+
+  for (i = 0; groups[i]; i++)
+  {
+    plugin_list = g_list_append (plugin_list, groups[i]);
+  }
+
+  g_key_file_free (keyfile);
+
+  return plugin_list;
+}
+
+static void 
+hd_desktop_select_plugins (HildonDesktopWindow *window, gpointer user_data)
+{
+/*  const gchar *config_file; */
+  const gchar *plugin_dir;
+  GList *loaded_plugins = NULL;
+  GList *selected_plugins = NULL;
+  HDDesktopPrivate *priv;
+
+  g_return_if_fail (user_data != NULL);
+  g_return_if_fail (HD_IS_DESKTOP (user_data));
+
+  priv = HD_DESKTOP_GET_PRIVATE (user_data);
+
+  loaded_plugins = gtk_container_get_children (window->container);
+
+/*  config_file = hildon_desktop_window_get_config_file (window); */
+  plugin_dir = hildon_desktop_window_get_plugin_dir (window);
+
+  selected_plugins = hd_select_plugins_dialog_run (loaded_plugins, 
+                                                   plugin_dir);
+
+  hd_plugin_manager_sync (HD_PLUGIN_MANAGER (priv->pm),
+                          selected_plugins,
+                          window->container);
+
+  /*Save container file here */
+
+  g_list_free (selected_plugins);
+  g_list_free (loaded_plugins);
+}
+
 static gboolean
 hd_desktop_destroy_container (gpointer key, gpointer value, gpointer user_data)
 {
@@ -98,12 +154,17 @@
 static void
 hd_desktop_container_config_changed (gchar *config_file, HDDesktop *desktop)
 {
+  GList *plugin_list = NULL;
   GtkContainer *container = g_hash_table_lookup (desktop->priv->containers,
                                                  config_file);
 
+  plugin_list = hd_desktop_plugin_list_from_conf (config_file);
+
   hd_plugin_manager_sync (HD_PLUGIN_MANAGER (desktop->priv->pm), 
-                          config_file, 
-                          container);
+                          plugin_list, 
+                          HILDON_DESKTOP_WINDOW (container)->container);
+
+  g_list_free (plugin_list);
 }
 
 static void 
@@ -155,11 +216,12 @@
   for (i = 0; groups[i]; i++)
   {
     GtkWidget *container = NULL;
-    gchar *type, *container_config, *container_config_file;
+    GList *plugin_list = NULL;
+    gchar *type, *container_config, *container_config_file, *plugin_dir;
 
     container_config_file = g_key_file_get_string (keyfile, 
                                                    groups[i], 
-                                                   HD_DESKTOP_KEY_CONFIG_FILE,
+                                                   HD_DESKTOP_CONFIG_KEY_CONFIG_FILE,
                                                    &error);
 
     if (error)
@@ -196,9 +258,24 @@
       }
     }
 
+    plugin_dir = g_key_file_get_string (keyfile, 
+                                        groups[i], 
+                                        HD_DESKTOP_CONFIG_KEY_PLUGIN_DIR,
+                                        &error);
+
+    if (error)
+    {
+      g_warning ("Error reading desktop configuration file: %s", 
+                 error->message);
+
+      g_error_free (error);
+
+      continue;
+    }
+
     type = g_key_file_get_string (keyfile, 
                                   groups[i], 
-                                  HD_DESKTOP_KEY_TYPE,
+                                  HD_DESKTOP_CONFIG_KEY_TYPE,
                                   &error);
 
     if (error)
@@ -227,7 +304,7 @@
 
       x = g_key_file_get_integer (keyfile, 
                                   groups[i],
-                                  HD_DESKTOP_KEY_POSITION_X,
+                                  HD_DESKTOP_CONFIG_KEY_POSITION_X,
                                   &error);
 
       if (error)
@@ -242,7 +319,7 @@
 
       y = g_key_file_get_integer (keyfile, 
                                   groups[i],
-                                  HD_DESKTOP_KEY_POSITION_Y,
+                                  HD_DESKTOP_CONFIG_KEY_POSITION_Y,
                                   &error);
 
       if (error)
@@ -257,7 +334,7 @@
 
       width = g_key_file_get_integer (keyfile, 
                                       groups[i],
-                                      HD_DESKTOP_KEY_SIZE_WIDTH,
+                                      HD_DESKTOP_CONFIG_KEY_SIZE_WIDTH,
                                       &error);
 
       if (error)
@@ -272,7 +349,7 @@
 
       height = g_key_file_get_integer (keyfile, 
                                        groups[i],
-                                       HD_DESKTOP_KEY_SIZE_HEIGHT,
+                                       HD_DESKTOP_CONFIG_KEY_SIZE_HEIGHT,
                                        &error);
 
       if (error)
@@ -287,7 +364,7 @@
 
       orientation_str = g_key_file_get_string (keyfile, 
                                                groups[i],
-                                               HD_DESKTOP_KEY_ORIENTATION,
+                                               HD_DESKTOP_CONFIG_KEY_ORIENTATION,
                                                &error);
 
       if (error)
@@ -311,7 +388,6 @@
       else 
         orientation = DPANEL_ORIENTATION_LEFT; 
 
-      /* Add Panel Box creation code here. */
       container = g_object_new (DESKTOP_TYPE_PANEL_WINDOW,
                                "x", x,
                                "y", y,
@@ -331,21 +407,35 @@
       continue;
     }
 
+    hildon_desktop_window_set_config_file (HILDON_DESKTOP_WINDOW (container), 
+                                           container_config);
+
+    hildon_desktop_window_set_plugin_dir (HILDON_DESKTOP_WINDOW (container), 
+                                          plugin_dir);
+
+    g_signal_connect (G_OBJECT (container), 
+                      "select-plugins",
+                      G_CALLBACK (hd_desktop_select_plugins),
+                      desktop);
+
     hd_desktop_watch_file (container_config, 
                            hd_desktop_container_config_changed, 
                            container);
 
     g_hash_table_insert (priv->containers, container_config, container);
 
+    plugin_list = hd_desktop_plugin_list_from_conf (container_config);
+
     hd_plugin_manager_load (HD_PLUGIN_MANAGER (priv->pm), 
-                            container_config, 
-                            GTK_CONTAINER (container));
+                            plugin_list, 
+                            HILDON_DESKTOP_WINDOW (container)->container);
 
     gtk_widget_show_all (container);
 
     g_free (type);
     g_free (container_config);
     g_free (container_config_file);
+    g_list_free (plugin_list);
   }
 
   g_strfreev (groups);

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -27,15 +27,13 @@
 #include "hd-plugin-loader.h"
 #include "hd-plugin-loader-legacy.h"
 #include "hd-plugin-loader-factory.h"
+#include "hd-config.h"
 
 #define HD_PLUGIN_LOADER_FACTORY_GET_PRIVATE(object) \
         (G_TYPE_INSTANCE_GET_PRIVATE ((object), HD_TYPE_PLUGIN_LOADER_FACTORY, HDPluginLoaderFactoryPrivate))
 
 G_DEFINE_TYPE (HDPluginLoaderFactory, hd_plugin_loader_factory, G_TYPE_OBJECT);
 
-#define HD_DESKTOP_PLUGIN_GROUP       "Desktop Entry"
-#define HD_DESKTOP_PLUGIN_KEY_TYPE    "Type"
-
 struct _HDPluginLoaderFactoryPrivate 
 {
   GHashTable *registry;
@@ -100,7 +98,7 @@
 
 HDPluginLoader *
 hd_plugin_loader_factory_create (HDPluginLoaderFactory *factory,
-                                 gchar                 *plugin_path)
+                                 const gchar           *plugin_path)
 {
   HDPluginLoaderFactoryPrivate *priv;
   HDPluginLoader *loader = NULL;
@@ -130,8 +128,8 @@
   }
 
   type = g_key_file_get_string (keyfile,
-                                HD_DESKTOP_PLUGIN_GROUP,
-                                HD_DESKTOP_PLUGIN_KEY_TYPE,
+                                HD_PLUGIN_CONFIG_GROUP,
+                                HD_PLUGIN_CONFIG_KEY_TYPE,
                                 &error);
 
   if (error)

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.h	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.h	2006-11-27 15:36:01 UTC (rev 8361)
@@ -62,7 +62,7 @@
 GObject*         hd_plugin_loader_factory_new      (void);
 
 HDPluginLoader*  hd_plugin_loader_factory_create   (HDPluginLoaderFactory *factory,
-                                                    gchar                 *plugin_path);
+                                                    const gchar           *plugin_path);
 
 G_END_DECLS
 

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -28,8 +28,6 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#include <libhildondesktop/hildon-desktop-window.h>
-
 #include "hd-plugin-manager.h"
 #include "hd-plugin-loader.h"
 #include "hd-plugin-loader-factory.h"
@@ -46,16 +44,16 @@
 
 static void 
 hd_plugin_manager_load_plugin (HDPluginManager *pm, 
-                               gchar           *plugin_path, 
+                               const gchar     *plugin_path, 
                                GtkContainer    *container)
 {
   HDPluginLoader *loader;
   GtkWidget *plugin;
   GError *error = NULL;
 
-  g_return_if_fail (plugin_path != NULL);
   g_return_if_fail (pm != NULL);
   g_return_if_fail (HD_IS_PLUGIN_MANAGER (pm));
+  g_return_if_fail (plugin_path != NULL);
   g_return_if_fail (container != NULL);
   g_return_if_fail (GTK_IS_CONTAINER (container));
 
@@ -84,51 +82,46 @@
     return;
   }
 
-  gtk_container_add (HILDON_DESKTOP_WINDOW (container)->container, plugin);
-}
+  g_object_set (G_OBJECT (plugin),
+                "id", plugin_path,
+                NULL);
 
-static gchar **
-hd_plugin_manager_get_plugins_from_keyfile (gchar *keyfile_path)
-{
-  GKeyFile *keyfile;
-  gchar **plugins;
-  GError *error = NULL;
+  /* FIXME: Remove this when home is fixed */
+  gtk_widget_show_all (plugin);
 
-  g_return_val_if_fail (keyfile_path != NULL, NULL);
+  gtk_container_add (container, plugin);
 
-  keyfile = g_key_file_new ();
+}
 
-  g_key_file_load_from_file (keyfile,
-                             keyfile_path,
-                             G_KEY_FILE_NONE,
-                             &error);
+static gint
+hd_plugin_manager_find_by_file (gconstpointer a, gconstpointer b)
+{
+  gint result = -1;
+  gchar *id = NULL;
 
-  if (error)
-  {
-    g_warning ("Error loading user configuration file: %s", error->message);
-    g_error_free (error);
+  g_object_get (G_OBJECT (a),
+                "id", &id,
+                NULL);
 
-    return NULL;
-  }
+  if (!g_ascii_strcasecmp (id, b))
+    result = 0;
 
-  plugins = g_key_file_get_groups (keyfile, NULL);
+  g_free (id);
 
-  g_key_file_free (keyfile);
-
-  return plugins;
+  return result;
 }
 
 static gint
-hd_plugin_manager_find_func (gconstpointer a, gconstpointer b)
+hd_plugin_manager_find_by_plugin (gconstpointer a, gconstpointer b)
 {
   gint result = -1;
   gchar *id = NULL;
 
-  g_object_get (G_OBJECT (a),
+  g_object_get (G_OBJECT (b),
                 "id", &id,
                 NULL);
 
-  if (!g_ascii_strcasecmp (id, b))
+  if (!g_ascii_strcasecmp (a, id))
     result = 0;
 
   g_free (id);
@@ -183,74 +176,56 @@
 
 void
 hd_plugin_manager_load (HDPluginManager *pm, 
-                        gchar           *user_configuration, 
+                        GList           *plugin_list, 
                         GtkContainer    *container)
 {
-  gchar **plugins;
-  gint i;
+  GList *iter;
 
-  g_return_if_fail (user_configuration != NULL);
   g_return_if_fail (GTK_IS_CONTAINER (container));
 
-  plugins = hd_plugin_manager_get_plugins_from_keyfile (user_configuration);
-
-  for (i = 0; plugins[i]; i++)
+  for (iter = plugin_list; iter; iter = g_list_next (iter))
   {
-    hd_plugin_manager_load_plugin (pm, plugins[i], container);
+    hd_plugin_manager_load_plugin (pm, (const gchar *) iter->data, container);
   }
-
-  g_strfreev (plugins);
 }
 
 void
 hd_plugin_manager_sync (HDPluginManager *pm, 
-                        gchar           *user_configuration, 
+                        GList           *plugin_list, 
                         GtkContainer    *container)
 {
-  gchar **plugins;
   GList *children, *iter;
-  gint i;
 
-  g_return_if_fail (user_configuration != NULL);
   g_return_if_fail (GTK_IS_CONTAINER (container));
 
-  plugins = hd_plugin_manager_get_plugins_from_keyfile (user_configuration);
   children = gtk_container_get_children (container);
 
   /* Add plugins to container if they are not already loaded */
-  for (i = 0; plugins[i]; i++)
+  for (iter = plugin_list; iter; iter = g_list_next (iter))
   {
     GList *found = g_list_find_custom (children, 
-                                       plugins[i], 
-                                       hd_plugin_manager_find_func);
+                                       iter->data,
+                                       hd_plugin_manager_find_by_file);
 
     if (!found)
     {
-      hd_plugin_manager_load_plugin (pm, plugins[i], container);
+      hd_plugin_manager_load_plugin (pm, (const gchar *) iter->data, container);
     }
   }
 
-  /* Remove plugins from container if they were removed 
-     from user configuration */
+  /* Remove plugins from container if they are not o 
+     from list */
   for (iter = children; iter; iter = g_list_next (iter))
   {
-    gboolean found = FALSE;
+    GList *found = g_list_find_custom (plugin_list, 
+                                       iter->data, 
+                                       hd_plugin_manager_find_by_plugin);
 
-    for (i = 0; plugins[i]; i++)
+    if (!found)
     {
-      if (!hd_plugin_manager_find_func (iter->data, plugins[i]))
-      {
-        found = TRUE;
-        break;
-      }
+      gtk_widget_destroy (GTK_WIDGET (iter->data));
     }
-
-    if (!found) 
-    {
-      gtk_widget_destroy (GTK_WIDGET (iter->data)); 
-    }
   }
 
   g_list_free (children);
-  g_strfreev (plugins); 
 }

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.h	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.h	2006-11-27 15:36:01 UTC (rev 8361)
@@ -26,6 +26,7 @@
 #define HD_PLUGIN_MANAGER_H
 
 #include <gtk/gtk.h>
+#include <glib.h>
 #include <glib-object.h>
 
 G_BEGIN_DECLS
@@ -53,17 +54,17 @@
   GObjectClass parent_class;
 };
 
-GType      hd_plugin_manager_get_type  (void);
+GType      hd_plugin_manager_get_type   (void);
 
-GObject*   hd_plugin_manager_new       (void);
+GObject*   hd_plugin_manager_new        (void);
 
-void       hd_plugin_manager_load      (HDPluginManager *pm,
-                                        gchar           *user_configuration, 
-                                        GtkContainer    *container);
+void       hd_plugin_manager_load       (HDPluginManager *pm,
+                                         GList           *plugin_list, 
+                                         GtkContainer    *container);
 
-void       hd_plugin_manager_sync      (HDPluginManager *pm,
-                                        gchar           *user_configuration, 
-                                        GtkContainer    *container);
+void       hd_plugin_manager_sync       (HDPluginManager *pm,
+                                         GList           *plugin_list, 
+                                         GtkContainer    *container);
 
 G_END_DECLS
 

Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.c	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.c	2006-11-27 15:36:01 UTC (rev 8361)
@@ -0,0 +1,311 @@
+/*
+ * This file is part of hildon-desktop
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Author:  Lucas Rocha <lucas.rocha at nokia.com>
+ *          Johan Bilien <johan.bilien at nokia.com>
+ * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <osso-helplib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "hd-select-plugins-dialog.h"
+#include "hd-config.h"
+
+#define HD_SELECT_PLUGINS_DIALOG_WIDTH  400 
+#define HD_SELECT_PLUGINS_DIALOG_TITLE  _("home_ti_select_applets")
+#define HD_SELECT_PLUGINS_DIALOG_OK     _("home_bd_select_applets_ok")
+#define HD_SELECT_PLUGINS_DIALOG_CANCEL _("home_bd_select_applets_cancel")
+
+enum
+{
+  HD_SPD_COLUMN_NAME = 0,
+  HD_SPD_COLUMN_ACTIVE,
+  HD_SPD_COLUMN_DESKTOP_FILE,
+  HD_SPD_N_COLUMNS
+};
+
+static GList *
+hd_select_plugins_dialog_get_selected (GtkListStore *plugin_list)
+{
+  GtkTreeIter iter;
+  gboolean valid;
+  GList *selected_plugins = NULL;
+
+  valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (plugin_list), &iter);
+
+  while (valid)
+  {
+    gboolean active;
+    gchar *desktop_file;    
+ 
+    gtk_tree_model_get (GTK_TREE_MODEL (plugin_list),
+                        &iter,
+                        HD_SPD_COLUMN_ACTIVE, &active,
+                        HD_SPD_COLUMN_DESKTOP_FILE, &desktop_file,
+                        -1);
+
+    if (active)
+    {
+       selected_plugins = g_list_append (selected_plugins, desktop_file);
+    }
+
+    valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (plugin_list), &iter);
+  }
+
+  return selected_plugins;
+}
+
+static gint
+hd_select_plugins_dialog_find_func (gconstpointer a, gconstpointer b)
+{
+  gint result = -1;
+  gchar *id = NULL;
+
+  g_object_get (G_OBJECT (a),
+                "id", &id,
+                NULL);
+
+  if (!g_ascii_strcasecmp (id, b))
+    result = 0;
+
+  g_free (id);
+
+  return result;
+}
+
+static void 
+hd_select_plugins_dialog_plugin_toggled
+                                (GtkCellRendererToggle *cell_renderer,
+                                 gchar *path,
+                                 gpointer user_data)
+{
+  GtkTreeIter iter;
+  gboolean active;
+
+  /* Get the GtkTreeModel iter */
+  GtkTreeModel *model = GTK_TREE_MODEL (user_data);
+
+  if (!gtk_tree_model_get_iter_from_string (model, &iter, path)) return;
+
+  /* Get boolean value */
+  gtk_tree_model_get (model,
+                      &iter,
+                      HD_SPD_COLUMN_ACTIVE, &active,
+                      -1);
+
+  /* Change the iter value on the TreeModel */
+  gtk_list_store_set (GTK_LIST_STORE (model),
+                      &iter,
+                      HD_SPD_COLUMN_ACTIVE, !active,
+                      -1);
+}
+
+static GtkListStore *
+hd_select_plugins_dialog_get_store (GList *loaded_plugins,
+                                    const gchar *plugin_dir)
+{
+  GDir *dir;
+  GKeyFile *keyfile;
+  const char *filename;
+  GError *error = NULL;
+  GtkListStore *store;
+  GtkTreeIter iter;
+
+  store = gtk_list_store_new (HD_SPD_N_COLUMNS, 
+                              G_TYPE_STRING, 
+                              G_TYPE_BOOLEAN,
+                              G_TYPE_STRING); 
+
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+                                        HD_SPD_COLUMN_NAME,
+                                        GTK_SORT_ASCENDING);
+
+  dir = g_dir_open (plugin_dir, 0, &error);
+
+  if (!dir)
+  {
+    g_warning ("Error reading plugin directory: %s", error->message);
+
+    g_error_free (error);
+
+    return NULL;
+  }
+
+  keyfile = g_key_file_new ();
+
+  while ((filename = g_dir_read_name (dir)))
+  {
+    gchar *desktop_path = NULL;
+    gchar *name = NULL;
+    GList *active;
+    error = NULL;
+
+    desktop_path = g_build_filename (plugin_dir, filename, NULL);
+
+    g_key_file_load_from_file (keyfile,
+                               desktop_path,
+                               G_KEY_FILE_NONE,
+                               &error);
+
+    if (error)
+    {
+      g_warning ("Error loading plugin configuration file: %s", error->message);
+
+      g_error_free (error);
+
+      return NULL;
+    }
+
+    name = g_key_file_get_locale_string (keyfile,
+                                         HD_PLUGIN_CONFIG_GROUP,
+                                         HD_PLUGIN_CONFIG_KEY_NAME,
+                                         NULL /* current locale */,
+                                         &error);
+
+    if (error)
+    {
+      g_warning ("Error reading plugin configuration file: %s", error->message);
+
+      g_error_free (error);
+
+      return NULL;
+    }
+
+    active = g_list_find_custom (loaded_plugins, 
+                                 desktop_path, 
+                                 hd_select_plugins_dialog_find_func);
+
+    gtk_list_store_append (GTK_LIST_STORE (store), &iter);
+
+    gtk_list_store_set (GTK_LIST_STORE (store), &iter, 
+                        HD_SPD_COLUMN_NAME, _(name),
+                        HD_SPD_COLUMN_ACTIVE, active,
+                        HD_SPD_COLUMN_DESKTOP_FILE, desktop_path,
+                        -1);
+
+    g_free (name);
+  }
+
+  return store;
+}
+
+GList *
+hd_select_plugins_dialog_run (GList *loaded_plugins,
+                              const gchar *plugin_dir)
+{
+  GtkWidget        *dialog;
+  GtkWidget        *scrollwindow;
+  GtkWidget        *treeview;
+  GtkCellRenderer  *cell_renderer;
+  GtkListStore     *plugin_list;
+  gint              response;
+  GList            *selected_plugins = NULL;
+
+  plugin_list = hd_select_plugins_dialog_get_store (loaded_plugins, 
+                                                    plugin_dir);
+
+  if (!plugin_list)
+  {
+    return NULL;
+  }
+
+  dialog = gtk_dialog_new_with_buttons (HD_SELECT_PLUGINS_DIALOG_TITLE,
+                                        NULL,
+                                        GTK_DIALOG_MODAL |
+                                        GTK_DIALOG_DESTROY_WITH_PARENT |
+                                        GTK_DIALOG_NO_SEPARATOR,
+                                        HD_SELECT_PLUGINS_DIALOG_OK,
+                                        GTK_RESPONSE_OK,
+                                        HD_SELECT_PLUGINS_DIALOG_CANCEL,
+                                        GTK_RESPONSE_CANCEL,
+                                        NULL);
+
+  gtk_widget_set_size_request (dialog, HD_SELECT_PLUGINS_DIALOG_WIDTH, -1);
+
+#if 0
+  /* Add help button to the dialog */
+  ossohelp_dialog_help_enable (GTK_DIALOG(dialog),
+                               HH_HELP_SELECT_APPLETS,
+                               osso_home);
+#endif
+
+  scrollwindow = gtk_scrolled_window_new (NULL, NULL);
+
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwindow),
+                                       GTK_SHADOW_ETCHED_IN);
+
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwindow),
+                                  GTK_POLICY_NEVER,
+                                  GTK_POLICY_NEVER);
+
+  treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (plugin_list));
+
+  g_object_set (treeview, "allow-checkbox-mode", FALSE, NULL);
+
+  cell_renderer = gtk_cell_renderer_toggle_new ();
+
+  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), 
+                                               -1,
+                                               NULL,
+                                               cell_renderer,
+                                               "active",
+                                               HD_SPD_COLUMN_ACTIVE,
+                                               NULL);
+
+  g_object_set (cell_renderer, "activatable", TRUE, NULL);
+
+  g_signal_connect (G_OBJECT (cell_renderer), 
+                    "toggled",
+                    G_CALLBACK (hd_select_plugins_dialog_plugin_toggled),
+                    plugin_list);
+
+  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
+                                               -1,
+                                               NULL,
+                                               gtk_cell_renderer_text_new (),
+                                               "text",
+                                               HD_SPD_COLUMN_NAME,
+                                               NULL);
+
+  gtk_container_add (GTK_CONTAINER (scrollwindow), treeview);
+  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scrollwindow);
+
+  gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+
+  response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+  switch (response)
+  {
+    case GTK_RESPONSE_OK:
+      selected_plugins = hd_select_plugins_dialog_get_selected (plugin_list);
+      break;
+  }
+
+  gtk_widget_destroy (dialog);
+  g_object_unref (plugin_list);
+
+  return selected_plugins;
+}
+
+

Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.h	2006-11-27 15:24:13 UTC (rev 8360)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-select-plugins-dialog.h	2006-11-27 15:36:01 UTC (rev 8361)
@@ -0,0 +1,34 @@
+/*
+ * This file is part of hildon-desktop
+ *
+ * Copyright (C) 2006 Nokia Corporation.
+ *
+ * Author:  Lucas Rocha <lucas.rocha at nokia.com>
+ *          Johan Bilien <johan.bilien at nokia.com>
+ * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __HD_SELECT_PLUGINS_DIALOG_H__
+#define __HD_SELECT_PLUGINS_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+GList*   hd_select_plugins_dialog_run  (GList *loaded_plugins,
+                                        const gchar *plugin_dir);
+
+#endif


More information about the maemo-commits mailing list