# HG changeset patch # User zas_ # Date 1208733455 0 # Node ID 5e9c24d3b3a85f240d2a865543ab601052a179d1 # Parent 12ba8fce8976263036b4d4f3cfe9cae6be7f2a8a Add a replacement for gtk_radio_action_set_current_value() which require GTK+ >= 2.10. Two new files were added, compat.h and compat.c. diff -r 12ba8fce8976 -r 5e9c24d3b3a8 src/Makefile.am --- a/src/Makefile.am Sun Apr 20 22:51:53 2008 +0000 +++ b/src/Makefile.am Sun Apr 20 23:17:35 2008 +0000 @@ -89,6 +89,8 @@ collect-table.h \ color-man.c \ color-man.h \ + compat.c \ + compat.h \ dnd.c \ dnd.h \ dupe.c \ diff -r 12ba8fce8976 -r 5e9c24d3b3a8 src/compat.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/compat.c Sun Apr 20 23:17:35 2008 +0000 @@ -0,0 +1,36 @@ +/* + * Geeqie + * + * Authors: Vladimir Nadvornik / Laurent Monin + * + * This software is released under the GNU General Public License (GNU GPL). + * Please read the included file COPYING for more information. + * This software comes with no warranty of any kind, use at your own risk! + */ + +#include "main.h" +#include "compat.h" + +/* gtk_radio_action_set_current_value() replacement for GTK+ < 2.10 */ +void radio_action_set_current_value(GtkRadioAction *action, gint current_value) +{ +#if GTK_CHECK_VERSION(2, 10, 0) + gtk_radio_action_set_current_value(action, current_value); +#else + GSList *group; + gint value; + + group = gtk_radio_action_get_group(action); + while (group) + { + action = GTK_RADIO_ACTION(group->data); + g_object_get(G_OBJECT(action), "value", &value, NULL); + if (value == current_value) + { + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE); + return; + } + group = g_slist_next(group); + } +#endif +} diff -r 12ba8fce8976 -r 5e9c24d3b3a8 src/compat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/compat.h Sun Apr 20 23:17:35 2008 +0000 @@ -0,0 +1,17 @@ +/* + * Geeqie + * + * Authors: Vladimir Nadvornik / Laurent Monin + * + * + * This software is released under the GNU General Public License (GNU GPL). + * Please read the included file COPYING for more information. + * This software comes with no warranty of any kind, use at your own risk! + */ + +#ifndef COMPAT_H +#define COMPAT_H + +void radio_action_set_current_value(GtkRadioAction *action, gint current_value); + +#endif /* COMPAT_H */ diff -r 12ba8fce8976 -r 5e9c24d3b3a8 src/layout_util.c --- a/src/layout_util.c Sun Apr 20 22:51:53 2008 +0000 +++ b/src/layout_util.c Sun Apr 20 23:17:35 2008 +0000 @@ -19,6 +19,7 @@ #include "cache_maint.h" #include "collect.h" #include "collect-dlg.h" +#include "compat.h" #include "dupe.h" #include "editors.h" #include "filelist.h" @@ -1551,7 +1552,7 @@ if (!lw->action_group) return; action = gtk_action_group_get_action(lw->action_group, "FolderTree"); - gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->dir_view_type); + radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->dir_view_type); action = gtk_action_group_get_action(lw->action_group, "ViewIcons"); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->icon_view);