[maemo-commits] [maemo-commits] r10704 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Mar 21 17:40:57 EET 2007
Author: jobi
Date: 2007-03-21 17:40:55 +0200 (Wed, 21 Mar 2007)
New Revision: 10704

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-desktop-home-item.h
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-window.c
   projects/haf/trunk/hildon-desktop/src/hd-config.h
   projects/haf/trunk/hildon-desktop/src/hd-desktop.c
Log:

2007-03-21  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-config.h:
	- added PADDING keys
	* src/hd-desktop.c:
	- Parse PADDING keys for the HomeWindow, give them as properties
	* libhildondesktop/hildon-home-window.c:
	- Use the padding property in child allocation
	* libhildondesktop/hildon-desktop-home-item.c, hildon-home-area.c:
	- Removed hard-coded padding


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-21 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-21 15:40:55 UTC (rev 10704)
@@ -1,3 +1,14 @@
+2007-03-21  Johan Bilien  <johan.bilien at nokia.com>
+
+	* src/hd-config.h:
+	- added PADDING keys
+	* src/hd-desktop.c:
+	- Parse PADDING keys for the HomeWindow, give them as properties
+	* libhildondesktop/hildon-home-window.c:
+	- Use the padding property in child allocation
+	* libhildondesktop/hildon-desktop-home-item.c, hildon-home-area.c:
+	- Removed hard-coded padding
+	
 2007-03-21  Moises Martinez  <moises.martinez at nokia.com>
 
 	* src/hn-app-switcher.c:

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 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c	2007-03-21 15:40:55 UTC (rev 10704)
@@ -1147,23 +1147,19 @@
       x_applet -= priv->x_offset;
       y_applet -= priv->y_offset;
 
-      if (x_applet < LAYOUT_AREA_LEFT_BORDER_PADDING)
-        x_applet = LAYOUT_AREA_LEFT_BORDER_PADDING;
+      if (x_applet < 0)
+        x_applet = 0;
 
-      if (y_applet < LAYOUT_AREA_TOP_BORDER_PADDING)
-        y_applet = LAYOUT_AREA_TOP_BORDER_PADDING;
+      if (y_applet < 0)
+        y_applet = 0;
 
-      if (x_applet + widget->allocation.width > fixed->allocation.width
-          - LAYOUT_AREA_RIGHT_BORDER_PADDING)
+      if (x_applet + widget->allocation.width > fixed->allocation.width)
         x_applet =  fixed->allocation.width -
-            widget->allocation.width - LAYOUT_AREA_RIGHT_BORDER_PADDING;
+            widget->allocation.width;
 
+      if (y_applet + widget->allocation.height > fixed->allocation.height)
+        y_applet =  fixed->allocation.height - widget->allocation.height;
 
-      if (y_applet + widget->allocation.height > fixed->allocation.height
-          - LAYOUT_AREA_BOTTOM_BORDER_PADDING)
-        y_applet =  fixed->allocation.height -
-            widget->allocation.height - LAYOUT_AREA_BOTTOM_BORDER_PADDING;
-
       if (x_applet != widget->allocation.x - fixed->allocation.x)
         priv->delta_x = x_applet - widget->allocation.x + fixed->allocation.x;
 
@@ -1195,16 +1191,14 @@
         height = priv->minimum_height;
 
       if (widget->allocation.x + width > 
-          fixed->allocation.x + fixed->allocation.width
-          - LAYOUT_AREA_RIGHT_BORDER_PADDING)
+          fixed->allocation.x + fixed->allocation.width)
         width = fixed->allocation.x + fixed->allocation.width
-          - LAYOUT_AREA_RIGHT_BORDER_PADDING - widget->allocation.x;
+                - widget->allocation.x;
       
       if (widget->allocation.y + height > 
-          fixed->allocation.y + fixed->allocation.height
-          - LAYOUT_AREA_RIGHT_BORDER_PADDING)
+          fixed->allocation.y + fixed->allocation.height)
         height = fixed->allocation.y + fixed->allocation.height
-          - LAYOUT_AREA_BOTTOM_BORDER_PADDING - widget->allocation.y;
+                 - widget->allocation.y;
 
       if (width != widget->allocation.width)
         priv->delta_x = width  - widget->allocation.width;

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h	2007-03-21 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.h	2007-03-21 15:40:55 UTC (rev 10704)
@@ -48,10 +48,6 @@
 
  
 /* FIXME: This will go in a style property, and use an alignment */
-#define LAYOUT_AREA_LEFT_BORDER_PADDING 10
-#define LAYOUT_AREA_BOTTOM_BORDER_PADDING 10
-#define LAYOUT_AREA_RIGHT_BORDER_PADDING 10
-#define LAYOUT_AREA_TOP_BORDER_PADDING 12
 #define APPLET_ADD_X_STEP 20
 #define APPLET_ADD_Y_STEP 20
 

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-03-21 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-03-21 15:40:55 UTC (rev 10704)
@@ -468,8 +468,7 @@
   HildonHomeAreaPriv      *priv;
 
   guint columns_last_width[2] = {0, 0};
-  guint columns_last_y[2] = {LAYOUT_AREA_TOP_BORDER_PADDING,
-                             LAYOUT_AREA_TOP_BORDER_PADDING};
+  guint columns_last_y[2] = {0, 0};
   GList *i_applet, *to_place;
   gint i_column = 0;
   gint width = GTK_WIDGET (area)->allocation.width;
@@ -514,19 +513,17 @@
 #endif
 
       if (columns_last_y[i_column] + req.height + PADDING < height
-          && req.width + columns_last_width[(1+i_column)%2] + LAYOUT_AREA_LEFT_BORDER_PADDING + LAYOUT_AREA_RIGHT_BORDER_PADDING < width)
+          && req.width + columns_last_width[(1+i_column)%2] < width)
         {
-          x = i_column? (width - req.width - LAYOUT_AREA_RIGHT_BORDER_PADDING):
-              LAYOUT_AREA_LEFT_BORDER_PADDING;
+          x = i_column? (width - req.width): 0;
           y = columns_last_y[i_column] + PADDING;
 
           selected_column = i_column;
         }
       else if (columns_last_y[other_c] + req.height + PADDING < height
-                              && req.width + columns_last_width[i_column] + LAYOUT_AREA_LEFT_BORDER_PADDING + LAYOUT_AREA_RIGHT_BORDER_PADDING < width)
+           && req.width + columns_last_width[i_column] < width)
         {
-          x = other_c? (width - req.width - LAYOUT_AREA_RIGHT_BORDER_PADDING):
-              LAYOUT_AREA_LEFT_BORDER_PADDING;
+          x = other_c? (width - req.width): 0;
           y = columns_last_y[other_c] + PADDING;
 
           selected_column = other_c;
@@ -538,13 +535,11 @@
           x = last_stacked_x;
           y = last_stacked_y;
 
-          if (x + req.width > width - LAYOUT_AREA_LEFT_BORDER_PADDING
-                                    - LAYOUT_AREA_RIGHT_BORDER_PADDING)
-            x = LAYOUT_AREA_LEFT_BORDER_PADDING;
+          if (x + req.width > width)
+            x = 0;
           
-          if (y + req.height > height - LAYOUT_AREA_TOP_BORDER_PADDING
-                                      - LAYOUT_AREA_BOTTOM_BORDER_PADDING)
-            y = LAYOUT_AREA_TOP_BORDER_PADDING;
+          if (y + req.height > height)
+            y = 0;
 
           last_stacked_x = x + APPLET_ADD_X_STEP;
           last_stacked_y = y + APPLET_ADD_Y_STEP;

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-window.c	2007-03-21 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-window.c	2007-03-21 15:40:55 UTC (rev 10704)
@@ -443,12 +443,21 @@
 
   if (GTK_IS_WIDGET (priv->applet_area))
     {
-      child_allocation.y += child_allocation.height;
+      gint padding_left, padding_bottom, padding_right, padding_top;
+
+      g_object_get (G_OBJECT (widget),
+                    "padding-left",         &padding_left,
+                    "padding-right",        &padding_right,
+                    "padding-top",          &padding_top,
+                    "padding_bottom",       &padding_bottom,
+                    NULL);
+
+      child_allocation.y += child_allocation.height + padding_top;
       child_allocation.height = priv->work_area->height -
-                                child_allocation.height;
+                                child_allocation.height - padding_bottom;
 
-      child_allocation.x = priv->work_area->x;
-      child_allocation.width = priv->work_area->width;
+      child_allocation.x = priv->work_area->x + padding_left;
+      child_allocation.width = priv->work_area->width - padding_right;
       
       gtk_widget_size_allocate (priv->applet_area, &child_allocation);
     }

Modified: projects/haf/trunk/hildon-desktop/src/hd-config.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-config.h	2007-03-21 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/src/hd-config.h	2007-03-21 15:40:55 UTC (rev 10704)
@@ -34,6 +34,11 @@
 #define HD_DESKTOP_CONFIG_KEY_CONFIG_FILE   "X-Config-File"
 #define HD_DESKTOP_CONFIG_KEY_PLUGIN_DIR    "X-Plugin-Dir"
 
+#define HD_DESKTOP_CONFIG_KEY_PADDING_TOP       "X-Padding-Top"
+#define HD_DESKTOP_CONFIG_KEY_PADDING_BOTTOM    "X-Padding-Bottom"
+#define HD_DESKTOP_CONFIG_KEY_PADDING_LEFT      "X-Padding-Left"
+#define HD_DESKTOP_CONFIG_KEY_PADDING_RIGHT     "X-Padding-Right"
+
 #define HD_CONTAINER_TYPE_HOME              "home"
 #define HD_CONTAINER_TYPE_PANEL_FIXED       "panel_fixed"
 #define HD_CONTAINER_TYPE_PANEL_BOX         "panel_box"

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-03-21 15:39:38 UTC (rev 10703)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-03-21 15:40:55 UTC (rev 10704)
@@ -667,12 +667,58 @@
 
     if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_HOME))
     {
+      gint padding_left, padding_right, padding_bottom, padding_top;
+
+      padding_left = g_key_file_get_integer (keyfile,
+                                             groups[i],
+                                             HD_DESKTOP_CONFIG_KEY_PADDING_LEFT,
+                                             &error);
+      if (error)
+      {
+        g_clear_error (&error);
+        padding_left = 0;
+      }
+      
+      padding_right = g_key_file_get_integer (keyfile,
+                                              groups[i],
+                                              HD_DESKTOP_CONFIG_KEY_PADDING_RIGHT,
+                                              &error);
+      if (error)
+      {
+        g_clear_error (&error);
+        padding_right = 0;
+      }
+      
+      padding_bottom = g_key_file_get_integer (keyfile,
+                                               groups[i],
+                                               HD_DESKTOP_CONFIG_KEY_PADDING_BOTTOM,
+                                               &error);
+      if (error)
+      {
+        g_clear_error (&error);
+        padding_bottom = 0;
+      }
+      
+      padding_top = g_key_file_get_integer (keyfile,
+                                            groups[i],
+                                            HD_DESKTOP_CONFIG_KEY_PADDING_TOP,
+                                            &error);
+      if (error)
+      {
+        g_clear_error (&error);
+        padding_top = 0;
+      }
+
       info = g_new0 (HDDesktopContainerInfo, 1);
  
       info->container = g_object_new (HD_TYPE_HOME_WINDOW,
 #ifdef HAVE_LIBOSSO
                                       "osso-context", priv->osso_context,
 #endif
+                                      "padding-left",   padding_left,
+                                      "padding-right",  padding_right,
+                                      "padding-top",    padding_top,
+                                      "padding-bottom", padding_bottom,
                                       NULL);
 
       hildon_home_window_applets_init (HILDON_HOME_WINDOW (info->container));


More information about the maemo-commits mailing list