annotate src/layout_config.c @ 219:92d2444893b8

Fix display of image number in properties dialog when more than one image is selected.
author zas_
date Tue, 01 Apr 2008 07:42:31 +0000
parents f6e307c7bad6
children 9995c5fb202a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 9
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 #include "layout_config.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 COLUMN_TEXT = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 COLUMN_KEY
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 typedef struct _LayoutStyle LayoutStyle;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 struct _LayoutStyle
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 LayoutLocation a, b, c;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 typedef struct _LayoutConfig LayoutConfig;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 struct _LayoutConfig
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 GtkWidget *box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 GList *style_widgets;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 GtkWidget *listview;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 gint style;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 gint a, b, c;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 static LayoutStyle layout_config_styles[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 /* 1, 2, 3 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 { LAYOUT_LEFT | LAYOUT_TOP, LAYOUT_LEFT | LAYOUT_BOTTOM, LAYOUT_RIGHT },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 { LAYOUT_LEFT | LAYOUT_TOP, LAYOUT_RIGHT | LAYOUT_TOP, LAYOUT_BOTTOM },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 { LAYOUT_LEFT, LAYOUT_RIGHT | LAYOUT_TOP, LAYOUT_RIGHT | LAYOUT_BOTTOM },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 { LAYOUT_TOP, LAYOUT_LEFT | LAYOUT_BOTTOM, LAYOUT_RIGHT | LAYOUT_BOTTOM }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 static gint layout_config_style_count = sizeof(layout_config_styles) / sizeof (LayoutStyle);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 static gchar *layout_titles[] = { N_("Tools"), N_("Files"), N_("Image") };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 static void layout_config_destroy(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 LayoutConfig * lc = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 g_list_free(lc->style_widgets);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 g_free(lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 static void layout_config_set_order(LayoutLocation l, gint n,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 LayoutLocation *a, LayoutLocation *b, LayoutLocation *c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 switch (n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 case 0:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 *a = l;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 case 1:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 *b = l;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 case 2: default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 *c = l;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 static void layout_config_from_data(gint style, gint oa, gint ob, gint oc,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 LayoutLocation *la, LayoutLocation *lb, LayoutLocation *lc)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 LayoutStyle ls;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 style = CLAMP(style, 0, layout_config_style_count);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 ls = layout_config_styles[style];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 layout_config_set_order(ls.a, oa, la, lb, lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 layout_config_set_order(ls.b, ob, la, lb, lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 layout_config_set_order(ls.c, oc, la, lb, lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 void layout_config_parse(gint style, const gchar *order,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 LayoutLocation *a, LayoutLocation *b, LayoutLocation *c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 gint na, nb, nc;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 layout_config_order_from_text(order, &na, &nb, &nc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 layout_config_from_data(style, na, nb, nc, a, b, c);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 static void layout_config_list_order_set(LayoutConfig *lc, gint src, gint dest)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(lc->listview)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 n = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 if (n == dest)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 gtk_list_store_set(store, &iter, COLUMN_TEXT, _(layout_titles[src]), COLUMN_KEY, src, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 static gint layout_config_list_order_get(LayoutConfig *lc, gint n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 gint c = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 store = gtk_tree_view_get_model(GTK_TREE_VIEW(lc->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 valid = gtk_tree_model_get_iter_first(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 if (c == n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 gint val;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 gtk_tree_model_get(store, &iter, COLUMN_KEY, &val, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 return val;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 c++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 valid = gtk_tree_model_iter_next(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 void layout_config_set(GtkWidget *widget, gint style, const gchar *order)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 LayoutConfig *lc;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 gint a, b, c;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 lc = g_object_get_data(G_OBJECT(widget), "layout_config");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 if (!lc) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 style = CLAMP(style, 0, layout_config_style_count);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 button = g_list_nth_data(lc->style_widgets, style);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 if (!button) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 layout_config_order_from_text(order, &a, &b, &c);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 layout_config_list_order_set(lc, a, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 layout_config_list_order_set(lc, b, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 layout_config_list_order_set(lc, c, 2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 gchar *layout_config_get(GtkWidget *widget, gint *style)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 LayoutConfig *lc;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 lc = g_object_get_data(G_OBJECT(widget), "layout_config");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 /* this should not happen */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 if (!lc) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 *style = lc->style;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 lc->a = layout_config_list_order_get(lc, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 lc->b = layout_config_list_order_get(lc, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 lc->c = layout_config_list_order_get(lc, 2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 return layout_config_order_to_text(lc->a, lc->b, lc->c);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 static void layout_config_widget_click_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 LayoutConfig *lc;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 lc = g_object_get_data(G_OBJECT(widget), "layout_config");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 if (lc) lc->style = GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 static void layout_config_table_button(GtkWidget *table, LayoutLocation l, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 gint x1, y1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 gint x2, y2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 x1 = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 y1 = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 x2 = 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 y2 = 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 if (l & LAYOUT_LEFT) x2 = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 if (l & LAYOUT_RIGHT) x1 = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 if (l & LAYOUT_TOP) y2 = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 if (l & LAYOUT_BOTTOM) y1 = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 button = gtk_button_new_with_label(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 gtk_widget_set_sensitive(button, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 gtk_table_attach_defaults(GTK_TABLE(table), button, x1, x2, y1, y2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 #define LAYOUT_STYLE_SIZE 48
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 static GtkWidget *layout_config_widget(GtkWidget *group, GtkWidget *box, gint style, LayoutConfig *lc)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 LayoutStyle ls;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 ls = layout_config_styles[style];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 if (group)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 group = gtk_radio_button_new(gtk_radio_button_get_group(GTK_RADIO_BUTTON(group)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 group = gtk_radio_button_new(NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 g_object_set_data(G_OBJECT(group), "layout_config", lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 g_signal_connect(G_OBJECT(group), "clicked",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 G_CALLBACK(layout_config_widget_click_cb), GINT_TO_POINTER(style));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 gtk_box_pack_start(GTK_BOX(box), group, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 table = gtk_table_new(2, 2, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 layout_config_table_button(table, ls.a, "1");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 layout_config_table_button(table, ls.b, "2");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 layout_config_table_button(table, ls.c, "3");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 gtk_widget_set_size_request(table, LAYOUT_STYLE_SIZE, LAYOUT_STYLE_SIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 gtk_container_add(GTK_CONTAINER(group), table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 gtk_widget_show(table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 gtk_widget_show(group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 return group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 static void layout_config_row_move(GtkWidget *clist, gint source_row, gint dest_row, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 for (i = 0; i < 3; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 text = g_strdup_printf("%d", i + 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 gtk_clist_set_text(GTK_CLIST(clist), i, 0, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 static void layout_config_number_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 GtkTreeModel *store, GtkTreeIter *iter, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 gint *indices;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 tpath = gtk_tree_model_get_path(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 indices = gtk_tree_path_get_indices(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 buf = g_strdup_printf("%d", indices[0] + 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 g_object_set(G_OBJECT(cell), "text", buf, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 GtkWidget *layout_config_new(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 LayoutConfig *lc;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 GtkWidget *group = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 GtkWidget *scrolled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 lc = g_new0(LayoutConfig, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 lc->box = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 g_object_set_data(G_OBJECT(lc->box), "layout_config", lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 g_signal_connect(G_OBJECT(lc->box), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 G_CALLBACK(layout_config_destroy), lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 hbox = gtk_hbox_new(TRUE, PREF_PAD_SPACE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 gtk_box_pack_start(GTK_BOX(lc->box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 for (i = 0; i < layout_config_style_count; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 group = layout_config_widget(group, hbox, i, lc);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 lc->style_widgets = g_list_append(lc->style_widgets, group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 GTK_POLICY_NEVER, GTK_POLICY_NEVER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 gtk_box_pack_start(GTK_BOX(lc->box), scrolled, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 gtk_widget_show(scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 lc->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(lc->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(lc->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 gtk_tree_view_set_reorderable(GTK_TREE_VIEW(lc->listview), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 gtk_tree_view_column_pack_start(column, renderer, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 gtk_tree_view_column_set_cell_data_func(column, renderer, layout_config_number_cb, lc, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 gtk_tree_view_column_add_attribute(column, renderer, "text", COLUMN_TEXT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 gtk_tree_view_append_column(GTK_TREE_VIEW(lc->listview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 for (i = 0; i < 3; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 gtk_list_store_append(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 gtk_list_store_set(store, &iter, COLUMN_TEXT, _(layout_titles[i]), COLUMN_KEY, i, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 gtk_container_add(GTK_CONTAINER(scrolled), lc->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 gtk_widget_show(lc->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 pref_label_new(lc->box, _("(drag to change order)"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 return lc->box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 static char num_to_text_char(gint n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 switch (n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 case 1:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 return '2';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 case 2:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 return '3';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 return '1';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 gchar *layout_config_order_to_text(gint a, gint b, gint c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 text = g_strdup(" ");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 text[0] = num_to_text_char(a);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 text[1] = num_to_text_char(b);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 text[2] = num_to_text_char(c);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 return text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 static gint text_char_to_num(const gchar *text, gint n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 if (text[n] == '3') return 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 if (text[n] == '2') return 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 void layout_config_order_from_text(const gchar *text, gint *a, gint *b, gint *c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 if (!text || strlen(text) < 3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 *a = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 *b = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 *c = 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 *a = text_char_to_num(text, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 *b = text_char_to_num(text, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 *c = text_char_to_num(text, 2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418