GTK2 version of xfplan - diffs of first try



Hi,

I thought I try xfplan a bit, just to find out, that the 0.8 .deb seems to have some prereqs, that I'm missing on Ubuntu 9.10. So I went ahead and checked out from CVS just to discover  that GTK V1 is needed.

Having done a little bit of GTK1->2 conversion work before, I thought I try it again.

With the following DIFFs it seems to build and run fine.

Kind regards,
Richard.

--- xfplan/Makefile    2009-12-25 01:57:32.000000000 +0100
+++ ../xfplan/Makefile    2010-03-16 16:38:10.000000000 +0100
@@ -128,7 +128,8 @@
 # ---------------------------------------------------------------------------
 # Define which directories contain the graphics header files. The lines
 # below are for the Gnome and no gui cases;
-GFX_INCLUDE = $(shell gnome-config --cflags glib gtk gnome gnomeui)
+#GFX_INCLUDE = $(shell gnome-config --cflags glib gtk gnome gnomeui)
+GFX_INCLUDE = $(shell pkg-config --cflags glib-2.0 gtk+-2.0 libgnome-2.0 libgnomeui-2.0)
 #GFX_INCLUDE = -I/usr/openwin/include
 #GFX_INCLUDE = 
 
@@ -136,7 +137,7 @@
 # Define which graphics libraries are required when linking the executable.
 # The lines below are for the Gnome, and no previewer cases;
 #GFX_LIBS = $(shell gnome-config --libs glib gtk gnome gnomeui)
-GFX_LIBS = -L/usr/lib -lgnomeui -lgtk -lgdk -lX11 -lgnome
+GFX_LIBS = -L/usr/lib -lgnomeui-2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lX11 -lgnome-2
 #GFX_LIBS = -L/usr/openwin/lib -lxview -lolgx -L/usr/X11R6/lib -lX11
 #GFX_LIBS =
 
--- xfplan/callbacks.c    2008-03-18 03:47:44.000000000 +0100
+++ ../xfplan/callbacks.c    2010-03-16 16:59:31.000000000 +0100
@@ -415,7 +415,7 @@
 gtk_window_set_title(GTK_WINDOW(parent), "Calculator") ;
 gtk_window_set_transient_for(GTK_WINDOW(parent),
 GTK_WINDOW(toplevel)) ;
-      calculator = gnome_calculator_new() ;
+      /* TODO calculator = gnome_calculator_new() ; haven't found a calculator yet */
 gtk_container_add(GTK_CONTAINER(parent), calculator) ;
 gtk_signal_connect(GTK_OBJECT(parent), "delete_event",
 GTK_SIGNAL_FUNC(gtk_widget_hide), NULL) ;
(I admit - just commenting out what doesn't work isn't the best style, but it is only one of two pieces, that didn't work out so far)

--- xfplan/canvas.c    2008-11-10 01:20:36.000000000 +0100
+++ ../xfplan/canvas.c    2010-03-16 15:59:37.000000000 +0100
@@ -433,7 +433,8 @@
 return ;
 
 window = canvas->window ;
-    font = gtk_widget_get_style(canvas)->font ;
+    /* font = gtk_widget_get_style(canvas)->font ; */
+    font = gtk_style_get_font(gtk_widget_get_style(canvas));
 
 /* Choose an increment that puts the lines at least 150 pixels
 * apart.

--- xfplan/dialog_helper.c    2008-03-20 05:10:17.000000000 +0100
+++ ../xfplan/dialog_helper.c    2010-03-16 17:20:07.000000000 +0100
@@ -411,7 +411,7 @@
 rval = strtoul(value, &value, 10) ;
 if( *value == 'c' || *value == 'C' ) {
 if( w != NULL && (style = gtk_widget_get_style(w)) != NULL &&
-          (font = style->font) != NULL )
+          (font = gtk_style_get_font(style)) != NULL )
 rval *= gdk_char_width(font, 'n') ;
 else
 rval *= 10 ;
@@ -437,7 +437,7 @@
 rval = strtoul(value, &value, 10) ;
 if( *value == 'l' || *value == 'L' ) {
 if( w != NULL && (style = gtk_widget_get_style(w)) != NULL &&
-          (font = style->font) != NULL )
+          (font = gtk_style_get_font(style)) != NULL )
 rval *= font->ascent + font->descent ;
 else
 rval *= 10 ;
@@ -601,9 +601,9 @@
 style = gtk_style_copy (gtk_widget_get_style (widget));
 
 /* Release style's previous font, assign new font */
-          gdk_font_unref(style->font) ;
-          style->font = font ;
-          gdk_font_ref(style->font);
+          gdk_font_unref(gtk_style_get_font(style)) ;
+          gtk_style_set_font(style, font) ;
+          gdk_font_ref(gtk_style_get_font(style));
 
 /* Attach the new style to the widget */
 gtk_widget_set_style(widget, style) ;
@@ -1086,10 +1086,11 @@
 {
 DialogUIInfo *list = *listp ;
 GtkWidget *text ;
+    GtkTextBuffer *buffer;
 
-    text = gtk_text_new(NULL, NULL) ;
+    text = gtk_text_view_new_with_buffer(buffer) ;
 
-    gtk_text_set_editable(GTK_TEXT(text), TRUE) ;
+    /* gtk_text_set_editable(GTK_TEXT(text), TRUE) ; */
 
 if( list->p1 != NULL )
 gtk_signal_connect( GTK_OBJECT(text), "activate",
@@ -2156,9 +2157,10 @@
 
 
 #ifndef    NO_GNOME
-    if( strcmp(key, "stock") == 0 ) {
-        return gnome_stock_pixmap_widget(parent, data) ;
-    }
+    /* TODO if( strcmp(key, "stock") == 0 ) {
+        // return gnome_stock_pixmap_widget(parent, data) ;
+        return gtk_image_new_from_stock(parent, data) ;
+    } */
 
 if( strcmp(key, "name") == 0 ) {
 return gnome_pixmap_new_from_file(data) ;
(here is another TODO left)

--- xfplan/map_wp.c    2008-03-19 00:52:42.000000000 +0100
+++ ../xfplan/map_wp.c    2010-03-16 16:01:03.000000000 +0100
@@ -127,10 +127,10 @@
 gdk_colormap_alloc_color(cmap, &airportColor, FALSE, TRUE) ;
 
 if( airport_font == NULL )
-      airport_font = gdk_font_ref(gtk_widget_get_style(canvas)->font) ;
+      airport_font = gdk_font_ref(gtk_style_get_font(gtk_widget_get_style(canvas))) ;
 
 if( navaid_font == NULL )
-      navaid_font = gdk_font_ref(gtk_widget_get_style(canvas)->font) ;
+      navaid_font = gdk_font_ref(gtk_style_get_font(gtk_widget_get_style(canvas))) ;
 
 
 ndb_bitmap = gdk_bitmap_create_from_data(win,


--- xfplan/preferences.c    2008-03-20 04:14:12.000000000 +0100
+++ ../xfplan/preferences.c    2010-03-16 16:10:53.000000000 +0100
@@ -258,9 +258,9 @@
 if( fontDialog == NULL ) {
 fontDialog = GTK_FONT_SELECTION_DIALOG(
 gtk_font_selection_dialog_new("Font select")) ;
-      gtk_font_selection_dialog_set_filter(
+      /* gtk_font_selection_dialog_set_filter(
 fontDialog, GTK_FONT_FILTER_BASE,
-        GTK_FONT_ALL, NULL, NULL, NULL, NULL, NULL, reg) ;
+        GTK_FONT_ALL, NULL, NULL, NULL, NULL, NULL, reg) ; */
 
 gtk_signal_connect( GTK_OBJECT(fontDialog), "delete_event",
 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL) ;
(another instance of just commenting things out)

--- xfplan/windows.c    2008-05-21 01:28:19.000000000 +0200
+++ ../xfplan/windows.c    2010-03-16 15:56:57.000000000 +0100
@@ -408,7 +408,7 @@
 GdkFont    *font ;
 
 if( w != NULL && (style = gtk_widget_get_style(w)) != NULL &&
-        (font = style->font) != NULL )
+        (font = gtk_style_get_font(style)) != NULL )
 width *= gdk_char_width(font, 'n') ;
 else
 width *= 10 ;
___________________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


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