GNOME Bugzilla – Bug 575017
Remove deprecated GTK+ symbols
Last modified: 2011-07-05 17:38:08 UTC
http://live.gnome.org/GnomeGoals/RemoveDeprecatedSymbols/GTK%2B GTK3 (March 2010) will not ship deprecated symbols anymore, and gthumb uses a lot of them. Potential patch contributors see http://library.gnome.org . GTK_CHECK_CAST, GTK_CHECK_CLASS_CAST, GTK_CHECK_CLASS_TYPE, GTK_CHECK_GET_CLASS, GTK_CHECK_TYPE, GtkType, gdk_pango_context_set_colormap, gdk_pixbuf_render_to_drawable, gdk_pixbuf_render_to_drawable_alpha, gtk_action_connect_proxy, gtk_menu_insert, gtk_menu_tool_button_set_arrow_tooltip, gtk_object_sink, gtk_option_menu_get_history, gtk_option_menu_get_menu, gtk_option_menu_new, gtk_option_menu_remove_menu, gtk_option_menu_set_history, gtk_option_menu_set_menu, gtk_tool_item_set_tooltip, gtk_tooltips_disable, gtk_tooltips_enable, gtk_tooltips_new, gtk_tooltips_set_tip, gtk_widget_get_action
I’m going to give it a try.
(In reply to comment #1) > I’m going to give it a try. > Hey buddy, I was planning to work on this thing too, hehe, and I have checked this page some minutes before you comment. I have already removed 12 deprecated symbols from gthumb. I'm working on option menu, but I think it is going to be a bit hard once there are soooo many places using it. Here goes the update list of deprecated symbols. gtk_option_menu_get_history, gtk_option_menu_get_menu, gtk_option_menu_new, gtk_option_menu_remove_menu, gtk_option_menu_set_history, gtk_option_menu_set_menu, gtk_tool_item_set_tooltip, gtk_tooltips_disable, gtk_tooltips_enable, gtk_tooltips_new, gtk_tooltips_set_tip, gtk_widget_get_action I'm going to publish a set of small patches with the fixes, but you can also fetch the `removing-deprecated-symbols' branch from the following git: git clone git://labs.alfaiati.net/lincoln/gthumb
Created attachment 133784 [details] [review] Removing gdk_pango_context_set_colormap.
Created attachment 133785 [details] [review] Removing deprecated GTK_TYPE macros in favor of G_TYPE.
Created attachment 133786 [details] [review] Removing gdk_pixbuf_render_to_drawable{_alpha,}
Created attachment 133787 [details] [review] Removing more references of gdk_pixbuf_render_to_drawable{_alpha,}
Created attachment 133788 [details] [review] Time to gtk_action_connect_proxy die
Created attachment 133789 [details] [review] Removing deprecated symbol gtk_menu_insert.
Created attachment 133790 [details] [review] Removing gtk_menu_tool_button_set_arrow_tooltip
Created attachment 133791 [details] [review] Replacing gtk_object_sink by g_object_ref_sink.
Thanks, Linkoln. I don’t have access to the web during week-ends, neither the time. That’s why I won’t hinder you. Please keep in mind the following issues: 1. Dependent libgnomeui, libgnomecanvas (probably others) must be fixed as well. 2. Some option menues contain separator, so getting active indexes must be shifted (if were 'history + 2' must be 'idx + 1') 3. Some menue items are changed their sensitivity. How to do that for combo box strings? Sorry, if those questions are obvious to you, because I’m very new to Gtk.
(In reply to comment #11) > Thanks, Linkoln. I don’t have access to the web during week-ends, neither the > time. That’s why I won’t hinder you. Hehe, ok. > Please keep in mind the following issues: > 1. Dependent libgnomeui, libgnomecanvas (probably others) must be fixed as > well. Yep, if it does not exist, we should file a new bug report about it. > 2. Some option menues contain separator, so getting active indexes must be > shifted (if were 'history + 2' must be 'idx + 1') > 3. Some menue items are changed their sensitivity. How to do that for combo box > strings? > Sorry, if those questions are obvious to you, because I’m very new to Gtk. I understood your questions, but I think we'll need to change the way that it works today. I think it is not possible (or at least too hard) to change sensitivity of a combobox option, so we can just hide it. And I think stop using separators can make our life easier =D. But this is my point of view. I think we should wait for the opinion of a gthumb developer. I'll poke Michael Chudobiak and ask him his opinion about this.
Created attachment 133846 [details] [review] removing tooltips deprecated stuff
Now the last deprecated symbols are about GtkOptionMenu. I'll look for cases that GtkOptionMenu can be replaced by GtkComboBox without dealing with separators and sensitivity.
Created attachment 133848 [details] [review] Remove GtkOptionMenu from dlg-save-image This patch (already proposed in bug 581128 replaces GtkOptionMenu by GtkComboBox in dlg-save-image.c. Marc
(In reply to comment #15) > Created an attachment (id=133848) [edit] > Remove GtkOptionMenu > > This patch (already proposed in bug 581128 replaces GtkOptionMenu by > GtkComboBox in dlg-save-image.c. Very nice =) Right now I'm removing GtkOptionMenu from dlg-preferences.c. So, if you are going to work on this issue, I recommend to go look at another file.
Created attachment 133850 [details] [review] Removing GtkOptionMenu from dlg-preferences.c
Created attachment 134372 [details] [review] Removing GtkOptionMenu from dlg-search.c (and glade)
gtk_activatable_set_related_action has only been available since 2.16. Fedora 10 only has 2.14. We can't use that yet. - Mike
Marc, does attachment 133791 [details] [review] look right to you? Do both g_object_ref and g_object_ref_sink need to be called? - Mike
Thanks for the patches! Everything has been committed, except for the gtk_activatable_set_related_action stuff (too new), and the g_object_ref_sink stuff (needs to be checked). - Mike
Hi Mike, No we should probably not call both methods. I will send you a patch which fixes this issue and other issues (for example in gth-image-selector, hadj and vadj are never freed). Marc
Created attachment 135520 [details] [review] Remove gtk_object_sink This patch replace call to gtk_object_sink by g_object_ref_sink with no extra g_object_ref. It also free priv->hadj and priv->vadj in gth-image-selector and remove a method that is never called (set_scroll_adjustments) Marc
Created attachment 135521 [details] [review] Improve tag search This patch improves tag search that is a little broken since removal of g_strcasecmp. The main problem is with accentuated characters that are not well handled. The patch simply remove call to gtk_tree_view_set_search_equal_func as default implementation works well. Marc
I thought g_utf8_casefold + g_utf8_collate was the correct way to handle keywords. Are those functions broken? Anyway, I guess it doesn't matter if the default sorting works well, but I'm curious anyway. - Mike
Are we done with this bug, or is there more to come? - Mike
(In reply to comment #26) > Are we done with this bug, or is there more to come? > > - Mike > No, we need to purge more references of GtkOptionMenu, like in dlg-{crop,comment,scale-image,image-prop}.c, print-callbacks.c and some other glade files. I'll back to work on these things this weekend.
Michael, you can take a look here: http://www.gnome.org/~fpeters/299.html (the page is automatically updated, every two hours)
Created attachment 135589 [details] [review] Replace GtkTooltips API with the new GtkTooltip API
Created attachment 135590 [details] [review] Replace deprecated gdk_pixbuf_render_to_drawable* functions
Javier, The last patch has warnings: [mjc@adama gthumb]$ make > eraseme nav-window.c: In function ‘nav_window_expose’: nav-window.c:208: warning: type defaults to ‘int’ in declaration of ‘type name’ nav-window.c:214: warning: passing argument 3 of ‘gdk_draw_pixbuf’ from incompatible pointer type - Mike
Created attachment 135643 [details] [review] Replace deprecated gdk_pixbuf_render_to_drawable* functions Sorry, hope that the patch is good now.
Created attachment 135644 [details] [review] Replace gtk_action_connect_proxy function I've used the #if GTK_CHECK_VERSION(2,16,0) macro so is not needed bump to new gtk+ version
Created attachment 135645 [details] [review] Replace gtk_action_connect_proxy function Sorry, this is the correct patch
Created attachment 135647 [details] [review] Replace gtk_widget_get_action I've used the #if GTK_CHECK_VERSION(2,16,0) macro so is not needed bump to new gtk+ version
Committed, thanks! - Mike
Is this bug fixed in the ext branch?
still not fixed
Created attachment 142583 [details] [review] removed deprecated symbols (this is just a test, please ignore)
Comment on attachment 142583 [details] [review] removed deprecated symbols (this is just a test, please ignore) this is just a test, please ignore
sorry for mess with the attachments above, anyway this now fixed in the ext branch.
Reopening: $:andre\> grep -r GTK_WIDGET_STATE . ./gthumb/gth-empty-list.c: widget->style->text_gc[GTK_WIDGET_STATE (widget)], ./gthumb/gth-empty-list.c: GTK_WIDGET_STATE (widget), ./gthumb/gth-histogram-view.c: gdk_cairo_set_source_color (cr, &widget->style->dark[GTK_WIDGET_STATE (widget)]); ./gthumb/gth-histogram-view.c: gdk_cairo_set_source_color (cr, &widget->style->base[GTK_WIDGET_STATE (widget)]); ./extensions/gstreamer_tools/gth-media-viewer-page.c: self->priv->has_video ? widget->style->black_gc : widget->style->text_gc[GTK_WIDGET_STATE (widget)], ./extensions/gstreamer_tools/gth-media-viewer-page.c: widget->style->base_gc[GTK_WIDGET_STATE (widget)], ./extensions/gstreamer_tools/gth-media-viewer-page.c: widget->style->base_gc[GTK_WIDGET_STATE (widget)], $:andre\> grep -r GTK_WIDGET_TOPLEVEL . ./gthumb/gth-tags-entry.c: if (! GTK_WIDGET_TOPLEVEL (toplevel)) ./gthumb/gth-file-tool.c: if (! GTK_WIDGET_TOPLEVEL (self->priv->window)) ./gthumb/gtk-utils.c: if (! GTK_WIDGET_TOPLEVEL (w)) ./gthumb/gtk-utils.c: if (! GTK_WIDGET_TOPLEVEL (top_level)) ./gthumb/eggfileformatchooser.c: if (!GTK_WIDGET_TOPLEVEL (toplevel))
This seems to have been fixed: bobbo@tiger:~/Code/gthumb/gthumb$ grep -r GTK_WIDGET_STATE . bobbo@tiger:~/Code/gthumb/gthumb$ grep -r GTK_WIDGET_TOPLEVEL . ./eggfileformatchooser.c: if (!GTK_WIDGET_TOPLEVEL (toplevel)) The GTK_WIDGET_TOPLEVEL call in eggfileformatchooser.c is if-guarded: /* Returns a toplevel GtkWindow, or NULL if none */ static GtkWindow * get_toplevel (GtkWidget *widget) { GtkWidget *toplevel; toplevel = gtk_widget_get_toplevel (widget); #if GTK_CHECK_VERSION (2,18,0) if (!gtk_widget_is_toplevel (toplevel)) #else if (!GTK_WIDGET_TOPLEVEL (toplevel)) #endif return NULL; else return GTK_WINDOW (toplevel); }
the current development version doesn't use any deprecated symbol of Gtk+ 2.24 (which is the minimum required version).