[maemo-commits] [maemo-commits] r10698 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Mar 21 17:10:31 EET 2007
- Previous message: [maemo-commits] r10697 - in projects/haf/trunk/hildon-theme-layout-4: . data
- Next message: [maemo-commits] r10699 - in projects/haf/trunk/hildon-theme-layout-4: . data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2007-03-21 17:10:29 +0200 (Wed, 21 Mar 2007) New Revision: 10698 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c projects/haf/trunk/hildon-desktop/src/hd-home-window.c Log: 2007-03-21 Johan Bilien <johan.bilien at nokia.com> * src/hd-home-window.c, libhildondesktop/hildon-desktop-home-item.c: - layout mode is back * libhildondesktop/hildon-home-area.c: - new implementation of the applet placement, based on GdkRegion Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-03-21 14:52:31 UTC (rev 10697) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-03-21 15:10:29 UTC (rev 10698) @@ -1,3 +1,11 @@ +2007-03-21 Johan Bilien <johan.bilien at nokia.com> + + * src/hd-home-window.c, libhildondesktop/hildon-desktop-home-item.c: + - layout mode is back + * libhildondesktop/hildon-home-area.c: + - new implementation of the applet placement, based + on GdkRegion + 2007-03-20 Moises Martinez <moises.martinez at nokia.com> * data/Makefile.am: remove statusbar.conf while statusbar window Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c 2007-03-21 14:52:31 UTC (rev 10697) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c 2007-03-21 15:10:29 UTC (rev 10698) @@ -363,7 +363,7 @@ "Layout mode sucks", "Whether or not the layout mode " "is considered to suck", - TRUE, + FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property (object_class, Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c 2007-03-21 14:52:31 UTC (rev 10697) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c 2007-03-21 15:10:29 UTC (rev 10698) @@ -445,6 +445,7 @@ } +#ifdef SIMPLE_PLACEMENT static gint sort_by_area (GtkWidget *a, GtkWidget *b) { @@ -585,13 +586,33 @@ #undef PADDING } +#endif +static void +remove_rectangle (GtkWidget *widget, GdkRegion *region) +{ + GdkRegion *to_remove; + GdkRectangle rectangle = (GdkRectangle)widget->allocation; + gint x, y; + gtk_container_child_get (GTK_CONTAINER (widget->parent), widget, + "x", &x, + "y", &y, + NULL); + rectangle.x = x; + rectangle.y = y; + + to_remove = gdk_region_rectangle (&rectangle); + gdk_region_subtract (region, to_remove); + gdk_region_destroy (to_remove); +} + static void hildon_home_area_batch_add (HildonHomeArea *area) { HildonHomeAreaPriv *priv; +#ifdef SIMPLE_PLACEMENT GList *children, *to_place; g_return_if_fail (area); @@ -605,6 +626,97 @@ g_list_free (children); /* g_list_free (priv->to_add);*/ + +#else + GList *i; + GList *children; + GdkRegion *region, *clean_region; + GdkRectangle area_rectangle = {0}; + + priv = HILDON_HOME_AREA_GET_PRIVATE (area); + + area_rectangle.width = GTK_WIDGET (area)->allocation.width; + area_rectangle.height = GTK_WIDGET (area)->allocation.height; + + clean_region = gdk_region_rectangle (&area_rectangle); + region = gdk_region_copy (clean_region); + + children = gtk_container_get_children (GTK_CONTAINER (area)); + g_list_foreach (children, (GFunc)remove_rectangle, region); + + i = priv->to_add; + + while (i) + { + GtkRequisition req = {0}; + GdkRectangle *rectangles; + gint n_rect, i_rect; + GtkWidget *w; + const gchar *name; + + w = GTK_WIDGET (i->data); + name = hildon_desktop_item_get_id (HILDON_DESKTOP_ITEM (w)); + + g_debug ("Placing %s", name); + + gtk_widget_size_request (w, &req); + gdk_region_get_rectangles (region, &rectangles, &n_rect); + + g_debug ("Got %i rectangles", n_rect); + + for (i_rect = 0; i_rect < n_rect; i_rect++) + { + g_debug ("Rectangle %i: (%i,%i) %ix%i", + i_rect, + rectangles[i_rect].x, + rectangles[i_rect].y, + rectangles[i_rect].width, + rectangles[i_rect].height); + if (rectangles[i_rect].width >= req.width && + rectangles[i_rect].height >= req.height) + { + GdkRectangle *layout = g_new (GdkRectangle, 1); + GdkRegion *layout_region; + + layout->x = rectangles[i_rect].x; + layout->y = rectangles[i_rect].y; + layout->width = -1; + layout->height = -1; + + g_hash_table_insert (priv->layout, g_strdup (name), layout); + gtk_container_add (GTK_CONTAINER (area), w); + + layout->width = req.width; + layout->height = req.height; + + layout_region = gdk_region_rectangle (layout); + gdk_region_subtract (region, layout_region); + gdk_region_destroy (layout_region); + + break; + } + + } + + if (i_rect == n_rect) + { + g_debug ("Adding layer"); + /* Not enough place in this layer, we need to add one */ + gdk_region_destroy (region); + region = gdk_region_copy (clean_region); + } + else + i = g_list_next (i); + + g_free (rectangles); + } + + gdk_region_destroy (clean_region); + gdk_region_destroy (region); + + g_list_free (children); + +#endif priv->to_add = NULL; } Modified: projects/haf/trunk/hildon-desktop/src/hd-home-window.c =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-home-window.c 2007-03-21 14:52:31 UTC (rev 10697) +++ projects/haf/trunk/hildon-desktop/src/hd-home-window.c 2007-03-21 15:10:29 UTC (rev 10698) @@ -249,7 +249,7 @@ pspec = g_param_spec_boolean ("layout-mode-sucks", "Layout mode sucks", "Whether or not the layout mode sucks", - TRUE, + FALSE, (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, PROP_LAYOUT_MODE_SUCKS,
- Previous message: [maemo-commits] r10697 - in projects/haf/trunk/hildon-theme-layout-4: . data
- Next message: [maemo-commits] r10699 - in projects/haf/trunk/hildon-theme-layout-4: . data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]