Skip to content

Commit

Permalink
Bump GTK+ version to 2.16
Browse files Browse the repository at this point in the history
  • Loading branch information
codebrainz committed Oct 28, 2011
1 parent c4980f8 commit a23e999
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 63 deletions.
10 changes: 5 additions & 5 deletions HACKING
Expand Up @@ -144,16 +144,16 @@ And then simply apply it like so::

GTK versions & API documentation
--------------------------------
Geany requires GTK >= 2.12 and GLib >= 2.16. API symbols from newer
Geany requires GTK >= 2.16 and GLib >= 2.20. API symbols from newer
GTK/GLib versions should be avoided or made optional to keep the source
code building on older systems.

The official GTK 2.12 API documentation may not be available online
The official GTK 2.16 API documentation may not be available online
anymore, so we put it on http://www.geany.org/manual/gtk/. There
is also a tarball with all available files for download and use with
devhelp.

Using the 2.12 API documentation of the GTK libs (including GLib, GDK
Using the 2.16 API documentation of the GTK libs (including GLib, GDK
and Pango) has the advantages that you don't get confused by any
newer API additions and you don't have to take care about whether
you can use them or not.
Expand All @@ -164,8 +164,8 @@ Coding
them down into smaller static functions where possible. This makes code
much easier to read and maintain.
* Use GLib types and functions - gint not int, g_free() not free().
* Your code should build against GLib 2.16 and GTK 2.12. At least for the
moment, we want to keep the minimum requirement for GTK at 2.12 (of
* Your code should build against GLib 2.20 and GTK 2.16. At least for the
moment, we want to keep the minimum requirement for GTK at 2.16 (of
course, you can use the GTK_CHECK_VERSION macro to protect code using
later versions).
* Variables should be declared before statements. You can use
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -28,7 +28,7 @@ The basic features of Geany are:

Requirements
------------
For compiling Geany yourself, you will need the GTK (>= 2.12.0)
For compiling Geany yourself, you will need the GTK (>= 2.16.0)
libraries and header files. You will also need its dependency libraries
and header files, such as Pango, Glib and ATK. All these files are
available at http://www.gtk.org.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -57,7 +57,7 @@ GEANY_CHECK_REVISION([dnl force debug mode for a SVN working copy


# GTK/GLib/GIO checks
gtk_modules="gtk+-2.0 >= 2.12 glib-2.0 >= 2.16 gio-2.0 >= 2.16"
gtk_modules="gtk+-2.0 >= 2.16 glib-2.0 >= 2.20 gio-2.0 >= 2.20"
PKG_CHECK_MODULES([GTK], [$gtk_modules])
AC_SUBST([GTK_CFLAGS])
AC_SUBST([GTK_LIBS])
Expand Down
6 changes: 3 additions & 3 deletions doc/geany.html
Expand Up @@ -571,7 +571,7 @@ <h2><a class="toc-backref" href="#id11">About this document</a></h2>
<h1><a class="toc-backref" href="#id12">Installation</a></h1>
<div class="section" id="requirements">
<h2><a class="toc-backref" href="#id13">Requirements</a></h2>
<p>You will need the GTK (&gt;= 2.12.0) libraries and their dependencies
<p>You will need the GTK (&gt;= 2.16.0) libraries and their dependencies
(Pango, GLib and ATK). Your distro should provide packages for these,
usually installed by default. For Windows, you can download an installer
from the website which bundles these libraries.</p>
Expand All @@ -584,7 +584,7 @@ <h2><a class="toc-backref" href="#id14">Binary packages</a></h2>
<div class="section" id="source-compilation">
<h2><a class="toc-backref" href="#id15">Source compilation</a></h2>
<p>Compiling Geany is quite easy.
To do so, you need the GTK (&gt;= 2.12.0) libraries and header files.
To do so, you need the GTK (&gt;= 2.16.0) libraries and header files.
You also need the Pango, GLib and ATK libraries and header files.
All these files are available at <a class="reference external" href="http://www.gtk.org">http://www.gtk.org</a>, but very often
your distro will provide development packages to save the trouble of
Expand Down Expand Up @@ -6700,7 +6700,7 @@ <h1><a class="toc-backref" href="#id239">License for Scintilla and SciTE</a></h1
<div class="footer">
<hr class="footer" />
<a class="reference external" href="geany.txt">View document source</a>.
Generated on: 2011-10-23 14:12 UTC.
Generated on: 2011-10-28 17:11 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.

</div>
Expand Down
4 changes: 2 additions & 2 deletions doc/geany.txt
Expand Up @@ -101,7 +101,7 @@ Installation
Requirements
------------

You will need the GTK (>= 2.12.0) libraries and their dependencies
You will need the GTK (>= 2.16.0) libraries and their dependencies
(Pango, GLib and ATK). Your distro should provide packages for these,
usually installed by default. For Windows, you can download an installer
from the website which bundles these libraries.
Expand All @@ -118,7 +118,7 @@ Source compilation
------------------

Compiling Geany is quite easy.
To do so, you need the GTK (>= 2.12.0) libraries and header files.
To do so, you need the GTK (>= 2.16.0) libraries and header files.
You also need the Pango, GLib and ATK libraries and header files.
All these files are available at http://www.gtk.org, but very often
your distro will provide development packages to save the trouble of
Expand Down
2 changes: 1 addition & 1 deletion geany.pc.in
Expand Up @@ -8,7 +8,7 @@ localedir=@localedir@

Name: Geany
Description: A fast and lightweight IDE using GTK2
Requires: gtk+-2.0 >= 2.12.0
Requires: gtk+-2.0 >= 2.16.0
Version: @VERSION@
Libs: -L${libdir}
Cflags: -DGTK -I${includedir}/geany -I${includedir}/geany/tagmanager -I${includedir}/geany/scintilla
18 changes: 3 additions & 15 deletions plugins/filebrowser.c
Expand Up @@ -886,16 +886,6 @@ static GtkWidget *make_toolbar(void)
g_signal_connect(wid, "clicked", G_CALLBACK(on_current_path), NULL);
gtk_container_add(GTK_CONTAINER(toolbar), wid);

if (gtk_check_version(2, 15, 2) != NULL)
{
wid = GTK_WIDGET(gtk_separator_tool_item_new());
gtk_container_add(GTK_CONTAINER(toolbar), wid);

wid = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR));
gtk_widget_set_tooltip_text(wid, _("Clear the filter"));
g_signal_connect(wid, "clicked", G_CALLBACK(on_clear_filter), NULL);
gtk_container_add(GTK_CONTAINER(toolbar), wid);
}
return toolbar;
}

Expand All @@ -911,11 +901,9 @@ static GtkWidget *make_filterbar(void)
filter_combo = gtk_combo_box_entry_new_text();
filter_entry = gtk_bin_get_child(GTK_BIN(filter_combo));

if (gtk_check_version(2, 15, 2) == NULL)
{
ui_entry_add_clear_icon(GTK_ENTRY(filter_entry));
g_signal_connect(filter_entry, "icon-release", G_CALLBACK(on_filter_clear), NULL);
}
ui_entry_add_clear_icon(GTK_ENTRY(filter_entry));
g_signal_connect(filter_entry, "icon-release", G_CALLBACK(on_filter_clear), NULL);

gtk_widget_set_tooltip_text(filter_entry,
_("Filter your files with the usual wildcards. Separate multiple patterns with a space."));
g_signal_connect(filter_entry, "activate", G_CALLBACK(on_filter_activate), NULL);
Expand Down
2 changes: 0 additions & 2 deletions src/callbacks.c
Expand Up @@ -1428,14 +1428,12 @@ void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer use
interface_prefs.sidebar_symbol_visible = TRUE;
}

#if GTK_CHECK_VERSION(2, 14, 0)
/* if window has input focus, set it back to the editor before toggling off */
if (! ui_prefs.sidebar_visible &&
gtk_container_get_focus_child(GTK_CONTAINER(main_widgets.sidebar_notebook)) != NULL)
{
keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR);
}
#endif

ui_sidebar_show_hide();
}
Expand Down
6 changes: 2 additions & 4 deletions src/dialogs.c
Expand Up @@ -378,8 +378,7 @@ static GtkWidget *create_open_file_dialog(void)
gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window));
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
if (gtk_check_version(2, 14, 0) == NULL)
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE);
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE);

/* add checkboxes and filename entry */
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), add_file_open_extra_widget(dialog));
Expand Down Expand Up @@ -605,8 +604,7 @@ static GtkWidget *create_save_file_dialog(void)
gtk_widget_show_all(vbox);
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), vbox);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
if (gtk_check_version(2, 14, 0) == NULL)
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE);
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE);

/* set the folder by default to the project base dir or the global pref for opening files */
initdir = utils_get_default_dir_utf8();
Expand Down
18 changes: 5 additions & 13 deletions src/ui_utils.c
Expand Up @@ -1117,7 +1117,7 @@ static void add_recent_file(const gchar *utf8_filename, GeanyRecentFiles *grf)
{
if (g_queue_find_custom(grf->recent_queue, utf8_filename, (GCompareFunc) strcmp) == NULL)
{
#if GTK_CHECK_VERSION(2, 10, 0)

if (grf->type == RECENT_FILE_FILE)
{
GtkRecentManager *manager = gtk_recent_manager_get_default();
Expand All @@ -1128,7 +1128,7 @@ static void add_recent_file(const gchar *utf8_filename, GeanyRecentFiles *grf)
g_free(uri);
}
}
#endif

g_queue_push_head(grf->recent_queue, g_strdup(utf8_filename));
if (g_queue_get_length(grf->recent_queue) > file_prefs.mru_length)
{
Expand Down Expand Up @@ -1421,21 +1421,14 @@ static void entry_clear_icon_release_cb(GtkEntry *entry, gint icon_pos,
/** Adds a small clear icon to the right end of the passed @a entry.
* A callback to clear the contents of the GtkEntry is automatically added.
*
* This feature is only available with GTK 2.16 but implemented as a runtime check,
* so it is safe to just use this function, if the code is ran with older versions,
* nothing happens. If ran with GTK 2.16 or newer, the icon is displayed.
*
* @param entry The GtkEntry object to which the icon should be attached.
*
* @since 0.16
*/
void ui_entry_add_clear_icon(GtkEntry *entry)
{
if (gtk_check_version(2, 15, 2) == NULL)
{
g_object_set(entry, "secondary-icon-stock", "gtk-clear", NULL);
g_signal_connect(entry, "icon-release", G_CALLBACK(entry_clear_icon_release_cb), NULL);
}
g_object_set(entry, "secondary-icon-stock", "gtk-clear", NULL);
g_signal_connect(entry, "icon-release", G_CALLBACK(entry_clear_icon_release_cb), NULL);
}


Expand Down Expand Up @@ -2532,7 +2525,6 @@ void ui_editable_insert_text_callback(GtkEditable *editable, gchar *new_text,
GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size)
{
GdkPixbuf *icon = NULL;
#if GTK_CHECK_VERSION(2, 14, 0)
gchar *ctype;
GIcon *gicon;
GtkIconInfo *info;
Expand All @@ -2558,7 +2550,7 @@ GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size)
gtk_icon_info_free(info);
}
}
#endif

/* fallback for builds with GIO < 2.18 or if icon lookup failed, like it might happen on Windows */
if (icon == NULL)
{
Expand Down
26 changes: 12 additions & 14 deletions src/utils.c
Expand Up @@ -1871,23 +1871,21 @@ gboolean utils_is_remote_path(const gchar *path)
return TRUE;

#ifndef G_OS_WIN32
if (glib_check_version(2, 16, 0) == NULL) /* no need to check for this with GLib < 2.16 */
{
static gchar *fuse_path = NULL;
static gsize len = 0;
static gchar *fuse_path = NULL;
static gsize len = 0;

if (G_UNLIKELY(fuse_path == NULL))
{
fuse_path = g_build_filename(g_get_home_dir(), ".gvfs", NULL);
len = strlen(fuse_path);
}
/* Comparing the file path against a hardcoded path is not the most elegant solution
* but for now it is better than nothing. Ideally, g_file_new_for_path() should create
* proper GFile objects for Fuse paths, but it only does in future GVFS
* versions (gvfs 1.1.1). */
return (strncmp(path, fuse_path, len) == 0);
if (G_UNLIKELY(fuse_path == NULL))
{
fuse_path = g_build_filename(g_get_home_dir(), ".gvfs", NULL);
len = strlen(fuse_path);
}
/* Comparing the file path against a hardcoded path is not the most elegant solution
* but for now it is better than nothing. Ideally, g_file_new_for_path() should create
* proper GFile objects for Fuse paths, but it only does in future GVFS
* versions (gvfs 1.1.1). */
return (strncmp(path, fuse_path, len) == 0);
#endif

return FALSE;
}

Expand Down
4 changes: 2 additions & 2 deletions wscript
Expand Up @@ -138,9 +138,9 @@ def configure(conf):
_load_intltool_if_available(conf)

# GTK / GIO version check
conf.check_cfg(package='gtk+-2.0', atleast_version='2.12.0', uselib_store='GTK',
conf.check_cfg(package='gtk+-2.0', atleast_version='2.16.0', uselib_store='GTK',
mandatory=True, args='--cflags --libs')
conf.check_cfg(package='glib-2.0', atleast_version='2.16.0', uselib_store='GLIB',
conf.check_cfg(package='glib-2.0', atleast_version='2.20.0', uselib_store='GLIB',
mandatory=True, args='--cflags --libs')
conf.check_cfg(package='gio-2.0', uselib_store='GIO', args='--cflags --libs', mandatory=True)
gtk_version = conf.check_cfg(modversion='gtk+-2.0', uselib_store='GTK') or 'Unknown'
Expand Down

0 comments on commit a23e999

Please sign in to comment.