Mercurial > geeqie
annotate src/bar.c @ 1472:b4001cb9fbc4
do not copy existing layout id to new window
author | nadvornik |
---|---|
date | Sat, 21 Mar 2009 18:22:04 +0000 |
parents | 65a5c27823c2 |
children | 9c16a93a0fdf |
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 | 29 #include "bar_histogram.h" |
1339 | 30 #include "histogram.h" |
1309 | 31 #include "rcfile.h" |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
32 |
1471 | 33 typedef struct _KnownPanes KnownPanes; |
34 struct _KnownPanes | |
35 { | |
36 PaneType type; | |
37 gchar *id; | |
38 gchar *title; | |
39 }; | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
40 |
1471 | 41 static const KnownPanes known_panes[] = { |
42 /* default sidebar */ | |
43 {PANE_HISTOGRAM, "histogram", N_("Histogram")}, | |
44 {PANE_COMMENT, "title", N_("Title")}, | |
45 {PANE_KEYWORDS, "keywords", N_("Keywords")}, | |
46 {PANE_COMMENT, "comment", N_("Comment")}, | |
47 {PANE_EXIF, "exif", N_("Exif")}, | |
48 | |
49 {PANE_UNDEF, NULL, NULL} | |
50 }; | |
1291
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 typedef struct _BarData BarData; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
53 struct _BarData |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
54 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
55 GtkWidget *widget; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
56 GtkWidget *vbox; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
57 FileData *fd; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
58 GtkWidget *label_file_name; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
59 |
1387 | 60 LayoutWindow *lw; |
1317 | 61 gint width; |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
62 }; |
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 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
|
65 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
66 GtkWidget *expander = data; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
67 GtkWidget *box; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
68 gint pos; |
1417 | 69 |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
70 if (!expander) return; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
71 box = gtk_widget_get_ancestor(expander, GTK_TYPE_BOX); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
72 if (!box) return; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
73 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
74 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
|
75 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
76 pos = up ? (pos - 1) : (pos + 1); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
77 if (pos < 0) pos = 0; |
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 gtk_box_reorder_child(GTK_BOX(box), expander, pos); |
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 |
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 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
|
84 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
85 bar_expander_move(widget, data, TRUE); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
86 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
87 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
88 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
|
89 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
90 bar_expander_move(widget, data, FALSE); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
91 } |
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 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
94 static void bar_expander_menu_popup(GtkWidget *data) |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
95 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
96 GtkWidget *menu; |
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 menu = popup_menu_short_lived(); |
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 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
|
101 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
|
102 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
|
103 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
104 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
105 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
106 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
|
107 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
108 if (bevent->button == MOUSE_BUTTON_RIGHT) |
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 bar_expander_menu_popup(widget); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
111 return TRUE; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
112 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
113 return FALSE; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
114 } |
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 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
117 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
|
118 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
119 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander)); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
120 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
|
121 if (!pd) return; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
122 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
|
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 void bar_set_fd(GtkWidget *bar, FileData *fd) |
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 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
|
129 if (!bd) return; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
130 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
131 file_data_unref(bd->fd); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
132 bd->fd = file_data_ref(fd); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
133 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
134 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
|
135 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
136 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
|
137 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
138 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
139 |
1417 | 140 gboolean bar_event(GtkWidget *bar, GdkEvent *event) |
1291
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 BarData *bd; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
143 GList *list, *work; |
1417 | 144 gboolean ret = FALSE; |
145 | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
146 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
|
147 if (!bd) return FALSE; |
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 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
150 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
151 work = list; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
152 while (work) |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
153 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
154 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
|
155 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
|
156 if (!pd) continue; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
157 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
158 if (pd->pane_event && pd->pane_event(widget, event)) |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
159 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
160 ret = TRUE; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
161 break; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
162 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
163 work = work->next; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
164 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
165 g_list_free(list); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
166 return ret; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
167 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
168 |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
169 GtkWidget *bar_find_pane_by_id(GtkWidget *bar, PaneType type, const gchar *id) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
170 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
171 BarData *bd; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
172 GList *list, *work; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
173 GtkWidget *ret = NULL; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
174 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
175 if (!id || !id[0]) return NULL; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
176 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
177 bd = g_object_get_data(G_OBJECT(bar), "bar_data"); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
178 if (!bd) return NULL; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
179 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
180 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
181 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
182 work = list; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
183 while (work) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
184 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
185 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(work->data)); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
186 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data"); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
187 if (!pd) continue; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
188 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
189 if (type == pd->type && strcmp(id, pd->id) == 0) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
190 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
191 ret = widget; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
192 break; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
193 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
194 work = work->next; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
195 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
196 g_list_free(list); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
197 return ret; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
198 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
199 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
200 void bar_clear(GtkWidget *bar) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
201 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
202 BarData *bd; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
203 GList *list, *work; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
204 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
205 bd = g_object_get_data(G_OBJECT(bar), "bar_data"); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
206 if (!bd) return; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
207 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
208 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
209 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
210 work = list; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
211 while (work) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
212 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
213 GtkWidget *widget = work->data; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
214 gtk_widget_destroy(widget); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
215 work = work->next; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
216 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
217 g_list_free(list); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
218 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
219 |
1309 | 220 void bar_write_config(GtkWidget *bar, GString *outstr, gint indent) |
221 { | |
222 BarData *bd; | |
223 GList *list, *work; | |
1417 | 224 |
1309 | 225 if (!bar) return; |
1417 | 226 |
1309 | 227 bd = g_object_get_data(G_OBJECT(bar), "bar_data"); |
228 if (!bd) return; | |
229 | |
1461 | 230 WRITE_NL(); WRITE_STRING("<bar "); |
1317 | 231 write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar)); |
232 write_uint_option(outstr, indent, "width", bd->width); | |
1461 | 233 WRITE_STRING(">"); |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
234 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
235 indent++; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
236 WRITE_NL(); WRITE_STRING("<clear/>"); |
1309 | 237 |
238 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox)); | |
239 work = list; | |
240 while (work) | |
241 { | |
242 GtkWidget *expander = work->data; | |
243 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander)); | |
244 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data"); | |
245 if (!pd) continue; | |
246 | |
247 pd->expanded = gtk_expander_get_expanded(GTK_EXPANDER(expander)); | |
248 | |
249 if (pd->pane_write_config) | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
250 pd->pane_write_config(widget, outstr, indent); |
1309 | 251 |
252 work = work->next; | |
253 } | |
254 g_list_free(list); | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
255 indent--; |
1461 | 256 WRITE_NL(); WRITE_STRING("</bar>"); |
1309 | 257 } |
258 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
259 void bar_update_expander(GtkWidget *pane) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
260 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
261 PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data"); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
262 GtkWidget *expander; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
263 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
264 if (!pd) return; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
265 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
266 expander = pane->parent; |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
267 |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
268 gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
269 } |
1309 | 270 |
271 void bar_add(GtkWidget *bar, GtkWidget *pane) | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
272 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
273 GtkWidget *expander; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
274 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
|
275 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
|
276 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
277 if (!bd) return; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
278 |
1387 | 279 pd->lw = bd->lw; |
280 pd->bar = bar; | |
281 | |
1351 | 282 expander = gtk_expander_new(NULL); |
1343 | 283 if (pd && pd->title) |
284 { | |
285 gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title); | |
286 gtk_widget_show(pd->title); | |
287 } | |
288 | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
289 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
|
290 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
291 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
|
292 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
293 gtk_container_add(GTK_CONTAINER(expander), pane); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
294 |
1309 | 295 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
|
296 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
297 gtk_widget_show(expander); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
298 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
299 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
|
300 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
301 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
302 |
1317 | 303 static void bar_populate_default(GtkWidget *bar) |
1309 | 304 { |
305 GtkWidget *widget; | |
1417 | 306 |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
307 widget = bar_pane_histogram_new("histogram", _("Histogram"), 80, TRUE, HCHAN_RGB, 0); |
1309 | 308 bar_add(bar, widget); |
309 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
310 widget = bar_pane_comment_new("title", _("Title"), "Xmp.dc.title", TRUE, 40); |
1309 | 311 bar_add(bar, widget); |
312 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
313 widget = bar_pane_keywords_new("keywords", _("Keywords"), KEYWORD_KEY, TRUE); |
1309 | 314 bar_add(bar, widget); |
315 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
316 widget = bar_pane_comment_new("comment", _("Comment"), "Xmp.dc.description", TRUE, 150); |
1309 | 317 bar_add(bar, widget); |
318 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
319 widget = bar_pane_exif_new("exif", _("Exif"), TRUE, TRUE); |
1309 | 320 bar_add(bar, widget); |
321 } | |
322 | |
1383 | 323 static void bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer data) |
1317 | 324 { |
325 BarData *bd = data; | |
1383 | 326 |
1317 | 327 bd->width = allocation->width; |
328 } | |
329 | |
1383 | 330 gint bar_get_width(GtkWidget *bar) |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
331 { |
1417 | 332 BarData *bd; |
333 | |
334 bd = g_object_get_data(G_OBJECT(bar), "bar_data"); | |
1383 | 335 if (!bd) return 0; |
1417 | 336 |
1383 | 337 return bd->width; |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
338 } |
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 void bar_close(GtkWidget *bar) |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
341 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
342 BarData *bd; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
343 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
344 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
|
345 if (!bd) return; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
346 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
347 gtk_widget_destroy(bd->widget); |
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 static void bar_destroy(GtkWidget *widget, gpointer data) |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
351 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
352 BarData *bd = data; |
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 file_data_unref(bd->fd); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
355 g_free(bd); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
356 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
357 |
1387 | 358 GtkWidget *bar_new(LayoutWindow *lw) |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
359 { |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
360 BarData *bd; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
361 GtkWidget *box; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
362 GtkWidget *scrolled; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
363 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
364 bd = g_new0(BarData, 1); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
365 |
1387 | 366 bd->lw = lw; |
367 | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
368 bd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
369 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
|
370 g_signal_connect(G_OBJECT(bd->widget), "destroy", |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
371 G_CALLBACK(bar_destroy), bd); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
372 |
1383 | 373 g_signal_connect(G_OBJECT(bd->widget), "size-allocate", |
374 G_CALLBACK(bar_size_allocate), bd); | |
1317 | 375 |
1383 | 376 bd->width = SIDEBAR_DEFAULT_WIDTH; |
1317 | 377 gtk_widget_set_size_request(bd->widget, bd->width, -1); |
378 | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
379 box = gtk_hbox_new(FALSE, 0); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
380 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
381 bd->label_file_name = gtk_label_new(""); |
1355 | 382 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
|
383 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
|
384 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
|
385 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
|
386 gtk_widget_show(bd->label_file_name); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
387 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
388 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
|
389 gtk_widget_show(box); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
390 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
391 scrolled = gtk_scrolled_window_new(NULL, NULL); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
392 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
|
393 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
394 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
|
395 gtk_widget_show(scrolled); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
396 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
397 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
398 bd->vbox = gtk_vbox_new(FALSE, 0); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
399 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
|
400 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
|
401 |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
402 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
|
403 gtk_widget_show(bd->vbox); |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
404 return bd->widget; |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
405 } |
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
406 |
1387 | 407 GtkWidget *bar_new_default(LayoutWindow *lw) |
1317 | 408 { |
1387 | 409 GtkWidget *bar = bar_new(lw); |
1317 | 410 |
411 bar_populate_default(bar); | |
412 | |
413 gtk_widget_show(bar); | |
414 | |
415 return bar; | |
416 } | |
417 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
418 GtkWidget *bar_update_from_config(GtkWidget *bar, const gchar **attribute_names, const gchar **attribute_values) |
1317 | 419 { |
420 gboolean enabled = TRUE; | |
1383 | 421 gint width = SIDEBAR_DEFAULT_WIDTH; |
1317 | 422 |
423 while (*attribute_names) | |
424 { | |
425 const gchar *option = *attribute_names++; | |
426 const gchar *value = *attribute_values++; | |
427 | |
428 if (READ_BOOL_FULL("enabled", enabled)) continue; | |
429 if (READ_INT_FULL("width", width)) continue; | |
430 | |
431 | |
1464 | 432 log_printf("unknown attribute %s = %s\n", option, value); |
1317 | 433 } |
434 | |
435 gtk_widget_set_size_request(bar, width, -1); | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
436 if (enabled) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
437 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
438 gtk_widget_show(bar); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
439 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
440 else |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
441 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
442 gtk_widget_hide(bar); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
443 } |
1317 | 444 return bar; |
445 } | |
446 | |
1469
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
447 GtkWidget *bar_new_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values) |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
448 { |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
449 GtkWidget *bar = bar_new(lw); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
450 return bar_update_from_config(bar, attribute_names, attribute_values); |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
451 } |
607c60506863
added a possibility to update existing bars from config
nadvornik
parents:
1464
diff
changeset
|
452 |
1389
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
453 GtkWidget *bar_pane_expander_title(const gchar *title) |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
454 { |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
455 GtkWidget *widget = gtk_label_new(title); |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
456 |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
457 pref_label_bold(widget, TRUE, FALSE); |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
458 //gtk_label_set_ellipsize(GTK_LABEL(widget), PANGO_ELLIPSIZE_END); //FIXME: do not work |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
459 |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
460 return widget; |
c44f21235ffe
Use a common function bar_pane_expander_title() to set expanders title widget.
zas_
parents:
1387
diff
changeset
|
461 } |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
462 |
1471 | 463 gboolean bar_pane_translate_title(PaneType type, const gchar *id, gchar **title) |
464 { | |
465 const KnownPanes *pane = known_panes; | |
466 | |
467 if (!title) return FALSE; | |
468 while (pane->id) | |
469 { | |
470 if (pane->type == type && strcmp(pane->id, id) == 0) break; | |
471 pane++; | |
472 } | |
473 if (!pane->id) return FALSE; | |
474 | |
475 if (*title && **title && strcmp(pane->title, *title) != 0) return FALSE; | |
476 | |
477 g_free(*title); | |
478 *title = g_strdup(_(pane->title)); | |
479 return TRUE; | |
480 } | |
481 | |
1291
50ae02a4a675
replaced bar_info with an universal bar, restored the original
nadvornik
parents:
diff
changeset
|
482 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |