[maemo-commits] [maemo-commits] r8290 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . data libhildondesktop src
From: www-data at stage.maemo.org www-data at stage.maemo.orgDate: Thu Nov 23 18:12:52 EET 2006
- Previous message: [maemo-commits] r8289 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildonwm test
- Next message: [maemo-commits] r8291 - projects/haf/trunk/dbus/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2006-11-23 18:12:50 +0200 (Thu, 23 Nov 2006) New Revision: 8290 Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/data/hildon-home-layout.conf Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac projects/haf/branches/maemo-af-desktop/hildon-desktop/data/Makefile.am projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-applet.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-area.c 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-loader-factory.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.h Log: 2006-11-23 Johan Bilien <johan.bilien at nokia.com> * src/hd-plugin-loader-factory.c: use the legacy loader for Type = HildonHomeApplet * src/hd-desktop.c: read layout configuration after creating window * data/hildon-home-layout.conf: added * libhildondesktop/hildon-home-area.c: Implement _add, keep track of the layout configuration and place applets accordingly Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac 2006-11-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/configure.ac 2006-11-23 16:12:50 UTC (rev 8290) @@ -105,7 +105,7 @@ PKG_CHECK_MODULES(OSSO_HELP, libossohelp) AC_SUBST(OSSO_HELP_CFLAGS) -AC_SUBST(OSSO_HELP_ERROR_LIBS) +AC_SUBST(OSSO_HELP_LIBS) ALL_LINGUAS="en_GB" AC_SUBST(ALL_LINGUAS) Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/data/Makefile.am =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/data/Makefile.am 2006-11-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/data/Makefile.am 2006-11-23 16:12:50 UTC (rev 8290) @@ -1 +1,4 @@ -hildondesktopconf_DATA = desktop.conf tasknavigator.conf home.conf +hildondesktopconf_DATA = desktop.conf \ + tasknavigator.conf \ + home.conf \ + hildon-home-layout.conf Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/data/hildon-home-layout.conf =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/data/hildon-home-layout.conf 2006-11-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/data/hildon-home-layout.conf 2006-11-23 16:12:50 UTC (rev 8290) @@ -0,0 +1,29 @@ +[/usr/share/applications/hildon-home/isearch-applet.desktop] +X=20 +Y=7 +X-home-applet-width=390 +X-home-applet-height=45 + +[/usr/share/applications/hildon-home/homeosso_rss_feed_reader.desktop] +X=20 +Y=61 +X-home-applet-width=390 +X-home-applet-height=350 + +[/usr/share/applications/hildon-home/osso-iradio-applet.desktop] +X=420 +Y=7 +X-home-applet-width=290 +X-home-applet-height=110 + +[/usr/share/applications/hildon-home/hildon-home-image-viewer.desktop] +X=420 +Y=276 +X-home-applet-width=290 +X-home-applet-height=134 + +[/usr/share/applications/hildon-home/speeddial.desktop] +X=420 +Y=122 +X-home-applet-width=290 +X-home-applet-height=150 Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-applet.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-applet.c 2006-11-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-applet.c 2006-11-23 16:12:50 UTC (rev 8290) @@ -318,7 +318,7 @@ g_signal_new ("settings", G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, + G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (HildonHomeAppletClass, settings), NULL, NULL, Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-area.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-area.c 2006-11-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-area.c 2006-11-23 16:12:50 UTC (rev 8290) @@ -39,6 +39,8 @@ { gboolean layout_mode; gboolean layout_changed; + + GHashTable *layout; } HildonHomeAreaPriv; #define HILDON_HOME_AREA_GET_PRIVATE(obj) \ @@ -66,6 +68,9 @@ hildon_home_area_applet_added (HildonHomeArea *area, GtkWidget *applet); static void +hildon_home_area_add (GtkContainer *area, GtkWidget *applet); + +static void hildon_home_area_remove (GtkContainer *area, GtkWidget *applet); static void @@ -80,7 +85,10 @@ GValue *value, GParamSpec *pspec); +static void +hildon_home_area_finalize (GObject *object); + GType hildon_home_area_get_type (void) { @@ -129,10 +137,12 @@ klass->layout_changed = hildon_home_area_layout_changed; klass->applet_added = hildon_home_area_applet_added; + container_class->add = hildon_home_area_add; container_class->remove = hildon_home_area_remove; object_class->set_property = hildon_home_area_set_property; object_class->get_property = hildon_home_area_get_property; + object_class->finalize = hildon_home_area_finalize; g_signal_new ("layout-mode-start", G_OBJECT_CLASS_TYPE (object_class), @@ -248,6 +258,22 @@ } static void +hildon_home_area_finalize (GObject *object) +{ + HildonHomeAreaPriv *priv; + priv = HILDON_HOME_AREA_GET_PRIVATE (object); + + if (priv->layout) + { + g_hash_table_destroy (priv->layout); + priv->layout = NULL; + } + + if (G_OBJECT_CLASS (parent_class)->finalize) + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void hildon_home_area_set_property (GObject *object, guint property_id, const GValue *value, @@ -337,6 +363,42 @@ } static void +hildon_home_area_add (GtkContainer *area, GtkWidget *applet) +{ + HildonHomeAreaPriv *priv; + g_return_if_fail (area); + + priv = HILDON_HOME_AREA_GET_PRIVATE (area); + + if (HILDON_IS_HOME_APPLET (applet)) + { + g_debug ("Adding Hildon Home applet"); + GdkRectangle *rect; + const gchar *name = hildon_desktop_item_get_name ( + HILDON_DESKTOP_ITEM (applet)); + + g_debug ("Name"); + + rect = g_hash_table_lookup (priv->layout, name); + + if (rect) + { + g_debug ("Found layout configuration"); + gtk_fixed_put (GTK_FIXED (area), applet, rect->x, rect->y); + if (rect->width > 0 && rect->height > 0) + gtk_widget_set_size_request (applet, rect->width, rect->height); + } + + else + { + g_debug ("No layout configuration"); + gtk_fixed_put (GTK_FIXED (area), applet, 0, 0); + } + } + +} + +static void hildon_home_area_remove (GtkContainer *area, GtkWidget *applet) { HildonHomeAreaPriv *priv; @@ -478,13 +540,21 @@ if (error) goto cleanup; + if (priv->layout) + g_hash_table_destroy (priv->layout); + + priv->layout = g_hash_table_new_full (g_str_hash, + g_str_equal, + (GDestroyNotify)g_free, + (GDestroyNotify)g_free); + groups = g_key_file_get_groups (keyfile, &n_groups); while (n_groups > 0) { - GtkWidget *applet; - gint x,y,width,height; - GList *list_element; + GtkWidget *applet = NULL; + gint x,y,width,height; + GList *list_element; x = g_key_file_get_integer (keyfile, groups[n_groups-1], @@ -507,6 +577,20 @@ &error); if (error) goto cleanup; + else + { + GdkRectangle *rect = g_new (GdkRectangle, 1); + + rect->x = x; + rect->y = y; + rect->width = width; + rect->height = height; + + g_hash_table_insert (priv->layout, + g_strdup (groups[n_groups-1]), + rect); + } + /* Do we already have this applet loaded? */ list_element = g_list_find_custom (applets, @@ -525,6 +609,7 @@ applets = g_list_remove (applets, applet); } +#if 0 else { applet = hildon_home_applet_new_with_plugin (groups[n_groups-1]); @@ -548,6 +633,7 @@ } } +#endif if (applet) 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-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-home-window.c 2006-11-23 16:12:50 UTC (rev 8290) @@ -64,8 +64,8 @@ #define LAYOUT_OPENING_BANNER_TIMEOUT 2500 -#define HH_AREA_CONFIGURATION_FILE ".osso/hildon-home/applet_manager.conf" -#define HH_AREA_GLOBAL_CONFIGURATION_FILE "/etc/hildon-home/applet_manager.conf" +#define HH_AREA_CONFIGURATION_FILE ".osso/hildon-desktop/hildon-home-layout.conf" +#define HH_AREA_GLOBAL_CONFIGURATION_FILE "/etc/hildon-desktop/hildon-home-layout.conf" /* DBUS defines */ 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-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c 2006-11-23 16:12:50 UTC (rev 8290) @@ -217,6 +217,7 @@ /* Add libosso context when we have it */ /*"osso-context", osso_context,*/ NULL); + hildon_home_window_applets_init (HILDON_HOME_WINDOW (container)); } else if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_PANEL_BOX)) { 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-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c 2006-11-23 16:12:50 UTC (rev 8290) @@ -154,7 +154,8 @@ if (!loader) { - if (!g_ascii_strcasecmp (type, HD_PLUGIN_LOADER_OLD_API)) + if (!g_ascii_strcasecmp (type, HD_PLUGIN_LOADER_OLD_API) || + !g_ascii_strcasecmp (type, HD_PLUGIN_LOADER_OLD_API_HOME)) { /* Create instance of Old API plugin loader and add to registry for later use */ 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-23 16:11:43 UTC (rev 8289) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.h 2006-11-23 16:12:50 UTC (rev 8290) @@ -43,6 +43,7 @@ #define HD_PLUGIN_LOADER_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HD_TYPE_PLUGIN_LOADER_FACTORY, HDPluginLoaderFactoryClass)) #define HD_PLUGIN_LOADER_OLD_API "old_api" +#define HD_PLUGIN_LOADER_OLD_API_HOME "HildonHomeApplet" struct _HDPluginLoaderFactory {
- Previous message: [maemo-commits] r8289 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildonwm test
- Next message: [maemo-commits] r8291 - projects/haf/trunk/dbus/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]