Deprecated code

Fixing deprecated code

If you want to fix a deprecation, fill out an issue on github explaining why.



DEPRECATED; use above status page

Module Status
libmate Done (1/11/12)
libmatecanvas Deprecated
libmatecomponent Deprecated
libmatecomponentui Deprecated
libmatekbd Not Started
libmatekeyring Done (1/11/12)
libmatenotify Done (1/11/12)
libmateui Deprecated
libmateweather Not Started
mate-applets Not Started
mate-calc Not Started
mate-conf Done (1/11/12)
mate-control-center Not Started
mate-corba Done (1/11/12)
mate-desktop Not Started
mate-dialogs Deprecated
mate-display-manager Not Started
mate-document-viewer Not Started
engrampa Not Started
caja Not Started
eom Not Started
mate-keyring Done (1/11/12)
mate-menus Done (1/11/12)
mate-notification-daemon Not Started
mate-panel Not Started
mate-polkit Not Started
mate-power-manager Not Started
mate-screensaver Not Started
mate-sensors-applet Not Started
mate-session-manager Done (2012/11/14)
mate-settings-daemon Not Started
mate-system-monitor Not Started
mate-system-tools Deprecated
mate-terminal Not Started
pluma Not Started
mate-vfs Deprecated
mate-window-manager Done (2012/11/20) SB

How to guide

When you find obsolete code, functions, variable names, constants, etc., you should look at the documentation to find the version in which the code became deprecated.


We want to support backwards compatibility.

Getting started

Say we have this obsolete constant, GTK_CHECK_CAST, and we need to change it to G_TYPE_CHECK_INSTANT_CAST. Since the documentation does not state the version in which the code became deprecated, we can simply change GTK_CHECK_CAST to G_TYPE_CHECK_INSTANT_CAST.

On other hand, say we have this obsolete function, g_format_size_for_display, and we want to change it to g_format_size. Since the documentation states that the code has been marked deprecated since version 2.30, we must be careful.

To support backwards compatibility, we cannot use the solution to the first example. In this case we must do something like the following:

#if GLIB_CHECK_VERSION (2, 30, 0) // greater than or equal to version 2.30
    return g_format_size(size);
#else  // less than version 2.30
    return g_format_size_for_display(size);

Now we can support both new and old versions of glib.

This is ugly!

Yes, the solution is quite ugly and not very elegant, but it helps keep track of changes in libraries and allows us to cater to a larger audience.

How to get a list of obsolete code

The following should be included at compile time, or using



Also see GNOME: Remove deprecated GTK+ symbols

Alternatively, if you would like to get a list of deprecated symbols without having to compile, you can use the following command:

egrep -wnr --include=*.[ch] -f ~/file-of-deprecated-symbols.txt path/to/src

Which means: Do an extended regexp search (egrep), search recursively (-r) in path/to/src (or the current directory if path ommitted), narrow the search only to files ending in '.c' or '.h' (–include=*.[ch]), using each line in the file specified as argument to '-f' as a search pattern, match whole-words only (-w), and prefix output matches with line number (-n).

The .txt files with lists of deprecated symbols can be found here.

deprecated_code.txt · Last modified: 2014/05/11 21:51 by infirit
Recent changes RSS feed Driven by DokuWiki
Hosted by First Colo