annotate src/compat.c @ 1776:f0e9f2dcfe8a

Editors: disable Delete button if a .desktop file is not writeable and disable Edit button when no entry is selected.
author zas_
date Fri, 04 Dec 2009 20:40:02 +0000
parents ee2b66a09a03
children 956aab097ea7
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
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1055
diff changeset
3 * Copyright (C) 2008 - 2009 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
6ca2c5fd7b13 Whitespaces cleanup.
zas_
parents: 475
diff changeset
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
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
38
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
39 #if !GLIB_CHECK_VERSION(2, 14, 0)
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
40 static void hash_table_add(gpointer key, gpointer value, gpointer user_data)
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
41 {
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
42 GList **list = user_data;
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
43 *list = g_list_prepend(*list, key);
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
44 }
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
45 #endif
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
46
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
47 GList* hash_table_get_keys(GHashTable *hash_table)
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
48 {
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
49 #if GLIB_CHECK_VERSION(2, 14, 0)
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
50 return g_hash_table_get_keys(hash_table);
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
51 #else
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
52 GList *list = NULL;
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
53 g_hash_table_foreach(hash_table, hash_table_add, &list);
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
54 return list;
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
55 #endif
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
56 }
ee2b66a09a03 compilation fixes for older glib and gtk
nadvornik
parents: 1284
diff changeset
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: */