GNOME Bugzilla – Bug 605776
Use accessor functions instead direct access
Last modified: 2010-06-01 07:41:06 UTC
GTK+ currently exposes a huge amount of internal implementation details which blocks cleaning up of internal code, something that is much needed. This is not only for code beautification, in fact, the reason is that it’s a necessity in order to maintain the toolkit. The objective is substitute all direct access to the object fields for accessor functions. After we have done this we will have an API consisting only of functions which means that any compatibility glue code we need to write can be done without the risk of variables being accessed directly and circumvent the compatibility layer. This is in the fundamentals of OOP practices. This is an important Goal to GTK+ 3 transition. AFAIK, evince doesn't compile with the -DGSEAL_ENABLE flag More info: http://live.gnome.org/GnomeGoals/UseGseal
> AFAIK, evince doesn't compile with the -DGSEAL_ENABLE flag Oh PLEASE actually TEST issues first before "guessing" bugs. This is a bug tracker about real bugs and not about "might be" bugs...
Confirming.
André, Sorry for my poor quality bug report. Of course it was not guessing, but I though of it as a reminding for talking with the maintainer on the IRC. I understand that "AFAIK" is misleading, but it was the first time I use I compiled Evince adding a flag and I wasn't sure if what I did was right. My Apologise for distrubing your job as bugmaster.
Compiled with this line on .jhbuildrc: os.environ['CFLAGS'] = '-DGSEAL_ENABLE' The message error: ev-pixbuf-cache.c: In function ‘get_selection_colors’: ev-pixbuf-cache.c:482: error: ‘GtkObject’ has no member named ‘flags’ ev-pixbuf-cache.c:483: error: ‘GtkWidget’ has no member named ‘style’ ev-pixbuf-cache.c:484: error: ‘GtkWidget’ has no member named ‘style’ ev-pixbuf-cache.c:486: error: ‘GtkWidget’ has no member named ‘style’ ev-pixbuf-cache.c:487: error: ‘GtkWidget’ has no member named ‘style’ make[3]: *** [libevview_la-ev-pixbuf-cache.lo] Error 1 make[3]: Leaving directory `/home/jjmarin/src/gnome/svn/evince/libview' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/jjmarin/src/gnome/svn/evince/libview' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/jjmarin/src/gnome/svn/evince' make: *** [all] Error 2 *** Error during phase build of evince: ########## Error running make *** [1/1]
libdocument and shell build now with GSEAL, libview uses GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); which odesn't have an accessor yet.
Hello Carlos, Where do you need to use GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);? Note that you should never need to use this (see https://bugzilla.gnome.org/show_bug.cgi?id=593601#c4)
* For interactive goto page in libview/ev-view-presentation.c * For annotation popup windows in libview/ev-annotation-window.c
Javier, do you have any idea how to address the use cases Carlos just mentioned?
Yeah ;), new GTK+ API will arrive soon to solve this. See bug #593671
Created attachment 159847 [details] [review] Do not use GTK_WIDGET_*SET_FLAGS (widget, GTK_HAS_FOCUS) Little patch to fix the use of GTK_WIDGET_*SET_FLAGS (widget, GTK_HAS_FOCUS) in libview/ev-view-presentation.c and in libview/ev-annotation-window.c
Hey Javier, thanks for the patch, but we'll better wait for a new GTK+ release with the accessor instead of adding more #if
Other issues left to fix: * cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c * cut-n-paste/toolbar-editor/egg-editable-toolbar.c * cut-n-paste/toolbar-editor/egg-toolbar-editor.c
I'm finishing the libview part and I've found some issues :-( I'll take a look at cut-n-paste as soon as libview is working.
Created attachment 160676 [details] [review] Do not use GTK_WIDGET_*SET_FLAGS (widget, GTK_HAS_FOCUS).v2 Updated patch against current master. GTK+ required version bumped to 2.21.0
Thanks for the patch Javier, I already had those changes in my local patch indeed. I've just pushed a commit to fix most of the GSEAL issues in libview. Only GtkWindow::group is still used because there ins't an accessor yet, see bug #618271.
(In reply to comment #12) > Other issues left to fix: > * cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c > * cut-n-paste/toolbar-editor/egg-editable-toolbar.c > * cut-n-paste/toolbar-editor/egg-toolbar-editor.c cut-n-paste code is fixed in git master now too.
So what is left to do on git master is make[4]: Entering directory `/evince/cut-n-paste/toolbar-editor' egg-editable-toolbar.c: In function ‘toolbar_drag_data_received_cb’: egg-editable-toolbar.c:697: error: ‘GdkDragContext’ has no member named ‘action’ egg-editable-toolbar.c:701: error: ‘GdkDragContext’ has no member named ‘action’ egg-editable-toolbar.c: In function ‘toolbar_drag_motion_cb’: egg-editable-toolbar.c:760: error: ‘GdkDragContext’ has no member named ‘suggested_action’ make[3]: Entering directory `/evince/libview' ev-view.c: In function ‘ev_view_drag_motion’: ev-view.c:3476: error: ‘GdkDragContext’ has no member named ‘suggested_action’ ev-view-presentation.c: In function ‘ev_view_presentation_goto_window_create’: ev-view-presentation.c:635: error: ‘GtkWindow’ has no member named ‘group’ ev-view-presentation.c:636: error: ‘GtkWindow’ has no member named ‘group’ ev-view-presentation.c:638: error: ‘GtkWindow’ has no member named ‘group’ ev-view-presentation.c:639: error: ‘GtkWindow’ has no member named ‘group’ ev-view-presentation.c:648: error: ‘GtkWindow’ has no member named ‘group’ ev-view-presentation.c:649: error: ‘GtkWindow’ has no member named ‘group’
(In reply to comment #17) > So what is left to do on git master is > > make[4]: Entering directory `/evince/cut-n-paste/toolbar-editor' > egg-editable-toolbar.c: In function ‘toolbar_drag_data_received_cb’: > egg-editable-toolbar.c:697: error: ‘GdkDragContext’ has no member named > ‘action’ > egg-editable-toolbar.c:701: error: ‘GdkDragContext’ has no member named > ‘action’ > egg-editable-toolbar.c: In function ‘toolbar_drag_motion_cb’: > egg-editable-toolbar.c:760: error: ‘GdkDragContext’ has no member named > ‘suggested_action’ hmm, no, I thought I had already fixed this, I'll look at it again. > make[3]: Entering directory `/evince/libview' > ev-view.c: In function ‘ev_view_drag_motion’: > ev-view.c:3476: error: ‘GdkDragContext’ has no member named ‘suggested_action’ > ev-view-presentation.c: In function ‘ev_view_presentation_goto_window_create’: > ev-view-presentation.c:635: error: ‘GtkWindow’ has no member named ‘group’ > ev-view-presentation.c:636: error: ‘GtkWindow’ has no member named ‘group’ > ev-view-presentation.c:638: error: ‘GtkWindow’ has no member named ‘group’ > ev-view-presentation.c:639: error: ‘GtkWindow’ has no member named ‘group’ > ev-view-presentation.c:648: error: ‘GtkWindow’ has no member named ‘group’ > ev-view-presentation.c:649: error: ‘GtkWindow’ has no member named ‘group’ Yes, I'm just waiting for a new gtk+ release with gtk_window_has_group() Thanks!
(In reply to comment #18) > (In reply to comment #17) > > So what is left to do on git master is > > > > make[4]: Entering directory `/evince/cut-n-paste/toolbar-editor' > > egg-editable-toolbar.c: In function ‘toolbar_drag_data_received_cb’: > > egg-editable-toolbar.c:697: error: ‘GdkDragContext’ has no member named > > ‘action’ > > egg-editable-toolbar.c:701: error: ‘GdkDragContext’ has no member named > > ‘action’ > > egg-editable-toolbar.c: In function ‘toolbar_drag_motion_cb’: > > egg-editable-toolbar.c:760: error: ‘GdkDragContext’ has no member named > > ‘suggested_action’ > > hmm, no, I thought I had already fixed this, I'll look at it again. aha, this is gdk, not gtk, which has been recently sealed, we need a new gtk+ release for these too.
Fixed in git master
Carlos, do you know which commit made the fix? :)
Many, the last one is this: http://git.gnome.org/browse/evince/commit/?id=ccf1a3cbc3fc2caa4a82713c1cff7a875de292f3 if that is what you are asking for.