Re: How to find replacements for deprecated functions



Hi;

On 30 November 2016 at 09:07, Erik de Castro Lopo <mle+gtk mega-nerd com> wrote:
HI all,

I am an occassional GTK user, and often I work on resurrecting code
bases for which I am not the original author. As such I often run
into reprecation warnings. When I go to the documentation I find
things like this:

    https://developer.gnome.org/gtk3/stable/GtkUIManager.html#gtk-ui-manager-get-widget

    "gtk_ui_manager_get_widget has been deprecated since version
     3.10 and should not be used in newly-written code."

How is someone like me supposed to figure out what to replace that
function with in the code I'm hacking on?

There is no direct replacement for GtkUIManager, in the sense that
there is no API that you can use to immediately replace GtkUIManager.

GtkUIManager has been deprecated for a long time — it was deprecated
in GTK+ 2.x, so it's not really a GTK+ 3.x issue.

Depending on what your application does, and how it's already built, you can:

 * define menus directly using GtkBuilder, but that won't give you
mapping between an "action path" and a GtkMenuItem;
 * define menus using GMenu/GMenuModel, which abstract menus in the
same way GtkUIManager did, but things like placeholders and
merging/unmerging of menu definitions are more complicated
 * write you own GtkMenu structures by hand

This is why it's hard to condense information inside GtkUIManager's
API reference; it depends on your context and expectations.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]