GNOME Bugzilla – Bug 361679
Replace all the deprecated widgets
Last modified: 2007-12-08 20:04:29 UTC
See http://bugzilla.gnome.org/show_bug.cgi?id=361134#c8 Requires to compile ekiga with the DISABLE_DEPRECATED flag.
Hum... Compiling with this flag set just gives me... nothing. Are all the deprecated widgets gone ?
I think it is GTK_DISABLE_DEPRECATED and G_DISABLE_DEPRECATED. There should still be a few deprecated widgets.
I hit bug 156034, which means we can't compile with these flags on, due to a libgnomeui problem. So it seems I also need to compile with GNOME_DISABLE_DEPRECATED.
Created attachment 85933 [details] [review] Patch to allow building with G_DISABLE_DEPRECATED This trivial patch fixes the code using deprecated glib symbols. This allows to build with G_DISABLE_DEPRECATED defined.
Applied, thanks! Does that mean you're finished with this bug report, or is there some more to do ?
Well, this was only for G_DISABLE_DEPRECATED. Now the big work is with GTK_DISABLE_DEPRECATED (which requires GNOME_DISABLE_DEPRECTED). There's much more to do...
Ok. Are you sure GTK_DISABLE_DEPRECATED requires GNOME_DISABLE_DEPRECATED and not the other more logical way around ? Do we use that many deprecated stuff !?
Yes, I'm sure, see comment 3. With just GTK_DISABLE_DEPRECATED, you can't compile. And it seems we use no GNOME deprecated stuff, as AFAIR compiling with GNOME_DISABLE_DEPRECATED works. The deprecated stuff I saw was the use of GtkOptionMenu scattered around, but I couldn't compile the remaining files without correcting that error. But don't worry, Ekiga is not the only one : http://liberforce.over-blog.org/article-10053850.html
Ok, thanks :-)
Here is a list of the deprecated GTK symbols still in use in ekiga: lib/gui/gmpreferences.c: option_menu = gtk_option_menu_new (); lib/gui/gmpreferences.c: gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); lib/gui/gmpreferences.c: gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), lib/gui/gmpreferences.c: option_menu = gtk_option_menu_new (); lib/gui/gmpreferences.c: gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); lib/gui/gmpreferences.c: gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), lib/gui/gmpreferences.c: gtk_option_menu_remove_menu (GTK_OPTION_MENU (option_menu)); lib/gui/gmpreferences.c: gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); lib/gui/gmpreferences.c: gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), history); lib/gui/gmlevelmeter.c: lm = gtk_type_new (gtk_levelmeter_get_type ()); lib/gui/gmstatusbar.c: gtk_timeout_add (15000, gm_statusbar_clear_msg_cb, lib/gui/gmconfwidgets.c: if (current_value != gtk_option_menu_get_history (GTK_OPTION_MENU (e))) lib/gui/gmconfwidgets.c: gtk_option_menu_set_history (GTK_OPTION_MENU (e), current_value); lib/gui/gmconfwidgets.c: if (gtk_option_menu_get_history (GTK_OPTION_MENU (data)) != cpt) lib/gui/gmconfwidgets.c: gtk_option_menu_set_history (GTK_OPTION_MENU (data), cpt); src/gui/addressbook.cpp: gtk_object_sink (GTK_OBJECT (menu)); src/gui/addressbook.cpp: gtk_object_sink (GTK_OBJECT (menu)); src/gui/callshistory.cpp: gtk_object_sink (GTK_OBJECT (menu)); src/gui/druid.cpp: * BEHAVIOR : Updates the given GtkOptionMenu with the given array and These symbols should be changed lik this: gtk_timeout_add -> g_timeout_add gtk_object_sink -> g_object_ref_sink gtk_type_new -> ? gtk_option_menu_* -> gtk_combo_box_* I can't submit a patch for this, as I currently can't build ekiga (pwlib version bump breaks the build).
gtk_type_new (something) -> g_object_new (something, NULL) ?
Anything new about that bug?
No sorry, I'm quite busy at the moment with non-GNOME related stuff... Hope to hack on this soon again, and try to transform it into a GNOME Goal...
Here is the list of deprecated GTK 2.12.1 symbols used in svn trunk: [liberforce@donald ekiga]$ egrep -n -R -f ~/gtk-deprecated-symbols.txt --include="*.c" * lib/gui/gmpreferences.c:60: GtkTooltips *tips; lib/gui/gmpreferences.c:191: gtk_tooltips_set_tip (gpw->tips, entry, tooltip, NULL); lib/gui/gmpreferences.c:233: gtk_tooltips_set_tip (gpw->tips, toggle, tooltip, NULL); lib/gui/gmpreferences.c:310: gtk_tooltips_set_tip (gpw->tips, hscale, tooltip, NULL); lib/gui/gmpreferences.c:406: gtk_tooltips_set_tip (gpw->tips, spin_button, tooltip, NULL); lib/gui/gmpreferences.c:498: gtk_tooltips_set_tip (gpw->tips, spin_button1, spin1_tooltip, NULL); lib/gui/gmpreferences.c:499: gtk_tooltips_set_tip (gpw->tips, spin_button2, spin2_tooltip, NULL); lib/gui/gmpreferences.c:555: option_menu = gtk_option_menu_new (); lib/gui/gmpreferences.c:569: gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); lib/gui/gmpreferences.c:570: gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), lib/gui/gmpreferences.c:580: gtk_tooltips_set_tip (gpw->tips, option_menu, tooltip, NULL); lib/gui/gmpreferences.c:677: gtk_tooltips_set_tip (gpw->tips, option_menu, tooltip, NULL); lib/gui/gmpreferences.c:872: gpw->tips = gtk_tooltips_new (); lib/gui/gmgroupseditor.c:1204: gtk_object_sink ((gpointer) popup_menu); lib/gui/gmlevelmeter.c:152: lm = gtk_type_new (gtk_levelmeter_get_type ()); lib/gui/gmstatusbar.c:130: gtk_timeout_add (15000, gm_statusbar_clear_msg_cb, lib/gui/gmconfwidgets.c:311: if (current_value != gtk_option_menu_get_history (GTK_OPTION_MENU (e))) lib/gui/gmconfwidgets.c:312: gtk_option_menu_set_history (GTK_OPTION_MENU (e), current_value);
Oh, BTW, the GNOME Goal for this kind of stuff is http://live.gnome.org/GnomeGoals/RemoveDeprecatedSymbols/Glib Feel free to add comments to it if you wish, even if currently ekiga is free of Glib deprecated symbols.
I got rid of the easy targets : gtk_object_sink, gtk_type_new and gtk_timeout_add.
gasp, was working on that at the same time :(
Oups, sorry... notice I didn't touch the rest, so it should be at most 3 chunks :-(
no problem ;-) but notice that my solution for gtk_timeout_add is slightly different, as g_timeout_add_seconds is prefered nowadays: if (flash_message) - g_timeout_add (15000, gm_statusbar_clear_msg_cb, - GINT_TO_POINTER (msg_id)); + { +#if GTK_CHECK_VERSION(2, 14, 0) + g_timeout_add_seconds (15, gm_statusbar_clear_msg_cb, + GINT_TO_POINTER (msg_id)); +#else + g_timeout_add (15000, gm_statusbar_clear_msg_cb, + GINT_TO_POINTER (msg_id)); +#endif + }
I've got some troubles to test ekiga... when I run it, It segfaults: (process:18484): GLib-GObject-CRITICAL **: gtype.c:2242: initialization assertion failed, use IA__g_type_init() prior to this function (process:18484): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed (process:18484): GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed
hum... the error kinda disapeared, but I still have one with audio device... gonna sort that out
What is the minimal gtk+ version we accept? I don't like #ifdef'd code that much :-/ And I think we have a bug : we set a timer to clear the flash bar in 15s... what happens if : time: we display a message time+14.999s: we display another, very important message time+15s: we clear the status bar ?
configure.ac: PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10.0) configure.ac: PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.8.0 gmodule-2.0 gobject-2.0 gthread-2.0) Ekiga requires GTK 2.10 and Glib 2.8 at least, but g_timeout_add and g_timeout_add_seconds are part of Glib, not GTK. g_timeout_add_second is fairly new (introduced with Glib 2.14), but is the way to go now. I think that special casing it makes sense, since we shouldn't require glib 2.14 just for that. Once the glib requirements get bumped, this kind of code can be cleaned. Moreover, it's easy to find as every section will call GTK_CHECK_VERSION, and ekiga's current requirements are easy to find. Oops, now that you tell me, there's a bug in my code: I should have uses GLIB_CHECK_VERSION and not GTK_CHECK_VERSION... For the bug you mention... well, I really don't know, as I just focused on the symbols.
Well, then lets keep the #ifdef... I'll just report the new problem I found as a bug.
Created attachment 99308 [details] [review] First patch to eliminate a bunch of them Here I don't really know how to replace the behavior of the "deactivate" signal that was used. It's #if 0'ed for now. Any idea ?
Well, it seems that my patch was modified and commited, while it was just a first draft... It's not rant, but, could you please inform me when this happens ? Otherwise I'm stuck waiting for some answer, or a review of that patch, instead of going foward with development...
Here's the remaining stuff I'll work on: [liberforce@donald ekiga]$ egrep -n -R -f ~/gtk-2.12.1-deprecated-symbols.txt --include="*.c" --include="*.cpp" * lib/engine/gui/gtk-frontend/addressbook-window.cpp:348: gtk_menu_item_remove_submenu (GTK_MENU_ITEM (self->priv->menu_item_view)); lib/engine/gui/gtk-frontend/addressbook-window.cpp:459: gtk_menu_item_remove_submenu (GTK_MENU_ITEM (self->priv->menu_item_view)); lib/gui/gmpreferences.c:60: GtkTooltips *tips; lib/gui/gmpreferences.c:191: gtk_tooltips_set_tip (gpw->tips, entry, tooltip, NULL); lib/gui/gmpreferences.c:233: gtk_tooltips_set_tip (gpw->tips, toggle, tooltip, NULL); lib/gui/gmpreferences.c:310: gtk_tooltips_set_tip (gpw->tips, hscale, tooltip, NULL); lib/gui/gmpreferences.c:406: gtk_tooltips_set_tip (gpw->tips, spin_button, tooltip, NULL); lib/gui/gmpreferences.c:498: gtk_tooltips_set_tip (gpw->tips, spin_button1, spin1_tooltip, NULL); lib/gui/gmpreferences.c:499: gtk_tooltips_set_tip (gpw->tips, spin_button2, spin2_tooltip, NULL); lib/gui/gmpreferences.c:590: gtk_tooltips_set_tip (gpw->tips, combo_box, tooltip, NULL); lib/gui/gmpreferences.c:695: gtk_tooltips_set_tip (gpw->tips, option_menu, tooltip, NULL); lib/gui/gmpreferences.c:890: gpw->tips = gtk_tooltips_new (); src/gui/main.cpp:115: GtkTooltips *tips; src/gui/main.cpp:853: gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), src/gui/main.cpp:876: gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), src/gui/main.cpp:1029: gtk_tooltips_set_tip (mw->tips, GTK_WIDGET (mw->connect_button), src/gui/main.cpp:1484: gtk_tooltips_set_tip (mw->tips, hscale_brightness, src/gui/main.cpp:1506: gtk_tooltips_set_tip (mw->tips, hscale_whiteness, src/gui/main.cpp:1528: gtk_tooltips_set_tip (mw->tips, hscale_colour, src/gui/main.cpp:1550: gtk_tooltips_set_tip (mw->tips, hscale_contrast, src/gui/main.cpp:1798: gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips, src/gui/main.cpp:1821: gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips, src/gui/main.cpp:1842: gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips, src/gui/main.cpp:1863: gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (item), mw->tips, src/gui/main.cpp:1958: gtk_tooltips_set_tip (mw->tips, mw->statusbar_ebox, src/gui/main.cpp:2484: gtk_tooltips_set_tip (mw->tips, GTK_WIDGET (e), tip_text, NULL); src/gui/main.cpp:3663: mw->tips = gtk_tooltips_new (); src/gui/main.cpp:4078: gtk_tooltips_set_tip (mw->tips, GTK_WIDGET (mw->statusbar_ebox), src/gui/druid.cpp:159: * BEHAVIOR : Updates the given GtkOptionMenu with the given array and
The GtkTooltip interface was added with GTK 2.12, which was released 2007, 14 September. Does the code needs to be #if'ed, or may we safely bump the GTK requirements to 2.12 ? The patch is cooked as if we could bump to 2.12. I we can't, you'll have to wait and apply it when Ekiga will bump to 2.12.
Created attachment 100078 [details] [review] Last ride to get rid of GtkTooltips Could someone please give a look on this and tell me if it's commited or not ? Thanks.
Oooohh... gtk_menu_item_remove_submenu is deprecated in 2.12 !? Your patch looks good ; I'll let Damien decide if we chase 2.12 already... that probably depends on how easy it is to get gtk+ 2.12 on win32 too.
GTK 2.12.3 binaries for Windows are available... http://ftp.acc.umu.se/pub/gnome/binaries/win32/gtk+/2.12/
My error was to check the deprecated stuff against 2.12 instead of 2.10, which is still a recent version. Damien, can you set the delay between a new GTK release and the time ekiga should use the stuff of that GTK release ? 6 months ? One year ? Another GTK release ? If you want to stick to 2.10, I can split the patch to have the remaining stuff about option menus fixed (that was mostly ekiga functions naming and comments issues). The other patch would be for the GtkTooltips->GtkTooltip migration only, which is the part that requires GTK 2.12, and could be applied later.
Created attachment 100596 [details] [review] Patch to comply to GTK 2.10 This fixes the GTK 2.10 compliance.
Th ebove patch fixes the final stuff for GTK 2.10 compliance. I will open a separate bug for GTK 2.12 compliance, so we can close this one. This patch is a subset of the previous one, so as snark reviewed it, please commit it.
marking as reviewed as it's a independant subset of the last patch, wich was reviewed by snark.
Ok, committed. I let you close :-)
Yeah, thanks very much :-) Hope to improve my score ;-)