GNOME Bugzilla – Bug 667155
Demos in gtk2 don't comply with gseal
Last modified: 2012-05-28 08:02:33 UTC
The demos that are supposed to be "exemplary" use members that are supposed to be private instead of accessor functions. This means that if one were to insert a dummy main function into a demo like ChangeDisplay, it would not compile with -DGSEAL_ENABLE. Once I finish putting in dummy main functions I will post patches.
Patches would be welcome, thanks.
Created attachment 204518 [details] [review] All-in-one patch
Review of attachment 204518 [details] [review]: ::: gtk-demo.orig/changedisplay.c @@ +253,1 @@ Avoid duplicate calls: GtkWidget *content_area; content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_container_add (GTK_CONTAINER (content_area), dialog_label); gtk_container_add (GTK_CONTAINER (content_area), display_entry); ::: gtk-demo.orig/colorsel.c @@ +30,1 @@ Avoid duplicate calls ::: gtk-demo.orig/offscreen_window.c @@ +262,1 @@ G_CALLBACK (pick_offscreen_child), bin); This should be: GdkWindow *gdk_window; gdk_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attibutes, attributes_mask); gtk_widget_set_window (widget, gdk_window); gdk_window_set_user_data (gdk_window, widget) g_signal_connect (gdk_window, @@ +288,1 @@ gdk_window_show (bin->offscreen_window); And this should be: gtk_widget_style_attach (widget); style = gtk_widget_get_style (widget); gtk_style_set_background (style, gdk_window, GTK_STATE_NORMAL); ::: gtk-demo.orig/offscreen_window2.c @@ +200,1 @@ G_CALLBACK (pick_offscreen_child), bin); The same as offscreen_window.c @@ +226,1 @@ gdk_window_show (bin->offscreen_window); The same as offscreen_window.c
Created attachment 204596 [details] [review] First update
Review of attachment 204596 [details] [review]: looks ok to me now
@Connor, Do you have commit access? If not, could you attach a patch in git format? https://live.gnome.org/GnomeLove/SubmittingPatches
Created attachment 208746 [details] [review] Git format patch I don't have commit access. Hope this is to your liking.
Haven't heard about this in awhile. Does my patch still need work or did you just forget to push?
The following fix has been pushed: 5b91e0d Make gtk2 demos comply with gseal
Created attachment 215064 [details] [review] Make gtk2 demos comply with gseal Demos in gtk-demo are supposed to be exemplary. However, if one were to give them dummy main functions many of them would not compile with -DGSEAL_ENABLE. This changes the demos to make them use accessor functions whenever possible instead of direct changes to the struct members. http://bugzilla.gnome.org/show_bug.cgi?id=667155
Thanks! (I was a dumbass to miss that semicolon)