annotate src/bar.c @ 1383:3c9abbc05792

use standard GtkHPaned for sidebar width
author nadvornik
date Fri, 06 Mar 2009 14:24:11 +0000
parents 5a61fb9adc05
children 6f31fa931d3f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
1 /*
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
2 * Geeqie
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
3 * (C) 2004 John Ellis
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
5 *
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
6 * Author: Vladimir Nadvornik
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
7 *
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
9 * Please read the included file COPYING for more information.
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
11 */
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
12
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
13
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
14 #include "main.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
15 #include "bar.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
16
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
17 #include "filedata.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
18 #include "history_list.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
19 #include "metadata.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
20 #include "misc.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
21 #include "ui_fileops.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
22 #include "ui_misc.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
23 #include "ui_utildlg.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
24
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
25 #include "ui_menu.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
26 #include "bar_comment.h"
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
27 #include "bar_keywords.h"
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents: 1292
diff changeset
28 #include "bar_exif.h"
1298
c37f36b97173 added histogram pane
nadvornik
parents: 1293
diff changeset
29 #include "bar_histogram.h"
1339
45bcfcb69f56 fixed bar_histogram headers
nadvornik
parents: 1317
diff changeset
30 #include "histogram.h"
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
31 #include "rcfile.h"
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
32
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
33 //#define BAR_SIZE_INCREMENT 48
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
34 //#define BAR_ARROW_SIZE 7
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
35
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
36
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
37 typedef struct _BarData BarData;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
38 struct _BarData
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
39 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
40 GtkWidget *widget;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
41 GtkWidget *vbox;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
42 FileData *fd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
43 GtkWidget *label_file_name;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
44
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
45 GList *(*list_func)(gpointer);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
46 gpointer list_data;
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
47 gint width;
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
48 };
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
49
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
50 static void bar_expander_move(GtkWidget *widget, gpointer data, gboolean up)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
51 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
52 GtkWidget *expander = data;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
53 GtkWidget *box;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
54 gint pos;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
55 if (!expander) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
56 box = gtk_widget_get_ancestor(expander, GTK_TYPE_BOX);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
57 if (!box) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
58
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
59 gtk_container_child_get(GTK_CONTAINER(box), expander, "position", &pos, NULL);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
60
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
61 pos = up ? (pos - 1) : (pos + 1);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
62 if (pos < 0) pos = 0;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
63
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
64 gtk_box_reorder_child(GTK_BOX(box), expander, pos);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
65 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
66
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
67
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
68 static void bar_expander_move_up_cb(GtkWidget *widget, gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
69 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
70 bar_expander_move(widget, data, TRUE);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
71 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
72
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
73 static void bar_expander_move_down_cb(GtkWidget *widget, gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
74 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
75 bar_expander_move(widget, data, FALSE);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
76 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
77
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
78
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
79 static void bar_expander_menu_popup(GtkWidget *data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
80 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
81 GtkWidget *menu;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
82
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
83 menu = popup_menu_short_lived();
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
84
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
85 menu_item_add_stock(menu, _("Move _up"), GTK_STOCK_GO_UP, G_CALLBACK(bar_expander_move_up_cb), data);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
86 menu_item_add_stock(menu, _("Move _down"), GTK_STOCK_GO_DOWN, G_CALLBACK(bar_expander_move_down_cb), data);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
87 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, data, 0, GDK_CURRENT_TIME);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
88 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
89
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
90
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
91 static gboolean bar_expander_menu_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
92 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
93 if (bevent->button == MOUSE_BUTTON_RIGHT)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
94 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
95 bar_expander_menu_popup(widget);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
96 return TRUE;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
97 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
98 return FALSE;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
99 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
100
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
101
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
102 void bar_pane_set_fd_cb(GtkWidget *expander, gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
103 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
104 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
105 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
106 if (!pd) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
107 if (pd->pane_set_fd) pd->pane_set_fd(widget, data);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
108 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
109
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
110 void bar_set_fd(GtkWidget *bar, FileData *fd)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
111 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
112 BarData *bd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
113 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
114 if (!bd) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
115
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
116 file_data_unref(bd->fd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
117 bd->fd = file_data_ref(fd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
118
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
119 gtk_container_foreach(GTK_CONTAINER(bd->vbox), bar_pane_set_fd_cb, fd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
120
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
121 gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : "");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
122
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
123 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
124
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
125 gint bar_event(GtkWidget *bar, GdkEvent *event)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
126 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
127 BarData *bd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
128 GList *list, *work;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
129 gint ret = FALSE;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
130 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
131 if (!bd) return FALSE;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
132
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
133 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
134
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
135 work = list;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
136 while (work)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
137 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
138 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(work->data));
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
139 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
140 if (!pd) continue;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
141
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
142 if (pd->pane_event && pd->pane_event(widget, event))
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
143 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
144 ret = TRUE;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
145 break;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
146 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
147 work = work->next;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
148 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
149 g_list_free(list);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
150 return ret;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
151 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
152
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
153 void bar_write_config(GtkWidget *bar, GString *outstr, gint indent)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
154 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
155 BarData *bd;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
156 GList *list, *work;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
157 if (!bar) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
158 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
159 if (!bd) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
160
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
161 WRITE_STRING("<bar\n");
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
162 indent++;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
163 write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar));
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
164 write_uint_option(outstr, indent, "width", bd->width);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
165 indent--;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
166 WRITE_STRING(">\n");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
167
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
168 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
169 work = list;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
170 while (work)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
171 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
172 GtkWidget *expander = work->data;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
173 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
174 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
175 if (!pd) continue;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
176
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
177 pd->expanded = gtk_expander_get_expanded(GTK_EXPANDER(expander));
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
178
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
179 if (pd->pane_write_config)
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
180 pd->pane_write_config(widget, outstr, indent + 1);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
181
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
182 work = work->next;
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
183 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
184 g_list_free(list);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
185
1314
8cca18bce950 simplified config writing
nadvornik
parents: 1309
diff changeset
186 WRITE_STRING("</bar>\n");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
187 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
188
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
189
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
190 void bar_pane_set_selection_func(GtkWidget *pane, GList *(*list_func)(gpointer data), gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
191 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
192 PaneData *pd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
193
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
194 pd = g_object_get_data(G_OBJECT(pane), "pane_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
195 if (!pd) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
196
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
197 pd->list_func = list_func;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
198 pd->list_data = data;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
199 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
200
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
201 void bar_set_selection_func(GtkWidget *bar, GList *(*list_func)(gpointer data), gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
202 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
203 BarData *bd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
204 GList *list, *work;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
205 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
206 if (!bd) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
207
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
208 bd->list_func = list_func;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
209 bd->list_data = data;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
210
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
211 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
212
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
213 work = list;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
214 while (work)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
215 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
216 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(work->data));
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
217
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
218 bar_pane_set_selection_func(widget, list_func, data);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
219
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
220 work = work->next;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
221 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
222 g_list_free(list);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
223 return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
224 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
225
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
226 void bar_add(GtkWidget *bar, GtkWidget *pane)
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
227 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
228 GtkWidget *expander;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
229 BarData *bd = g_object_get_data(G_OBJECT(bar), "bar_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
230 PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
231
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
232
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
233 if (!bd) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
234
1351
93fe7a68a689 fixed possible crash
nadvornik
parents: 1350
diff changeset
235 expander = gtk_expander_new(NULL);
1343
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
236 if (pd && pd->title)
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
237 {
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
238 gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title);
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
239 gtk_widget_show(pd->title);
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
240 pref_label_bold(pd->title, TRUE, FALSE);
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
241 }
eebb8d0cb677 give the panes more control over expander title
nadvornik
parents: 1339
diff changeset
242
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
243 gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
244
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
245 g_signal_connect(expander, "button_press_event", G_CALLBACK(bar_expander_menu_cb), bd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
246
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
247 gtk_container_add(GTK_CONTAINER(expander), pane);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
248
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
249 gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
250
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
251 gtk_widget_show(expander);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
252
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
253 if (bd->list_func) bar_pane_set_selection_func(pane, bd->list_func, bd->list_data);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
254 if (bd->fd && pd && pd->pane_set_fd) pd->pane_set_fd(pane, bd->fd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
255
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
256 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
257
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
258 static void bar_populate_default(GtkWidget *bar)
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
259 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
260 GtkWidget *widget;
1339
45bcfcb69f56 fixed bar_histogram headers
nadvornik
parents: 1317
diff changeset
261 widget = bar_pane_histogram_new(_("Histogram"), 80, TRUE, HCHAN_RGB, 0);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
262 bar_add(bar, widget);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
263
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
264 widget = bar_pane_comment_new(_("Title"), "Xmp.dc.title", TRUE, 40);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
265 bar_add(bar, widget);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
266
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
267 widget = bar_pane_keywords_new(_("Keywords"), KEYWORD_KEY, TRUE);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
268 bar_add(bar, widget);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
269
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
270 widget = bar_pane_comment_new(_("Comment"), "Xmp.dc.description", TRUE, 150);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
271 bar_add(bar, widget);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
272
1350
9d190c098b97 rewritten exif pane to support arbitrary number of entries
nadvornik
parents: 1343
diff changeset
273 widget = bar_pane_exif_new(_("Exif"), TRUE, TRUE);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
274 bar_add(bar, widget);
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
275 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1298
diff changeset
276
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
277 static void bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
278 {
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
279 BarData *bd = data;
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
280
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
281 bd->width = allocation->width;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
282 }
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
283
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
284 gint bar_get_width(GtkWidget *bar)
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
285 {
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
286 BarData *bd = g_object_get_data(G_OBJECT(bar), "bar_data");
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
287 if (!bd) return 0;
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
288 return bd->width;
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
289 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
290
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
291 void bar_close(GtkWidget *bar)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
292 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
293 BarData *bd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
294
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
295 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
296 if (!bd) return;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
297
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
298 gtk_widget_destroy(bd->widget);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
299 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
300
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
301 static void bar_destroy(GtkWidget *widget, gpointer data)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
302 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
303 BarData *bd = data;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
304
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
305 file_data_unref(bd->fd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
306 g_free(bd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
307 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
308
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
309 GtkWidget *bar_new(GtkWidget *bounding_widget)
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
310 {
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
311 BarData *bd;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
312 GtkWidget *box;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
313 GtkWidget *sizer;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
314 GtkWidget *button;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
315 GtkWidget *arrow;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
316 GtkWidget *scrolled;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
317
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
318 bd = g_new0(BarData, 1);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
319
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
320 bd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
321 g_object_set_data(G_OBJECT(bd->widget), "bar_data", bd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
322 g_signal_connect(G_OBJECT(bd->widget), "destroy",
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
323 G_CALLBACK(bar_destroy), bd);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
324
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
325 g_signal_connect(G_OBJECT(bd->widget), "size-allocate",
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
326 G_CALLBACK(bar_size_allocate), bd);
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
327
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
328 bd->width = SIDEBAR_DEFAULT_WIDTH;
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
329 gtk_widget_set_size_request(bd->widget, bd->width, -1);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
330
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
331 box = gtk_hbox_new(FALSE, 0);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
332
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
333 bd->label_file_name = gtk_label_new("");
1355
5a61fb9adc05 Add an ellipse when the file name is truncated.
zas_
parents: 1354
diff changeset
334 gtk_label_set_ellipsize(GTK_LABEL(bd->label_file_name), PANGO_ELLIPSIZE_END);
1354
d5fec01ce866 In the side bar, display the filename without the 'Filename:' prefix and makes it centered. Allow to select it for copy'n'paste.
zas_
parents: 1351
diff changeset
335 gtk_label_set_selectable(GTK_LABEL(bd->label_file_name), TRUE);
d5fec01ce866 In the side bar, display the filename without the 'Filename:' prefix and makes it centered. Allow to select it for copy'n'paste.
zas_
parents: 1351
diff changeset
336 gtk_misc_set_alignment(GTK_MISC(bd->label_file_name), 0.5, 0.5);
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
337 gtk_box_pack_start(GTK_BOX(box), bd->label_file_name, TRUE, TRUE, 0);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
338 gtk_widget_show(bd->label_file_name);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
339
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
340 gtk_box_pack_start(GTK_BOX(bd->widget), box, FALSE, FALSE, 0);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
341 gtk_widget_show(box);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
342
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
343 scrolled = gtk_scrolled_window_new(NULL, NULL);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
344 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents: 1292
diff changeset
345 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
346 gtk_box_pack_start(GTK_BOX(bd->widget), scrolled, TRUE, TRUE, 0);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
347 gtk_widget_show(scrolled);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
348
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
349
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
350 bd->vbox = gtk_vbox_new(FALSE, 0);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
351 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), bd->vbox);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
352 gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(scrolled))), GTK_SHADOW_NONE);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
353
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
354 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_NONE);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
355 gtk_widget_show(bd->vbox);
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
356 return bd->widget;
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
357 }
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
358
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
359 GtkWidget *bar_new_default(GtkWidget *bounding_widget)
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
360 {
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
361 GtkWidget *bar = bar_new(bounding_widget);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
362
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
363 bar_populate_default(bar);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
364
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
365 gtk_widget_show(bar);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
366
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
367 return bar;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
368 }
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
369
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
370 GtkWidget *bar_new_from_config(GtkWidget *bounding_widget, const gchar **attribute_names, const gchar **attribute_values)
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
371 {
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
372 GtkWidget *bar = bar_new(bounding_widget);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
373
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
374 gboolean enabled = TRUE;
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1355
diff changeset
375 gint width = SIDEBAR_DEFAULT_WIDTH;
1317
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
376
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
377 while (*attribute_names)
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
378 {
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
379 const gchar *option = *attribute_names++;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
380 const gchar *value = *attribute_values++;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
381
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
382 if (READ_BOOL_FULL("enabled", enabled)) continue;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
383 if (READ_INT_FULL("width", width)) continue;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
384
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
385
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
386 DEBUG_1("unknown attribute %s = %s", option, value);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
387 }
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
388
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
389 gtk_widget_set_size_request(bar, width, -1);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
390 if (enabled) gtk_widget_show(bar);
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
391 return bar;
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
392 }
cd7204a18f14 simplified and improved bar configuration
nadvornik
parents: 1314
diff changeset
393
1291
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
394
50ae02a4a675 replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff changeset
395 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */