widget positions porting gtk1.2=>gtk2.0
- From: Joseph Monti <joe tgpr org>
- To: gtk-app-devel-list gnome org
- Subject: widget positions porting gtk1.2=>gtk2.0
- Date: 12 Jan 2003 13:50:59 -0500
I'm porting an application I wrote (grubconf:
http://www.sourceforge.net/projects/grubconf) from gtk1.2 to gtk2.0 and
I was able to make the port, but the widgets are aligned quite
differently in the gtk-2.0 version. It appears that when adding a widget
the upper bounds has changed so everything is rendered higher than they
should be.
Here are a few screen shots to illustrate
before (Gtk-1.4): http://joe.tgpr.org/images/gc4.png
after (Gtk-2.0): http://joe.tgpr.org/images/gc3.png
Would anyone have any suggestions on how to fix this?
Thanks!
Below are a few excerpts from code to see how things are added. The full
source isn't in the public CVS yet, but should be in a few days. So if
you want to see that let me know.
winMain = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (winMain), "winMain", winMain);
gtk_window_set_title (GTK_WINDOW (winMain), "GrubConf");
gtk_window_set_policy (GTK_WINDOW (winMain), FALSE, FALSE, FALSE);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox1);
gtk_object_set_data_full (GTK_OBJECT (winMain), "vbox1", vbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox1);
gtk_container_add (GTK_CONTAINER (winMain), vbox1);
menubar1 = gtk_menu_bar_new ();
gtk_widget_ref (menubar1);
gtk_object_set_data_full (GTK_OBJECT (winMain), "menubar1", menubar1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar1);
gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);
gnome_app_fill_menu (GTK_MENU_SHELL (menubar1), menubar1_uiinfo,
NULL, FALSE, 0);
... skip a bit ...
notebook1 = gtk_notebook_new ();
gtk_widget_ref (notebook1);
gtk_object_set_data_full (GTK_OBJECT (winMain), "notebook1",
notebook1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (notebook1);
gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);
gtk_widget_set_usize (notebook1, 400, 200);
... skip a bit ...
fixed2 = gtk_fixed_new ();
gtk_widget_ref (fixed2);
gtk_object_set_data_full (GTK_OBJECT (winMain), "fixed2", fixed2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (fixed2);
gtk_container_add (GTK_CONTAINER (notebook1), fixed2);
txtGenTimeout = gtk_entry_new ();
gtk_widget_ref (txtGenTimeout);
gtk_object_set_data_full (GTK_OBJECT (winMain), "txtGenTimeout",
txtGenTimeout,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (txtGenTimeout);
gtk_fixed_put (GTK_FIXED (fixed2), txtGenTimeout, 88, 16);
gtk_widget_set_uposition (txtGenTimeout, 88, 16);
gtk_widget_set_usize (txtGenTimeout, 24, 22);
gtk_entry_set_text (GTK_ENTRY (txtGenTimeout), "0");
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[ Joseph Monti ][ joe tgpr org ][ http://joe.tgpr.org/ ]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]