annotate src/compat.c @ 457:5e9c24d3b3a8

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.
author zas_
date Sun, 20 Apr 2008 23:17:35 +0000
parents
children 48c8e49b571c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
457
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
1 /*
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
2 * Geeqie
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
3 *
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
4 * Authors: Vladimir Nadvornik / Laurent Monin
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
5 *
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
6 * This software is released under the GNU General Public License (GNU GPL).
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
7 * Please read the included file COPYING for more information.
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
8 * This software comes with no warranty of any kind, use at your own risk!
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
9 */
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
10
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
11 #include "main.h"
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
12 #include "compat.h"
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
13
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
14 /* gtk_radio_action_set_current_value() replacement for GTK+ < 2.10 */
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
15 void radio_action_set_current_value(GtkRadioAction *action, gint current_value)
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
16 {
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
17 #if GTK_CHECK_VERSION(2, 10, 0)
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
18 gtk_radio_action_set_current_value(action, current_value);
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
19 #else
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
20 GSList *group;
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
21 gint value;
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
22
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
23 group = gtk_radio_action_get_group(action);
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
24 while (group)
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
25 {
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
26 action = GTK_RADIO_ACTION(group->data);
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
27 g_object_get(G_OBJECT(action), "value", &value, NULL);
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
28 if (value == current_value)
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
29 {
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
30 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
31 return;
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
32 }
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
33 group = g_slist_next(group);
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
34 }
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
35 #endif
5e9c24d3b3a8 Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff changeset
36 }