[maemo-commits] [maemo-commits] r11021 - in projects/haf/trunk/sapwood: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Apr 13 13:51:52 EEST 2007
Author: xan
Date: 2007-04-13 13:51:51 +0300 (Fri, 13 Apr 2007)
New Revision: 11021

Modified:
   projects/haf/trunk/sapwood/ChangeLog
   projects/haf/trunk/sapwood/src/sapwood-draw.c
Log:
	* src/sapwood-draw.c: Add general positioning theming based on GTK+
	"maemo-position-theming" style property.


Modified: projects/haf/trunk/sapwood/ChangeLog
===================================================================
--- projects/haf/trunk/sapwood/ChangeLog	2007-04-13 10:49:25 UTC (rev 11020)
+++ projects/haf/trunk/sapwood/ChangeLog	2007-04-13 10:51:51 UTC (rev 11021)
@@ -1,3 +1,8 @@
+2007-04-13  Xan Lopez  <xan.lopez at nokia.com>
+
+	* src/sapwood-draw.c: Add general positioning theming based on GTK+
+	"maemo-position-theming" style property.
+
 2007-04-02  Tommi Komulainen  <tommi.komulainen at nokia.com>
 
 	* demos/treeview.c (create_treeview): Enable rubberbanding only with

Modified: projects/haf/trunk/sapwood/src/sapwood-draw.c
===================================================================
--- projects/haf/trunk/sapwood/src/sapwood-draw.c	2007-04-13 10:49:25 UTC (rev 11020)
+++ projects/haf/trunk/sapwood/src/sapwood-draw.c	2007-04-13 10:51:51 UTC (rev 11021)
@@ -213,6 +213,28 @@
   g_list_free (children);
 }
 
+static void
+gtk_container_children_callback (GtkWidget *widget,
+				 gpointer   client_data)
+{
+  GList **children;
+
+  children = (GList**) client_data;
+  *children = g_list_prepend (*children, widget);
+}
+
+static GList *
+gtk_container_get_all_children (GtkContainer *container)
+{
+  GList *children = NULL;
+
+  gtk_container_forall (container,
+			gtk_container_children_callback,
+			&children);
+
+  return children;
+}
+
 static gboolean
 draw_simple_image(GtkStyle       *style,
 		  GdkWindow      *window,
@@ -225,6 +247,7 @@
 		  gint            width,
 		  gint            height)
 {
+  gboolean maemo_position_theming;
   ThemeImage *image;
   
   if ((width == -1) && (height == -1))
@@ -244,11 +267,25 @@
 	match_data->orientation = GTK_ORIENTATION_HORIZONTAL;
     }
 
-  /* Special handling for buttons in dialogs */
-  if (GTK_IS_BUTTON (widget))
+  /* Check for maemo-position-theming to update the position data */
+  if (widget->parent)
     {
-      if (GTK_IS_BUTTON_BOX (widget->parent))
-	check_buttonbox_child_position (widget, match_data);
+      gtk_widget_style_get (widget->parent,
+			    "maemo-position-theming", &maemo_position_theming,
+			    NULL);
+      if (maemo_position_theming)
+	{
+	  if (GTK_IS_BUTTON_BOX (widget->parent))
+	    check_buttonbox_child_position (widget, match_data);
+	  else
+	    {
+	      GList *children;
+
+	      children = gtk_container_get_all_children (widget->parent);
+	      check_child_position (widget, children, match_data);
+	      g_list_free (children);
+	    }
+	}
     }
     
   image = match_theme_image (style, match_data);


More information about the maemo-commits mailing list