evolution r34877 - in trunk/widgets: misc table



Author: sragavan
Date: Thu Jan 24 08:34:13 2008
New Revision: 34877
URL: http://svn.gnome.org/viewvc/evolution?rev=34877&view=rev

Log:
Cairofication of the preference window's etable.


Modified:
   trunk/widgets/misc/ChangeLog
   trunk/widgets/misc/e-multi-config-dialog.c
   trunk/widgets/table/ChangeLog
   trunk/widgets/table/e-cell-pixbuf.c

Modified: trunk/widgets/misc/e-multi-config-dialog.c
==============================================================================
--- trunk/widgets/misc/e-multi-config-dialog.c	(original)
+++ trunk/widgets/misc/e-multi-config-dialog.c	Thu Jan 24 08:34:13 2008
@@ -214,45 +214,8 @@
 			   ((color).blue & 0xff00) >> 8)
 
 static void
-fill_in_pixbufs (EMultiConfigDialog *dialog, int row)
-{
-	GdkPixbuf *original = e_table_model_value_at (dialog->priv->list_e_table_model, 1, row);
-	GtkWidget *canvas;
-	guint32 colors[3];
-	int i;
-
-	if (original == NULL)
-		return;
-
-	canvas = GTK_WIDGET (e_table_scrolled_get_table (E_TABLE_SCROLLED (dialog->priv->list_e_table))->table_canvas);
-
-	colors[0] = RGB_COLOR (canvas->style->bg [GTK_STATE_SELECTED]);
-	colors[1] = RGB_COLOR (canvas->style->bg [GTK_STATE_ACTIVE]);
-	colors[2] = RGB_COLOR (canvas->style->base [GTK_STATE_NORMAL]);
-
-	for (i = 0; i < 3; i++) {
-		GdkPixbuf *pixbuf = gdk_pixbuf_composite_color_simple (original,
-								       gdk_pixbuf_get_width (original),
-								       gdk_pixbuf_get_height (original),
-								       GDK_INTERP_BILINEAR,
-								       255,
-								       1,
-								       colors[i], colors[i]);
-		e_table_model_set_value_at (dialog->priv->list_e_table_model, i + 2, row, pixbuf);
-		g_object_unref(pixbuf);
-	}
-}
-
-static void
 canvas_realize (GtkWidget *widget, EMultiConfigDialog *dialog)
 {
-	int i;
-	int row_count;
-
-	row_count = e_table_model_row_count (dialog->priv->list_e_table_model);
-	for (i = 0; i < row_count; i++) {
-		fill_in_pixbufs (dialog, i);
-	}
 }
 
 
@@ -385,10 +348,6 @@
 
 	e_table_memory_store_insert (E_TABLE_MEMORY_STORE (priv->list_e_table_model), -1, NULL, title, icon, NULL, NULL, NULL);
 
-	if (GTK_WIDGET_REALIZED (e_table_scrolled_get_table (E_TABLE_SCROLLED (dialog->priv->list_e_table))->table_canvas)) {
-		fill_in_pixbufs (dialog, e_table_model_row_count (priv->list_e_table_model) - 1);
-	}
-
 	page_no = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
 				  create_page_container (description, GTK_WIDGET (page_widget)),
 				  NULL);

Modified: trunk/widgets/table/e-cell-pixbuf.c
==============================================================================
--- trunk/widgets/table/e-cell-pixbuf.c	(original)
+++ trunk/widgets/table/e-cell-pixbuf.c	Thu Jan 24 08:34:13 2008
@@ -115,31 +115,11 @@
     GdkPixbuf *cell_pixbuf;
     int real_x, real_y, real_w, real_h;
     int pix_w, pix_h;
-    ECellPixbuf *ecp;
+    cairo_t *cr;
+	
+    cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model,
+							  1, row);
 
-    cell_pixbuf = NULL;
-
-    ecp = E_CELL_PIXBUF (ecell_view->ecell);
-
-    if (flags & E_CELL_SELECTED) {
-	    if (GTK_WIDGET_HAS_FOCUS (GNOME_CANVAS_ITEM (ecell_view->e_table_item_view)->canvas)) {
-		    if (ecp->focused_column != -1)
-			    cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model,
-										ecp->focused_column, row);
-	    } else {
-		    if (ecp->selected_column != -1)
-			    cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model,
-										ecp->selected_column, row);
-	    }
-    } else {
-	    if (ecp->unselected_column != -1)
-		    cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model,
-							  ecp->unselected_column, row);
-    }
-
-    if (cell_pixbuf == NULL)
-	    cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model,
-						  model_col, row);
     /* we can't make sure we really got a pixbuf since, well, it's a Gdk thing */
 
     if (x2 - x1 == 0)
@@ -170,15 +150,12 @@
         real_h = y2 - y1;
     }
 
-
-    gdk_draw_pixbuf (drawable,
-		     NULL,
-		     cell_pixbuf,
-		     0, 0,
-		     real_x, real_y,
-		     real_w, real_h,
-		     GDK_RGB_DITHER_NORMAL,
-		     0, 0);
+    cr = gdk_cairo_create (drawable);
+    cairo_save (cr);
+    gdk_cairo_set_source_pixbuf (cr, cell_pixbuf, real_x, real_y);
+    cairo_paint_with_alpha (cr, 1);
+    cairo_restore (cr);
+    cairo_destroy (cr);	
 }
 
 static gint
@@ -203,7 +180,7 @@
       }
     }
 
-    pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+    pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row);
     if (!pixbuf)
         return 0;
 
@@ -223,7 +200,7 @@
 	int scale;
 	cairo_t *cr = gtk_print_context_get_cairo_context (context);
 
-	pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+	pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row);
 	if (pixbuf == NULL)
 		return;
 
@@ -250,7 +227,7 @@
 		}
 	}
 
-	pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+	pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, 1, row);
 	if (!pixbuf)
 		return 0;
 
@@ -271,10 +248,10 @@
         for (i = 0; i <= num_rows; i++) {
             GdkPixbuf *pixbuf = (GdkPixbuf *) e_table_model_value_at
                 (ecell_view->e_table_model,
-                 model_col,
+                 1,
                  i);
-	    if (!pixbuf)
-		continue;
+           if (!pixbuf)
+               continue;
             pw = gdk_pixbuf_get_width (pixbuf);
             if (max_width < pw)
                 max_width = pw;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]