[maemo-commits] [maemo-commits] r8256 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . src
From: lucasr at stage.maemo.org lucasr at stage.maemo.orgDate: Wed Nov 22 16:16:34 EET 2006
- Previous message: [maemo-commits] r8255 - in projects/haf/trunk/maemo-theme-layout-3: . rc
- Next message: [maemo-commits] r8257 - projects/haf/branches/maemo-af-desktop/hildon-desktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2006-11-22 16:16:32 +0200 (Wed, 22 Nov 2006) New Revision: 8256 Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac 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-manager.c Log: 2006-11-21 Lucas Rocha <lucas.rocha at nokia.com> * src/hd-desktop.c: desktop conf file and container conf file handling. For both: look for user conf file, if not found, fall to global configuration at sysconfdir (i.e /etc/hildon-desktop). Change orientation to "north", "south", "west" and "east" instead of "vertical" and "horizontal". * src/hd-plugin-manager.c: checks if the plugin conf file exists. If not, ignore the plugin. * configure.ac, src/Makefile.am: define hildon-desktop global conf dir as ${sysconfdir}/hildon-desktop. Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-11-22 13:09:35 UTC (rev 8255) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-11-22 14:16:32 UTC (rev 8256) @@ -1,3 +1,15 @@ +2006-11-21 Lucas Rocha <lucas.rocha at nokia.com> + + * src/hd-desktop.c: desktop conf file and container conf file + handling. For both: look for user conf file, if not found, fall to + global configuration at sysconfdir (i.e /etc/hildon-desktop). + Change orientation to "north", "south", "west" and "east" instead of + "vertical" and "horizontal". + * src/hd-plugin-manager.c: checks if the plugin conf file exists. If + not, ignore the plugin. + * configure.ac, src/Makefile.am: define hildon-desktop global conf dir + as ${sysconfdir}/hildon-desktop. + 2006-11-21 Johan Bilien <johan.bilien at nokia.com> * src/hd-plugin-loader-legacy.c: Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac 2006-11-22 13:09:35 UTC (rev 8255) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac 2006-11-22 14:16:32 UTC (rev 8256) @@ -121,6 +121,9 @@ hildondesktopentrydir=`pkg-config osso-af-settings --variable=desktopentrydir` AC_SUBST(hildondesktopentrydir) +hildondesktopconfdir=${sysconfdir}/hildon-desktop +AC_SUBST(hildondesktopconfdir) + hildoncpdesktopentrydir=${datadir}/applications/hildon-control-panel AC_SUBST(hildoncpdesktopentrydir) 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-22 13:09:35 UTC (rev 8255) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am 2006-11-22 14:16:32 UTC (rev 8256) @@ -25,6 +25,7 @@ $(HILDON_CFLAGS) \ -DLOCALEDIR=\"$(localedir)\" \ -I$(top_srcdir) \ + -DHD_DESKTOP_CONFIG_PATH=\"$(hildondesktopconfdir)\" \ -DHD_PLUGIN_LOADER_LEGACY_HOME_MODULE_PATH=\"$(hildonhomelibdir)\" \ -DHD_PLUGIN_LOADER_LEGACY_NAVIGATOR_MODULE_PATH=\"$(hildonnavigatorlibdir)\" 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-22 13:09:35 UTC (rev 8255) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c 2006-11-22 14:16:32 UTC (rev 8256) @@ -22,6 +22,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdlib.h> #include <glib.h> @@ -38,7 +42,8 @@ G_DEFINE_TYPE (HDDesktop, hd_desktop, G_TYPE_OBJECT); -#define HD_DESKTOP_DEFAULT_CONFIG_FILE "desktop.conf" +#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" @@ -52,11 +57,14 @@ #define HD_CONTAINER_TYPE_PANEL_FIXED "panel_fixed" #define HD_CONTAINER_TYPE_PANEL_BOX "panel_box" -#define HD_WINDOW_ORIENTATION_VERT "vertical" -#define HD_WINDOW_ORIENTATION_HOR "horizontal" +#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; gchar *config_file; GHashTable *containers; GObject *pm; @@ -146,8 +154,47 @@ for (i = 0; groups[i]; i++) { GtkWidget *container = NULL; - gchar *type, *container_config; + gchar *type, *container_config, *container_config_file; + container_config_file = g_key_file_get_string (keyfile, + groups[i], + HD_DESKTOP_KEY_CONFIG_FILE, + &error); + + if (error) + { + g_warning ("Error reading desktop configuration file: %s", + error->message); + + g_error_free (error); + + continue; + } + + container_config = g_build_filename (desktop->priv->config_path, + container_config_file, + NULL); + + /* If use container configuration file is not on user dir, + try to find it on hildon-desktop global configuration dir. + If it's not found there, ignore the container. */ + if (!g_file_test (container_config, G_FILE_TEST_EXISTS)) + { + g_free (container_config); + + container_config = g_build_filename (HD_DESKTOP_CONFIG_PATH, + container_config_file, + NULL); + + if (!g_file_test (container_config, G_FILE_TEST_EXISTS)) + { + g_warning ("Container configuration file doesn't exist, ignoring container"); + g_free (container_config); + g_free (container_config_file); + continue; + } + } + type = g_key_file_get_string (keyfile, groups[i], HD_DESKTOP_KEY_TYPE, @@ -248,12 +295,16 @@ continue; } - if (!g_ascii_strcasecmp (orientation_str, HD_WINDOW_ORIENTATION_VERT)) - orientation = DPANEL_ORIENTATION_VERTICAL; - else if (!g_ascii_strcasecmp (orientation_str, HD_WINDOW_ORIENTATION_HOR)) - orientation = DPANEL_ORIENTATION_HORIZONTAL; + if (!g_ascii_strcasecmp (orientation_str, HD_WINDOW_ORIENTATION_NORTH)) + orientation = DPANEL_ORIENTATION_TOP; + else if (!g_ascii_strcasecmp (orientation_str, HD_WINDOW_ORIENTATION_SOUTH)) + orientation = DPANEL_ORIENTATION_BOTTOM; + else if (!g_ascii_strcasecmp (orientation_str, HD_WINDOW_ORIENTATION_WEST)) + orientation = DPANEL_ORIENTATION_LEFT; + else if (!g_ascii_strcasecmp (orientation_str, HD_WINDOW_ORIENTATION_EAST)) + orientation = DPANEL_ORIENTATION_RIGHT; else - orientation = DPANEL_ORIENTATION_HORIZONTAL; + orientation = DPANEL_ORIENTATION_LEFT; /* Add Panel Box creation code here. */ container = g_object_new (DESKTOP_TYPE_PANEL_WINDOW, @@ -268,26 +319,13 @@ } else { - g_warning ("Invalid container type in desktop configuration file."); + g_warning ("Invalid container type in desktop configuration file, ignoring container."); g_free (type); + g_free (container_config); + g_free (container_config_file); continue; } - container_config = g_key_file_get_string (keyfile, - groups[i], - HD_DESKTOP_KEY_CONFIG_FILE, - &error); - - if (error) - { - g_warning ("Error reading desktop configuration file: %s", - error->message); - - g_error_free (error); - - continue; - } - hd_desktop_watch_file (container_config, hd_desktop_container_config_changed, container); @@ -302,6 +340,7 @@ g_free (type); g_free (container_config); + g_free (container_config_file); } g_strfreev (groups); @@ -311,16 +350,46 @@ static void hd_desktop_init (HDDesktop *desktop) { - const gchar *env_config_file; + const gchar *home, *env_config_file; desktop->priv = HD_DESKTOP_GET_PRIVATE (desktop); + home = getenv ("HOME"); + + desktop->priv->config_path = g_build_filename (home, + HD_DESKTOP_CONFIG_USER_PATH, + NULL); + + if (g_mkdir_with_parents (desktop->priv->config_path, 0755) < 0) + { + g_error ("Error on creating desktop user configuration directory"); + } + env_config_file = getenv ("HILDON_DESKTOP_CONFIG_FILE"); /* Environment variable overrides default config file */ if (env_config_file == NULL) { - desktop->priv->config_file = g_strdup (HD_DESKTOP_DEFAULT_CONFIG_FILE); + desktop->priv->config_file = g_build_filename (desktop->priv->config_path, + HD_DESKTOP_CONFIG_FILE, + NULL); + + /* If there's no user desktop configuration file, fall to global + configuration file at sysconfdir. If still not found a fatal error + occurs. */ + if (!g_file_test (desktop->priv->config_file, G_FILE_TEST_EXISTS)) + { + g_free (desktop->priv->config_file); + + desktop->priv->config_file = g_build_filename (HD_DESKTOP_CONFIG_PATH, + HD_DESKTOP_CONFIG_FILE, + NULL); + + if (!g_file_test (desktop->priv->config_file, G_FILE_TEST_EXISTS)) + { + g_error ("No desktop configuration file found, exiting..."); + } + } } else { 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-22 13:09:35 UTC (rev 8255) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-manager.c 2006-11-22 14:16:32 UTC (rev 8256) @@ -59,6 +59,12 @@ g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); + if (!g_file_test (plugin_path, G_FILE_TEST_EXISTS)) + { + g_warning ("Plugin desktop file not found, ignoring plugin"); + return; + } + loader = hd_plugin_loader_factory_create (HD_PLUGIN_LOADER_FACTORY (pm->priv->factory), plugin_path); @@ -192,6 +198,8 @@ { hd_plugin_manager_load_plugin (pm, plugins[i], container); } + + g_strfreev (plugins); } void
- Previous message: [maemo-commits] r8255 - in projects/haf/trunk/maemo-theme-layout-3: . rc
- Next message: [maemo-commits] r8257 - projects/haf/branches/maemo-af-desktop/hildon-desktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]