2005年5月24日星期二

Gtk2 patch for gnome-commander-1.1.6

As Debian doesn't have the gnome2 version of gnome-commander, I have to build it by self.

But the problem is a function called _gtk_clist_create_cell_layout is used by the gnome2 version gnome-commander. The symbols started with an '_' are private symbols of gtk2, they should not be used by applications (in old days, these symbols are also exported by gtk2 on some distributions, but not debian).

I just found Mandrake provides this version of gcmd, thus I download the SRPM, and found the patch from it.

===================================================================
RCS file: /cvs/gnome/gnome-commander/src/gnome-cmd-clist.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- gnome-commander/src/gnome-cmd-clist.c 2004/01/08 20:11:28 1.3
+++ gnome-commander/src/gnome-cmd-clist.c 2004/05/03 18:20:18 1.4
@@ -226,6 +226,46 @@
}


+PangoLayout *
+my_gtk_clist_create_cell_layout (GtkCList *clist,
+ GtkCListRow *clist_row,
+ gint column)
+{
+ PangoLayout *layout;
+ GtkStyle *style;
+ GtkCell *cell;
+ gchar *text;
+
+ get_cell_style (clist, clist_row, GTK_STATE_NORMAL, column, &style,
+ NULL, NULL);
+
+
+ cell = &clist_row->cell[column];
+ switch (cell->type)
+ {
+ case GTK_CELL_TEXT:
+ case GTK_CELL_PIXTEXT:
+ text = ((cell->type == GTK_CELL_PIXTEXT) ?
+ GTK_CELL_PIXTEXT (*cell)->text :
+ GTK_CELL_TEXT (*cell)->text);
+
+ if (!text)
+ return NULL;
+
+ layout = gtk_widget_create_pango_layout (GTK_WIDGET (clist),
+ ((cell->type == GTK_CELL_PIXTEXT) ?
+ GTK_CELL_PIXTEXT (*cell)->text :
+ GTK_CELL_TEXT (*cell)->text));
+ pango_layout_set_font_description (layout, style->font_desc);
+
+ return layout;
+
+ default:
+ return NULL;
+ }
+}
+
+
static void
draw_row (GtkCList *clist,
GdkRectangle *area,
@@ -389,7 +429,7 @@

/* calculate real width for column justification */

- layout = _gtk_clist_create_cell_layout (clist, clist_row, i);
+ layout = my_gtk_clist_create_cell_layout (clist, clist_row, i);
if (layout)
{
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);

没有评论: