annotate src/bar.c @ 2500:eb2ce489ceea

Fix #323: Rating system https://github.com/BestImageViewer/geeqie/issues/323 Initial implementation. Set values either by Edit menu, or Alt+Keypad+n: n is 0 to 5 Alt+keypad+minus sets the value to -1.
author Colin Clark <colin.clark@cclark.uk>
date Thu, 08 Jun 2017 20:46:52 +0100
parents a05ba0d6135c
children aaca094d2f32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
1 /*
2350
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
2 * Copyright (C) 2004 John Ellis
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
3 * Copyright (C) 2008 - 2016 The Geeqie Team
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
4 *
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
5 * Author: Vladimir Nadvornik
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
6 *
2350
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
7 * This program is free software; you can redistribute it and/or modify
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
8 * it under the terms of the GNU General Public License as published by
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
10 * (at your option) any later version.
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
11 *
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
12 * This program is distributed in the hope that it will be useful,
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
15 * GNU General Public License for more details.
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
16 *
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
17 * You should have received a copy of the GNU General Public License along
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
18 * with this program; if not, write to the Free Software Foundation, Inc.,
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
20 */
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
21
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
22 #include "main.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
23 #include "bar.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
24
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
25 #include "filedata.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
26 #include "history_list.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
27 #include "metadata.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
28 #include "misc.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
29 #include "ui_fileops.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
30 #include "ui_misc.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
31 #include "ui_utildlg.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
32
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
33 #include "ui_menu.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
34 #include "bar_comment.h"
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
35 #include "bar_keywords.h"
1293
6546ca1fea07 separated "normal" and advanced exif, "Normal" exif is now in the
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1292
diff changeset
36 #include "bar_exif.h"
1298
86766089aeb1 added histogram pane
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1293
diff changeset
37 #include "bar_histogram.h"
1339
eb7a696b73f3 fixed bar_histogram headers
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1317
diff changeset
38 #include "histogram.h"
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
39 #include "rcfile.h"
1604
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
40 #include "bar_gps.h"
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
41
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
42 typedef struct _KnownPanes KnownPanes;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
43 struct _KnownPanes
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
44 {
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
45 PaneType type;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
46 gchar *id;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
47 gchar *title;
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
48 const gchar *config;
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
49 };
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
50
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
51 static const gchar default_config_histogram[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
52 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
53 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
54 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
55 " <pane_histogram id = 'histogram' expanded = 'true' histogram_channel = '4' histogram_mode = '0' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
56 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
57 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
58 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
59
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
60 static const gchar default_config_title[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
61 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
62 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
63 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
64 " <pane_comment id = 'title' expanded = 'true' key = 'Xmp.dc.title' height = '40' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
65 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
66 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
67 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
68
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
69 static const gchar default_config_keywords[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
70 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
71 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
72 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
73 " <pane_keywords id = 'keywords' expanded = 'true' key = '" KEYWORD_KEY "' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
74 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
75 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
76 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
77
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
78 static const gchar default_config_comment[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
79 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
80 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
81 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
82 " <pane_comment id = 'comment' expanded = 'true' key = '" COMMENT_KEY "' height = '150' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
83 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
84 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
85 "</gq>";
2500
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
86 static const gchar default_config_rating[] =
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
87 "<gq>"
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
88 " <layout id = '_current_'>"
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
89 " <bar>"
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
90 " <pane_comment id = 'rating' expanded = 'true' key = '" RATING_KEY "' height = '10' />"
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
91 " </bar>"
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
92 " </layout>"
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
93 "</gq>";
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
94
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
95 static const gchar default_config_exif[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
96 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
97 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
98 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
99 " <pane_exif id = 'exif' expanded = 'true' >"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
100 " <entry key = 'formatted.Camera' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
101 " <entry key = 'formatted.DateTime' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
102 " <entry key = 'formatted.ShutterSpeed' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
103 " <entry key = 'formatted.Aperture' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
104 " <entry key = 'formatted.ExposureBias' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
105 " <entry key = 'formatted.ISOSpeedRating' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
106 " <entry key = 'formatted.FocalLength' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
107 " <entry key = 'formatted.FocalLength35mmFilm' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
108 " <entry key = 'formatted.Flash' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
109 " <entry key = 'Exif.Photo.ExposureProgram' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
110 " <entry key = 'Exif.Photo.MeteringMode' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
111 " <entry key = 'Exif.Photo.LightSource' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
112 " <entry key = 'formatted.ColorProfile' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
113 " <entry key = 'formatted.SubjectDistance' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
114 " <entry key = 'formatted.Resolution' if_set = 'true' editable = 'false' />"
1567
ef3ca18df43f added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1543
diff changeset
115 " <entry key = '" ORIENTATION_KEY "' if_set = 'true' editable = 'false' />"
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
116 " </pane_exif>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
117 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
118 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
119 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
120
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
121 static const gchar default_config_file_info[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
122 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
123 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
124 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
125 " <pane_exif id = 'file_info' expanded = 'true' >"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
126 " <entry key = 'file.mode' if_set = 'false' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
127 " <entry key = 'file.date' if_set = 'false' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
128 " <entry key = 'file.size' if_set = 'false' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
129 " </pane_exif>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
130 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
131 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
132 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
133
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
134 static const gchar default_config_location[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
135 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
136 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
137 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
138 " <pane_exif id = 'location' expanded = 'true' >"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
139 " <entry key = 'formatted.GPSPosition' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
140 " <entry key = 'formatted.GPSAltitude' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
141 " <entry key = 'Xmp.photoshop.Country' if_set = 'false' editable = 'true' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
142 " <entry key = 'Xmp.iptc.CountryCode' if_set = 'false' editable = 'true' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
143 " <entry key = 'Xmp.photoshop.State' if_set = 'false' editable = 'true' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
144 " <entry key = 'Xmp.photoshop.City' if_set = 'false' editable = 'true' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
145 " <entry key = 'Xmp.iptc.Location' if_set = 'false' editable = 'true' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
146 " </pane_exif>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
147 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
148 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
149 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
150
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
151 static const gchar default_config_copyright[] =
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
152 "<gq>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
153 " <layout id = '_current_'>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
154 " <bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
155 " <pane_exif id = 'copyright' expanded = 'true' >"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
156 " <entry key = 'Xmp.dc.creator' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
157 " <entry key = 'Xmp.dc.contributor' if_set = 'true' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
158 " <entry key = 'Xmp.dc.rights' if_set = 'false' editable = 'false' />"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
159 " </pane_exif>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
160 " </bar>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
161 " </layout>"
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
162 "</gq>";
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
163
1604
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
164 #ifdef HAVE_LIBCHAMPLAIN
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
165 #ifdef HAVE_LIBCHAMPLAIN_GTK
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
166 static const gchar default_config_gps[] =
1604
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
167 "<gq>"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
168 " <layout id = '_current_'>"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
169 " <bar>"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
170 " <pane_gps id = 'gps' expanded = 'true'"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
171 " map-id = 'osm::mapnik'"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
172 " zoom-level = '8'"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
173 " latitude = '50116666'"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
174 " longitude = '8683333' />"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
175 " </bar>"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
176 " </layout>"
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
177 "</gq>";
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
178 #endif
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
179 #endif
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
180
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
181 static const KnownPanes known_panes[] = {
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
182 /* default sidebar */
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
183 {PANE_HISTOGRAM, "histogram", N_("Histogram"), default_config_histogram},
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
184 {PANE_COMMENT, "title", N_("Title"), default_config_title},
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
185 {PANE_KEYWORDS, "keywords", N_("Keywords"), default_config_keywords},
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
186 {PANE_COMMENT, "comment", N_("Comment"), default_config_comment},
2500
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
187 {PANE_COMMENT, "rating", N_("Rating"), default_config_rating},
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
188 {PANE_EXIF, "exif", N_("Exif"), default_config_exif},
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
189 /* other pre-configured panes */
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
190 {PANE_EXIF, "file_info", N_("File info"), default_config_file_info},
1543
5d7d2e5a8c09 fixed ambiguous strings
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1532
diff changeset
191 {PANE_EXIF, "location", N_("Location and GPS"), default_config_location},
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
192 {PANE_EXIF, "copyright", N_("Copyright"), default_config_copyright},
1604
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
193 #ifdef HAVE_LIBCHAMPLAIN
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
194 #ifdef HAVE_LIBCHAMPLAIN_GTK
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
195 {PANE_GPS, "gps", N_("GPS Map"), default_config_gps},
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
196 #endif
934646ea4af8 added GPS map support - patch by Colin Clark
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1567
diff changeset
197 #endif
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
198 {PANE_UNDEF, NULL, NULL, NULL}
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
199 };
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
200
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
201 typedef struct _BarData BarData;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
202 struct _BarData
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
203 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
204 GtkWidget *widget;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
205 GtkWidget *vbox;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
206 FileData *fd;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
207 GtkWidget *label_file_name;
2498
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
208 GtkWidget *add_button;
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
209
1387
add2c9869a56 simplified bar interface
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1383
diff changeset
210 LayoutWindow *lw;
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
211 gint width;
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
212 };
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
213
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
214 static void bar_expander_move(GtkWidget *widget, gpointer data, gboolean up, gboolean single_step)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
215 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
216 GtkWidget *expander = data;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
217 GtkWidget *box;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
218 gint pos;
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
219
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
220 if (!expander) return;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
221 box = gtk_widget_get_ancestor(expander, GTK_TYPE_BOX);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
222 if (!box) return;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
223
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
224 gtk_container_child_get(GTK_CONTAINER(box), expander, "position", &pos, NULL);
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
225
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
226 if (single_step)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
227 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
228 pos = up ? (pos - 1) : (pos + 1);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
229 if (pos < 0) pos = 0;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
230 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
231 else
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
232 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
233 pos = up ? 0 : -1;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
234 }
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
235
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
236 gtk_box_reorder_child(GTK_BOX(box), expander, pos);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
237 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
238
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
239
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
240 static void bar_expander_move_up_cb(GtkWidget *widget, gpointer data)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
241 {
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
242 bar_expander_move(widget, data, TRUE, TRUE);
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
243 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
244
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
245 static void bar_expander_move_down_cb(GtkWidget *widget, gpointer data)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
246 {
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
247 bar_expander_move(widget, data, FALSE, TRUE);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
248 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
249
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
250 static void bar_expander_move_top_cb(GtkWidget *widget, gpointer data)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
251 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
252 bar_expander_move(widget, data, TRUE, FALSE);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
253 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
254
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
255 static void bar_expander_move_bottom_cb(GtkWidget *widget, gpointer data)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
256 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
257 bar_expander_move(widget, data, FALSE, FALSE);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
258 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
259
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
260 static void bar_expander_delete_cb(GtkWidget *widget, gpointer data)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
261 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
262 GtkWidget *expander = data;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
263 gtk_widget_destroy(expander);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
264 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
265
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
266 static void bar_expander_add_cb(GtkWidget *widget, gpointer data)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
267 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
268 //GtkWidget *bar = data;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
269 const KnownPanes *pane = known_panes;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
270 const gchar *id = g_object_get_data(G_OBJECT(widget), "pane_add_id");
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
271 const gchar *config;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
272
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
273 if (!id) return;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
274
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
275 while (pane->id)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
276 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
277 if (strcmp(pane->id, id) == 0) break;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
278 pane++;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
279 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
280 if (!pane->id) return;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
281
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
282 config = bar_pane_get_default_config(id);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
283 if (config) load_config_from_buf(config, strlen(config), FALSE);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
284
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
285 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
286
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
287
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
288 static void bar_menu_popup(GtkWidget *widget)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
289 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
290 GtkWidget *menu;
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
291 GtkWidget *bar;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
292 GtkWidget *expander;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
293 const KnownPanes *pane = known_panes;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
294 BarData *bd;
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
295
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
296 bd = g_object_get_data(G_OBJECT(widget), "bar_data");
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
297 if (bd)
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
298 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
299 expander = NULL;
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
300 bar = widget;
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
301 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
302 else
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
303 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
304 expander = widget;
2034
9297985567b5 use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 2021
diff changeset
305 bar = gtk_widget_get_parent(widget);
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
306 while (bar && !g_object_get_data(G_OBJECT(bar), "bar_data"))
2034
9297985567b5 use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 2021
diff changeset
307 bar = gtk_widget_get_parent(bar);
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
308 if (!bar) return;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
309 }
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
310
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
311 menu = popup_menu_short_lived();
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
312
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
313 if (expander)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
314 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
315 menu_item_add_stock(menu, _("Move to _top"), GTK_STOCK_GOTO_TOP, G_CALLBACK(bar_expander_move_top_cb), expander);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
316 menu_item_add_stock(menu, _("Move _up"), GTK_STOCK_GO_UP, G_CALLBACK(bar_expander_move_up_cb), expander);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
317 menu_item_add_stock(menu, _("Move _down"), GTK_STOCK_GO_DOWN, G_CALLBACK(bar_expander_move_down_cb), expander);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
318 menu_item_add_stock(menu, _("Move to _bottom"), GTK_STOCK_GOTO_BOTTOM, G_CALLBACK(bar_expander_move_bottom_cb), expander);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
319 menu_item_add_divider(menu);
1543
5d7d2e5a8c09 fixed ambiguous strings
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1532
diff changeset
320 menu_item_add_stock(menu, _("Remove"), GTK_STOCK_DELETE, G_CALLBACK(bar_expander_delete_cb), expander);
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
321 menu_item_add_divider(menu);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
322 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
323
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
324 while (pane->id)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
325 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
326 GtkWidget *item;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
327 item = menu_item_add_stock(menu, _(pane->title), GTK_STOCK_ADD, G_CALLBACK(bar_expander_add_cb), bar);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
328 g_object_set_data(G_OBJECT(item), "pane_add_id", pane->id);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
329 pane++;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
330 }
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
331
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
332 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, bar, 0, GDK_CURRENT_TIME);
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
333 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
334
2498
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
335 static void bar_menu_add_popup(GtkWidget *widget)
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
336 {
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
337 GtkWidget *menu;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
338 GtkWidget *bar;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
339 const KnownPanes *pane = known_panes;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
340
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
341 bar = widget;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
342
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
343 menu = popup_menu_short_lived();
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
344
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
345 while (pane->id)
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
346 {
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
347 GtkWidget *item;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
348 item = menu_item_add_stock(menu, _(pane->title), GTK_STOCK_ADD, G_CALLBACK(bar_expander_add_cb), bar);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
349 g_object_set_data(G_OBJECT(item), "pane_add_id", pane->id);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
350 pane++;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
351 }
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
352
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
353 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, bar, 0, GDK_CURRENT_TIME);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
354 }
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
355
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
356
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
357 static gboolean bar_menu_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
358 {
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
359 if (bevent->button == MOUSE_BUTTON_RIGHT)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
360 {
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
361 bar_menu_popup(widget);
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
362 return TRUE;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
363 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
364 return FALSE;
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
365 }
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
366
2498
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
367 static gboolean bar_menu_add_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
368 {
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
369 bar_menu_add_popup(widget);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
370 return TRUE;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
371 }
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
372
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
373
1520
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
374 static void bar_pane_set_fd_cb(GtkWidget *expander, gpointer data)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
375 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
376 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
377 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
378 if (!pd) return;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
379 if (pd->pane_set_fd) pd->pane_set_fd(widget, data);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
380 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
381
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
382 void bar_set_fd(GtkWidget *bar, FileData *fd)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
383 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
384 BarData *bd;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
385 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
386 if (!bd) return;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
387
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
388 file_data_unref(bd->fd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
389 bd->fd = file_data_ref(fd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
390
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
391 gtk_container_foreach(GTK_CONTAINER(bd->vbox), bar_pane_set_fd_cb, fd);
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
392
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
393 gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : "");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
394
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
395 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
396
1520
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
397 static void bar_pane_notify_selection_cb(GtkWidget *expander, gpointer data)
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
398 {
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
399 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
400 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
401 if (!pd) return;
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
402 if (pd->pane_notify_selection) pd->pane_notify_selection(widget, GPOINTER_TO_INT(data));
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
403 }
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
404
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
405 void bar_notify_selection(GtkWidget *bar, gint count)
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
406 {
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
407 BarData *bd;
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
408 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
409 if (!bd) return;
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
410
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
411 gtk_container_foreach(GTK_CONTAINER(bd->vbox), bar_pane_notify_selection_cb, GINT_TO_POINTER(count));
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
412 }
056ab2f7b7d8 added pane_notify_selection to pane API
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1484
diff changeset
413
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
414 gboolean bar_event(GtkWidget *bar, GdkEvent *event)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
415 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
416 BarData *bd;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
417 GList *list, *work;
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
418 gboolean ret = FALSE;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
419
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
420 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
421 if (!bd) return FALSE;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
422
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
423 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
424
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
425 work = list;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
426 while (work)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
427 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
428 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(work->data));
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
429 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
430 if (!pd) continue;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
431
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
432 if (pd->pane_event && pd->pane_event(widget, event))
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
433 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
434 ret = TRUE;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
435 break;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
436 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
437 work = work->next;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
438 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
439 g_list_free(list);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
440 return ret;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
441 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
442
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
443 GtkWidget *bar_find_pane_by_id(GtkWidget *bar, PaneType type, const gchar *id)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
444 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
445 BarData *bd;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
446 GList *list, *work;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
447 GtkWidget *ret = NULL;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
448
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
449 if (!id || !id[0]) return NULL;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
450
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
451 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
452 if (!bd) return NULL;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
453
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
454 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
455
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
456 work = list;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
457 while (work)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
458 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
459 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(work->data));
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
460 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
461 if (!pd) continue;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
462
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
463 if (type == pd->type && strcmp(id, pd->id) == 0)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
464 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
465 ret = widget;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
466 break;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
467 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
468 work = work->next;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
469 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
470 g_list_free(list);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
471 return ret;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
472 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
473
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
474 void bar_clear(GtkWidget *bar)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
475 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
476 BarData *bd;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
477 GList *list, *work;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
478
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
479 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
480 if (!bd) return;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
481
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
482 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
483
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
484 work = list;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
485 while (work)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
486 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
487 GtkWidget *widget = work->data;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
488 gtk_widget_destroy(widget);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
489 work = work->next;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
490 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
491 g_list_free(list);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
492 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
493
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
494 void bar_write_config(GtkWidget *bar, GString *outstr, gint indent)
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
495 {
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
496 BarData *bd;
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
497 GList *list, *work;
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
498
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
499 if (!bar) return;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
500
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
501 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
502 if (!bd) return;
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
503
1461
8f4df7710af8 improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1417
diff changeset
504 WRITE_NL(); WRITE_STRING("<bar ");
1810
c3a79dda8ea7 GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents: 1802
diff changeset
505 write_bool_option(outstr, indent, "enabled", gtk_widget_get_visible(bar));
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
506 write_uint_option(outstr, indent, "width", bd->width);
1461
8f4df7710af8 improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1417
diff changeset
507 WRITE_STRING(">");
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
508
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
509 indent++;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
510 WRITE_NL(); WRITE_STRING("<clear/>");
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
511
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
512 list = gtk_container_get_children(GTK_CONTAINER(bd->vbox));
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
513 work = list;
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
514 while (work)
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
515 {
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
516 GtkWidget *expander = work->data;
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
517 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(expander));
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
518 PaneData *pd = g_object_get_data(G_OBJECT(widget), "pane_data");
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
519 if (!pd) continue;
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
520
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
521 pd->expanded = gtk_expander_get_expanded(GTK_EXPANDER(expander));
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
522
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
523 if (pd->pane_write_config)
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
524 pd->pane_write_config(widget, outstr, indent);
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
525
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
526 work = work->next;
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
527 }
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
528 g_list_free(list);
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
529 indent--;
1461
8f4df7710af8 improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1417
diff changeset
530 WRITE_NL(); WRITE_STRING("</bar>");
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
531 }
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
532
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
533 void bar_update_expander(GtkWidget *pane)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
534 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
535 PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data");
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
536 GtkWidget *expander;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
537
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
538 if (!pd) return;
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
539
2034
9297985567b5 use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 2021
diff changeset
540 expander = gtk_widget_get_parent(pane);
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
541
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
542 gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
543 }
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
544
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
545 void bar_add(GtkWidget *bar, GtkWidget *pane)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
546 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
547 GtkWidget *expander;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
548 BarData *bd = g_object_get_data(G_OBJECT(bar), "bar_data");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
549 PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data");
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
550
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
551 if (!bd) return;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
552
1387
add2c9869a56 simplified bar interface
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1383
diff changeset
553 pd->lw = bd->lw;
add2c9869a56 simplified bar interface
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1383
diff changeset
554 pd->bar = bar;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
555
1351
729bb282c441 fixed possible crash
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1350
diff changeset
556 expander = gtk_expander_new(NULL);
1343
9161a33c2cf3 give the panes more control over expander title
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1339
diff changeset
557 if (pd && pd->title)
9161a33c2cf3 give the panes more control over expander title
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1339
diff changeset
558 {
9161a33c2cf3 give the panes more control over expander title
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1339
diff changeset
559 gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title);
9161a33c2cf3 give the panes more control over expander title
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1339
diff changeset
560 gtk_widget_show(pd->title);
9161a33c2cf3 give the panes more control over expander title
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1339
diff changeset
561 }
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
562
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
563 gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
564
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
565 g_signal_connect(expander, "button_release_event", G_CALLBACK(bar_menu_cb), bd);
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
566
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
567 gtk_container_add(GTK_CONTAINER(expander), pane);
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
568
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
569 gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
570
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
571 gtk_widget_show(expander);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
572
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
573 if (bd->fd && pd && pd->pane_set_fd) pd->pane_set_fd(pane, bd->fd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
574
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
575 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
576
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
577 void bar_populate_default(GtkWidget *bar)
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
578 {
2500
eb2ce489ceea Fix #323: Rating system
Colin Clark <colin.clark@cclark.uk>
parents: 2498
diff changeset
579 const gchar *populate_id[] = {"histogram", "title", "keywords", "comment", "rating", "exif", NULL};
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
580 const gchar **id = populate_id;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
581
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
582 while (*id)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
583 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
584 const gchar *config = bar_pane_get_default_config(*id);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
585 if (config) load_config_from_buf(config, strlen(config), FALSE);
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
586 id++;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
587 }
1309
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
588 }
d89f8c4d593b config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1298
diff changeset
589
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
590 static void bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
591 {
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
592 BarData *bd = data;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
593
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
594 bd->width = allocation->width;
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
595 }
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
596
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
597 gint bar_get_width(GtkWidget *bar)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
598 {
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
599 BarData *bd;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
600
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
601 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
602 if (!bd) return 0;
1417
1c7a09253cac Tidy up.
Laurent Monin <geeqie@norz.org>
parents: 1389
diff changeset
603
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
604 return bd->width;
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
605 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
606
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
607 void bar_close(GtkWidget *bar)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
608 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
609 BarData *bd;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
610
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
611 bd = g_object_get_data(G_OBJECT(bar), "bar_data");
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
612 if (!bd) return;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
613
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
614 gtk_widget_destroy(bd->widget);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
615 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
616
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
617 static void bar_destroy(GtkWidget *widget, gpointer data)
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
618 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
619 BarData *bd = data;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
620
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
621 file_data_unref(bd->fd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
622 g_free(bd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
623 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
624
1766
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
625 #ifdef HAVE_LIBCHAMPLAIN_GTK
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
626 /*
1766
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
627 FIXME: this is an ugly hack that works around this bug:
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
628 https://bugzilla.gnome.org/show_bug.cgi?id=590692
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
629 http://bugzilla.openedhand.com/show_bug.cgi?id=1751
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
630 it should be removed as soon as a better solution exists
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
631 */
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
632
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
633 static void bar_unrealize_clutter_fix_cb(GtkWidget *widget, gpointer data)
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
634 {
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
635 GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget));
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
636 if (child) gtk_widget_unrealize(child);
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
637 }
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
638 #endif
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
639
1387
add2c9869a56 simplified bar interface
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1383
diff changeset
640 GtkWidget *bar_new(LayoutWindow *lw)
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
641 {
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
642 BarData *bd;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
643 GtkWidget *box;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
644 GtkWidget *scrolled;
2498
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
645 GtkWidget *tbar;
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
646 GtkWidget *add_box;
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
647
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
648 bd = g_new0(BarData, 1);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
649
1387
add2c9869a56 simplified bar interface
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1383
diff changeset
650 bd->lw = lw;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
651
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
652 bd->widget = gtk_vbox_new(FALSE, PREF_PAD_GAP);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
653 g_object_set_data(G_OBJECT(bd->widget), "bar_data", bd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
654 g_signal_connect(G_OBJECT(bd->widget), "destroy",
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
655 G_CALLBACK(bar_destroy), bd);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
656
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
657 g_signal_connect(G_OBJECT(bd->widget), "size-allocate",
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
658 G_CALLBACK(bar_size_allocate), bd);
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
659
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
660 g_signal_connect(G_OBJECT(bd->widget), "button_release_event", G_CALLBACK(bar_menu_cb), bd);
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
661
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
662 bd->width = SIDEBAR_DEFAULT_WIDTH;
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
663 gtk_widget_set_size_request(bd->widget, bd->width, -1);
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
664
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
665 box = gtk_hbox_new(FALSE, 0);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
666
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
667 bd->label_file_name = gtk_label_new("");
1355
7a47857edeb6 Add an ellipse when the file name is truncated.
Laurent Monin <geeqie@norz.org>
parents: 1354
diff changeset
668 gtk_label_set_ellipsize(GTK_LABEL(bd->label_file_name), PANGO_ELLIPSIZE_END);
1354
28c2903f56f4 In the side bar, display the filename without the 'Filename:' prefix and makes it centered. Allow to select it for copy'n'paste.
Laurent Monin <geeqie@norz.org>
parents: 1351
diff changeset
669 gtk_label_set_selectable(GTK_LABEL(bd->label_file_name), TRUE);
28c2903f56f4 In the side bar, display the filename without the 'Filename:' prefix and makes it centered. Allow to select it for copy'n'paste.
Laurent Monin <geeqie@norz.org>
parents: 1351
diff changeset
670 gtk_misc_set_alignment(GTK_MISC(bd->label_file_name), 0.5, 0.5);
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
671 gtk_box_pack_start(GTK_BOX(box), bd->label_file_name, TRUE, TRUE, 0);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
672 gtk_widget_show(bd->label_file_name);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
673
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
674 gtk_box_pack_start(GTK_BOX(bd->widget), box, FALSE, FALSE, 0);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
675 gtk_widget_show(box);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
676
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
677 scrolled = gtk_scrolled_window_new(NULL, NULL);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
678 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
1293
6546ca1fea07 separated "normal" and advanced exif, "Normal" exif is now in the
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1292
diff changeset
679 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
680 gtk_box_pack_start(GTK_BOX(bd->widget), scrolled, TRUE, TRUE, 0);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
681 gtk_widget_show(scrolled);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
682
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
683
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
684 bd->vbox = gtk_vbox_new(FALSE, 0);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
685 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), bd->vbox);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
686 gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(scrolled))), GTK_SHADOW_NONE);
1766
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
687
2498
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
688 add_box = gtk_vbox_new(FALSE, 0);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
689 gtk_box_pack_end(GTK_BOX(bd->widget), add_box, FALSE, FALSE, 0);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
690 tbar = pref_toolbar_new(add_box, GTK_TOOLBAR_ICONS);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
691 bd->add_button = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE,
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
692 _("Add Pane"),
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
693 G_CALLBACK(bar_menu_add_cb), bd);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
694 gtk_widget_show(add_box);
a05ba0d6135c Fix #490: Creating info sidebar panes
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
695
1766
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
696 #ifdef HAVE_LIBCHAMPLAIN_GTK
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
697 g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(scrolled))), "unrealize", G_CALLBACK(bar_unrealize_clutter_fix_cb), NULL);
1766
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
698 #endif
e73cffffcb89 added a workaround for https://bugzilla.gnome.org/show_bug.cgi?id=590692
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1604
diff changeset
699
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
700 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_NONE);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
701 gtk_widget_show(bd->vbox);
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
702 return bd->widget;
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
703 }
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
704
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
705
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
706 GtkWidget *bar_update_from_config(GtkWidget *bar, const gchar **attribute_names, const gchar **attribute_values)
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
707 {
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
708 gboolean enabled = TRUE;
1383
bdd15a0038dd use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1355
diff changeset
709 gint width = SIDEBAR_DEFAULT_WIDTH;
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
710
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
711 while (*attribute_names)
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
712 {
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
713 const gchar *option = *attribute_names++;
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
714 const gchar *value = *attribute_values++;
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
715
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
716 if (READ_BOOL_FULL("enabled", enabled)) continue;
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
717 if (READ_INT_FULL("width", width)) continue;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
718
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
719
1464
6c71e4a9d06a be more verbose on parse errors
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1461
diff changeset
720 log_printf("unknown attribute %s = %s\n", option, value);
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
721 }
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
722
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
723 gtk_widget_set_size_request(bar, width, -1);
2184
9cdebd070874 Trim trailing white spaces.
Laurent Monin <zas@norz.org>
parents: 2095
diff changeset
724 if (enabled)
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
725 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
726 gtk_widget_show(bar);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
727 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
728 else
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
729 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
730 gtk_widget_hide(bar);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
731 }
1317
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
732 return bar;
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
733 }
bb9d01551d6c simplified and improved bar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1314
diff changeset
734
1469
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
735 GtkWidget *bar_new_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values)
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
736 {
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
737 GtkWidget *bar = bar_new(lw);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
738 return bar_update_from_config(bar, attribute_names, attribute_values);
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
739 }
b9ef2bfd9d95 added a possibility to update existing bars from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1464
diff changeset
740
1389
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
741 GtkWidget *bar_pane_expander_title(const gchar *title)
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
742 {
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
743 GtkWidget *widget = gtk_label_new(title);
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
744
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
745 pref_label_bold(widget, TRUE, FALSE);
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
746 //gtk_label_set_ellipsize(GTK_LABEL(widget), PANGO_ELLIPSIZE_END); //FIXME: do not work
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
747
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
748 return widget;
f674e5503097 Use a common function bar_pane_expander_title() to set expanders title widget.
Laurent Monin <geeqie@norz.org>
parents: 1387
diff changeset
749 }
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
750
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
751 gboolean bar_pane_translate_title(PaneType type, const gchar *id, gchar **title)
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
752 {
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
753 const KnownPanes *pane = known_panes;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
754
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
755 if (!title) return FALSE;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
756 while (pane->id)
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
757 {
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
758 if (pane->type == type && strcmp(pane->id, id) == 0) break;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
759 pane++;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
760 }
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
761 if (!pane->id) return FALSE;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
762
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
763 if (*title && **title && strcmp(pane->title, *title) != 0) return FALSE;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
764
1471
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
765 g_free(*title);
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
766 *title = g_strdup(_(pane->title));
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
767 return TRUE;
89ed5df7dc28 update translated pane titles
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1469
diff changeset
768 }
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
769
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
770 const gchar *bar_pane_get_default_config(const gchar *id)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
771 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
772 const KnownPanes *pane = known_panes;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
773
1484
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
774 while (pane->id)
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
775 {
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
776 if (strcmp(pane->id, id) == 0) break;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
777 pane++;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
778 }
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
779 if (!pane->id) return NULL;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
780 return pane->config;
f3b033a71fc9 improved sidebar configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1471
diff changeset
781 }
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2184
diff changeset
782
1291
abf5d1de9102 replaced bar_info with an universal bar, restored the original
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
diff changeset
783 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */