[maemo-commits] [maemo-commits] r10127 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Feb 21 15:32:11 EET 2007
Author: lucasr
Date: 2007-02-21 15:32:10 +0200 (Wed, 21 Feb 2007)
New Revision: 10127

Modified:
   projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c
Log:
2007-02-21  Lucas Rocha  <lucas.rocha at nokia.com>

	* gtk/gtkiconview.c: surround all changes made on selection behavior
	with MAEMO_CHANGES ifdefs.


Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog	2007-02-21 13:28:02 UTC (rev 10126)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog	2007-02-21 13:32:10 UTC (rev 10127)
@@ -1,3 +1,8 @@
+2007-02-21  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* gtk/gtkiconview.c: surround all changes made on selection behavior
+	with MAEMO_CHANGES ifdefs.
+
 Wed Feb 21 13:43:33 2007  Tim Janik  <timj at gtk.org>
 
 	* gtkprogressbar.c: adapt minimum progressbar height (used for progress

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c	2007-02-21 13:28:02 UTC (rev 10126)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c	2007-02-21 13:32:10 UTC (rev 10127)
@@ -1894,7 +1894,11 @@
   GtkIconViewCellInfo *info = NULL;
   gboolean dirty = FALSE;
   GtkCellRendererMode mode;
+#ifdef MAEMO_CHANGES
   gint cursor_cell = -1;
+#else
+  gint cursor_cell;
+#endif /* MAEMO_CHANGES */
 
   icon_view = GTK_ICON_VIEW (widget);
 
@@ -1908,10 +1912,16 @@
     {
       item = gtk_icon_view_get_item_at_coords (icon_view, 
 					       event->x, event->y,
+#ifdef MAEMO_CHANGES
 					       FALSE,
+#else
+					       TRUE,
+#endif /* MAEMO_CHANGES */
 					       &info); 
+
       if (item != NULL)
 	{
+#ifdef MAEMO_CHANGES
           if (info != NULL)
             {
 	      g_object_get (info->cell, "mode", &mode, NULL);
@@ -1920,6 +1930,15 @@
 	          mode == GTK_CELL_RENDERER_MODE_EDITABLE)
 	        cursor_cell = g_list_index (icon_view->priv->cell_list, info);
 	    }
+#else
+	  g_object_get (info->cell, "mode", &mode, NULL);
+	  
+	  if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE ||
+	      mode == GTK_CELL_RENDERER_MODE_EDITABLE)
+	    cursor_cell = g_list_index (icon_view->priv->cell_list, info);
+	  else
+	    cursor_cell = -1;
+#endif /* MAEMO_CHANGES */	  
 
 	  gtk_icon_view_scroll_to_item (icon_view, item);
  
@@ -1980,15 +1999,19 @@
 	  /* cancel the current editing, if it exists */
 	  gtk_icon_view_stop_editing (icon_view, TRUE);
 
+#ifdef MAEMO_CHANGES
           if (info != NULL)
             {
+#endif /* MAEMO_CHANGES */
 	      if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
 	        gtk_icon_view_item_activate_cell (icon_view, item, info, 
 	          			          (GdkEvent *)event);
 	      else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
 	        gtk_icon_view_start_editing (icon_view, item, info, 
 	      				     (GdkEvent *)event);	  
+#ifdef MAEMO_CHANGES
             }
+#endif /* MAEMO_CHANGES */
 	}
       else
 	{
@@ -2879,6 +2902,7 @@
 #endif
 
   if (item->selected)
+#ifdef MAEMO_CHANGES
     {
       gdk_cairo_set_source_color (cr, &GTK_WIDGET (icon_view)->style->base[state]);
 
@@ -2889,7 +2913,31 @@
 
       cairo_fill (cr);
     }
-  
+#else
+    for (l = icon_view->priv->cell_list; l; l = l->next)
+      {
+	GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
+	
+	if (!info->cell->visible)
+	  continue;
+	
+	gtk_icon_view_get_cell_box (icon_view, item, info, &box);
+
+	/* FIXME we hardwire background drawing behind text
+	 * cell renderers here 
+	 */
+	if (GTK_IS_CELL_RENDERER_TEXT (info->cell))
+	  {
+	    gdk_cairo_set_source_color (cr, &GTK_WIDGET (icon_view)->style->base[state]);
+	    cairo_rectangle (cr,
+			     x - item->x + box.x, 
+			     y - item->y + box.y,
+			     box.width, box.height);
+	    cairo_fill (cr);
+	  }
+      }
+#endif /* MAEMO_CHANGES */
+
   for (l = icon_view->priv->cell_list; l; l = l->next)
     {
       GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
@@ -2938,9 +2986,15 @@
           if (!info->cell->visible)
             continue;
 
-          /* If found a editable/activatable cell, draw focus on it. */          
+#ifdef MAEMO_CHANGES
+          /* If found a editable/activatable cell, draw focus on it. */
           if (icon_view->priv->cursor_cell < 0 &&
               info->cell->mode != GTK_CELL_RENDERER_MODE_INERT)
+#else
+	  if (icon_view->priv->cursor_cell < 0 &&
+	      (info->cell->mode != GTK_CELL_RENDERER_MODE_INERT ||
+	       GTK_IS_CELL_RENDERER_TEXT (info->cell)))
+#endif /* MAEMO_CHANGES */
             icon_view->priv->cursor_cell = i;
 
           gtk_icon_view_get_cell_box (icon_view, item, info, &box);
@@ -2961,6 +3015,7 @@
             }
         }
 
+#ifdef MAEMO_CHANGES
       /* If there are no editable/activatable cells, draw focus 
        * around the whole item. */          
       if (icon_view->priv->cursor_cell < 0)
@@ -2974,6 +3029,7 @@
                    y - padding,
                    item->width + 2 * padding,
                    item->height + 2 * padding);
+#endif /* MAEMO_CHANGES */
     }
 }
 
@@ -4448,8 +4504,12 @@
   
   g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), NULL);
 
+#ifdef MAEMO_CHANGES
   item = gtk_icon_view_get_item_at_coords (icon_view, x, y, FALSE, NULL);
-
+#else
+  item = gtk_icon_view_get_item_at_coords (icon_view, x, y, TRUE, NULL);
+#endif /* MAEMO_CHANGES */
+  
   if (!item)
     return NULL;
 


More information about the maemo-commits mailing list