annotate src/bar_info.c @ 1248:f3cb10d0ad0d

French translation was updated.
author zas_
date Sat, 24 Jan 2009 07:36:21 +0000
parents 947e603a52c6
children 8b89e3ff286b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 188
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 449
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 254
diff changeset
14 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #include "bar_info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 516
diff changeset
17 #include "filedata.h"
902
c414002a1f27 Move history_list_*() functions to separate files:
zas_
parents: 844
diff changeset
18 #include "history_list.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "info.h"
1178
f6449c17306b Move comments/keywords read and write stuff to new metadata.{c,h}.
zas_
parents: 1174
diff changeset
20 #include "metadata.h"
1022
9962b24b6b43 Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents: 995
diff changeset
21 #include "misc.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "ui_utildlg.h"
1022
9962b24b6b43 Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents: 995
diff changeset
25 #include "utilops.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 static const gchar *keyword_favorite_defaults[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 N_("Favorite"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 N_("Todo"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 N_("People"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 N_("Places"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 N_("Art"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 N_("Nature"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 N_("Possessions"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 NULL
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 static void bar_info_keyword_update_all(void);
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
40 static void bar_info_changed(GtkTextBuffer *buffer, gpointer data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 * keyword / comment utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
188
0584cb78aa14 write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents: 138
diff changeset
48
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 static gchar *comment_pull(GtkWidget *textview)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 GtkTextBuffer *buffer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 GtkTextIter start, end;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 427
diff changeset
53
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 gtk_text_buffer_get_bounds(buffer, &start, &end);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 427
diff changeset
56
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 return gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 GList *keyword_list_pull(GtkWidget *text_widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 {
1178
f6449c17306b Move comments/keywords read and write stuff to new metadata.{c,h}.
zas_
parents: 1174
diff changeset
62 GList *list;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 if (GTK_IS_TEXT_VIEW(text_widget))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 text = comment_pull(text_widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 else if (GTK_IS_ENTRY(text_widget))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 text = g_strdup(gtk_entry_get_text(GTK_ENTRY(text_widget)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 }
1178
f6449c17306b Move comments/keywords read and write stuff to new metadata.{c,h}.
zas_
parents: 1174
diff changeset
77
f6449c17306b Move comments/keywords read and write stuff to new metadata.{c,h}.
zas_
parents: 1174
diff changeset
78 list = string_to_keywords_list(text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 return list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 void keyword_list_push(GtkWidget *textview, GList *list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 GtkTextBuffer *buffer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 GtkTextIter start, end;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 gtk_text_buffer_get_bounds(buffer, &start, &end);
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
92 gtk_text_buffer_delete(buffer, &start, &end);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 const gchar *word = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 GtkTextIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 gtk_text_buffer_get_end_iter(buffer, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 if (word) gtk_text_buffer_insert(buffer, &iter, word, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 gtk_text_buffer_get_end_iter(buffer, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 gtk_text_buffer_insert(buffer, &iter, "\n", -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 list = list->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 * keyword list dialog
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 #define KEYWORD_DIALOG_WIDTH 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 #define KEYWORD_DIALOG_HEIGHT 250
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 typedef struct _KeywordDlg KeywordDlg;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 struct _KeywordDlg
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 GenericDialog *gd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 GtkWidget *treeview;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 static KeywordDlg *keyword_dialog = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 static void keyword_dialog_cancel_cb(GenericDialog *gd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 g_free(keyword_dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 keyword_dialog = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 static void keyword_dialog_ok_cb(GenericDialog *gd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 KeywordDlg *kd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 history_list_free_key("keywords");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 store = gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 valid = gtk_tree_model_get_iter_first(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 gchar *key;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 gtk_tree_model_get(store, &iter, 0, &key, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 valid = gtk_tree_model_iter_next(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 history_list_add_to_key("keywords", key, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 keyword_dialog_cancel_cb(gd, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 bar_info_keyword_update_all();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 static void keyword_dialog_add_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 KeywordDlg *kd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 GtkTreeIter sibling;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(kd->treeview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 if (gtk_tree_selection_get_selected(selection, &store, &sibling))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 gtk_list_store_insert_before(GTK_LIST_STORE(store), &iter, &sibling);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 store = gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 gtk_list_store_append(GTK_LIST_STORE(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 gtk_list_store_set(GTK_LIST_STORE(store), &iter, 1, TRUE, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 gtk_tree_view_set_cursor(GTK_TREE_VIEW(kd->treeview), tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 gtk_tree_view_get_column(GTK_TREE_VIEW(kd->treeview), 0), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 static void keyword_dialog_remove_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 KeywordDlg *kd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 GtkTreeIter next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(kd->treeview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 if (!gtk_tree_selection_get_selected(selection, &store, &iter)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 tpath = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 next = iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 if (gtk_tree_model_iter_next(store, &next))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 tpath = gtk_tree_model_get_path(store, &next);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 if (!gtk_tree_path_prev(tpath))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 tpath = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 if (tpath)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 gtk_tree_view_set_cursor(GTK_TREE_VIEW(kd->treeview), tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 gtk_tree_view_get_column(GTK_TREE_VIEW(kd->treeview), 0), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 gtk_list_store_remove(GTK_LIST_STORE(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 static void keyword_dialog_edit_cb(GtkCellRendererText *renderer, const gchar *path,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 const gchar *new_text, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 KeywordDlg *kd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 if (!new_text || strlen(new_text) == 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 store = gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 tpath = gtk_tree_path_new_from_string(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 gtk_list_store_set(GTK_LIST_STORE(store), &iter, 0, new_text, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 static void keyword_dialog_populate(KeywordDlg *kd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 gtk_list_store_clear(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 list = history_list_get_by_key("keywords");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 list = g_list_last(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 gtk_list_store_append(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 gtk_list_store_set(store, &iter, 0, list->data,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 1, TRUE, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 list = list->prev;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 static void keyword_dialog_show(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 GtkWidget *scrolled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 if (keyword_dialog)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 gtk_window_present(GTK_WINDOW(keyword_dialog->gd->dialog));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 keyword_dialog = g_new0(KeywordDlg, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 keyword_dialog->gd = generic_dialog_new(_("Keyword Presets"),
1174
0bea79d87065 Drop useless wmclass stuff. Gtk will take care of it and as said in the documentation using gtk_window_set_wmclass() is sort of pointless.
zas_
parents: 1148
diff changeset
284 "keyword_presets", NULL, TRUE,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 keyword_dialog_cancel_cb, keyword_dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 generic_dialog_add_message(keyword_dialog->gd, NULL, _("Favorite keywords list"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 generic_dialog_add_button(keyword_dialog->gd, GTK_STOCK_OK, NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 keyword_dialog_ok_cb, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 gtk_widget_set_size_request(scrolled, KEYWORD_DIALOG_WIDTH, KEYWORD_DIALOG_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 gtk_box_pack_start(GTK_BOX(keyword_dialog->gd->vbox), scrolled, TRUE, TRUE, 5);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 gtk_widget_show(scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 keyword_dialog->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(keyword_dialog->treeview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 gtk_tree_view_set_search_column(GTK_TREE_VIEW(keyword_dialog->treeview), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 gtk_tree_view_set_reorderable(GTK_TREE_VIEW(keyword_dialog->treeview), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 g_signal_connect(G_OBJECT(renderer), "edited",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 G_CALLBACK(keyword_dialog_edit_cb), keyword_dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 gtk_tree_view_column_add_attribute(column, renderer, "text", 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 gtk_tree_view_column_add_attribute(column, renderer, "editable", 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 gtk_tree_view_append_column(GTK_TREE_VIEW(keyword_dialog->treeview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 gtk_container_add(GTK_CONTAINER(scrolled), keyword_dialog->treeview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 gtk_widget_show(keyword_dialog->treeview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 hbox = gtk_hbox_new(FALSE, 5);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 gtk_box_pack_start(GTK_BOX(keyword_dialog->gd->vbox), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 button = gtk_button_new_from_stock(GTK_STOCK_ADD);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 g_signal_connect(G_OBJECT(button), "clicked",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 G_CALLBACK(keyword_dialog_add_cb), keyword_dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 g_signal_connect(G_OBJECT(button), "clicked",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 G_CALLBACK(keyword_dialog_remove_cb), keyword_dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 keyword_dialog_populate(keyword_dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 gtk_widget_show(keyword_dialog->gd->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 static void bar_keyword_edit_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 keyword_dialog_show();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 * info bar
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 BAR_SORT_COPY,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 BAR_SORT_MOVE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 BAR_SORT_LINK
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 } SortActionType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 KEYWORD_COLUMN_TOGGLE = 0,
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
362 KEYWORD_COLUMN_TEXT,
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
363 KEYWORD_COLUMN_MARK
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 typedef struct _BarInfoData BarInfoData;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 struct _BarInfoData
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 GtkWidget *group_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 GtkWidget *label_file_name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 GtkWidget *label_file_time;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 GtkWidget *keyword_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 GtkWidget *keyword_treeview;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 GtkWidget *comment_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
379 #if 0
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 GtkWidget *button_save;
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
381 #endif
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
382 GtkWidget *button_set_keywords_add;
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
383 GtkWidget *button_set_keywords_replace;
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
384 GtkWidget *button_set_comment_add;
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
385 GtkWidget *button_set_comment_replace;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
387 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 GList *(*list_func)(gpointer);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 gpointer list_data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 static GList *bar_list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 static void bar_info_write(BarInfoData *bd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 gchar *comment;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
402 if (!bd->fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 list = keyword_list_pull(bd->keyword_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 comment = comment_pull(bd->comment_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406
1234
31f50c1b6a9a write keywords and comments with separate functions
nadvornik
parents: 1223
diff changeset
407 metadata_write_string(bd->fd, COMMENT_KEY, comment);
31f50c1b6a9a write keywords and comments with separate functions
nadvornik
parents: 1223
diff changeset
408 metadata_write_list(bd->fd, KEYWORD_KEY, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
410 string_list_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 g_free(comment);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
414 static gchar *bar_info_get_mark_text(const gchar *key)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
415 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
416 gint i;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
417 static gchar buf[10];
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
418
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
419 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
420 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
421 FileDataGetMarkFunc get_mark_func;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
422 FileDataSetMarkFunc set_mark_func;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
423 gpointer data;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
424 file_data_get_registered_mark_func(i, &get_mark_func, &set_mark_func, &data);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
425 if (get_mark_func == meta_data_get_keyword_mark && strcmp(data, key) == 0)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
426 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
427 sprintf(buf, " %d ", i + 1);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
428 return buf;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
429 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
430 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
431 return " ... ";
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
432 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
433
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 static void bar_keyword_list_sync(BarInfoData *bd, GList *keywords)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 list = history_list_get_by_key("keywords");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 /* blank? set up a few example defaults */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 gint i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 while (keyword_favorite_defaults[i] != NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 history_list_add_to_key("keywords", _(keyword_favorite_defaults[i]), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 list = history_list_get_by_key("keywords");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(bd->keyword_treeview)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 gtk_list_store_clear(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 list = g_list_last(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 gchar *key = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 gtk_list_store_append(store, &iter);
1193
aed0e28b2744 keyword_list_find() -> find_string_in_list(), return gboolean.
zas_
parents: 1192
diff changeset
466 gtk_list_store_set(store, &iter, KEYWORD_COLUMN_TOGGLE, find_string_in_list(keywords, key),
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
467 KEYWORD_COLUMN_TEXT, key,
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
468 KEYWORD_COLUMN_MARK, bar_info_get_mark_text(key), -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 list = list->prev;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 static void bar_info_keyword_update_all(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 work = bar_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 GList *keywords;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 bd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 keywords = keyword_list_pull(bd->keyword_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 bar_keyword_list_sync(bd, keywords);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
489 string_list_free(keywords);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493 static void bar_info_update(BarInfoData *bd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 GList *keywords = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496 gchar *comment = NULL;
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
497 GtkTextBuffer *keyword_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->keyword_view));
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
498 GtkTextBuffer *comment_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->comment_view));
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
499
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
500 g_signal_handlers_block_by_func(keyword_buffer, bar_info_changed, bd);
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
501 g_signal_handlers_block_by_func(comment_buffer, bar_info_changed, bd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 if (bd->label_file_name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
505 gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : "");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 if (bd->label_file_time)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
509 gtk_label_set_text(GTK_LABEL(bd->label_file_time), (bd->fd) ? text_from_time(bd->fd->date) : "");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511
1238
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
512 comment = metadata_read_string(bd->fd, COMMENT_KEY);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
513 gtk_text_buffer_set_text(comment_buffer,
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
514 (comment) ? comment : "", -1);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
515 g_free(comment);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
516
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
517 keywords = metadata_read_list(bd->fd, KEYWORD_KEY);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
518 keyword_list_push(bd->keyword_view, keywords);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
519 bar_keyword_list_sync(bd, keywords);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
520 string_list_free(keywords);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
521
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
522 g_signal_handlers_unblock_by_func(keyword_buffer, bar_info_changed, bd);
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
523 g_signal_handlers_unblock_by_func(comment_buffer, bar_info_changed, bd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
525 gtk_widget_set_sensitive(bd->group_box, (bd->fd != NULL));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
528 void bar_info_set(GtkWidget *bar, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 bd = g_object_get_data(G_OBJECT(bar), "bar_info_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 if (!bd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
535 file_data_unref(bd->fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
536 bd->fd = file_data_ref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 bar_info_update(bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
541 void bar_info_maint_renamed(GtkWidget *bar, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 bd = g_object_get_data(G_OBJECT(bar), "bar_info_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
546 if (!bd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
548 file_data_unref(bd->fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
549 bd->fd = file_data_ref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 if (bd->label_file_name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
553 gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : "");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 gint bar_info_event(GtkWidget *bar, GdkEvent *event)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 bd = g_object_get_data(G_OBJECT(bar), "bar_info_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 if (!bd) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564 if (GTK_WIDGET_HAS_FOCUS(bd->keyword_view)) return gtk_widget_event(bd->keyword_view, event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 if (GTK_WIDGET_HAS_FOCUS(bd->comment_view)) return gtk_widget_event(bd->comment_view, event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 static void bar_info_keyword_set(BarInfoData *bd, const gchar *keyword, gint active)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 gint found;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 if (!keyword) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 list = keyword_list_pull(bd->keyword_view);
1193
aed0e28b2744 keyword_list_find() -> find_string_in_list(), return gboolean.
zas_
parents: 1192
diff changeset
578 found = find_string_in_list(list, keyword);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 if (active != found)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 if (found)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 GList *work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 gchar *key = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 if (key && keyword && strcmp(key, keyword) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 list = g_list_remove(list, key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 g_free(key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 list = g_list_append(list, g_strdup(keyword));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 keyword_list_push(bd->keyword_view, list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
606 string_list_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 static void bar_info_keyword_toggle(GtkCellRendererToggle *toggle, const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 BarInfoData *bd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 gchar *key = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 gboolean active;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 store = gtk_tree_view_get_model(GTK_TREE_VIEW(bd->keyword_treeview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 tpath = gtk_tree_path_new_from_string(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 gtk_tree_model_get(store, &iter, KEYWORD_COLUMN_TOGGLE, &active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 KEYWORD_COLUMN_TEXT, &key, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 active = (!active);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 gtk_list_store_set(GTK_LIST_STORE(store), &iter, KEYWORD_COLUMN_TOGGLE, active, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 bar_info_keyword_set(bd, key, active);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 g_free(key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632
1192
48d62a7e3c33 metadata_set_keywords() -> metadata_set(). Use gboolean type for boolean parameters.
zas_
parents: 1191
diff changeset
633 static void bar_info_set_selection(BarInfoData *bd, gboolean set_keywords, gboolean set_comment, gboolean append)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 {
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
635 GList *keywords = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 GList *work;
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
638 gchar *comment = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 if (!bd->list_func) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
642 if (set_keywords)
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
643 {
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
644 keywords = keyword_list_pull(bd->keyword_view);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
645 }
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
646
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
647 if (set_comment)
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
648 {
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
649 comment = comment_pull(bd->comment_view);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
650 }
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
651
1192
48d62a7e3c33 metadata_set_keywords() -> metadata_set(). Use gboolean type for boolean parameters.
zas_
parents: 1191
diff changeset
652 if (append && !keywords && !comment) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 list = bd->list_func(bd->list_data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
658 FileData *fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660
1238
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
661 if (append)
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
662 {
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
663 if (comment) metadata_append_string(fd, COMMENT_KEY, comment);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
664 if (keywords) metadata_append_list(fd, KEYWORD_KEY, keywords);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
665 }
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
666 else
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
667 {
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
668 if (comment) metadata_write_string(fd, COMMENT_KEY, comment);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
669 if (keywords) metadata_write_list(fd, KEYWORD_KEY, keywords);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1234
diff changeset
670 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
673 filelist_free(list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
674 string_list_free(keywords);
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
675 g_free(comment);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
678 static void bar_info_set_keywords_add(GtkWidget *button, gpointer data)
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
679 {
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
680 BarInfoData *bd = data;
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
681
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
682 bar_info_set_selection(bd, TRUE, FALSE, TRUE);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
683 }
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
684
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
685 static void bar_info_set_keywords_replace(GtkWidget *button, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 BarInfoData *bd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
689 bar_info_set_selection(bd, TRUE, FALSE, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
692 static void bar_info_set_comment_add(GtkWidget *button, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 BarInfoData *bd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
696 bar_info_set_selection(bd, FALSE, TRUE, TRUE);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
697 }
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
698
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
699 static void bar_info_set_comment_replace(GtkWidget *button, gpointer data)
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
700 {
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
701 BarInfoData *bd = data;
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
702
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
703 bar_info_set_selection(bd, FALSE, TRUE, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705
1219
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
706 static void bar_info_notify_cb(FileData *fd, NotifyType type, gpointer data)
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
707 {
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
708 BarInfoData *bd = data;
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
709 if (fd == bd->fd) bar_info_update(bd);
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
710 }
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
711
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 static void bar_info_changed(GtkTextBuffer *buffer, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 BarInfoData *bd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715
1219
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
716 file_data_unregister_notify_func(bar_info_notify_cb, bd);
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
717 bar_info_write(bd);
1219
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
718 file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
721 static void bar_info_mark_edited (GtkCellRendererText *cell, const gchar *path, const gchar *text, gpointer data)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
722 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
723 BarInfoData *bd = data;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
724 GtkTreeModel *store;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
725 GtkTreeIter iter;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
726 GtkTreePath *tpath;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
727 gchar *key = NULL;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
728 gint i;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
729 FileDataGetMarkFunc get_mark_func;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
730 FileDataSetMarkFunc set_mark_func;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
731 gpointer mark_func_data;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
732
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
733 file_data_unregister_notify_func(bar_info_notify_cb, bd);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
734
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
735 store = gtk_tree_view_get_model(GTK_TREE_VIEW(bd->keyword_treeview));
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
736
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
737 tpath = gtk_tree_path_new_from_string(path);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
738 gtk_tree_model_get_iter(store, &iter, tpath);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
739 gtk_tree_path_free(tpath);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
740
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
741 gtk_tree_model_get(store, &iter, KEYWORD_COLUMN_TEXT, &key, -1);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
742
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
743 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
744 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
745 file_data_get_registered_mark_func(i, &get_mark_func, &set_mark_func, &mark_func_data);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
746 if (get_mark_func == meta_data_get_keyword_mark && strcmp(mark_func_data, key) == 0)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
747 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
748 g_free(mark_func_data);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
749 file_data_register_mark_func(i, NULL, NULL, NULL);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
750 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
751 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
752
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
753 if (sscanf(text, " %d ", &i) &&i >=1 && i <= FILEDATA_MARKS_SIZE)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
754 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
755 i--;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
756 file_data_get_registered_mark_func(i, &get_mark_func, &set_mark_func, &mark_func_data);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
757 if (get_mark_func == meta_data_get_keyword_mark && mark_func_data) g_free(mark_func_data);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
758 file_data_register_mark_func(i, meta_data_get_keyword_mark, meta_data_set_keyword_mark, g_strdup(key));
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
759 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
760
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
761 g_free(key);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
762
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
763 file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
764 bar_info_update(bd);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
765 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
766
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 void bar_info_close(GtkWidget *bar)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 bd = g_object_get_data(G_OBJECT(bar), "bar_info_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 if (!bd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 gtk_widget_destroy(bd->vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 static void bar_info_destroy(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 BarInfoData *bd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
780
1219
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
781 file_data_unregister_notify_func(bar_info_notify_cb, bd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 bar_list = g_list_remove(bar_list, bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
784 file_data_unref(bd->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 g_free(bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
789 static GtkTreeModel *create_marks_list(void)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
790 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
791 GtkListStore *model;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
792 GtkTreeIter iter;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
793 gint i;
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
794
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
795 /* create list store */
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
796 model = gtk_list_store_new (1, G_TYPE_STRING);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
797 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
798 {
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
799 char str[10];
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
800 sprintf(str, " %d ", i + 1);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
801 gtk_list_store_append (model, &iter);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
802 gtk_list_store_set(model, &iter, 0, str, -1);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
803 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
804 gtk_list_store_append (model, &iter);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
805 gtk_list_store_set(model, &iter, 0, " ... ", -1);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
806 return GTK_TREE_MODEL (model);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
807 }
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
808
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
809 GtkWidget *bar_info_new(FileData *fd, gint metadata_only, GtkWidget *bounding_widget)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 GtkWidget *box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 GtkWidget *scrolled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 GtkTextBuffer *buffer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 GtkWidget *tbar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 bd = g_new0(BarInfoData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 bd->list_func = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 bd->list_data = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 bd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 g_object_set_data(G_OBJECT(bd->vbox), "bar_info_data", bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 g_signal_connect(G_OBJECT(bd->vbox), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 G_CALLBACK(bar_info_destroy), bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 if (!metadata_only)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 hbox = pref_box_new(bd->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 label = sizer_new(bd->vbox, bounding_widget, SIZER_POS_LEFT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841 label = gtk_label_new(_("Keywords"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 bd->group_box = pref_box_new(bd->vbox, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 if (!metadata_only)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 table = pref_table_new(bd->group_box, 2, 2, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 bd->label_file_name = table_add_line(table, 0, 0, _("Filename:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 bd->label_file_time = table_add_line(table, 0, 1, _("File date:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 bd->label_file_name = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 bd->label_file_time = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864 table = gtk_table_new(3, 1, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 gtk_table_set_row_spacings(GTK_TABLE(table), PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 gtk_box_pack_start(GTK_BOX(bd->group_box), table, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 gtk_widget_show(table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869 /* keyword entry */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 gtk_table_attach(GTK_TABLE(table), box, 0, 1, 0, 2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874 gtk_widget_show(box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 label = pref_label_new(box, _("Keywords:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 hbox = pref_box_new(box, TRUE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882 scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886 gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 gtk_widget_show(scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 bd->keyword_view = gtk_text_view_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 gtk_container_add(GTK_CONTAINER(scrolled), bd->keyword_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 gtk_widget_show(bd->keyword_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->keyword_view));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894 g_signal_connect(G_OBJECT(buffer), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 G_CALLBACK(bar_info_changed), bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902 gtk_widget_show(scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
904 store = gtk_list_store_new(3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 bd->keyword_treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(bd->keyword_treeview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
910 if (metadata_only)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 gtk_tree_view_set_search_column(GTK_TREE_VIEW(bd->keyword_treeview), KEYWORD_COLUMN_TEXT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
913 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
914 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(bd->keyword_treeview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922 renderer = gtk_cell_renderer_toggle_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923 gtk_tree_view_column_pack_start(column, renderer, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924 gtk_tree_view_column_add_attribute(column, renderer, "active", KEYWORD_COLUMN_TOGGLE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 g_signal_connect(G_OBJECT(renderer), "toggled",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
926 G_CALLBACK(bar_info_keyword_toggle), bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
927
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
929 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
930 gtk_tree_view_column_add_attribute(column, renderer, "text", KEYWORD_COLUMN_TEXT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
931
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
932 gtk_tree_view_append_column(GTK_TREE_VIEW(bd->keyword_treeview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
933
1223
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
934 column = gtk_tree_view_column_new();
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
935 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
936
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
937 renderer = gtk_cell_renderer_combo_new();
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
938 g_object_set(G_OBJECT(renderer), "editable", (gboolean)TRUE,
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
939 "model", create_marks_list(),
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
940 "text-column", 0,
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
941 "has-entry", FALSE,
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
942 NULL);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
943
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
944 gtk_tree_view_column_pack_start(column, renderer, TRUE);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
945 gtk_tree_view_column_add_attribute(column, renderer, "text", KEYWORD_COLUMN_MARK);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
946 g_signal_connect (renderer, "edited",
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
947 G_CALLBACK (bar_info_mark_edited), bd);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
948 gtk_tree_view_append_column(GTK_TREE_VIEW(bd->keyword_treeview), column);
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
949
18d08b10b80e implemented a possibility to connect keywords with marks
nadvornik
parents: 1220
diff changeset
950
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951 gtk_container_add(GTK_CONTAINER(scrolled), bd->keyword_treeview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952 gtk_widget_show(bd->keyword_treeview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
953
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
954 /* comment entry */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
955
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
956 box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
957 gtk_table_attach(GTK_TABLE(table), box, 0, 1, 2, 3,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
958 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
959 gtk_widget_show(box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
960
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
961 label = pref_label_new(box, _("Comment:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
962 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
963 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
964
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
965 scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
966 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
967 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
968 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
969 gtk_box_pack_start(GTK_BOX(box), scrolled, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
970 gtk_widget_show(scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
971
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
972 bd->comment_view = gtk_text_view_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
973 gtk_container_add(GTK_CONTAINER(scrolled), bd->comment_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
974 gtk_widget_show(bd->comment_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
975
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
976 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->comment_view));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
977 g_signal_connect(G_OBJECT(buffer), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
978 G_CALLBACK(bar_info_changed), bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
979
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
980 /* toolbar */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
981
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
982 tbar = pref_toolbar_new(bd->group_box, GTK_TOOLBAR_ICONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
983
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
984 pref_toolbar_button(tbar, GTK_STOCK_INDEX, NULL, FALSE,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
985 _("Edit favorite keywords list."),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
986 G_CALLBACK(bar_keyword_edit_cb), bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
987 pref_toolbar_spacer(tbar);
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
988 bd->button_set_keywords_add = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
989 _("Add keywords to selected files"),
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
990 G_CALLBACK(bar_info_set_keywords_add), bd);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
991 bd->button_set_keywords_replace = pref_toolbar_button(tbar, GTK_STOCK_CONVERT, NULL, FALSE,
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
992 _("Add keywords to selected files, replacing existing ones"),
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
993 G_CALLBACK(bar_info_set_keywords_replace), bd);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
994 bd->button_set_comment_add = pref_toolbar_button(tbar, GTK_STOCK_DND_MULTIPLE, NULL, FALSE,
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
995 _("Add comment to selected files"),
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
996 G_CALLBACK(bar_info_set_comment_add), bd);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
997 bd->button_set_comment_replace = pref_toolbar_button(tbar, GTK_STOCK_DND, NULL, FALSE,
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
998 _("Add comment to selected files, replacing existing one"),
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
999 G_CALLBACK(bar_info_set_comment_replace), bd);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
1000
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
1001 #if 0
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1002 pref_toolbar_spacer(tbar);
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1003 bd->button_save = pref_toolbar_button(tbar, GTK_STOCK_SAVE, NULL, FALSE,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1004 _("Save comment now"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1005 G_CALLBACK(bar_info_save), bd);
1217
70f1d002436f write changes immediately, the necessary buffering is done on lower
nadvornik
parents: 1193
diff changeset
1006 #endif
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1007
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 41
diff changeset
1008 bd->fd = file_data_ref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1009 bar_info_update(bd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1010
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1011 bar_info_selection(bd->vbox, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1012
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1013 bar_list = g_list_append(bar_list, bd);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 427
diff changeset
1014
1219
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
1015 file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW);
86fcbd0fcb7b added change notification to bar_info.c
nadvornik
parents: 1217
diff changeset
1016
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1017 return bd->vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1018 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1019
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1020 void bar_info_set_selection_func(GtkWidget *bar, GList *(*list_func)(gpointer data), gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1021 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1022 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1023
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1024 bd = g_object_get_data(G_OBJECT(bar), "bar_info_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1025 if (!bd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1026
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1027 bd->list_func = list_func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1028 bd->list_data = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1029 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1030
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1031 void bar_info_selection(GtkWidget *bar, gint count)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1032 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1033 BarInfoData *bd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1034 gint enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1035
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1036 bd = g_object_get_data(G_OBJECT(bar), "bar_info_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1037 if (!bd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1038
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1039 enable = (count > 0 && bd->list_func != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1040
595
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
1041 gtk_widget_set_sensitive(bd->button_set_keywords_add, enable);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
1042 gtk_widget_set_sensitive(bd->button_set_keywords_replace, enable);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
1043 gtk_widget_set_sensitive(bd->button_set_comment_add, enable);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
1044 gtk_widget_set_sensitive(bd->button_set_comment_replace, enable);
15766932414c Allow the user to append or replace comments for a group of selected files.
zas_
parents: 594
diff changeset
1045
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1046 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1051
diff changeset
1047 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */