Mercurial > geeqie
annotate src/compat.c @ 1811:f405ec9b696b default tip
Some small logic mistakes
Use boolean operators for booleans and bitwise otherwise only.
| author | mow |
|---|---|
| date | Mon, 10 May 2010 11:33:13 +0000 |
| parents | 956aab097ea7 |
| children |
| 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 |
| 1802 | 3 * Copyright (C) 2008 - 2010 The Geeqie Team |
|
457
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
4 * |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
5 * Authors: Vladimir Nadvornik / Laurent Monin |
| 995 | 6 * |
|
457
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
7 * 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
|
8 * 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
|
9 * 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
|
10 */ |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
11 |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
12 #include "main.h" |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
13 #include "compat.h" |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
14 |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
15 /* 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
|
16 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
|
17 { |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
18 #if GTK_CHECK_VERSION(2, 10, 0) |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
19 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
|
20 #else |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
21 GSList *group; |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
22 gint value; |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
23 |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
24 group = gtk_radio_action_get_group(action); |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
25 while (group) |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
26 { |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
27 action = GTK_RADIO_ACTION(group->data); |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
28 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
|
29 if (value == current_value) |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
30 { |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
31 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
|
32 return; |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
33 } |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
34 group = g_slist_next(group); |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
35 } |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
36 #endif |
|
5e9c24d3b3a8
Add a replacement for gtk_radio_action_set_current_value() which
zas_
parents:
diff
changeset
|
37 } |
| 1574 | 38 |
| 39 #if !GLIB_CHECK_VERSION(2, 14, 0) | |
| 40 static void hash_table_add(gpointer key, gpointer value, gpointer user_data) | |
| 41 { | |
| 42 GList **list = user_data; | |
| 43 *list = g_list_prepend(*list, key); | |
| 44 } | |
| 45 #endif | |
| 46 | |
| 47 GList* hash_table_get_keys(GHashTable *hash_table) | |
| 48 { | |
| 49 #if GLIB_CHECK_VERSION(2, 14, 0) | |
| 50 return g_hash_table_get_keys(hash_table); | |
| 51 #else | |
| 52 GList *list = NULL; | |
| 53 g_hash_table_foreach(hash_table, hash_table_add, &list); | |
| 54 return list; | |
| 55 #endif | |
| 56 } | |
| 57 | |
|
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
995
diff
changeset
|
58 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |
