summaryrefslogtreecommitdiffstats
path: root/docs/porting-ugtk
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-12-02 15:19:39 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-12-02 15:19:39 +0000
commit2b63fd596539297c639b9bf73a3a96aa9c980f85 (patch)
tree9ab2bbb40db39e0b84a06b94669709a33b05e66b /docs/porting-ugtk
parent28fcfc616838d65e34e61d73c3025255c564a6a8 (diff)
downloaddrakx-2b63fd596539297c639b9bf73a3a96aa9c980f85.tar
drakx-2b63fd596539297c639b9bf73a3a96aa9c980f85.tar.gz
drakx-2b63fd596539297c639b9bf73a3a96aa9c980f85.tar.bz2
drakx-2b63fd596539297c639b9bf73a3a96aa9c980f85.tar.xz
drakx-2b63fd596539297c639b9bf73a3a96aa9c980f85.zip
add a tool to ease gtk2 port.
this is not the rule of thumb but basic stuff.
Diffstat (limited to 'docs/porting-ugtk')
-rwxr-xr-xdocs/porting-ugtk46
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/porting-ugtk b/docs/porting-ugtk
new file mode 100755
index 000000000..5a9a9ac7f
--- /dev/null
+++ b/docs/porting-ugtk
@@ -0,0 +1,46 @@
+#!/usr/bin/perl -pi
+#
+# $Id$
+#
+# This is not an automatic gtk+-1.x to gtk+-2.x port tool,
+# just a tool that ease perl apps' gtk2 port.
+# you'll have to fix all remaining problems, beginning by spotted warnings
+# it'll save you basic conversion work
+#
+# if you used Gtk::Text, a little more work will be needed (look at logdrake gtk2 port)
+# if you used Gtk::CTree, Gtk::CList or worse, Gtk::Tree, you'll need quite a lot of exhausting work :-(
+#
+# usage: porting-ugtk <file>
+#
+# hint: always use strict
+
+# switch to gtk2 :
+s!Gtk:!Gtk2:!g;
+/(use|require) Gtk/ and print STDERR "Warning: if this (bad) app that did not use my_gtk, you'll have a hard time :-)\n if not, using both Gtk && my_gtk was misdesigned ...\n";
+s!(use|require) Gtk.*!!g; #
+s!my_gtk!ugtk2!g;
+
+# one should pass the right ":stuff" to "use ugtk2 qw();"
+/ugtk::/ and print STDERR "Warning: you'll have to passe eiter :ask, :create, :helpers or :wrappers to ugtk\n";
+s!ugtk::!!g;
+# if my_gtk wasn't used, this'll be spotted by the lack of "use ugtk2;" anyway
+s!(require|use) ugtk.*!!g;
+
+
+# deprecated :
+/::(CTree|CList|Text[^V])/ and print STDERR "Warning: CTree, CList and Text widgets are deprecated... Good luck :-(\n";
+/gtkcreate_(png|xpm)/ and print STDERR "Warning: new Gtk::Pixmap(gtkcreate_(png|xpm)) should be replaced by gtkcreate_img\n";
+/set_policy/ and print STDERR "Warning: ->set_policy() should be replaced by allow_shrink/allow_grow/set_resizable\n";
+
+# obsoletes methods||functions :
+s!set_usize!set_size_request!g;
+s!-(end|spread|extended|start|single)!'\1'!g;
+s!createScrolledWindow!create_scrolled_window!g;
+# quite a lot less usefull with gtk+2 but who knows... :
+s!set_position\(1\)!set_position('center')!g;
+s!gtkpng!gtkcreate_img!g;
+# hacky but usefull in ->set_pixmap() context; else that'll be spoted at run time :
+s!gtkcreate_png!gtkcreate_img!g;
+# usefull sometimes but not in most cases :
+#s!new GtkVBox!create_vbox!g;
+#s!new GtkHBox!create_hbox!g;