If you want to fix a deprecation, fill out an issue on github explaining why.
|mate-window-manager||Done (2012/11/20) SB|
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.
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); #endif
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 autogen.sh:
-DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES
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.
#if GTK_CHECK_VERSION (3, 0, 0) #define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) #define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) #endif