After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 595425 - Use accessor functions instead direct access (use GSEAL GnomeGoal)
Use accessor functions instead direct access (use GSEAL GnomeGoal)
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: general
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on: 69872
Blocks: 585391
 
 
Reported: 2009-09-17 05:49 UTC by Javier Jardón (IRC: jjardon)
Modified: 2010-04-06 18:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use accessor functions instead direct access (744 bytes, patch)
2009-09-17 05:54 UTC, Javier Jardón (IRC: jjardon)
none Details | Review
Use accessor functions instead direct access. (59.83 KB, patch)
2009-09-17 16:24 UTC, Javier Jardón (IRC: jjardon)
none Details | Review
Use accessor functions instead direct accessv2 (64.54 KB, patch)
2009-12-30 07:11 UTC, Javier Jardón (IRC: jjardon)
committed Details | Review
Use accessor functions instead direct access. Final patch (14.18 KB, patch)
2010-03-22 15:56 UTC, Javier Jardón (IRC: jjardon)
committed Details | Review
compilation with GSEAL is broken for me without this patch (4.61 KB, patch)
2010-04-01 21:28 UTC, Christophe Fergeau
committed Details | Review

Description Javier Jardón (IRC: jjardon) 2009-09-17 05:49:24 UTC
To be ready for GNOME/GTK+ 3 should be able to build with -DGSEAL_ENABLE

See http://live.gnome.org/GnomeGoals/UseGseal for more details
Comment 1 Javier Jardón (IRC: jjardon) 2009-09-17 05:54:37 UTC
Created attachment 143319 [details] [review]
Use accessor functions instead direct access

GTK+ 2.17.10 is now the required version

I've used all the GTK+ 2.17.11 api available, still missing:

GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
GTK_WIDGET_REALIZED ()
Comment 2 Javier Jardón (IRC: jjardon) 2009-09-17 16:24:49 UTC
Created attachment 143368 [details] [review]
Use accessor functions instead direct access.

Sorry, here the correct patch
Comment 3 Jonathan Matthew 2009-09-17 21:18:40 UTC
Thanks for working on this.  I haven't had a close look at the patch yet.  My main concern is that I don't want to increase the gtk+ version requirement to 2.17.x.  It's important that it remains possible to build rhythmbox on recent desktop distribution releases.
Comment 4 Jonathan Matthew 2009-10-11 12:13:37 UTC
Looks like we can commit a large portion of this if we increase the gtk+ version requirement to 2.14, which isn't a problem at all.

For much of the rest, it looks like we could provide a set of backwards compatibility #defines, like "#define gtk_widget_is_drawable(x) GTK_WIDGET_DRAWABLE(x)", in a header with appropriate version checks.
Comment 5 Javier Jardón (IRC: jjardon) 2009-10-14 14:17:53 UTC
Indeed, we should coordinate us to have a common file.

gnome-games already has one: http://git.gnome.org/cgit/gnome-games/tree/libgames-support/games-gtk-compat.h.

After talking with a gnome-games devel I think we should use that file as a "main repo" to all the funcions we need, what do you think?
Comment 6 Jonathan Matthew 2009-12-04 12:11:42 UTC
I've just increased the gtk+ version requirement to 2.14, and I'll look at committing parts of this soon.  As far as I can tell, the GtkAdjustment, GtkSelectionData, and gtk_dialog_get_content_area changes can go in as-is.
Comment 7 Javier Jardón (IRC: jjardon) 2009-12-30 07:11:10 UTC
Created attachment 150566 [details] [review]
Use accessor functions instead direct accessv2

Ok, here a new patch;

I've created a gseal-gtk-compat.h file to functions that need a GTK+ version >= 2.14.0

Still missing (no GTK+ api):
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
GTK_WIDGET_REALIZED ()
Comment 8 Jonathan Matthew 2009-12-30 11:34:45 UTC
Review of attachment 150566 [details] [review]:

Aside from a couple of things, this looks good.  Thanks for working on it.

::: plugins/visualizer/rb-vis-widget.c
@@ +58,3 @@
 {
+	gtk_widget_set_can_focus (GTK_WIDGET (rbvw), TRUE);
+	gtk_widget_set_double_buffered (GTK_WIDGET (rbvw), TRUE);

shouldn't this be gtk_widget_set_double_buffered (GTK_WIDGET (rbvw), FALSE); ?

::: shell/rb-shell-preferences.c
@@ +202,3 @@
 			   shell_preferences->priv->notebook);
 
+	gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);

I don't think this one should have been changed - the original line was setting the border with on shell_preferences, not the content area.
Comment 9 Jonathan Matthew 2009-12-31 02:03:11 UTC
hrm, splinter didn't format that the way I'd hoped it would..

the original line for this:
+    gtk_widget_set_double_buffered (GTK_WIDGET (rbvw), TRUE);
was:
	GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (rbvw), GTK_DOUBLE_BUFFERED);
Comment 10 Jonathan Matthew 2010-01-01 23:14:46 UTC
Review of attachment 150566 [details] [review]:

I haven't actually tried building this with gtk+ <2.18 yet, but I'm about to.

::: lib/gseal-gtk-compat.h
@@ +36,3 @@
+#define gtk_widget_set_can_default(widget, TRUE)                (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT))
+#define gtk_widget_set_can_focus(widget, TRUE)                  (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS))
+#define gtk_widget_set_double_buffered (widget, FALSE)          (GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED))

These cause compiler errors - (do { ... } while (...)) results in "expected expression before 'do'".

The c preprocessor doesn't check that the arguments match here, it'll use these expansions for anything that looks like gtk_widget_set_can_focus(x, y), whether y is TRUE or FALSE or ICECREAM.

@@ +37,3 @@
+#define gtk_widget_set_can_focus(widget, TRUE)                  (GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS))
+#define gtk_widget_set_double_buffered (widget, FALSE)          (GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED))
+#define gtk_widget_set_window (widget, window)                  ((widget)->window=window)

It'll also replace any instance of 'window' in the macro expansion with the macro argument.  The argument needs to be renamed to _window for this to work.
Comment 11 Jonathan Matthew 2010-01-02 00:05:29 UTC
A few things were missing from gseal-gtk-compat.h:

gtk_cell_renderer_get_padding
gtk_cell_renderer_set_padding
gtk_cell_renderer_get_alignment

and a few more files needed to include it, but with those changes, it builds with gtk 2.16.  I'm pretty sure 2.14 will be OK too.
Comment 12 Jonathan Matthew 2010-01-02 00:35:28 UTC
I've committed my updated version.  Since there's still more to do (GTK_WIDGET_REALIZED etc.) I'm leaving the bug open.
Comment 13 Javier Jardón (IRC: jjardon) 2010-01-04 16:46:24 UTC
Hello Jonathan, thank you for fix my patch and commit it, I was a bit busy these days ;)

As soon as exist the GTK+ api to complete fix this bug I'll attach a new patch

Happy year!
Comment 14 Javier Jardón (IRC: jjardon) 2010-03-22 15:56:35 UTC
Created attachment 156761 [details] [review]
Use accessor functions instead direct access. Final patch

Here the final patch to fix this bug.

I'd recommend you to add 

CFLAGS+="-DGSEAL_ENABLE"

to you configure.ac, so this bug won't be reopended
Comment 15 Jonathan Matthew 2010-03-29 13:26:03 UTC
Committed, thanks.
Comment 16 Christophe Fergeau 2010-04-01 21:28:23 UTC
Created attachment 157719 [details] [review]
compilation with GSEAL is broken for me without this patch

Please review it carefully, I wrote all this patch by guessing, I might have used wrong accessors...
Comment 17 Jonathan Matthew 2010-04-01 22:22:02 UTC
Comment on attachment 157719 [details] [review]
compilation with GSEAL is broken for me without this patch

Looks correct to me
Comment 18 Christophe Fergeau 2010-04-06 18:31:11 UTC
Comment on attachment 157719 [details] [review]
compilation with GSEAL is broken for me without this patch

Pushed as 55777fcb6ec68fd6e257425dfe66023225e9d440