[maemo-commits] [maemo-commits] r14997 - in projects/haf/trunk/hildon-desktop: . debian/config src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Jan 2 16:08:06 EET 2008
- Previous message: [maemo-commits] r14996 - projects/haf/tags/hildon-desktop
- Next message: [maemo-commits] r14998 - in projects/haf/trunk/hildon-desktop: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2008-01-02 16:08:02 +0200 (Wed, 02 Jan 2008) New Revision: 14997 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/debian/config/desktop.conf projects/haf/trunk/hildon-desktop/src/hd-desktop.c projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.c projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.h Log: 2008-01-02 Johan Bilien <johan.bilien at nokia.com> * src/hd-desktop.c: - have ContainerInfo have a list of plugin directories instead of one - watch each of the directories. * src/hd-select-plugins-dialog.c: - iterate plugins from all plugin directories. Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2008-01-02 10:25:45 UTC (rev 14996) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2008-01-02 14:08:02 UTC (rev 14997) @@ -1,3 +1,11 @@ +2008-01-02 Johan Bilien <johan.bilien at nokia.com> + + * src/hd-desktop.c: + - have ContainerInfo have a list of plugin directories instead of one + - watch each of the directories. + * src/hd-select-plugins-dialog.c: + - iterate plugins from all plugin directories. + 2007-12-18 Johan Bilien <johan.bilien at nokia.com> * configure.ac: 2.0.7 Modified: projects/haf/trunk/hildon-desktop/debian/config/desktop.conf =================================================================== --- projects/haf/trunk/hildon-desktop/debian/config/desktop.conf 2008-01-02 10:25:45 UTC (rev 14996) +++ projects/haf/trunk/hildon-desktop/debian/config/desktop.conf 2008-01-02 14:08:02 UTC (rev 14997) @@ -15,7 +15,7 @@ X-Is-Ordered=0 X-Load-New-Plugins=1 X-Config-File=home.conf -X-Plugin-Dir=/usr/share/applications/hildon-home +X-Plugin-Dir=/usr/share/applications/hildon-home;~/.hildon-home [Statusbar] X-Type=panel_expandable Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-desktop.c 2008-01-02 10:25:45 UTC (rev 14996) +++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c 2008-01-02 14:08:02 UTC (rev 14997) @@ -86,13 +86,14 @@ typedef struct { gchar *config_file; - gchar *plugin_dir; + gchar **plugin_dirs; GtkWidget *container; HDDesktop *desktop; HDUIPolicy *policy; gboolean is_ordered; gboolean load_new_plugins; - GnomeVFSMonitorHandle *plugin_dir_monitor; + GnomeVFSMonitorHandle **plugin_dir_monitors; + gsize n_plugin_dir; gboolean ignore_next_monitor; } HDDesktopContainerInfo; @@ -604,7 +605,7 @@ #ifdef HAVE_LIBHILDONHELP priv->osso_context, #endif - info->plugin_dir, + info->plugin_dirs, &selected_plugins); if (response == GTK_RESPONSE_OK) @@ -626,18 +627,27 @@ static void hd_desktop_free_container_info (HDDesktopContainerInfo *info) { + gsize i_monitor; + if (info->config_file) g_free (info->config_file); - if (info->plugin_dir) - g_free (info->plugin_dir); + if (info->plugin_dirs) + g_strfreev (info->plugin_dirs); if (info->container) gtk_widget_destroy (info->container); - if (info->plugin_dir_monitor) - gnome_vfs_monitor_cancel (info->plugin_dir_monitor); - + if (info->plugin_dir_monitors) + { + for (i_monitor = 0; i_monitor < info->n_plugin_dir; i_monitor ++) + { + gnome_vfs_monitor_cancel (info->plugin_dir_monitors[i_monitor]); + } + + g_free (info->plugin_dir_monitors); + } + g_free (info); } @@ -903,9 +913,10 @@ HDDesktopContainerInfo *info = NULL; HDUIPolicy *policy = NULL; GList *plugin_list = NULL; - gchar *type, *container_config, *container_config_file, *plugin_dir; + gchar *type, *container_config, *container_config_file, **plugin_dirs; gchar *policy_module; gboolean is_ordered, load_new_plugins; + gsize n_plugin_dir, i_plugin_dir; error = NULL; @@ -1005,17 +1016,18 @@ continue; } - plugin_dir = g_key_file_get_string (keyfile, - groups[i], - HD_DESKTOP_CONFIG_KEY_PLUGIN_DIR, - &error); + plugin_dirs = g_key_file_get_string_list (keyfile, + groups[i], + HD_DESKTOP_CONFIG_KEY_PLUGIN_DIR, + &n_plugin_dir, + &error); if (error) { g_warning ("Error reading desktop configuration file: %s", error->message); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1036,7 +1048,7 @@ error->message); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1120,7 +1132,7 @@ error->message); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1141,7 +1153,7 @@ error->message); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1162,7 +1174,7 @@ error->message); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1183,7 +1195,7 @@ error->message); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1205,7 +1217,7 @@ g_free (orientation_str); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (container_config_file); g_free (policy_module); @@ -1287,7 +1299,7 @@ } info->config_file = g_strdup (container_config_file); - info->plugin_dir = g_strdup (plugin_dir); + info->plugin_dirs = g_strdupv (plugin_dirs); info->desktop = desktop; info->policy = policy; info->is_ordered = is_ordered; @@ -1308,11 +1320,29 @@ G_CALLBACK (hd_desktop_container_load), info); - hd_desktop_watch_dir (plugin_dir, - hd_desktop_plugin_dir_changed, - info->plugin_dir_monitor, - info); + info->plugin_dir_monitors = g_new0 (GnomeVFSMonitorHandle*, n_plugin_dir); + info->n_plugin_dir = n_plugin_dir; + for (i_plugin_dir = 0; i_plugin_dir < n_plugin_dir; i_plugin_dir ++) + { + /* escape ~ */ + if (info->plugin_dirs[i_plugin_dir][0] == '~') + { + gchar *tmp = info->plugin_dirs[i_plugin_dir]; + + info->plugin_dirs[i_plugin_dir] = + g_build_filename (g_get_home_dir (), + info->plugin_dirs[i_plugin_dir] + 1, + NULL); + g_free (tmp); + } + + hd_desktop_watch_dir (info->plugin_dirs[i_plugin_dir], + hd_desktop_plugin_dir_changed, + info->plugin_dir_monitors[i_plugin_dir], + info); + } + g_hash_table_insert (priv->containers, container_config_file, info); plugin_list = hd_desktop_plugin_list_from_conf (container_config); @@ -1345,7 +1375,7 @@ gtk_widget_show (info->container); g_free (type); - g_free (plugin_dir); + g_strfreev (plugin_dirs); g_free (container_config); g_free (policy_module); g_list_foreach (plugin_list, (GFunc) g_free , NULL); Modified: projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.c =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.c 2008-01-02 10:25:45 UTC (rev 14996) +++ projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.c 2008-01-02 14:08:02 UTC (rev 14997) @@ -132,11 +132,11 @@ static GtkListStore * hd_select_plugins_dialog_get_store (GList *loaded_plugins, - const gchar *plugin_dir) + gchar **plugin_dirs) { - GDir *dir; GKeyFile *keyfile; const char *filename; + const char *plugin_dir; GError *error = NULL; GtkListStore *store; GtkTreeIter iter; @@ -150,91 +150,97 @@ HD_SPD_COLUMN_NAME, GTK_SORT_ASCENDING); - dir = g_dir_open (plugin_dir, 0, &error); - - if (!dir) + while ((plugin_dir = *(plugin_dirs++))) { - g_warning ("Error reading plugin directory: %s", error->message); + GDir *dir; - g_error_free (error); + dir = g_dir_open (plugin_dir, 0, &error); - return NULL; - } + if (!dir) + { + g_warning ("Error reading plugin directory: %s", error->message); - keyfile = g_key_file_new (); + g_error_free (error); - while ((filename = g_dir_read_name (dir))) - { - gchar *desktop_path = NULL; - gchar *name = NULL; - gchar *text_domain = NULL; - GList *active; - error = NULL; + return NULL; + } - /* Only consider .desktop files */ - if (!g_str_has_suffix (filename, ".desktop")) continue; + keyfile = g_key_file_new (); - desktop_path = g_build_filename (plugin_dir, filename, NULL); + while ((filename = g_dir_read_name (dir))) + { + gchar *desktop_path = NULL; + gchar *name = NULL; + gchar *text_domain = NULL; + GList *active; + error = NULL; - g_key_file_load_from_file (keyfile, - desktop_path, - G_KEY_FILE_NONE, - &error); + /* Only consider .desktop files */ + if (!g_str_has_suffix (filename, ".desktop")) continue; - if (error) - { - g_warning ("Error loading plugin configuration file: %s", error->message); + desktop_path = g_build_filename (plugin_dir, filename, NULL); - g_error_free (error); - g_dir_close (dir); - g_key_file_free (keyfile); - g_free (desktop_path); + 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); - return NULL; - } + g_error_free (error); + g_dir_close (dir); + g_key_file_free (keyfile); + g_free (desktop_path); - name = g_key_file_get_string (keyfile, - HD_PLUGIN_CONFIG_GROUP, - HD_PLUGIN_CONFIG_KEY_NAME, - &error); - if (error) - { - g_warning ("Error reading plugin configuration file: %s", error->message); + return NULL; + } - g_error_free (error); - g_dir_close (dir); - g_key_file_free (keyfile); - g_free (desktop_path); + name = g_key_file_get_string (keyfile, + HD_PLUGIN_CONFIG_GROUP, + HD_PLUGIN_CONFIG_KEY_NAME, + &error); - return NULL; - } + if (error) + { + g_warning ("Error reading plugin configuration file: %s", error->message); - active = g_list_find_custom (loaded_plugins, - desktop_path, - hd_select_plugins_dialog_find_func); + g_error_free (error); + g_dir_close (dir); + g_key_file_free (keyfile); + g_free (desktop_path); - gtk_list_store_append (GTK_LIST_STORE (store), &iter); + return NULL; + } - text_domain = g_key_file_get_string (keyfile, - HD_PLUGIN_CONFIG_GROUP, - HD_PLUGIN_CONFIG_KEY_TEXT_DOMAIN, - NULL); + active = g_list_find_custom (loaded_plugins, + desktop_path, + hd_select_plugins_dialog_find_func); - gtk_list_store_set (GTK_LIST_STORE (store), &iter, - HD_SPD_COLUMN_NAME, (text_domain ? dgettext(text_domain, name) : _(name)), - HD_SPD_COLUMN_ACTIVE, active, - HD_SPD_COLUMN_DESKTOP_FILE, desktop_path, - -1); + gtk_list_store_append (GTK_LIST_STORE (store), &iter); - g_free (desktop_path); - g_free (text_domain); - g_free (name); + text_domain = g_key_file_get_string (keyfile, + HD_PLUGIN_CONFIG_GROUP, + HD_PLUGIN_CONFIG_KEY_TEXT_DOMAIN, + NULL); + + gtk_list_store_set (GTK_LIST_STORE (store), &iter, + HD_SPD_COLUMN_NAME, (text_domain ? dgettext(text_domain, name) : _(name)), + HD_SPD_COLUMN_ACTIVE, active, + HD_SPD_COLUMN_DESKTOP_FILE, desktop_path, + -1); + + g_free (desktop_path); + g_free (text_domain); + g_free (name); + } + + g_key_file_free (keyfile); + g_dir_close (dir); } - g_key_file_free (keyfile); - g_dir_close (dir); return store; } @@ -243,7 +249,7 @@ #ifdef HAVE_LIBHILDONHELP osso_context_t *osso_context, #endif - const gchar *plugin_dir, + gchar **plugin_dirs, GList **selected_plugins) { GtkWidget *dialog; @@ -255,7 +261,7 @@ gint response; plugin_list = hd_select_plugins_dialog_get_store (loaded_plugins, - plugin_dir); + plugin_dirs); if (!plugin_list) { Modified: projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.h =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.h 2008-01-02 10:25:45 UTC (rev 14996) +++ projects/haf/trunk/hildon-desktop/src/hd-select-plugins-dialog.h 2008-01-02 14:08:02 UTC (rev 14997) @@ -40,7 +40,7 @@ #ifdef HAVE_LIBHILDONHELP osso_context_t *osso_context, #endif - const gchar *plugin_dir, + gchar **plugin_dirs, GList **selected_plugins); #endif /* __HD_SELECT_PLUGINS_DIALOG_H__ */
- Previous message: [maemo-commits] r14996 - projects/haf/tags/hildon-desktop
- Next message: [maemo-commits] r14998 - in projects/haf/trunk/hildon-desktop: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]