diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-27 13:40:54 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-28 07:54:55 -0800 |
commit | 41027c2843e9b333fe15ae986322c3b348be0045 (patch) | |
tree | 558baef09bb2bfc8377c77d904efc9478ec3da0b /gtk-gui.c | |
parent | 075aba8f7da8139c1dced48e5c0b8ea60cc7ae8f (diff) | |
download | subsurface-41027c2843e9b333fe15ae986322c3b348be0045.tar.gz |
Make subsurface compile with -DGSEAL_ENABLE
This forces us to use the proper gtk accessor functions. It may not be
worth it if people actually do the Qt conversion, but if we want to try
gtk3 at some point, this might help.
This all came about because I was trying to explain on G+ what an
immense pain this all was to even figure out, if you don't actually know
gtk at all. Google and the gtk migration guide are almost useless, and
the gtk2 documentation itself actually uses the fields directly without
any accessor functions in several places.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r-- | gtk-gui.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -514,7 +514,7 @@ static void event_toggle(GtkWidget *w, gpointer _data) { gboolean *plot_ev = _data; - *plot_ev = GTK_TOGGLE_BUTTON(w)->active; + *plot_ev = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); } static void pick_default_file(GtkWidget *w, GtkButton *button) @@ -584,7 +584,8 @@ static void preferences_dialog(GtkWidget *w, gpointer data) /* create the notebook for the preferences and attach it to dialog */ notebook = gtk_notebook_new(); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, FALSE, FALSE, 5); + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + gtk_box_pack_start(GTK_BOX(vbox), notebook, FALSE, FALSE, 5); /* vbox that holds the first notebook page */ vbox = gtk_vbox_new(FALSE, 6); @@ -1663,16 +1664,18 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer { int i = 0; struct dive *dive = current_dive; + GtkAllocation allocation; static struct graphics_context gc = { .printer = 0 }; /* the drawing area gives TOTAL width * height - x,y is used as the topx/topy offset * so effective drawing area is width-2x * height-2y */ - gc.drawing_area.width = widget->allocation.width; - gc.drawing_area.height = widget->allocation.height; + gtk_widget_get_allocation(widget, &allocation); + gc.drawing_area.width = allocation.width; + gc.drawing_area.height = allocation.height; gc.drawing_area.x = MIN(50,gc.drawing_area.width / 20.0); gc.drawing_area.y = MIN(50,gc.drawing_area.height / 20.0); - gc.cr = gdk_cairo_create(widget->window); + gc.cr = gdk_cairo_create(gtk_widget_get_window(widget)); g_object_set(widget, "has-tooltip", TRUE, NULL); g_signal_connect(widget, "query-tooltip", G_CALLBACK(profile_tooltip), &gc); init_profile_background(&gc); |