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

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Thu Nov 30 17:12:51 EET 2006
Author: lucasr
Date: 2006-11-30 17:12:50 +0200 (Thu, 30 Nov 2006)
New Revision: 8506

Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel-window.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-window.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c
Log:
2006-11-30  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-plugin-manager.c: do not gtk_widget_show_all plugins.
	* libhildondesktop/hildon-desktop-window.[ch]: new signals to
	request the desktop save and load container configuration.
	* src/hd-desktop.c: listen to "save" and "load" container signals to
	decide when to save and load container configuration.
	* libhildondesktop/desktop-panel-window.c: small code cleanups.
	* libhildondesktop/hildon-home-window.c: emit load signal when
	canceling layout mode and save signal when confirming layout.


Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2006-11-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2006-11-30 15:12:50 UTC (rev 8506)
@@ -1,3 +1,14 @@
+2006-11-30  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-plugin-manager.c: do not gtk_widget_show_all plugins.
+	* libhildondesktop/hildon-desktop-window.[ch]: new signals to
+	request the desktop save and load container configuration.
+	* src/hd-desktop.c: listen to "save" and "load" container signals to
+	decide when to save and load container configuration.
+	* libhildondesktop/desktop-panel-window.c: small code cleanups.
+	* libhildondesktop/hildon-home-window.c: emit load signal when
+	canceling layout mode and save signal when confirming layout.
+
 2006-11-29  Johan Bilien  <johan.bilien at nokia.com>
 
 	* src/hd-plugin-loader-legacy.c: do not unref GModule

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel-window.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel-window.c	2006-11-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/desktop-panel-window.c	2006-11-30 15:12:50 UTC (rev 8506)
@@ -339,10 +339,9 @@
   GTK_WINDOW (window)->type = GTK_WINDOW_TOPLEVEL;
 
   gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
-  /*gtk_window_set_decorated (GTK_WINDOW (window), FALSE);*/
+
   gtk_widget_push_composite_child ();
 
-  /* FIXME: set orientation to the window as well */
   HILDON_DESKTOP_WINDOW (window)->container = g_object_new (DESKTOP_TYPE_PANEL, NULL);
 
   if (window->priv->orientation & DPANEL_ORIENTATION_HORIZONTAL)

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-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c	2006-11-30 15:12:50 UTC (rev 8506)
@@ -38,6 +38,8 @@
 
 enum {
   SIGNAL_SELECT_PLUGINS,
+  SIGNAL_SAVE,
+  SIGNAL_LOAD,
   N_SIGNALS
 };
 
@@ -159,6 +161,24 @@
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
 
+  signals[SIGNAL_SAVE] =
+        g_signal_new ("save",
+                      G_OBJECT_CLASS_TYPE (g_object_class),
+                      G_SIGNAL_RUN_FIRST,
+		      G_STRUCT_OFFSET (HildonDesktopWindowClass, save),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE, 0);
+
+  signals[SIGNAL_LOAD] =
+        g_signal_new ("load",
+                      G_OBJECT_CLASS_TYPE (g_object_class),
+                      G_SIGNAL_RUN_FIRST,
+		      G_STRUCT_OFFSET (HildonDesktopWindowClass, load),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE, 0);
+
   pspec = g_param_spec_pointer ("plugin-dir",
                                 "Plugin Directory",
                                 "Plugin Directory",

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-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h	2006-11-30 15:12:50 UTC (rev 8506)
@@ -54,6 +54,10 @@
 
     void (*select_plugins) (HildonDesktopWindow *window);
 
+    void (*save)           (HildonDesktopWindow *window);
+
+    void (*load)           (HildonDesktopWindow *window);
+
     void (*set_sensitive)  (HildonDesktopWindow *window,
 			    gboolean sensitive);
     

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-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-window.c	2006-11-30 15:12:50 UTC (rev 8506)
@@ -220,6 +220,8 @@
                                               HH_FLASH_FULL_TEXT); 
 
   g_free (filename);
+
+  g_signal_emit_by_name (window, "save", NULL);
 }
 
 static void
@@ -265,6 +267,8 @@
                                            filename);
 
       g_free (user_filename);
+
+      g_signal_emit_by_name (window, "load", NULL);
     }
 
   hildon_home_area_set_layout_mode (HILDON_HOME_AREA (priv->applet_area),

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-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c	2006-11-30 15:12:50 UTC (rev 8506)
@@ -59,6 +59,27 @@
 
 static void hd_desktop_load_containers (HDDesktop *desktop);
 
+static GList *
+hd_desktop_plugin_list_from_container (GtkContainer *container)
+{
+  GList *plugin_list = NULL, *children, *iter;
+
+  children = gtk_container_get_children (container);
+
+  for (iter = g_list_first (children); iter; iter = g_list_next (iter))
+  {
+    gchar *id;
+
+    g_object_get (G_OBJECT (iter->data),
+                  "id", &id,
+                  NULL);
+
+    plugin_list = g_list_append (plugin_list, id);
+  }
+
+  return plugin_list;
+}
+
 static void 
 hd_desktop_plugin_list_to_conf (GList *plugin_list, const gchar *config_file)
 {
@@ -157,6 +178,56 @@
 }
 
 static void 
+hd_desktop_container_load (HildonDesktopWindow *window, gpointer user_data)
+{
+  HDDesktopPrivate *priv;
+  GList *plugin_list;
+  gchar *config_file;
+
+  g_return_if_fail (user_data != NULL);
+  g_return_if_fail (HD_IS_DESKTOP (user_data));
+
+  priv = HD_DESKTOP_GET_PRIVATE (user_data);
+
+  config_file = g_build_filename (priv->config_path, 
+                                  hildon_desktop_window_get_config_file (window),
+                                  NULL);
+
+  plugin_list = hd_desktop_plugin_list_from_conf (config_file);
+
+  hd_plugin_manager_sync (HD_PLUGIN_MANAGER (priv->pm), 
+                          plugin_list, 
+                          window->container);
+
+  g_list_free (plugin_list); 
+  g_free (config_file);
+}
+
+static void 
+hd_desktop_container_save (HildonDesktopWindow *window, gpointer user_data)
+{
+  HDDesktopPrivate *priv;
+  GList *plugin_list;
+  gchar *config_file;
+
+  g_return_if_fail (user_data != NULL);
+  g_return_if_fail (HD_IS_DESKTOP (user_data));
+
+  priv = HD_DESKTOP_GET_PRIVATE (user_data);
+
+  config_file = g_build_filename (priv->config_path, 
+                                  hildon_desktop_window_get_config_file (window),
+                                  NULL);
+
+  plugin_list = hd_desktop_plugin_list_from_container (window->container);
+
+  hd_desktop_plugin_list_to_conf (plugin_list, config_file);
+
+  g_list_free (plugin_list); 
+  g_free (config_file);
+}
+
+static void 
 hd_desktop_select_plugins (HildonDesktopWindow *window, gpointer user_data)
 {
   const gchar *plugin_dir;
@@ -176,8 +247,6 @@
                                   hildon_desktop_window_get_config_file (window),
                                   NULL);
 
-  g_debug ("Config file: %s", config_file);
-
   plugin_dir = hildon_desktop_window_get_plugin_dir (window);
 
   selected_plugins = hd_select_plugins_dialog_run (loaded_plugins, 
@@ -187,7 +256,7 @@
                           selected_plugins,
                           window->container);
 
-  hd_desktop_plugin_list_to_conf (selected_plugins, config_file);
+/*  hd_desktop_plugin_list_to_conf (selected_plugins, config_file); */
 
   g_free (config_file);
   g_list_free (selected_plugins);
@@ -220,6 +289,7 @@
 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);
 
@@ -483,6 +553,16 @@
                       G_CALLBACK (hd_desktop_select_plugins),
                       desktop);
 
+    g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (container)), 
+                      "save",
+                      G_CALLBACK (hd_desktop_container_save),
+                      desktop);
+
+    g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (container)), 
+                      "load",
+                      G_CALLBACK (hd_desktop_container_load),
+                      desktop);
+
     hd_desktop_watch_file (container_config, 
                            hd_desktop_container_config_changed, 
                            container);
@@ -495,7 +575,7 @@
                             plugin_list, 
                             HILDON_DESKTOP_WINDOW (container)->container);
 
-    gtk_widget_show_all (container);
+    gtk_widget_show (container);
 
     g_free (type);
     g_free (container_config);

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-30 15:10:17 UTC (rev 8505)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c	2006-11-30 15:12:50 UTC (rev 8506)
@@ -86,8 +86,7 @@
                 "id", plugin_path,
                 NULL);
 
-  /* FIXME: Remove this when home is fixed */
-  gtk_widget_show_all (plugin);
+  gtk_widget_show (plugin);
 
   gtk_container_add (container, plugin);
 


More information about the maemo-commits mailing list