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 | |
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>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | callbacks-gtk.h | 2 | ||||
-rw-r--r-- | equipment.c | 4 | ||||
-rw-r--r-- | gps.c | 2 | ||||
-rw-r--r-- | gtk-gui.c | 13 | ||||
-rw-r--r-- | print.c | 2 | ||||
-rw-r--r-- | statistics.c | 2 |
7 files changed, 15 insertions, 12 deletions
@@ -1,7 +1,7 @@ VERSION=2.1 CC=gcc -CFLAGS=-Wall -Wno-pointer-sign -g $(CLCFLAGS) +CFLAGS=-Wall -Wno-pointer-sign -g $(CLCFLAGS) -DGSEAL_ENABLE INSTALL=install PKGCONFIG=pkg-config XML2CONFIG=xml2-config diff --git a/callbacks-gtk.h b/callbacks-gtk.h index 017a8c0ae..08c159b4d 100644 --- a/callbacks-gtk.h +++ b/callbacks-gtk.h @@ -10,7 +10,7 @@ static void name(GtkWidget *w, gpointer data) \ static void name(GtkWidget *w, gpointer data) \ { \ GtkWidget **entry = data; \ - option = GTK_TOGGLE_BUTTON(w)->active; \ + option = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); \ update_screen(); \ if (entry) \ gtk_widget_set_sensitive(*entry, option);\ diff --git a/equipment.c b/equipment.c index 7f69e5c70..416c2c853 100644 --- a/equipment.c +++ b/equipment.c @@ -942,7 +942,7 @@ static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, G cylinder->description = GTK_COMBO_BOX(widget); g_signal_connect(widget, "changed", G_CALLBACK(cylinder_cb), cylinder); - entry = GTK_ENTRY(GTK_BIN(widget)->child); + entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget))); g_signal_connect(entry, "activate", G_CALLBACK(cylinder_activate_cb), cylinder); completion = gtk_entry_completion_new(); @@ -1028,7 +1028,7 @@ static void ws_widget(GtkWidget *vbox, struct ws_widget *ws_widget, GtkListStore ws_widget->description = GTK_COMBO_BOX(widget); g_signal_connect(widget, "changed", G_CALLBACK(weight_cb), ws_widget); - entry = GTK_ENTRY(GTK_BIN(widget)->child); + entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget))); g_signal_connect(entry, "activate", G_CALLBACK(weight_activate_cb), ws_widget); completion = gtk_entry_completion_new(); @@ -132,7 +132,7 @@ void show_map(OsmGpsMap *map, GtkWidget **window) gtk_window_set_default_size(GTK_WINDOW(*window), 640, 480); gtk_window_set_title(GTK_WINDOW(*window), _("Dives locations")); gtk_container_set_border_width(GTK_CONTAINER(*window), 5); - GTK_WINDOW(*window)->allow_shrink = TRUE; + gtk_window_set_resizable(GTK_WINDOW(*window), TRUE); gtk_container_add(GTK_CONTAINER(*window), GTK_WIDGET(map)); g_signal_connect(*window, "destroy", G_CALLBACK(on_close), (gpointer)window); g_signal_connect(G_OBJECT(map), "scroll-event", G_CALLBACK(scroll_cb), NULL); @@ -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); @@ -877,7 +877,7 @@ OPTIONCALLBACK(set_oneperpage, type, ONEPERPAGE) #define OPTIONSELECTEDCALLBACK(name, option) \ static void name(GtkWidget *w, gpointer data) \ { \ - option = GTK_TOGGLE_BUTTON(w)->active; \ + option = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); \ } OPTIONSELECTEDCALLBACK(print_selection_toggle, print_options.print_selected) diff --git a/statistics.c b/statistics.c index 2efc3947a..794678bc2 100644 --- a/statistics.c +++ b/statistics.c @@ -395,7 +395,7 @@ void show_yearly_stats() gtk_window_set_default_size(GTK_WINDOW(window), 640, 480); gtk_window_set_title(GTK_WINDOW(window), _("Yearly Statistics")); gtk_container_set_border_width(GTK_CONTAINER(window), 5); - GTK_WINDOW(window)->allow_shrink = TRUE; + gtk_window_set_resizable(GTK_WINDOW(window), TRUE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN); |