diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-28 07:28:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-28 07:28:13 +0000 |
commit | b0a102d6424a4503e04d4077ee37fc5916df7c62 (patch) | |
tree | 099593002af8ff2a17cc36b5fe14acbd543b83da | |
parent | 34415f9534f9f42b0a538b1bb22fc039ce670a76 (diff) | |
download | gnunet-gtk-b0a102d6424a4503e04d4077ee37fc5916df7c62.tar.gz gnunet-gtk-b0a102d6424a4503e04d4077ee37fc5916df7c62.zip |
-vminko: fixing #2129
-rw-r--r-- | src/fs/gnunet-fs-gtk.h | 109 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_advertise-pseudonym.c | 36 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_anonymity-widgets.c | 11 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_common.c | 31 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 486 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c | 7 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c | 54 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_main-window-search.c | 10 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-dialog.c | 300 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-edit-dialog.c | 184 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk.c | 70 | ||||
-rw-r--r-- | src/setup/gnunet-setup-hostlist-editing.c | 10 | ||||
-rw-r--r-- | src/setup/gnunet-setup-options.c | 68 | ||||
-rw-r--r-- | src/setup/gnunet-setup.h | 50 |
14 files changed, 1104 insertions, 322 deletions
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h index 5fe13213..2ac6fdf0 100644 --- a/src/fs/gnunet-fs-gtk.h +++ b/src/fs/gnunet-fs-gtk.h | |||
@@ -60,6 +60,115 @@ struct GNUNET_GTK_MainWindowContext | |||
60 | gulong ns_manager_delete_handler_id; | 60 | gulong ns_manager_delete_handler_id; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | |||
64 | /** | ||
65 | * Columns in the search namespace model. | ||
66 | */ | ||
67 | enum GNUNET_GTK_FS_MAIN_WINDOW_SearchNamespaceModelColumns | ||
68 | { | ||
69 | /** | ||
70 | * A gchararray. | ||
71 | */ | ||
72 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME = 0, | ||
73 | |||
74 | /** | ||
75 | * A gpointer. | ||
76 | */ | ||
77 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY = 1, | ||
78 | |||
79 | /** | ||
80 | * A gchararray. | ||
81 | */ | ||
82 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT = 2, | ||
83 | |||
84 | /** | ||
85 | * A gchararray. | ||
86 | */ | ||
87 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP = 3, | ||
88 | }; | ||
89 | |||
90 | |||
91 | /** | ||
92 | * Columns in the meta data model. | ||
93 | */ | ||
94 | enum GNUNET_GTK_FS_MAIN_WINDOW_MetaDataModelColumns | ||
95 | { | ||
96 | /** | ||
97 | * A guint. | ||
98 | */ | ||
99 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE = 0, | ||
100 | |||
101 | /** | ||
102 | * A guint. | ||
103 | */ | ||
104 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT = 1, | ||
105 | |||
106 | /** | ||
107 | * A gchararray. | ||
108 | */ | ||
109 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING = 2, | ||
110 | |||
111 | /** | ||
112 | * A gchararray. | ||
113 | */ | ||
114 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE = 3, | ||
115 | }; | ||
116 | |||
117 | |||
118 | /** | ||
119 | * Columns in the anonymity level model. | ||
120 | */ | ||
121 | enum GNUNET_GTK_FS_MAIN_WINDOW_AnonymityLevelModelColumns | ||
122 | { | ||
123 | /** | ||
124 | * A gchararray. | ||
125 | */ | ||
126 | GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_NAME = 0, | ||
127 | |||
128 | /** | ||
129 | * A guint. | ||
130 | */ | ||
131 | GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_LEVEL = 1, | ||
132 | |||
133 | /** | ||
134 | * A gchararray. | ||
135 | */ | ||
136 | GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_COLOR = 2, | ||
137 | }; | ||
138 | |||
139 | |||
140 | /** | ||
141 | * Columns in the search mime model. | ||
142 | */ | ||
143 | enum GNUNET_GTK_FS_MAIN_WINDOW_SearchMimeModelColumns | ||
144 | { | ||
145 | /** | ||
146 | * A gchararray. | ||
147 | */ | ||
148 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME = 0, | ||
149 | |||
150 | /** | ||
151 | * A gchararray. | ||
152 | */ | ||
153 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_TYPE = 1, | ||
154 | |||
155 | /** | ||
156 | * A gchararray. | ||
157 | */ | ||
158 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_EXTENSION = 2, | ||
159 | |||
160 | /** | ||
161 | * A gchararray. | ||
162 | */ | ||
163 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_LOSSYNESS = 3, | ||
164 | |||
165 | /** | ||
166 | * A gchararray. | ||
167 | */ | ||
168 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_FREEDOM = 4, | ||
169 | }; | ||
170 | |||
171 | |||
63 | /** | 172 | /** |
64 | * Get our configuration. | 173 | * Get our configuration. |
65 | */ | 174 | */ |
diff --git a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c index 942ae563..42ab0ca8 100644 --- a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c +++ b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c | |||
@@ -30,6 +30,23 @@ | |||
30 | #include "gnunet-fs-gtk_publish-edit-dialog.h" | 30 | #include "gnunet-fs-gtk_publish-edit-dialog.h" |
31 | 31 | ||
32 | 32 | ||
33 | /** | ||
34 | * Columns in the select pseudonym model. | ||
35 | */ | ||
36 | enum FS_SelectPseudonymModelColumns | ||
37 | { | ||
38 | /** | ||
39 | * A gchararray | ||
40 | */ | ||
41 | FS_SELECT_PSEUDONYM_NAMESPACE_NAME = 0, | ||
42 | |||
43 | /** | ||
44 | * A gpointer | ||
45 | */ | ||
46 | FS_SELECT_PSEUDONYM_NAMESPACE_HANDLE = 1, | ||
47 | }; | ||
48 | |||
49 | |||
33 | /* *************************** handlers run on closing of the dialog ********************** */ | 50 | /* *************************** handlers run on closing of the dialog ********************** */ |
34 | 51 | ||
35 | 52 | ||
@@ -156,13 +173,15 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog, | |||
156 | g_object_unref (G_OBJECT (builder)); | 173 | g_object_unref (G_OBJECT (builder)); |
157 | return; | 174 | return; |
158 | } | 175 | } |
159 | gtk_tree_model_get (tm, &iter, 1, &ns, -1); | 176 | gtk_tree_model_get (tm, &iter, |
177 | FS_SELECT_PSEUDONYM_NAMESPACE_MC_HANDLE, &ns, -1); | ||
160 | /* free all namespaces from list store except "ns" */ | 178 | /* free all namespaces from list store except "ns" */ |
161 | if (gtk_tree_model_get_iter_first (tm, &iter)) | 179 | if (gtk_tree_model_get_iter_first (tm, &iter)) |
162 | { | 180 | { |
163 | do | 181 | do |
164 | { | 182 | { |
165 | gtk_tree_model_get (tm, &iter, 1, &nso, -1); | 183 | gtk_tree_model_get (tm, &iter, |
184 | FS_SELECT_PSEUDONYM_NAMESPACE_MC_HANDLE, &nso, -1); | ||
166 | if (ns != nso) | 185 | if (ns != nso) |
167 | GNUNET_FS_namespace_delete (nso, GNUNET_NO); | 186 | GNUNET_FS_namespace_delete (nso, GNUNET_NO); |
168 | } | 187 | } |
@@ -218,7 +237,8 @@ GNUNET_GTK_select_pseudonym_dialog_delete_event_cb (GtkWidget *widget, | |||
218 | { | 237 | { |
219 | struct GNUNET_FS_Namespace *nso; | 238 | struct GNUNET_FS_Namespace *nso; |
220 | 239 | ||
221 | gtk_tree_model_get (tm, &iter, 1, &nso, -1); | 240 | gtk_tree_model_get (tm, &iter, |
241 | FS_SELECT_PSEUDONYM_NAMESPACE_HANDLE, &nso, -1); | ||
222 | GNUNET_FS_namespace_delete (nso, GNUNET_NO); | 242 | GNUNET_FS_namespace_delete (nso, GNUNET_NO); |
223 | } | 243 | } |
224 | while (gtk_tree_model_iter_next (tm, &iter)); | 244 | while (gtk_tree_model_iter_next (tm, &iter)); |
@@ -250,10 +270,12 @@ add_to_list (void *cls, | |||
250 | GtkListStore *ls = cls; | 270 | GtkListStore *ls = cls; |
251 | GtkTreeIter iter; | 271 | GtkTreeIter iter; |
252 | 272 | ||
253 | gtk_list_store_insert_with_values (ls, &iter, -1, | 273 | gtk_list_store_insert_with_values (ls, &iter, -1, |
254 | 0, name, | 274 | FS_SELECT_PSEUDONYM_NAMESPACE_MC_NAME, |
255 | 1, GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), | 275 | name, |
256 | name), | 276 | FS_SELECT_PSEUDONYM_NAMESPACE_MC_HANDLE, |
277 | GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), | ||
278 | name), | ||
257 | -1); | 279 | -1); |
258 | } | 280 | } |
259 | 281 | ||
diff --git a/src/fs/gnunet-fs-gtk_anonymity-widgets.c b/src/fs/gnunet-fs-gtk_anonymity-widgets.c index 82fe26ca..2dca9747 100644 --- a/src/fs/gnunet-fs-gtk_anonymity-widgets.c +++ b/src/fs/gnunet-fs-gtk_anonymity-widgets.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * @brief operations to manage user's anonymity level selections | 24 | * @brief operations to manage user's anonymity level selections |
25 | */ | 25 | */ |
26 | #include "gnunet-fs-gtk.h" | ||
26 | #include "gnunet-fs-gtk_common.h" | 27 | #include "gnunet-fs-gtk_common.h" |
27 | #include "gnunet-fs-gtk_anonymity-widgets.h" | 28 | #include "gnunet-fs-gtk_anonymity-widgets.h" |
28 | #include <gdk/gdk.h> | 29 | #include <gdk/gdk.h> |
@@ -112,7 +113,10 @@ GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox *combo, guint *p_leve | |||
112 | model = gtk_combo_box_get_model (combo); | 113 | model = gtk_combo_box_get_model (combo); |
113 | if (!model) | 114 | if (!model) |
114 | return FALSE; | 115 | return FALSE; |
115 | gtk_tree_model_get (model, &iter, 1, &level, -1); | 116 | gtk_tree_model_get (model, &iter, |
117 | GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_LEVEL, | ||
118 | &level, | ||
119 | -1); | ||
116 | if (p_level) | 120 | if (p_level) |
117 | *p_level = level; | 121 | *p_level = level; |
118 | return TRUE; | 122 | return TRUE; |
@@ -161,7 +165,10 @@ GNUNET_GTK_select_anonymity_combo_level (GtkComboBox *combo, guint sel_level) | |||
161 | return FALSE; | 165 | return FALSE; |
162 | do | 166 | do |
163 | { | 167 | { |
164 | gtk_tree_model_get (model, &iter, 1, &level, -1); | 168 | gtk_tree_model_get (model, &iter, |
169 | GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_LEVEL, | ||
170 | &level, | ||
171 | -1); | ||
165 | if (level == sel_level) | 172 | if (level == sel_level) |
166 | { | 173 | { |
167 | gtk_combo_box_set_active_iter (combo, &iter); | 174 | gtk_combo_box_set_active_iter (combo, &iter); |
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c index d671a40d..1a8aa15c 100644 --- a/src/fs/gnunet-fs-gtk_common.c +++ b/src/fs/gnunet-fs-gtk_common.c | |||
@@ -106,9 +106,16 @@ GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const char *plugin_name, | |||
106 | data_to_insert = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len); | 106 | data_to_insert = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len); |
107 | if (NULL == data_to_insert) | 107 | if (NULL == data_to_insert) |
108 | return 0; | 108 | return 0; |
109 | gtk_list_store_insert_with_values (ls, NULL, G_MAXINT, 0, type, 1, format, | 109 | gtk_list_store_insert_with_values (ls, NULL, G_MAXINT, |
110 | 2, EXTRACTOR_metatype_to_string (type), | 110 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE, |
111 | 3, data_to_insert, -1); | 111 | type, |
112 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT, | ||
113 | format, | ||
114 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING, | ||
115 | EXTRACTOR_metatype_to_string (type), | ||
116 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE, | ||
117 | data_to_insert, | ||
118 | -1); | ||
112 | GNUNET_free (data_to_insert); | 119 | GNUNET_free (data_to_insert); |
113 | return 0; | 120 | return 0; |
114 | } | 121 | } |
@@ -353,16 +360,18 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri, | |||
353 | return; | 360 | return; |
354 | } | 361 | } |
355 | gtk_tree_model_get (namespace_treestore, &iter, | 362 | gtk_tree_model_get (namespace_treestore, &iter, |
356 | 1, &nsid, | 363 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, |
357 | -1); | 364 | &nsid, |
365 | -1); | ||
358 | while ( ( (NULL == nsid) || | 366 | while ( ( (NULL == nsid) || |
359 | (0 != memcmp (nsid, | 367 | (0 != memcmp (nsid, |
360 | &want, | 368 | &want, |
361 | sizeof (GNUNET_HashCode))) ) && | 369 | sizeof (GNUNET_HashCode))) ) && |
362 | (gtk_tree_model_iter_next (namespace_treestore, &iter)) ) | 370 | (gtk_tree_model_iter_next (namespace_treestore, &iter)) ) |
363 | gtk_tree_model_get (namespace_treestore, &iter, | 371 | gtk_tree_model_get (namespace_treestore, &iter, |
364 | 1, &nsid, | 372 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, |
365 | -1); | 373 | &nsid, |
374 | -1); | ||
366 | if ( (NULL == nsid) || | 375 | if ( (NULL == nsid) || |
367 | (0 != memcmp (nsid, | 376 | (0 != memcmp (nsid, |
368 | &want, | 377 | &want, |
@@ -376,7 +385,9 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri, | |||
376 | (namespace_tree), &iter); | 385 | (namespace_tree), &iter); |
377 | treepath = gtk_tree_model_get_path (namespace_treestore, | 386 | treepath = gtk_tree_model_get_path (namespace_treestore, |
378 | &iter); | 387 | &iter); |
379 | if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, 0, &value)) | 388 | if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, |
389 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, | ||
390 | &value)) | ||
380 | gtk_label_set_text (sel_namespace_label, value); | 391 | gtk_label_set_text (sel_namespace_label, value); |
381 | gtk_tree_path_free (treepath); | 392 | gtk_tree_path_free (treepath); |
382 | 393 | ||
@@ -401,7 +412,9 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri, | |||
401 | gtk_tree_selection_select_iter (gtk_tree_view_get_selection | 412 | gtk_tree_selection_select_iter (gtk_tree_view_get_selection |
402 | (namespace_tree), &iter); | 413 | (namespace_tree), &iter); |
403 | treepath = gtk_tree_model_get_path (namespace_treestore, &iter); | 414 | treepath = gtk_tree_model_get_path (namespace_treestore, &iter); |
404 | if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, 0, &value)) | 415 | if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, |
416 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, | ||
417 | &value)) | ||
405 | gtk_label_set_text (sel_namespace_label, value); | 418 | gtk_label_set_text (sel_namespace_label, value); |
406 | gtk_tree_path_free (treepath); | 419 | gtk_tree_path_free (treepath); |
407 | } | 420 | } |
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index fb1fdb97..be5c3ba7 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -29,6 +29,136 @@ | |||
29 | #include "gnunet-fs-gtk_event-handler.h" | 29 | #include "gnunet-fs-gtk_event-handler.h" |
30 | #include "gnunet-fs-gtk_unindex.h" | 30 | #include "gnunet-fs-gtk_unindex.h" |
31 | 31 | ||
32 | |||
33 | /** | ||
34 | * Columns in the file sharing result model. | ||
35 | */ | ||
36 | enum SEARCH_TAB_ModelColumns | ||
37 | { | ||
38 | /** | ||
39 | * A gpointer. | ||
40 | */ | ||
41 | SEARCH_TAB_MC_METADATA = 0, | ||
42 | |||
43 | /** | ||
44 | * A gpointer. | ||
45 | */ | ||
46 | SEARCH_TAB_MC_URI = 1, | ||
47 | |||
48 | /** | ||
49 | * A guint64. | ||
50 | */ | ||
51 | SEARCH_TAB_MC_FILESIZE = 2, | ||
52 | |||
53 | /** | ||
54 | * A GdkPixbuf. | ||
55 | */ | ||
56 | SEARCH_TAB_MC_PREVIEW = 3, | ||
57 | |||
58 | /** | ||
59 | * A guint. | ||
60 | */ | ||
61 | SEARCH_TAB_MC_PERCENT_PROGRESS = 4, | ||
62 | |||
63 | /** | ||
64 | * A guint. | ||
65 | */ | ||
66 | SEARCH_TAB_MC_PERCENT_AVAILABILITY = 5, | ||
67 | |||
68 | /** | ||
69 | * A gchararray. | ||
70 | */ | ||
71 | SEARCH_TAB_MC_FILENAME = 6, | ||
72 | |||
73 | /** | ||
74 | * A gchararray. | ||
75 | */ | ||
76 | SEARCH_TAB_MC_URI_AS_STRING = 7, | ||
77 | |||
78 | /** | ||
79 | * A gchararray. | ||
80 | */ | ||
81 | SEARCH_TAB_MC_STATUS_COLOUR = 8, | ||
82 | |||
83 | /** | ||
84 | * A gpointer. | ||
85 | */ | ||
86 | SEARCH_TAB_MC_SEARCH_RESULT = 9, | ||
87 | |||
88 | /** | ||
89 | * A gchararray. | ||
90 | */ | ||
91 | SEARCH_TAB_MC_MIMETYPE = 10, | ||
92 | |||
93 | /** | ||
94 | * A guint. | ||
95 | */ | ||
96 | SEARCH_TAB_MC_APPLICABILITY_RANK = 11, | ||
97 | |||
98 | /** | ||
99 | * A guint. | ||
100 | */ | ||
101 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY = 12, | ||
102 | |||
103 | /** | ||
104 | * A gint. | ||
105 | */ | ||
106 | SEARCH_TAB_MC_AVAILABILITY_RANK = 13, | ||
107 | |||
108 | /** | ||
109 | * A guint64. | ||
110 | */ | ||
111 | SEARCH_TAB_MC_COMPLETED = 14, | ||
112 | |||
113 | /** | ||
114 | * A gchararray. | ||
115 | */ | ||
116 | SEARCH_TAB_MC_DOWNLOADED_FILENAME = 15, | ||
117 | |||
118 | /** | ||
119 | * A gint. | ||
120 | */ | ||
121 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY = 16, | ||
122 | }; | ||
123 | |||
124 | |||
125 | /** | ||
126 | * Columns in the publish frame model. | ||
127 | */ | ||
128 | enum PUBLISH_TAB_ModelColumns | ||
129 | { | ||
130 | /** | ||
131 | * A gchararray. | ||
132 | */ | ||
133 | PUBLISH_TAB_MC_FILENAME = 0, | ||
134 | |||
135 | /** | ||
136 | * A gchararray. | ||
137 | */ | ||
138 | PUBLISH_TAB_MC_FILESIZE = 1, | ||
139 | |||
140 | /** | ||
141 | * A gchararray. | ||
142 | */ | ||
143 | PUBLISH_TAB_MC_BGCOLOUR = 2, | ||
144 | |||
145 | /** | ||
146 | * A guint. | ||
147 | */ | ||
148 | PUBLISH_TAB_MC_PROGRESS = 3, | ||
149 | |||
150 | /** | ||
151 | * A gpointer. | ||
152 | */ | ||
153 | PUBLISH_TAB_MC_ENT = 4, | ||
154 | |||
155 | /** | ||
156 | * A gchararray. | ||
157 | */ | ||
158 | PUBLISH_TAB_MC_RESULT_STRING = 5, | ||
159 | }; | ||
160 | |||
161 | |||
32 | /** | 162 | /** |
33 | * We have a single tab where we display publishing operations. | 163 | * We have a single tab where we display publishing operations. |
34 | * So there is only one instance of this struct. | 164 | * So there is only one instance of this struct. |
@@ -190,10 +320,12 @@ get_suggested_filename_anonymity (GtkTreeModel *tm, | |||
190 | 320 | ||
191 | /* FIXME-BUG-MAYBE: this function is likely responsible for not always | 321 | /* FIXME-BUG-MAYBE: this function is likely responsible for not always |
192 | suggesting the best filename... To be investigated some more... */ | 322 | suggesting the best filename... To be investigated some more... */ |
193 | gtk_tree_model_get (tm, iter, 0, &meta, | 323 | gtk_tree_model_get (tm, iter, |
194 | 15, &local_filename, | 324 | SEARCH_TAB_MC_METADATA, &meta, |
195 | 16, &downloaded_anonymity, | 325 | SEARCH_TAB_MC_DOWNLOADED_FILENAME, &local_filename, |
196 | -1); | 326 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, |
327 | &downloaded_anonymity, | ||
328 | -1); | ||
197 | if (GNUNET_NO == top) | 329 | if (GNUNET_NO == top) |
198 | { | 330 | { |
199 | if (NULL != local_filename) | 331 | if (NULL != local_filename) |
@@ -305,7 +437,11 @@ start_download (GtkTreeView *tree_view, | |||
305 | GNUNET_break (0); | 437 | GNUNET_break (0); |
306 | return; | 438 | return; |
307 | } | 439 | } |
308 | gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, 9, &sr, -1); | 440 | gtk_tree_model_get (tm, &iter, |
441 | SEARCH_TAB_MC_METADATA, &meta, | ||
442 | SEARCH_TAB_MC_URI, &uri, | ||
443 | SEARCH_TAB_MC_SEARCH_RESULT, &sr, | ||
444 | -1); | ||
309 | if (NULL == uri) | 445 | if (NULL == uri) |
310 | { | 446 | { |
311 | /* user clicked on directory that was opened (not downloaded!), so we | 447 | /* user clicked on directory that was opened (not downloaded!), so we |
@@ -463,7 +599,8 @@ GNUNET_FS_GTK_search_treeview_row_activated (GtkTreeView * tree_view, | |||
463 | GNUNET_break (0); | 599 | GNUNET_break (0); |
464 | return; | 600 | return; |
465 | } | 601 | } |
466 | gtk_tree_model_get (tm, &iter, 1, &uri, -1); | 602 | gtk_tree_model_get (tm, &iter, |
603 | SEARCH_TAB_MC_URI, &uri, -1); | ||
467 | if (NULL == uri) | 604 | if (NULL == uri) |
468 | { | 605 | { |
469 | /* user clicked on directory that was opened (not downloaded!), so we | 606 | /* user clicked on directory that was opened (not downloaded!), so we |
@@ -598,7 +735,8 @@ copy_search_uri_to_clipboard_ctx_menu (GtkMenuItem *item, gpointer user_data) | |||
598 | gtk_tree_path_free (path); | 735 | gtk_tree_path_free (path); |
599 | return; | 736 | return; |
600 | } | 737 | } |
601 | gtk_tree_model_get (tm, &iter, 1, &uri, -1); | 738 | gtk_tree_model_get (tm, &iter, |
739 | SEARCH_TAB_MC_URI, &uri, -1); | ||
602 | gtk_tree_path_free (path); | 740 | gtk_tree_path_free (path); |
603 | if (uri == NULL) | 741 | if (uri == NULL) |
604 | { | 742 | { |
@@ -643,7 +781,10 @@ search_list_popup (GtkTreeModel *tm, | |||
643 | path = gtk_tree_model_get_path (tm, iter); | 781 | path = gtk_tree_model_get_path (tm, iter); |
644 | spc->rr = gtk_tree_row_reference_new (tm, path); | 782 | spc->rr = gtk_tree_row_reference_new (tm, path); |
645 | gtk_tree_path_free (path); | 783 | gtk_tree_path_free (path); |
646 | gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1); | 784 | gtk_tree_model_get (tm, iter, |
785 | SEARCH_TAB_MC_URI, &uri, | ||
786 | SEARCH_TAB_MC_SEARCH_RESULT, &sr, | ||
787 | -1); | ||
647 | spc->sr = sr; | 788 | spc->sr = sr; |
648 | menu = GTK_MENU (gtk_menu_new ()); | 789 | menu = GTK_MENU (gtk_menu_new ()); |
649 | if ( (NULL == sr->download) && | 790 | if ( (NULL == sr->download) && |
@@ -882,25 +1023,28 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
882 | return; | 1023 | return; |
883 | do | 1024 | do |
884 | { | 1025 | { |
885 | gtk_tree_model_get (src_model, &src_child, | 1026 | gtk_tree_model_get (src_model, &src_child, |
886 | 0, &meta, | 1027 | SEARCH_TAB_MC_METADATA, &meta, |
887 | 1, &uri, | 1028 | SEARCH_TAB_MC_URI, &uri, |
888 | 2, &filesize, | 1029 | SEARCH_TAB_MC_FILESIZE, &filesize, |
889 | 3, &preview, | 1030 | SEARCH_TAB_MC_PREVIEW, &preview, |
890 | 4, &percent_progress, | 1031 | SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, |
891 | 5, &percent_availability, | 1032 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
892 | 6, &filename, | 1033 | &percent_availability, |
893 | 7, &uri_as_string, | 1034 | SEARCH_TAB_MC_FILENAME, &filename, |
894 | 8, &status_colour, | 1035 | SEARCH_TAB_MC_URI_AS_STRING, &uri_as_string, |
895 | 9, &search_result_old, | 1036 | SEARCH_TAB_MC_STATUS_COLOUR, &status_colour, |
896 | 10, &mimetype, | 1037 | SEARCH_TAB_MC_SEARCH_RESULT, &search_result_old, |
897 | 11, &applicability_rank, | 1038 | SEARCH_TAB_MC_MIMETYPE, &mimetype, |
898 | 12, &availability_certainty, | 1039 | SEARCH_TAB_MC_APPLICABILITY_RANK, &applicability_rank, |
899 | 13, &availability_rank, | 1040 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, |
900 | 14, &completed, | 1041 | &availability_certainty, |
901 | 15, &downloaded_filename, | 1042 | SEARCH_TAB_MC_AVAILABILITY_RANK, &availability_rank, |
902 | 16, &downloaded_anonymity, | 1043 | SEARCH_TAB_MC_COMPLETED, &completed, |
903 | -1); | 1044 | SEARCH_TAB_MC_DOWNLOADED_FILENAME, &downloaded_filename, |
1045 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, | ||
1046 | &downloaded_anonymity, | ||
1047 | -1); | ||
904 | search_result_new = GNUNET_malloc (sizeof (struct SearchResult)); | 1048 | search_result_new = GNUNET_malloc (sizeof (struct SearchResult)); |
905 | search_result_new->tab = dst_tab; | 1049 | search_result_new->tab = dst_tab; |
906 | search_result_new->download = search_result_old->download; | 1050 | search_result_new->download = search_result_old->download; |
@@ -910,25 +1054,37 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
910 | search_result_new->download->sr = search_result_new; | 1054 | search_result_new->download->sr = search_result_new; |
911 | } | 1055 | } |
912 | gtk_tree_store_insert_with_values (dst_tab->ts, &dst_child, | 1056 | gtk_tree_store_insert_with_values (dst_tab->ts, &dst_child, |
913 | dst_iter, G_MAXINT, | 1057 | dst_iter, G_MAXINT, |
914 | 0, GNUNET_CONTAINER_meta_data_duplicate (meta), | 1058 | SEARCH_TAB_MC_METADATA, |
915 | 1, GNUNET_FS_uri_dup (uri), | 1059 | GNUNET_CONTAINER_meta_data_duplicate (meta), |
916 | 2, filesize, | 1060 | SEARCH_TAB_MC_URI, |
917 | 3, preview, | 1061 | GNUNET_FS_uri_dup (uri), |
918 | 4, percent_progress, | 1062 | SEARCH_TAB_MC_SEARCH_RESULT, filesize, |
919 | 5, percent_availability, | 1063 | SEARCH_TAB_MC_PREVIEW, preview, |
920 | 6, filename, | 1064 | SEARCH_TAB_MC_PERCENT_PROGRESS, |
921 | 7, uri_as_string, | 1065 | percent_progress, |
922 | 8, status_colour, | 1066 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
923 | 9, search_result_new, | 1067 | percent_availability, |
924 | 10, mimetype, | 1068 | SEARCH_TAB_MC_FILENAME, filename, |
925 | 11, applicability_rank, | 1069 | SEARCH_TAB_MC_URI_AS_STRING, |
926 | 12, availability_certainty, | 1070 | uri_as_string, |
927 | 13, availability_rank, | 1071 | SEARCH_TAB_MC_STATUS_COLOUR, |
928 | 14, completed, | 1072 | status_colour, |
929 | 15, downloaded_filename, | 1073 | SEARCH_TAB_MC_SEARCH_RESULT, |
930 | 16, downloaded_anonymity, | 1074 | search_result_new, |
931 | -1); | 1075 | SEARCH_TAB_MC_MIMETYPE, mimetype, |
1076 | SEARCH_TAB_MC_APPLICABILITY_RANK, | ||
1077 | applicability_rank, | ||
1078 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, | ||
1079 | availability_certainty, | ||
1080 | SEARCH_TAB_MC_AVAILABILITY_RANK, | ||
1081 | availability_rank, | ||
1082 | SEARCH_TAB_MC_COMPLETED, completed, | ||
1083 | SEARCH_TAB_MC_DOWNLOADED_FILENAME, | ||
1084 | downloaded_filename, | ||
1085 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, | ||
1086 | downloaded_anonymity, | ||
1087 | -1); | ||
932 | g_free (filename); | 1088 | g_free (filename); |
933 | g_free (downloaded_filename); | 1089 | g_free (downloaded_filename); |
934 | g_free (uri_as_string); | 1090 | g_free (uri_as_string); |
@@ -985,19 +1141,20 @@ download_lost_parent (struct DownloadEntry *de) | |||
985 | } | 1141 | } |
986 | gtk_tree_path_free (path); | 1142 | gtk_tree_path_free (path); |
987 | gtk_tree_model_get (tm_old, &iter_old, | 1143 | gtk_tree_model_get (tm_old, &iter_old, |
988 | 0, &meta, | 1144 | SEARCH_TAB_MC_METADATA, &meta, |
989 | 1, &uri, | 1145 | SEARCH_TAB_MC_URI, &uri, |
990 | 4, &percent_progress, | 1146 | SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, |
991 | 5, &percent_availability, | 1147 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, &percent_availability, |
992 | 6, &filename, | 1148 | SEARCH_TAB_MC_FILENAME, &filename, |
993 | 8, &status_colour, | 1149 | SEARCH_TAB_MC_STATUS_COLOUR, &status_colour, |
994 | 11, &applicability_rank, | 1150 | SEARCH_TAB_MC_APPLICABILITY_RANK, &applicability_rank, |
995 | 12, &availability_certainty, | 1151 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, |
996 | 13, &availability_rank, | 1152 | &availability_certainty, |
997 | 14, &completed, | 1153 | SEARCH_TAB_MC_AVAILABILITY_RANK, &availability_rank, |
998 | 15, &downloaded_filename, | 1154 | SEARCH_TAB_MC_COMPLETED, &completed, |
999 | 16, &downloaded_anonymity, | 1155 | SEARCH_TAB_MC_DOWNLOADED_FILENAME, &downloaded_filename, |
1000 | -1); | 1156 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, &downloaded_anonymity, |
1157 | -1); | ||
1001 | GNUNET_assert (GNUNET_YES == GNUNET_FS_uri_test_equal (uri, de->uri)); | 1158 | GNUNET_assert (GNUNET_YES == GNUNET_FS_uri_test_equal (uri, de->uri)); |
1002 | GNUNET_assert (de->sr->download == de); | 1159 | GNUNET_assert (de->sr->download == de); |
1003 | de->sr->download = NULL; | 1160 | de->sr->download = NULL; |
@@ -1018,17 +1175,18 @@ download_lost_parent (struct DownloadEntry *de) | |||
1018 | gtk_tree_path_free (path); | 1175 | gtk_tree_path_free (path); |
1019 | 1176 | ||
1020 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 1177 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
1021 | 4, percent_progress, | 1178 | SEARCH_TAB_MC_PERCENT_PROGRESS, percent_progress, |
1022 | 5, percent_availability, | 1179 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, percent_availability, |
1023 | 6, filename, | 1180 | SEARCH_TAB_MC_FILENAME, filename, |
1024 | 8, status_colour, | 1181 | SEARCH_TAB_MC_STATUS_COLOUR, status_colour, |
1025 | 11, applicability_rank, | 1182 | SEARCH_TAB_MC_APPLICABILITY_RANK, applicability_rank, |
1026 | 12, availability_certainty, | 1183 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, |
1027 | 13, availability_rank, | 1184 | availability_certainty, |
1028 | 14, completed, | 1185 | SEARCH_TAB_MC_AVAILABILITY_RANK, availability_rank, |
1029 | 15, downloaded_filename, | 1186 | SEARCH_TAB_MC_COMPLETED, completed, |
1030 | 16, downloaded_anonymity, | 1187 | SEARCH_TAB_MC_DOWNLOADED_FILENAME, downloaded_filename, |
1031 | -1); | 1188 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, downloaded_anonymity, |
1189 | -1); | ||
1032 | g_free (filename); | 1190 | g_free (filename); |
1033 | g_free (downloaded_filename); | 1191 | g_free (downloaded_filename); |
1034 | g_free (status_colour); | 1192 | g_free (status_colour); |
@@ -1062,10 +1220,10 @@ move_downloads_in_subtree (GtkTreeModel *tm, | |||
1062 | do | 1220 | do |
1063 | { | 1221 | { |
1064 | gtk_tree_model_get (tm, &child, | 1222 | gtk_tree_model_get (tm, &child, |
1065 | 0, &meta, | 1223 | SEARCH_TAB_MC_METADATA, &meta, |
1066 | 1, &uri, | 1224 | SEARCH_TAB_MC_URI, &uri, |
1067 | 9, &sr, | 1225 | SEARCH_TAB_MC_SEARCH_RESULT, &sr, |
1068 | -1); | 1226 | -1); |
1069 | if (NULL != sr->download) | 1227 | if (NULL != sr->download) |
1070 | { | 1228 | { |
1071 | if (sr->download->is_done == GNUNET_YES) | 1229 | if (sr->download->is_done == GNUNET_YES) |
@@ -1088,10 +1246,10 @@ move_downloads_in_subtree (GtkTreeModel *tm, | |||
1088 | GNUNET_free (sr); | 1246 | GNUNET_free (sr); |
1089 | /* get ready for removal of the tree */ | 1247 | /* get ready for removal of the tree */ |
1090 | gtk_tree_store_set (GTK_TREE_STORE (tm), &child, | 1248 | gtk_tree_store_set (GTK_TREE_STORE (tm), &child, |
1091 | 0, NULL, | 1249 | SEARCH_TAB_MC_METADATA, NULL, |
1092 | 1, NULL, | 1250 | SEARCH_TAB_MC_URI, NULL, |
1093 | 9, NULL, | 1251 | SEARCH_TAB_MC_SEARCH_RESULT, NULL, |
1094 | -1); | 1252 | -1); |
1095 | } | 1253 | } |
1096 | while (TRUE == gtk_tree_model_iter_next (tm, &child)); | 1254 | while (TRUE == gtk_tree_model_iter_next (tm, &child)); |
1097 | } | 1255 | } |
@@ -1133,7 +1291,10 @@ free_search_result (struct SearchResult *sr) | |||
1133 | return; | 1291 | return; |
1134 | } | 1292 | } |
1135 | gtk_tree_path_free (tp); | 1293 | gtk_tree_path_free (tp); |
1136 | gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, -1); | 1294 | gtk_tree_model_get (tm, &iter, |
1295 | SEARCH_TAB_MC_METADATA, &meta, | ||
1296 | SEARCH_TAB_MC_URI, &uri, | ||
1297 | -1); | ||
1137 | if (uri != NULL) | 1298 | if (uri != NULL) |
1138 | GNUNET_FS_uri_destroy (uri); | 1299 | GNUNET_FS_uri_destroy (uri); |
1139 | if (meta != NULL) | 1300 | if (meta != NULL) |
@@ -1181,7 +1342,10 @@ GNUNET_FS_GTK_search_treeview_cursor_changed (GtkTreeView *tv, | |||
1181 | } | 1342 | } |
1182 | meta = NULL; | 1343 | meta = NULL; |
1183 | pixbuf = NULL; | 1344 | pixbuf = NULL; |
1184 | gtk_tree_model_get (model, &iter, 0, &meta, 3, &pixbuf, -1); | 1345 | gtk_tree_model_get (model, &iter, |
1346 | SEARCH_TAB_MC_METADATA, &meta, | ||
1347 | SEARCH_TAB_MC_PREVIEW, &pixbuf, | ||
1348 | -1); | ||
1185 | if (NULL != pixbuf) | 1349 | if (NULL != pixbuf) |
1186 | { | 1350 | { |
1187 | gtk_image_set_from_pixbuf (image, pixbuf); | 1351 | gtk_image_set_from_pixbuf (image, pixbuf); |
@@ -1328,7 +1492,9 @@ stop_downloads_in_subtree (GtkTreeModel *tm, | |||
1328 | { | 1492 | { |
1329 | do | 1493 | do |
1330 | { | 1494 | { |
1331 | gtk_tree_model_get (tm, &child, 9, &sr, -1); | 1495 | gtk_tree_model_get (tm, &child, |
1496 | SEARCH_TAB_MC_SEARCH_RESULT, &sr, | ||
1497 | -1); | ||
1332 | if ( (NULL != sr->download) && | 1498 | if ( (NULL != sr->download) && |
1333 | (sr->download->is_done == GNUNET_YES) ) | 1499 | (sr->download->is_done == GNUNET_YES) ) |
1334 | { | 1500 | { |
@@ -1371,7 +1537,9 @@ GNUNET_FS_GTK_search_result_clear_button_clicked (GtkButton * button, gpointer u | |||
1371 | return; | 1537 | return; |
1372 | do | 1538 | do |
1373 | { | 1539 | { |
1374 | gtk_tree_model_get (tm, &iter, 9, &sr, -1); | 1540 | gtk_tree_model_get (tm, &iter, |
1541 | SEARCH_TAB_MC_SEARCH_RESULT, &sr, | ||
1542 | -1); | ||
1375 | if ( (sr->download != NULL) && | 1543 | if ( (sr->download != NULL) && |
1376 | (sr->download->is_done == GNUNET_YES) ) | 1544 | (sr->download->is_done == GNUNET_YES) ) |
1377 | { | 1545 | { |
@@ -1480,7 +1648,9 @@ update_search_result (struct SearchResult *sr, | |||
1480 | desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup); | 1648 | desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup); |
1481 | mime = get_mimetype_from_metadata (meta); | 1649 | mime = get_mimetype_from_metadata (meta); |
1482 | pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); | 1650 | pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); |
1483 | gtk_tree_model_get (tm, &iter, 0, &ometa, -1); | 1651 | gtk_tree_model_get (tm, &iter, |
1652 | SEARCH_TAB_MC_METADATA, &ometa, | ||
1653 | -1); | ||
1484 | if (NULL != ometa) | 1654 | if (NULL != ometa) |
1485 | GNUNET_CONTAINER_meta_data_destroy (ometa); | 1655 | GNUNET_CONTAINER_meta_data_destroy (ometa); |
1486 | if (availability_certainty > 0) | 1656 | if (availability_certainty > 0) |
@@ -1488,13 +1658,18 @@ update_search_result (struct SearchResult *sr, | |||
1488 | else | 1658 | else |
1489 | percent_avail = 50; | 1659 | percent_avail = 50; |
1490 | gtk_tree_store_set (ts, &iter, | 1660 | gtk_tree_store_set (ts, &iter, |
1491 | 0, GNUNET_CONTAINER_meta_data_duplicate (meta), | 1661 | SEARCH_TAB_MC_METADATA, |
1492 | 3, pixbuf /* preview */ , | 1662 | GNUNET_CONTAINER_meta_data_duplicate (meta), |
1493 | 5, (guint) percent_avail /* percent availability */ , | 1663 | SEARCH_TAB_MC_PREVIEW, pixbuf, |
1494 | 6, desc /* filename/description */ , | 1664 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) percent_avail, |
1495 | 10, mime, 11, (guint) applicability_rank, 12, | 1665 | SEARCH_TAB_MC_FILENAME, desc, |
1496 | (guint) availability_certainty, 13, | 1666 | SEARCH_TAB_MC_MIMETYPE, mime, |
1497 | (gint) availability_rank, -1); | 1667 | SEARCH_TAB_MC_APPLICABILITY_RANK, |
1668 | (guint) applicability_rank, | ||
1669 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, | ||
1670 | (guint) availability_certainty, | ||
1671 | SEARCH_TAB_MC_AVAILABILITY_RANK, (gint) availability_rank, | ||
1672 | -1); | ||
1498 | if (pixbuf != NULL) | 1673 | if (pixbuf != NULL) |
1499 | g_object_unref (pixbuf); | 1674 | g_object_unref (pixbuf); |
1500 | GNUNET_free (desc); | 1675 | GNUNET_free (desc); |
@@ -1615,24 +1790,28 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, | |||
1615 | pitr = NULL; | 1790 | pitr = NULL; |
1616 | ts = tab->ts; | 1791 | ts = tab->ts; |
1617 | } | 1792 | } |
1618 | gtk_tree_store_insert_with_values (ts, &iter, pitr, G_MAXINT, | 1793 | gtk_tree_store_insert_with_values (ts, &iter, pitr, G_MAXINT, |
1619 | 0, GNUNET_CONTAINER_meta_data_duplicate (meta), | 1794 | SEARCH_TAB_MC_METADATA, |
1620 | 1, (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri), | 1795 | GNUNET_CONTAINER_meta_data_duplicate (meta), |
1621 | 2, fsize, | 1796 | SEARCH_TAB_MC_URI, |
1622 | 3, pixbuf /* preview */ , | 1797 | (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri), |
1623 | 4, 0 /* percent progress */ , | 1798 | SEARCH_TAB_MC_FILESIZE, fsize, |
1624 | 5, (fsize == 0) ? 100 : 0 /* percent availability */ , | 1799 | SEARCH_TAB_MC_PREVIEW, pixbuf, |
1625 | 6, desc /* filename/description */ , | 1800 | SEARCH_TAB_MC_PERCENT_PROGRESS, 0, |
1626 | 7, uris, | 1801 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
1627 | 8, status_colour, | 1802 | (fsize == 0) ? 100 : 0, |
1628 | 9, sr, | 1803 | SEARCH_TAB_MC_FILENAME, desc, |
1629 | 10, mime, | 1804 | SEARCH_TAB_MC_URI_AS_STRING, uris, |
1630 | 11, applicability_rank, | 1805 | SEARCH_TAB_MC_STATUS_COLOUR, status_colour, |
1631 | 12, 0 /* avail-cert */ , | 1806 | SEARCH_TAB_MC_SEARCH_RESULT, sr, |
1632 | 13, 0, /* avail-rank */ | 1807 | SEARCH_TAB_MC_MIMETYPE, mime, |
1633 | 14, (guint64) 0, /* completed */ | 1808 | SEARCH_TAB_MC_APPLICABILITY_RANK, |
1634 | 15, NULL, /* downloaded_filename */ | 1809 | applicability_rank, |
1635 | 16, -1, /* downloaded_anonymity */ | 1810 | SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, 0, |
1811 | SEARCH_TAB_MC_AVAILABILITY_RANK, 0, | ||
1812 | SEARCH_TAB_MC_COMPLETED, (guint64) 0, | ||
1813 | SEARCH_TAB_MC_DOWNLOADED_FILENAME, NULL, | ||
1814 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, -1, | ||
1636 | -1); | 1815 | -1); |
1637 | if (pixbuf != NULL) | 1816 | if (pixbuf != NULL) |
1638 | g_object_unref (pixbuf); | 1817 | g_object_unref (pixbuf); |
@@ -1881,7 +2060,9 @@ change_download_color (struct DownloadEntry *de, | |||
1881 | return; | 2060 | return; |
1882 | } | 2061 | } |
1883 | gtk_tree_path_free (path); | 2062 | gtk_tree_path_free (path); |
1884 | gtk_tree_store_set (de->sr->tab->ts, &iter, 8, color, -1); | 2063 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2064 | SEARCH_TAB_MC_STATUS_COLOUR, color, | ||
2065 | -1); | ||
1885 | } | 2066 | } |
1886 | 2067 | ||
1887 | 2068 | ||
@@ -1989,7 +2170,7 @@ add_directory_entry (void *cls, const char *filename, | |||
1989 | { | 2170 | { |
1990 | do | 2171 | do |
1991 | { | 2172 | { |
1992 | gtk_tree_model_get (tm, &iter, 1, &xuri, -1); | 2173 | gtk_tree_model_get (tm, &iter, SEARCH_TAB_MC_URI, &xuri, -1); |
1993 | if (GNUNET_YES == GNUNET_FS_uri_test_equal (xuri, uri)) | 2174 | if (GNUNET_YES == GNUNET_FS_uri_test_equal (xuri, uri)) |
1994 | return; /* already present */ | 2175 | return; /* already present */ |
1995 | } | 2176 | } |
@@ -2042,15 +2223,13 @@ mark_download_progress (struct DownloadEntry *de, | |||
2042 | 'progress' once the download has started and re-use the | 2223 | 'progress' once the download has started and re-use the |
2043 | space in the display? Probably yes, at least once we have | 2224 | space in the display? Probably yes, at least once we have |
2044 | a custom CellRenderer... */ | 2225 | a custom CellRenderer... */ |
2045 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2226 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2046 | 4, (guint) ((size > | 2227 | SEARCH_TAB_MC_PERCENT_PROGRESS, |
2047 | 0) ? (100 * completed / | 2228 | (guint) ((size > 0) ? (100 * completed / size) : 100), |
2048 | size) : 100) /* progress */, | 2229 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, |
2049 | 5, (guint) ((size > | 2230 | (guint) ((size > 0) ? (100 * completed / size) : 100), |
2050 | 0) ? (100 * completed / | 2231 | SEARCH_TAB_MC_COMPLETED, completed, |
2051 | size) : 100) /* availability == progress */, | 2232 | -1); |
2052 | 14, completed, | ||
2053 | -1); | ||
2054 | if (completed < size) | 2233 | if (completed < size) |
2055 | { | 2234 | { |
2056 | /* partial completion, consider looking at the block */ | 2235 | /* partial completion, consider looking at the block */ |
@@ -2070,8 +2249,8 @@ mark_download_progress (struct DownloadEntry *de, | |||
2070 | { | 2249 | { |
2071 | /* Mime type was wrong, this is not a directory, update model! */ | 2250 | /* Mime type was wrong, this is not a directory, update model! */ |
2072 | de->is_directory = GNUNET_SYSERR; | 2251 | de->is_directory = GNUNET_SYSERR; |
2073 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2252 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2074 | 10, "" /* unknown mime type */, -1); | 2253 | SEARCH_TAB_MC_MIMETYPE, "", -1); |
2075 | } | 2254 | } |
2076 | } | 2255 | } |
2077 | } | 2256 | } |
@@ -2120,7 +2299,10 @@ mark_download_error (struct DownloadEntry *de, | |||
2120 | return; | 2299 | return; |
2121 | } | 2300 | } |
2122 | gtk_tree_path_free (path); | 2301 | gtk_tree_path_free (path); |
2123 | gtk_tree_store_set (de->sr->tab->ts, &iter, 4, 0, 7, emsg, -1); | 2302 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2303 | SEARCH_TAB_MC_PERCENT_PROGRESS, 0, | ||
2304 | SEARCH_TAB_MC_URI_AS_STRING, emsg | ||
2305 | -1); | ||
2124 | } | 2306 | } |
2125 | 2307 | ||
2126 | 2308 | ||
@@ -2148,9 +2330,9 @@ mark_download_completed (struct DownloadEntry *de, uint64_t size) | |||
2148 | } | 2330 | } |
2149 | gtk_tree_path_free (path); | 2331 | gtk_tree_path_free (path); |
2150 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2332 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2151 | 4, (guint) 100, | 2333 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100, |
2152 | 5, (guint) 100, | 2334 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100, |
2153 | -1); | 2335 | -1); |
2154 | } | 2336 | } |
2155 | 2337 | ||
2156 | 2338 | ||
@@ -2229,9 +2411,10 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
2229 | { | 2411 | { |
2230 | do | 2412 | do |
2231 | { | 2413 | { |
2232 | gtk_tree_model_get (tm, &child, 1, &uri, | 2414 | gtk_tree_model_get (tm, &child, |
2233 | 9, &de->sr, | 2415 | SEARCH_TAB_MC_URI, &uri, |
2234 | -1); | 2416 | SEARCH_TAB_MC_SEARCH_RESULT, &de->sr, |
2417 | -1); | ||
2235 | if (GNUNET_YES == GNUNET_FS_uri_test_equal (de->uri, | 2418 | if (GNUNET_YES == GNUNET_FS_uri_test_equal (de->uri, |
2236 | uri)) | 2419 | uri)) |
2237 | break; | 2420 | break; |
@@ -2278,21 +2461,20 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
2278 | return de; | 2461 | return de; |
2279 | } | 2462 | } |
2280 | gtk_tree_model_get (GTK_TREE_MODEL (de->sr->tab->ts), &iter, | 2463 | gtk_tree_model_get (GTK_TREE_MODEL (de->sr->tab->ts), &iter, |
2281 | 0, &meta, | 2464 | SEARCH_TAB_MC_METADATA, &meta, |
2282 | -1); | 2465 | -1); |
2283 | de->is_directory = GNUNET_FS_meta_data_test_for_directory (meta); | 2466 | de->is_directory = GNUNET_FS_meta_data_test_for_directory (meta); |
2284 | } | 2467 | } |
2285 | gtk_tree_path_free (path); | 2468 | gtk_tree_path_free (path); |
2286 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2469 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2287 | 4, (guint) ((size > | 2470 | SEARCH_TAB_MC_PERCENT_PROGRESS, |
2288 | 0) ? (100 * completed / | 2471 | (guint) ((size > 0) ? (100 * completed / size) : 100), |
2289 | size) : 100) /* progress */ , | 2472 | SEARCH_TAB_MC_FILENAME, filename, |
2290 | 6, filename /* filename/description */ , | 2473 | SEARCH_TAB_MC_STATUS_COLOUR, "blue", |
2291 | 8, "blue" /* status colour: pending */ , | 2474 | SEARCH_TAB_MC_SEARCH_RESULT, de->sr, |
2292 | 9, de->sr, | 2475 | SEARCH_TAB_MC_COMPLETED, completed, |
2293 | 14, completed, | 2476 | SEARCH_TAB_MC_FILENAME, de->filename, |
2294 | 15, de->filename, | 2477 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity, |
2295 | 16, de->anonymity, | ||
2296 | -1); | 2478 | -1); |
2297 | return de; | 2479 | return de; |
2298 | } | 2480 | } |
@@ -2327,7 +2509,7 @@ change_publish_color (struct PublishEntry *pe, | |||
2327 | return; | 2509 | return; |
2328 | } | 2510 | } |
2329 | gtk_tree_path_free (path); | 2511 | gtk_tree_path_free (path); |
2330 | gtk_tree_store_set (pe->tab->ts, &iter, 2, color, -1); | 2512 | gtk_tree_store_set (pe->tab->ts, &iter, PUBLISH_TAB_MC_BGCOLOUR, color, -1); |
2331 | } | 2513 | } |
2332 | 2514 | ||
2333 | 2515 | ||
@@ -2354,10 +2536,9 @@ mark_publish_progress (struct PublishEntry *pe, uint64_t size, | |||
2354 | return; | 2536 | return; |
2355 | } | 2537 | } |
2356 | gtk_tree_path_free (path); | 2538 | gtk_tree_path_free (path); |
2357 | gtk_tree_store_set (pe->tab->ts, &iter, 3, | 2539 | gtk_tree_store_set (pe->tab->ts, &iter, |
2358 | (guint) ((size > | 2540 | PUBLISH_TAB_MC_PROGRESS, |
2359 | 0) ? (100 * completed / | 2541 | (guint) ((size > 0) ? (100 * completed / size) : 100), |
2360 | size) : 100) /* progress */ , | ||
2361 | -1); | 2542 | -1); |
2362 | } | 2543 | } |
2363 | 2544 | ||
@@ -2388,7 +2569,7 @@ handle_publish_completed (struct PublishEntry *pe, | |||
2388 | pe->uri = GNUNET_FS_uri_dup (uri); | 2569 | pe->uri = GNUNET_FS_uri_dup (uri); |
2389 | uris = GNUNET_FS_uri_to_string (uri); | 2570 | uris = GNUNET_FS_uri_to_string (uri); |
2390 | gtk_tree_store_set (pe->tab->ts, &iter, | 2571 | gtk_tree_store_set (pe->tab->ts, &iter, |
2391 | 5, uris, | 2572 | PUBLISH_TAB_MC_RESULT_STRING, uris, |
2392 | -1); | 2573 | -1); |
2393 | GNUNET_free (uris); | 2574 | GNUNET_free (uris); |
2394 | change_publish_color (pe, "green"); | 2575 | change_publish_color (pe, "green"); |
@@ -2418,7 +2599,7 @@ handle_publish_error (struct PublishEntry *pe, | |||
2418 | } | 2599 | } |
2419 | gtk_tree_path_free (path); | 2600 | gtk_tree_path_free (path); |
2420 | gtk_tree_store_set (pe->tab->ts, &iter, | 2601 | gtk_tree_store_set (pe->tab->ts, &iter, |
2421 | 5, emsg, | 2602 | PUBLISH_TAB_MC_RESULT_STRING, emsg, |
2422 | -1); | 2603 | -1); |
2423 | change_publish_color (pe, "red"); | 2604 | change_publish_color (pe, "red"); |
2424 | } | 2605 | } |
@@ -2480,7 +2661,7 @@ GNUNET_FS_GTK_publish_label_close_button_clicked (GtkButton * button, | |||
2480 | tm = GTK_TREE_MODEL (publish_tab->ts); | 2661 | tm = GTK_TREE_MODEL (publish_tab->ts); |
2481 | while (gtk_tree_model_iter_children (tm, &iter, NULL)) | 2662 | while (gtk_tree_model_iter_children (tm, &iter, NULL)) |
2482 | { | 2663 | { |
2483 | gtk_tree_model_get (tm, &iter, 4, &pe, -1); | 2664 | gtk_tree_model_get (tm, &iter, PUBLISH_TAB_MC_ENT, &pe, -1); |
2484 | GNUNET_FS_publish_stop (pe->pc); | 2665 | GNUNET_FS_publish_stop (pe->pc); |
2485 | } | 2666 | } |
2486 | clear_metadata_display (); | 2667 | clear_metadata_display (); |
@@ -2586,9 +2767,12 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const char *fn, | |||
2586 | ent->pc = pc; | 2767 | ent->pc = pc; |
2587 | size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize); | 2768 | size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize); |
2588 | gtk_tree_store_insert_with_values (publish_tab->ts, &iter, pitrptr, G_MAXINT, | 2769 | gtk_tree_store_insert_with_values (publish_tab->ts, &iter, pitrptr, G_MAXINT, |
2589 | 0, fn, 1, size_fancy, 2, "white", 3, | 2770 | PUBLISH_TAB_MC_FILENAME, fn, |
2590 | (guint) 0 /* progress */ , | 2771 | PUBLISH_TAB_MC_FILESIZE, size_fancy, |
2591 | 4, ent, -1); | 2772 | PUBLISH_TAB_MC_BGCOLOUR, "white", |
2773 | PUBLISH_TAB_MC_PROGRESS, (guint) 0, | ||
2774 | PUBLISH_TAB_MC_ENT, ent, | ||
2775 | -1); | ||
2592 | GNUNET_free (size_fancy); | 2776 | GNUNET_free (size_fancy); |
2593 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (publish_tab->ts), &iter); | 2777 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (publish_tab->ts), &iter); |
2594 | ent->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (publish_tab->ts), path); | 2778 | ent->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (publish_tab->ts), path); |
@@ -2709,7 +2893,7 @@ publish_list_popup (GtkTreeModel *tm, | |||
2709 | struct PublishEntry *pe; | 2893 | struct PublishEntry *pe; |
2710 | struct PublishListPopupContext *ppc; | 2894 | struct PublishListPopupContext *ppc; |
2711 | 2895 | ||
2712 | gtk_tree_model_get (tm, iter, 4, &pe, -1); | 2896 | gtk_tree_model_get (tm, iter, PUBLISH_TAB_MC_ENT, &pe, -1); |
2713 | if ( (NULL == pe->uri) && | 2897 | if ( (NULL == pe->uri) && |
2714 | ( (NULL == pe->pc) || | 2898 | ( (NULL == pe->pc) || |
2715 | (GNUNET_NO == pe->is_top) ) ) | 2899 | (GNUNET_NO == pe->is_top) ) ) |
diff --git a/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c b/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c index f5ecc1ab..06e58b67 100644 --- a/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c +++ b/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c | |||
@@ -48,7 +48,12 @@ copy_metadata_to_clipboard (GtkTreeModel * model, GtkTreePath * path, | |||
48 | gchar *type; | 48 | gchar *type; |
49 | gchar *value; | 49 | gchar *value; |
50 | 50 | ||
51 | gtk_tree_model_get (model, iter, 2, &type, 3, &value, -1); | 51 | gtk_tree_model_get (model, iter, |
52 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING, | ||
53 | &type, | ||
54 | GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE, | ||
55 | &value, | ||
56 | -1); | ||
52 | *l = g_list_prepend (*l, type); | 57 | *l = g_list_prepend (*l, type); |
53 | *l = g_list_prepend (*l, value); | 58 | *l = g_list_prepend (*l, value); |
54 | } | 59 | } |
diff --git a/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c b/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c index b9b7daaa..b1f7ab59 100644 --- a/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c +++ b/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c | |||
@@ -150,12 +150,16 @@ commit_changes (struct GNUNET_GTK_MainWindowContext *main_ctx, | |||
150 | main_ctx->selected_ns_row = get_selected_row_from_treeview (tv); | 150 | main_ctx->selected_ns_row = get_selected_row_from_treeview (tv); |
151 | 151 | ||
152 | treepath = gtk_tree_row_reference_get_path (main_ctx->selected_ns_row); | 152 | treepath = gtk_tree_row_reference_get_path (main_ctx->selected_ns_row); |
153 | if (GNUNET_GTK_get_tree_string (tv, treepath, 0, &value)) | 153 | if (GNUNET_GTK_get_tree_string (tv, treepath, |
154 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, | ||
155 | &value)) | ||
154 | { | 156 | { |
155 | gtk_label_set_text (main_ctx->search_ns_label, (NULL != value) ? value : ""); | 157 | gtk_label_set_text (main_ctx->search_ns_label, (NULL != value) ? value : ""); |
156 | g_free (value); | 158 | g_free (value); |
157 | } | 159 | } |
158 | if (GNUNET_GTK_get_tree_string (tv, treepath, 2, &value)) | 160 | if (GNUNET_GTK_get_tree_string (tv, treepath, |
161 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT, | ||
162 | &value)) | ||
159 | { | 163 | { |
160 | gtk_entry_set_text (main_ctx->search_entry, (NULL != value) ? value : ""); | 164 | gtk_entry_set_text (main_ctx->search_entry, (NULL != value) ? value : ""); |
161 | g_free (value); | 165 | g_free (value); |
@@ -326,11 +330,15 @@ add_namespace_to_ts (void *cls, const GNUNET_HashCode * pseudonym, | |||
326 | } | 330 | } |
327 | description = GNUNET_FS_GTK_get_description_from_metadata (md, &desc_is_a_dup); | 331 | description = GNUNET_FS_GTK_get_description_from_metadata (md, &desc_is_a_dup); |
328 | gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, | 332 | gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, |
329 | 0, unique_ns_name, | 333 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, |
330 | 1, nsid, | 334 | unique_ns_name, |
331 | 2, root, | 335 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, |
332 | 3, description, | 336 | nsid, |
333 | -1); | 337 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT, |
338 | root, | ||
339 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP, | ||
340 | description, | ||
341 | -1); | ||
334 | GNUNET_free (unique_ns_name); | 342 | GNUNET_free (unique_ns_name); |
335 | GNUNET_free_non_null (root); | 343 | GNUNET_free_non_null (root); |
336 | GNUNET_free (description); | 344 | GNUNET_free (description); |
@@ -356,7 +364,10 @@ GNUNET_GTK_main_window_refresh_ns_list (struct GNUNET_GTK_MainWindowContext *mai | |||
356 | { | 364 | { |
357 | if (gtk_tree_model_get_iter (model, &iter, treepath)) | 365 | if (gtk_tree_model_get_iter (model, &iter, treepath)) |
358 | { | 366 | { |
359 | gtk_tree_model_get (model, &iter, 1, &key, -1); | 367 | gtk_tree_model_get (model, &iter, |
368 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, | ||
369 | &key, | ||
370 | -1); | ||
360 | } | 371 | } |
361 | } | 372 | } |
362 | gtk_tree_path_free (treepath); | 373 | gtk_tree_path_free (treepath); |
@@ -376,8 +387,9 @@ GNUNET_GTK_main_window_refresh_ns_list (struct GNUNET_GTK_MainWindowContext *mai | |||
376 | while (TRUE) | 387 | while (TRUE) |
377 | { | 388 | { |
378 | gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter, | 389 | gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter, |
379 | 1, &key, | 390 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, |
380 | -1); | 391 | &key, |
392 | -1); | ||
381 | GNUNET_free_non_null (key); | 393 | GNUNET_free_non_null (key); |
382 | if (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL ( | 394 | if (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL ( |
383 | main_ctx->search_ns_treestore), &iter)) | 395 | main_ctx->search_ns_treestore), &iter)) |
@@ -387,7 +399,13 @@ GNUNET_GTK_main_window_refresh_ns_list (struct GNUNET_GTK_MainWindowContext *mai | |||
387 | gtk_tree_store_clear (main_ctx->search_ns_treestore); | 399 | gtk_tree_store_clear (main_ctx->search_ns_treestore); |
388 | 400 | ||
389 | gtk_tree_store_insert_with_values (main_ctx->search_ns_treestore, &iter, NULL, G_MAXINT, | 401 | gtk_tree_store_insert_with_values (main_ctx->search_ns_treestore, &iter, NULL, G_MAXINT, |
390 | 0, "Any", 1, NULL, 2, "", 3, | 402 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, |
403 | "Any", | ||
404 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, | ||
405 | NULL, | ||
406 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT, | ||
407 | "", | ||
408 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP, | ||
391 | "Do not search in any particular namespace", | 409 | "Do not search in any particular namespace", |
392 | -1); | 410 | -1); |
393 | 411 | ||
@@ -404,9 +422,11 @@ GNUNET_GTK_main_window_refresh_ns_list (struct GNUNET_GTK_MainWindowContext *mai | |||
404 | while (TRUE) | 422 | while (TRUE) |
405 | { | 423 | { |
406 | gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter, | 424 | gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter, |
407 | 0, &value, | 425 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, |
408 | 1, &key, | 426 | &value, |
409 | -1); | 427 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, |
428 | &key, | ||
429 | -1); | ||
410 | if (selected_ns_id == NULL) | 430 | if (selected_ns_id == NULL) |
411 | found = TRUE; | 431 | found = TRUE; |
412 | else if (key != NULL && memcmp (key, selected_ns_id, sizeof (GNUNET_HashCode)) == 0) | 432 | else if (key != NULL && memcmp (key, selected_ns_id, sizeof (GNUNET_HashCode)) == 0) |
@@ -423,7 +443,11 @@ GNUNET_GTK_main_window_refresh_ns_list (struct GNUNET_GTK_MainWindowContext *mai | |||
423 | main_ctx->search_ns_treestore), &iter)) | 443 | main_ctx->search_ns_treestore), &iter)) |
424 | { | 444 | { |
425 | gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter, | 445 | gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter, |
426 | 0, &value, 1, &key, -1); | 446 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME, |
447 | &value, | ||
448 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY, | ||
449 | &key, | ||
450 | -1); | ||
427 | found = TRUE; | 451 | found = TRUE; |
428 | } | 452 | } |
429 | if (found) | 453 | if (found) |
diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c index cf4d969c..881131a9 100644 --- a/src/fs/gnunet-fs-gtk_main-window-search.c +++ b/src/fs/gnunet-fs-gtk_main-window-search.c | |||
@@ -62,7 +62,10 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx) | |||
62 | mime_keyword = NULL; | 62 | mime_keyword = NULL; |
63 | if ( (NULL != mime_model) && | 63 | if ( (NULL != mime_model) && |
64 | gtk_combo_box_get_active_iter (mime_combo, &iter)) | 64 | gtk_combo_box_get_active_iter (mime_combo, &iter)) |
65 | gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1); | 65 | gtk_tree_model_get (mime_model, &iter, |
66 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME, | ||
67 | &mime_keyword, | ||
68 | -1); | ||
66 | if ( (NULL != mime_keyword) && | 69 | if ( (NULL != mime_keyword) && |
67 | (0 == strcmp (mime_keyword, " ")) ) | 70 | (0 == strcmp (mime_keyword, " ")) ) |
68 | { | 71 | { |
@@ -87,7 +90,10 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx) | |||
87 | namespace_treepath = gtk_tree_row_reference_get_path (ref); | 90 | namespace_treepath = gtk_tree_row_reference_get_path (ref); |
88 | if ( (NULL != namespace_treepath) && | 91 | if ( (NULL != namespace_treepath) && |
89 | (gtk_tree_model_get_iter (namespace_model, &iter, namespace_treepath))) | 92 | (gtk_tree_model_get_iter (namespace_model, &iter, namespace_treepath))) |
90 | gtk_tree_model_get (namespace_model, &iter, 1, &nsid, -1); | 93 | gtk_tree_model_get (namespace_model, &iter, |
94 | GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_TYPE, | ||
95 | &nsid, | ||
96 | -1); | ||
91 | } | 97 | } |
92 | } | 98 | } |
93 | 99 | ||
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index 73acaf93..57cc865b 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c | |||
@@ -38,6 +38,105 @@ | |||
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Columns in the publish model. | ||
42 | */ | ||
43 | enum PUBLISH_ModelColumns | ||
44 | { | ||
45 | /** | ||
46 | * A gchararray. | ||
47 | */ | ||
48 | PUBLISH_MC_FILESIZE = 0, | ||
49 | |||
50 | /** | ||
51 | * A gboolean. | ||
52 | */ | ||
53 | PUBLISH_MC_DO_INDEX = 1, | ||
54 | |||
55 | /** | ||
56 | * A gchararray. | ||
57 | */ | ||
58 | PUBLISH_MC_FILENAME = 2, | ||
59 | |||
60 | /** | ||
61 | * A guint. | ||
62 | */ | ||
63 | PUBLISH_MC_ANONYMITY_LEVEL = 3, | ||
64 | |||
65 | /** | ||
66 | * A guint. | ||
67 | */ | ||
68 | PUBLISH_MC_PRIORITY = 4, | ||
69 | |||
70 | /** | ||
71 | * A gpointer. | ||
72 | */ | ||
73 | PUBLISH_MC_FILE_INFORMATION_STRUCT = 5, | ||
74 | |||
75 | /** | ||
76 | * A guint64. | ||
77 | */ | ||
78 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE = 6, | ||
79 | |||
80 | /** | ||
81 | * A guint. | ||
82 | */ | ||
83 | PUBLISH_MC_REPLICATION_LEVEL = 7, | ||
84 | }; | ||
85 | |||
86 | |||
87 | /** | ||
88 | * Columns in the pseudonym model. | ||
89 | */ | ||
90 | enum PSEUDONYM_ModelColumns | ||
91 | { | ||
92 | /** | ||
93 | * A gchararray. | ||
94 | */ | ||
95 | PSEUDONYM_MC_LOCAL_NAME = 0, | ||
96 | |||
97 | /** | ||
98 | * A gpointer. | ||
99 | */ | ||
100 | PSEUDONYM_MC_NAMESPACE_HANDLE = 1, | ||
101 | |||
102 | /** | ||
103 | * A gchararray. | ||
104 | */ | ||
105 | PSEUDONYM_MC_LAST_ID = 2, | ||
106 | |||
107 | /** | ||
108 | * A gchararray. | ||
109 | */ | ||
110 | PSEUDONYM_MC_LAST_URI = 3, | ||
111 | |||
112 | /** | ||
113 | * A gpointer. | ||
114 | */ | ||
115 | PSEUDONYM_MC_LAST_META = 4, | ||
116 | |||
117 | /** | ||
118 | * A gchararray. | ||
119 | */ | ||
120 | PSEUDONYM_MC_NEXT_ID = 5, | ||
121 | |||
122 | /** | ||
123 | * A gchararray. | ||
124 | */ | ||
125 | PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META = 6, | ||
126 | |||
127 | /** | ||
128 | * A gboolean. | ||
129 | */ | ||
130 | PSEUDONYM_MC_NEXT_ID_EDITABLE = 7, | ||
131 | |||
132 | /** | ||
133 | * A gboolean. | ||
134 | */ | ||
135 | PSEUDONYM_MC_CURRENT_ID_EDITABLE = 8, | ||
136 | }; | ||
137 | |||
138 | |||
139 | /** | ||
41 | * Context we create when we are scanning a directory. | 140 | * Context we create when we are scanning a directory. |
42 | */ | 141 | */ |
43 | struct AddDirClientContext; | 142 | struct AddDirClientContext; |
@@ -281,7 +380,8 @@ update_selectivity (struct MainPublishingDialogContext *ctx) | |||
281 | ns_ok = GNUNET_YES; | 380 | ns_ok = GNUNET_YES; |
282 | if (gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter)) | 381 | if (gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter)) |
283 | { | 382 | { |
284 | gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 2, &namespace_id, -1); | 383 | gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, |
384 | PSEUDONYM_MC_LAST_ID, &namespace_id, -1); | ||
285 | if (namespace_id == NULL) | 385 | if (namespace_id == NULL) |
286 | ns_ok = GNUNET_NO; | 386 | ns_ok = GNUNET_NO; |
287 | else | 387 | else |
@@ -339,7 +439,8 @@ update_selectivity (struct MainPublishingDialogContext *ctx) | |||
339 | is_dir = GNUNET_SYSERR; | 439 | is_dir = GNUNET_SYSERR; |
340 | while (GNUNET_YES != gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter)) | 440 | while (GNUNET_YES != gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter)) |
341 | { | 441 | { |
342 | gtk_tree_model_get (ctx->file_info_treemodel, &pred, 5, &fip, -1); | 442 | gtk_tree_model_get (ctx->file_info_treemodel, &pred, |
443 | PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1); | ||
343 | is_dir = GNUNET_FS_file_information_is_directory (fip); | 444 | is_dir = GNUNET_FS_file_information_is_directory (fip); |
344 | GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred)); | 445 | GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred)); |
345 | } | 446 | } |
@@ -405,15 +506,17 @@ create_dir_at_iter (struct MainPublishingDialogContext *ctx, | |||
405 | (GNUNET_FS_GTK_get_fs_handle (), row_reference, NULL, meta, bo, name); | 506 | (GNUNET_FS_GTK_get_fs_handle (), row_reference, NULL, meta, bo, name); |
406 | GNUNET_CONTAINER_meta_data_destroy (meta); | 507 | GNUNET_CONTAINER_meta_data_destroy (meta); |
407 | gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel), pos, | 508 | gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel), pos, |
408 | 0, MARKER_DIR_FILE_SIZE, | 509 | PUBLISH_MC_FILESIZE, MARKER_DIR_FILE_SIZE, |
409 | 1, (gboolean) GNUNET_NO, | 510 | PUBLISH_MC_DO_INDEX, (gboolean) GNUNET_NO, |
410 | 2, name, | 511 | PUBLISH_MC_FILENAME, name, |
411 | 3, (guint) bo->anonymity_level, | 512 | PUBLISH_MC_ANONYMITY_LEVEL, (guint) bo->anonymity_level, |
412 | 4, (guint) bo->content_priority, | 513 | PUBLISH_MC_PRIORITY, (guint) bo->content_priority, |
413 | 5, fi, | 514 | PUBLISH_MC_FILE_INFORMATION_STRUCT, fi, |
414 | 6, (guint64) bo->expiration_time.abs_value, | 515 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, |
415 | 7, (guint) bo->replication_level, | 516 | (guint64) bo->expiration_time.abs_value, |
416 | -1); | 517 | PUBLISH_MC_REPLICATION_LEVEL, |
518 | (guint) bo->replication_level, | ||
519 | -1); | ||
417 | update_selectivity (ctx); | 520 | update_selectivity (ctx); |
418 | } | 521 | } |
419 | 522 | ||
@@ -453,25 +556,27 @@ copy_entry (struct MainPublishingDialogContext *ctx, GtkTreeModel * tm, GtkTreeI | |||
453 | char *fsf; | 556 | char *fsf; |
454 | 557 | ||
455 | gtk_tree_model_get (tm, old, | 558 | gtk_tree_model_get (tm, old, |
456 | 0, &fsf, | 559 | PUBLISH_MC_FILESIZE, &fsf, |
457 | 1, &do_index, | 560 | PUBLISH_MC_DO_INDEX, &do_index, |
458 | 2, &short_fn, | 561 | PUBLISH_MC_FILENAME, &short_fn, |
459 | 3, &anonymity_level, | 562 | PUBLISH_MC_ANONYMITY_LEVEL, &anonymity_level, |
460 | 4, &priority, | 563 | PUBLISH_MC_PRIORITY, &priority, |
461 | 5, &fip, | 564 | PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, |
462 | 6, &expiration_time_abs, | 565 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, |
463 | 7, &replication_level, | 566 | &expiration_time_abs, |
464 | -1); | 567 | PUBLISH_MC_REPLICATION_LEVEL, &replication_level, |
465 | gtk_tree_store_set (GTK_TREE_STORE (tm), newpos, | 568 | -1); |
466 | 0, fsf, | 569 | gtk_tree_store_set (GTK_TREE_STORE (tm), newpos, |
467 | 1, do_index, | 570 | PUBLISH_MC_FILESIZE, fsf, |
468 | 2, short_fn, | 571 | PUBLISH_MC_DO_INDEX, do_index, |
469 | 3, anonymity_level, | 572 | PUBLISH_MC_FILENAME, short_fn, |
470 | 4, priority, | 573 | PUBLISH_MC_ANONYMITY_LEVEL, anonymity_level, |
471 | 5, fip, | 574 | PUBLISH_MC_PRIORITY, priority, |
472 | 6, expiration_time_abs, | 575 | PUBLISH_MC_FILE_INFORMATION_STRUCT, fip, |
473 | 7, replication_level, | 576 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, |
474 | -1); | 577 | expiration_time_abs, |
578 | PUBLISH_MC_REPLICATION_LEVEL, replication_level, | ||
579 | -1); | ||
475 | g_free (short_fn); | 580 | g_free (short_fn); |
476 | g_free (fsf); | 581 | g_free (fsf); |
477 | } | 582 | } |
@@ -548,8 +653,8 @@ GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb (GtkCellRe | |||
548 | return; | 653 | return; |
549 | } | 654 | } |
550 | gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, | 655 | gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, |
551 | 5, new_text, | 656 | PSEUDONYM_MC_NEXT_ID, new_text, |
552 | -1); | 657 | -1); |
553 | update_selectivity (ctx); | 658 | update_selectivity (ctx); |
554 | } | 659 | } |
555 | 660 | ||
@@ -578,8 +683,8 @@ GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb (GtkCel | |||
578 | return; | 683 | return; |
579 | } | 684 | } |
580 | gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, | 685 | gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, |
581 | 2, new_text, | 686 | PSEUDONYM_MC_LAST_ID, new_text, |
582 | -1); | 687 | -1); |
583 | update_selectivity (ctx); | 688 | update_selectivity (ctx); |
584 | } | 689 | } |
585 | 690 | ||
@@ -878,7 +983,8 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy, | |||
878 | GNUNET_assert (gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter)); | 983 | GNUNET_assert (gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter)); |
879 | 984 | ||
880 | /* now delete the subtree */ | 985 | /* now delete the subtree */ |
881 | gtk_tree_model_get (ctx->file_info_treemodel, &iter, 5, &fip, -1); | 986 | gtk_tree_model_get (ctx->file_info_treemodel, &iter, |
987 | PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1); | ||
882 | GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL); | 988 | GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL); |
883 | GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (ctx->file_info_treemodel), | 989 | GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (ctx->file_info_treemodel), |
884 | &iter); | 990 | &iter); |
@@ -1058,14 +1164,19 @@ add_item (struct AddDirClientContext *adcc, | |||
1058 | file_size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize); | 1164 | file_size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize); |
1059 | } | 1165 | } |
1060 | gtk_tree_store_set (ts, item_iter, | 1166 | gtk_tree_store_set (ts, item_iter, |
1061 | 0, file_size_fancy, | 1167 | PUBLISH_MC_FILESIZE, file_size_fancy, |
1062 | 1, (gboolean) adcc->directory_scan_do_index, | 1168 | PUBLISH_MC_DO_INDEX, |
1063 | 2, item->short_filename, | 1169 | (gboolean) adcc->directory_scan_do_index, |
1064 | 3, (guint) adcc->directory_scan_bo.anonymity_level, | 1170 | PUBLISH_MC_FILENAME, item->short_filename, |
1065 | 4, (guint) adcc->directory_scan_bo.content_priority, | 1171 | PUBLISH_MC_ANONYMITY_LEVEL, |
1066 | 5, fi, | 1172 | (guint) adcc->directory_scan_bo.anonymity_level, |
1067 | 6, (guint64) adcc->directory_scan_bo.expiration_time.abs_value, | 1173 | PUBLISH_MC_PRIORITY, |
1068 | 7, (guint) adcc->directory_scan_bo.replication_level, -1); | 1174 | (guint) adcc->directory_scan_bo.content_priority, |
1175 | PUBLISH_MC_FILE_INFORMATION_STRUCT, fi, | ||
1176 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, | ||
1177 | (guint64) adcc->directory_scan_bo.expiration_time.abs_value, | ||
1178 | PUBLISH_MC_REPLICATION_LEVEL, | ||
1179 | (guint) adcc->directory_scan_bo.replication_level, -1); | ||
1069 | GNUNET_free (file_size_fancy); | 1180 | GNUNET_free (file_size_fancy); |
1070 | } | 1181 | } |
1071 | 1182 | ||
@@ -1553,13 +1664,15 @@ update_treeview_after_edit (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
1553 | { | 1664 | { |
1554 | struct EditPublishContext *epc = cls; | 1665 | struct EditPublishContext *epc = cls; |
1555 | 1666 | ||
1556 | gtk_tree_store_set (GTK_TREE_STORE (epc->tm), &epc->iter, | 1667 | gtk_tree_store_set (GTK_TREE_STORE (epc->tm), &epc->iter, |
1557 | 1, *do_index, | 1668 | PUBLISH_MC_DO_INDEX, *do_index, |
1558 | 3, (guint) bo->anonymity_level, | 1669 | PUBLISH_MC_ANONYMITY_LEVEL, (guint) bo->anonymity_level, |
1559 | 4, (guint) bo->content_priority, | 1670 | PUBLISH_MC_PRIORITY, (guint) bo->content_priority, |
1560 | 6, (guint64) bo->expiration_time.abs_value, | 1671 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, |
1561 | 7, (guint) bo->replication_level, | 1672 | (guint64) bo->expiration_time.abs_value, |
1562 | -1); | 1673 | PUBLISH_MC_REPLICATION_LEVEL, |
1674 | (guint) bo->replication_level, | ||
1675 | -1); | ||
1563 | return GNUNET_SYSERR; | 1676 | return GNUNET_SYSERR; |
1564 | } | 1677 | } |
1565 | 1678 | ||
@@ -1607,9 +1720,9 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy, | |||
1607 | return; | 1720 | return; |
1608 | } | 1721 | } |
1609 | gtk_tree_model_get (ctx->file_info_treemodel, | 1722 | gtk_tree_model_get (ctx->file_info_treemodel, |
1610 | &epc->iter, | 1723 | &epc->iter, |
1611 | 5, &epc->fip, | 1724 | PUBLISH_MC_FILE_INFORMATION_STRUCT, &epc->fip, |
1612 | -1); | 1725 | -1); |
1613 | GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, | 1726 | GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, |
1614 | epc->fip, | 1727 | epc->fip, |
1615 | GNUNET_NO, | 1728 | GNUNET_NO, |
@@ -1639,8 +1752,9 @@ get_file_information (GtkTreeModel * tm, GtkTreeIter * iter) | |||
1639 | struct GNUNET_FS_FileInformation *fic; | 1752 | struct GNUNET_FS_FileInformation *fic; |
1640 | GtkTreeIter child; | 1753 | GtkTreeIter child; |
1641 | 1754 | ||
1642 | gtk_tree_model_get (tm, iter, 5, &fi, -1); | 1755 | gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fi, -1); |
1643 | gtk_tree_store_set (GTK_TREE_STORE (tm), iter, 5, NULL, -1); | 1756 | gtk_tree_store_set (GTK_TREE_STORE (tm), iter, |
1757 | PUBLISH_MC_FILE_INFORMATION_STRUCT, NULL, -1); | ||
1644 | GNUNET_assert (fi != NULL); | 1758 | GNUNET_assert (fi != NULL); |
1645 | if (gtk_tree_model_iter_children (tm, &child, iter)) | 1759 | if (gtk_tree_model_iter_children (tm, &child, iter)) |
1646 | { | 1760 | { |
@@ -1670,9 +1784,9 @@ free_pseudonym_tree_store (GtkTreeModel * tm, GtkTreeIter * iter) | |||
1670 | struct GNUNET_FS_Namespace *ns; | 1784 | struct GNUNET_FS_Namespace *ns; |
1671 | 1785 | ||
1672 | gtk_tree_model_get (tm, iter, | 1786 | gtk_tree_model_get (tm, iter, |
1673 | 1, &ns, | 1787 | PSEUDONYM_MC_NAMESPACE_HANDLE, &ns, |
1674 | 4, &meta, | 1788 | PSEUDONYM_MC_LAST_META, &meta, |
1675 | -1); | 1789 | -1); |
1676 | if (NULL != meta) | 1790 | if (NULL != meta) |
1677 | GNUNET_CONTAINER_meta_data_destroy (meta); | 1791 | GNUNET_CONTAINER_meta_data_destroy (meta); |
1678 | if (NULL != ns) | 1792 | if (NULL != ns) |
@@ -1700,7 +1814,7 @@ free_file_information_tree_store (GtkTreeModel * tm, GtkTreeIter * iter) | |||
1700 | GtkTreeIter child; | 1814 | GtkTreeIter child; |
1701 | struct GNUNET_FS_FileInformation *fip; | 1815 | struct GNUNET_FS_FileInformation *fip; |
1702 | 1816 | ||
1703 | gtk_tree_model_get (tm, iter, 5, &fip, -1); | 1817 | gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1); |
1704 | if (NULL != fip) | 1818 | if (NULL != fip) |
1705 | GNUNET_FS_file_information_destroy (fip, NULL, NULL); | 1819 | GNUNET_FS_file_information_destroy (fip, NULL, NULL); |
1706 | /* recursively clean up children */ | 1820 | /* recursively clean up children */ |
@@ -1782,8 +1896,11 @@ GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton * button, | |||
1782 | } | 1896 | } |
1783 | if (TRUE == gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter)) | 1897 | if (TRUE == gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter)) |
1784 | { | 1898 | { |
1785 | gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 1, &namespace, 2, &namespace_id, 5, | 1899 | gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, |
1786 | &namespace_uid, -1); | 1900 | PSEUDONYM_MC_NAMESPACE_HANDLE, &namespace, |
1901 | PSEUDONYM_MC_LAST_ID, &namespace_id, | ||
1902 | PSEUDONYM_MC_NEXT_ID, &namespace_uid, | ||
1903 | -1); | ||
1787 | } | 1904 | } |
1788 | else | 1905 | else |
1789 | { | 1906 | { |
@@ -1919,14 +2036,23 @@ add_updateable_to_ts (void *cls, const char *last_id, | |||
1919 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 2036 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
1920 | /* FIXME-BUG-MAYBE: what if this put fails? Not convinced it cannot... */ | 2037 | /* FIXME-BUG-MAYBE: what if this put fails? Not convinced it cannot... */ |
1921 | desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta, &desc_is_a_dup); | 2038 | desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta, &desc_is_a_dup); |
1922 | gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT, 0, | 2039 | gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT, |
1923 | uc->namespace_name, 1, | 2040 | PSEUDONYM_MC_LOCAL_NAME, |
1924 | GNUNET_FS_namespace_dup (uc->ns), 2, last_id, | 2041 | uc->namespace_name, |
1925 | 3, GNUNET_FS_uri_dup (last_uri), 4, | 2042 | PSEUDONYM_MC_NAMESPACE_HANDLE, |
2043 | GNUNET_FS_namespace_dup (uc->ns), | ||
2044 | PSEUDONYM_MC_LAST_ID, last_id, | ||
2045 | PSEUDONYM_MC_LAST_URI, | ||
2046 | GNUNET_FS_uri_dup (last_uri), | ||
2047 | PSEUDONYM_MC_LAST_META, | ||
1926 | GNUNET_CONTAINER_meta_data_duplicate | 2048 | GNUNET_CONTAINER_meta_data_duplicate |
1927 | (last_meta), 5, "", 6, desc, 7, | 2049 | (last_meta), |
2050 | PSEUDONYM_MC_NEXT_ID, "", | ||
2051 | PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META, | ||
2052 | desc, | ||
2053 | PSEUDONYM_MC_NEXT_ID_EDITABLE, | ||
1928 | TRUE /* update editable (always) */ , | 2054 | TRUE /* update editable (always) */ , |
1929 | 8, FALSE | 2055 | PSEUDONYM_MC_CURRENT_ID_EDITABLE, FALSE |
1930 | /* current not editable (only for top-level) */ | 2056 | /* current not editable (only for top-level) */ |
1931 | , -1); | 2057 | , -1); |
1932 | GNUNET_free_non_null (desc); | 2058 | GNUNET_free_non_null (desc); |
@@ -1942,12 +2068,21 @@ add_updateable_to_ts (void *cls, const char *last_id, | |||
1942 | (strlen (next_id) > 0)) | 2068 | (strlen (next_id) > 0)) |
1943 | { | 2069 | { |
1944 | /* add leaf */ | 2070 | /* add leaf */ |
1945 | gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT, 0, | 2071 | gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT, |
1946 | uc->namespace_name, 1, | 2072 | PSEUDONYM_MC_LOCAL_NAME, |
1947 | GNUNET_FS_namespace_dup (uc->ns), 2, | 2073 | uc->namespace_name, |
1948 | next_id, 3, NULL, 4, NULL, 5, "", 6, "", | 2074 | PSEUDONYM_MC_NAMESPACE_HANDLE, |
1949 | 7, TRUE /* update editable (always) */ , | 2075 | GNUNET_FS_namespace_dup (uc->ns), |
1950 | 8, FALSE | 2076 | PSEUDONYM_MC_LAST_ID, next_id, |
2077 | PSEUDONYM_MC_LAST_URI, NULL, | ||
2078 | PSEUDONYM_MC_LAST_META, NULL, | ||
2079 | PSEUDONYM_MC_NEXT_ID, "", | ||
2080 | PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META, | ||
2081 | "", | ||
2082 | PSEUDONYM_MC_NEXT_ID_EDITABLE, | ||
2083 | TRUE /* update editable (always) */ , | ||
2084 | PSEUDONYM_MC_CURRENT_ID_EDITABLE, | ||
2085 | FALSE | ||
1951 | /* current not editable (only for top-level) */ | 2086 | /* current not editable (only for top-level) */ |
1952 | , -1); | 2087 | , -1); |
1953 | } | 2088 | } |
@@ -1975,15 +2110,16 @@ add_namespace_to_ts (void *cls, const char *name, const GNUNET_HashCode * id) | |||
1975 | uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); | 2110 | uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); |
1976 | uc.update_called = GNUNET_NO; | 2111 | uc.update_called = GNUNET_NO; |
1977 | gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, | 2112 | gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, |
1978 | 0, name, | 2113 | PSEUDONYM_MC_LOCAL_NAME, name, |
1979 | 1, uc.ns, | 2114 | PSEUDONYM_MC_NAMESPACE_HANDLE, uc.ns, |
1980 | 2, NULL /* last-id */ , | 2115 | PSEUDONYM_MC_LAST_ID, NULL, |
1981 | 3, NULL /* last-uri (as string!) */ , | 2116 | PSEUDONYM_MC_LAST_URI, NULL, |
1982 | 4, NULL /* meta */ , | 2117 | PSEUDONYM_MC_LAST_META, NULL, |
1983 | 5, NULL /* next-ID */ , | 2118 | PSEUDONYM_MC_NEXT_ID, NULL, |
1984 | 6, NULL /* last-description */ , | 2119 | PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META, |
1985 | 7, TRUE /* update editable */ , | 2120 | NULL, |
1986 | 8, TRUE /* current editable */ , | 2121 | PSEUDONYM_MC_NEXT_ID_EDITABLE, TRUE, |
2122 | PSEUDONYM_MC_CURRENT_ID_EDITABLE, TRUE, | ||
1987 | -1); | 2123 | -1); |
1988 | uc.seen = GNUNET_CONTAINER_multihashmap_create (128); | 2124 | uc.seen = GNUNET_CONTAINER_multihashmap_create (128); |
1989 | GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc); | 2125 | GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc); |
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c index 43e8db14..9cf1eac4 100644 --- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c | |||
@@ -30,6 +30,99 @@ | |||
30 | 30 | ||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Columns in the publication metadata model. | ||
34 | */ | ||
35 | enum PUBLISH_MetadataModelColumns | ||
36 | { | ||
37 | /** | ||
38 | * A guint. | ||
39 | */ | ||
40 | PUBLISH_METADATA_MC_TYPE = 0, | ||
41 | |||
42 | /** | ||
43 | * A guint. | ||
44 | */ | ||
45 | PUBLISH_METADATA_MC_FORMAT = 1, | ||
46 | |||
47 | /** | ||
48 | * A gchararray. | ||
49 | */ | ||
50 | PUBLISH_METADATA_MC_TYPE_NAME = 2, | ||
51 | |||
52 | /** | ||
53 | * A gchararray. | ||
54 | */ | ||
55 | PUBLISH_METADATA_MC_VALUE = 3, | ||
56 | |||
57 | /** | ||
58 | * A gchararray. | ||
59 | */ | ||
60 | PUBLISH_METADATA_MC_DESCRIPTION = 4, | ||
61 | }; | ||
62 | |||
63 | |||
64 | /** | ||
65 | * Columns in the publication metadata types model. | ||
66 | */ | ||
67 | enum PUBLISH_MetadataTypesModelColumns | ||
68 | { | ||
69 | /** | ||
70 | * A gint. | ||
71 | */ | ||
72 | PUBLISH_METADATA_TYPES_MC_TYPE = 0, | ||
73 | |||
74 | /** | ||
75 | * A gint. | ||
76 | */ | ||
77 | PUBLISH_METADATA_TYPES_MC_FORMAT = 1, | ||
78 | |||
79 | /** | ||
80 | * A gchararray. | ||
81 | */ | ||
82 | PUBLISH_METADATA_TYPES_MC_TYPE_NAME = 2, | ||
83 | |||
84 | /** | ||
85 | * A gchararray. | ||
86 | */ | ||
87 | PUBLISH_METADATA_TYPES_MC_DESCRIPTION = 3, | ||
88 | }; | ||
89 | |||
90 | |||
91 | /** | ||
92 | * Columns in the publication types model. | ||
93 | */ | ||
94 | enum PUBLISH_TypesModelColumns | ||
95 | { | ||
96 | /** | ||
97 | * A gint. | ||
98 | */ | ||
99 | PUBLISH_TYPES_MC_TYPE = 0, | ||
100 | |||
101 | /** | ||
102 | * A gchararray. | ||
103 | */ | ||
104 | PUBLISH_TYPES_MC_TYPE_NAME = 1, | ||
105 | }; | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Columns in the publication keywords model. | ||
110 | */ | ||
111 | enum PUBLISH_KeywordsModelColumns | ||
112 | { | ||
113 | /** | ||
114 | * A gchararray. | ||
115 | */ | ||
116 | PUBLISH_TYPES_MC_KEYWORD = 0, | ||
117 | |||
118 | /** | ||
119 | * A gboolean. | ||
120 | */ | ||
121 | PUBLISH_TYPES_MC_ADDED = 1, | ||
122 | }; | ||
123 | |||
124 | |||
125 | /** | ||
33 | * Internal state kept for each "edit" dialog where the user can edit | 126 | * Internal state kept for each "edit" dialog where the user can edit |
34 | * publishing information for a file. | 127 | * publishing information for a file. |
35 | */ | 128 | */ |
@@ -215,12 +308,18 @@ change_metatypes (struct EditPublicationDialogContext *ctx, gint code) | |||
215 | for (i = 0; types[code][i] != EXTRACTOR_METATYPE_RESERVED; i++) | 308 | for (i = 0; types[code][i] != EXTRACTOR_METATYPE_RESERVED; i++) |
216 | if ( (types[code][i] < max_type) && (types[code][i] > 0) ) | 309 | if ( (types[code][i] < max_type) && (types[code][i] > 0) ) |
217 | gtk_list_store_insert_with_values (ctx->metatypes_liststore, | 310 | gtk_list_store_insert_with_values (ctx->metatypes_liststore, |
218 | &iter, G_MAXINT, | 311 | &iter, G_MAXINT, |
219 | 0, types[code][i], | 312 | PUBLISH_METADATA_TYPES_MC_TYPE, |
220 | 1, EXTRACTOR_METAFORMAT_UTF8, | 313 | types[code][i], |
221 | 2, EXTRACTOR_metatype_to_string (types [code][i]), | 314 | PUBLISH_METADATA_TYPES_MC_FORMAT, |
222 | 3, EXTRACTOR_metatype_to_description (types[code][i]), | 315 | EXTRACTOR_METAFORMAT_UTF8, |
223 | -1); | 316 | PUBLISH_METADATA_TYPES_MC_TYPE_NAME, |
317 | EXTRACTOR_metatype_to_string | ||
318 | (types [code][i]), | ||
319 | PUBLISH_METADATA_TYPES_MC_DESCRIPTION, | ||
320 | EXTRACTOR_metatype_to_description | ||
321 | (types[code][i]), | ||
322 | -1); | ||
224 | } | 323 | } |
225 | 324 | ||
226 | 325 | ||
@@ -241,7 +340,8 @@ GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox * widget, | |||
241 | 340 | ||
242 | if (! gtk_combo_box_get_active_iter (widget, &iter)) | 341 | if (! gtk_combo_box_get_active_iter (widget, &iter)) |
243 | return; | 342 | return; |
244 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter, 0, &code, -1); | 343 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter, |
344 | PUBLISH_TYPES_MC_TYPE, &code, -1); | ||
245 | change_metatypes (ctx, code); | 345 | change_metatypes (ctx, code); |
246 | } | 346 | } |
247 | 347 | ||
@@ -301,11 +401,13 @@ GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (GtkCellR | |||
301 | } | 401 | } |
302 | type_id = ctx->meta_combo_selected_type_id; | 402 | type_id = ctx->meta_combo_selected_type_id; |
303 | ctx->meta_combo_selected_type_id = -1; | 403 | ctx->meta_combo_selected_type_id = -1; |
304 | gtk_list_store_set (ctx->meta_liststore, &iter, | 404 | gtk_list_store_set (ctx->meta_liststore, &iter, |
305 | 0, type_id, | 405 | PUBLISH_METADATA_MC_TYPE, type_id, |
306 | 1, EXTRACTOR_METAFORMAT_UTF8, | 406 | PUBLISH_METADATA_MC_FORMAT, EXTRACTOR_METAFORMAT_UTF8, |
307 | 2, EXTRACTOR_metatype_to_string (type_id), | 407 | PUBLISH_METADATA_MC_TYPE_NAME, |
308 | 4, EXTRACTOR_metatype_to_description (type_id), | 408 | EXTRACTOR_metatype_to_string (type_id), |
409 | PUBLISH_METADATA_MC_DESCRIPTION, | ||
410 | EXTRACTOR_metatype_to_description (type_id), | ||
309 | -1); | 411 | -1); |
310 | } | 412 | } |
311 | 413 | ||
@@ -334,8 +436,8 @@ GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb (GtkCell | |||
334 | g_object_get (combo, | 436 | g_object_get (combo, |
335 | "model", &combo_model, NULL); | 437 | "model", &combo_model, NULL); |
336 | gtk_tree_model_get (combo_model, new_iter, | 438 | gtk_tree_model_get (combo_model, new_iter, |
337 | 0, &type_id, | 439 | PUBLISH_METADATA_MC_TYPE, &type_id, |
338 | -1); | 440 | -1); |
339 | ctx->meta_combo_selected_type_id = type_id; | 441 | ctx->meta_combo_selected_type_id = type_id; |
340 | } | 442 | } |
341 | 443 | ||
@@ -373,7 +475,7 @@ GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (GtkCell | |||
373 | } | 475 | } |
374 | 476 | ||
375 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, | 477 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, |
376 | 0, &metatype, -1); | 478 | PUBLISH_METADATA_MC_TYPE, &metatype, -1); |
377 | if (metatype == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME) | 479 | if (metatype == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME) |
378 | { | 480 | { |
379 | /* apply filename rules */ | 481 | /* apply filename rules */ |
@@ -413,8 +515,8 @@ GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (GtkCell | |||
413 | avalue = NULL; | 515 | avalue = NULL; |
414 | } | 516 | } |
415 | gtk_list_store_set (ctx->meta_liststore, &iter, | 517 | gtk_list_store_set (ctx->meta_liststore, &iter, |
416 | 3, ivalue, | 518 | PUBLISH_METADATA_MC_VALUE, ivalue, |
417 | -1); | 519 | -1); |
418 | GNUNET_free_non_null (avalue); | 520 | GNUNET_free_non_null (avalue); |
419 | } | 521 | } |
420 | 522 | ||
@@ -434,13 +536,16 @@ GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton * button, | |||
434 | GtkTreeIter iter; | 536 | GtkTreeIter iter; |
435 | 537 | ||
436 | gtk_list_store_insert_with_values (ctx->meta_liststore, | 538 | gtk_list_store_insert_with_values (ctx->meta_liststore, |
437 | &iter, 0, | 539 | &iter, 0, |
438 | 0, 0, | 540 | PUBLISH_METADATA_MC_TYPE, 0, |
439 | 1, EXTRACTOR_METAFORMAT_UTF8, | 541 | PUBLISH_METADATA_MC_FORMAT, |
440 | 2, _("Select a type"), | 542 | EXTRACTOR_METAFORMAT_UTF8, |
441 | 3, _("Specify a value"), | 543 | PUBLISH_METADATA_MC_TYPE_NAME, |
442 | 4, NULL, | 544 | _("Select a type"), |
443 | -1); | 545 | PUBLISH_METADATA_MC_VALUE, |
546 | _("Specify a value"), | ||
547 | PUBLISH_METADATA_MC_DESCRIPTION, NULL, | ||
548 | -1); | ||
444 | } | 549 | } |
445 | 550 | ||
446 | 551 | ||
@@ -608,10 +713,10 @@ GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (GtkButton * | |||
608 | if (strlen (keyword) == 0) | 713 | if (strlen (keyword) == 0) |
609 | return; | 714 | return; |
610 | gtk_list_store_insert_with_values (ctx->keywords_liststore, | 715 | gtk_list_store_insert_with_values (ctx->keywords_liststore, |
611 | &iter, G_MAXINT, | 716 | &iter, G_MAXINT, |
612 | 0, keyword, | 717 | PUBLISH_TYPES_MC_KEYWORD, keyword, |
613 | 1, TRUE, | 718 | PUBLISH_TYPES_MC_ADDED, TRUE, |
614 | -1); | 719 | -1); |
615 | gtk_entry_set_text (ctx->keyword_entry, ""); | 720 | gtk_entry_set_text (ctx->keyword_entry, ""); |
616 | update_confirm_sensitivity (ctx); | 721 | update_confirm_sensitivity (ctx); |
617 | } | 722 | } |
@@ -731,7 +836,11 @@ preserve_meta_items (void *cls, const char *plugin_name, | |||
731 | { | 836 | { |
732 | do | 837 | do |
733 | { | 838 | { |
734 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, &ntype, 1, &nformat, 3, &value, -1); | 839 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, |
840 | PUBLISH_METADATA_MC_TYPE, &ntype, | ||
841 | PUBLISH_METADATA_MC_FORMAT, &nformat, | ||
842 | PUBLISH_METADATA_MC_VALUE, &value, | ||
843 | -1); | ||
735 | if ((ntype == type) && (nformat == format) && | 844 | if ((ntype == type) && (nformat == format) && |
736 | (0 == strcmp (value, data))) | 845 | (0 == strcmp (value, data))) |
737 | { | 846 | { |
@@ -809,7 +918,9 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
809 | { | 918 | { |
810 | gchar *value; | 919 | gchar *value; |
811 | 920 | ||
812 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->keywords_liststore), &iter, 0, &value, -1); | 921 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->keywords_liststore), &iter, |
922 | PUBLISH_TYPES_MC_KEYWORD, &value, | ||
923 | -1); | ||
813 | if (NULL == *uri) | 924 | if (NULL == *uri) |
814 | *uri = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value); | 925 | *uri = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value); |
815 | else | 926 | else |
@@ -840,7 +951,11 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
840 | guint nformat; | 951 | guint nformat; |
841 | gchar *value; | 952 | gchar *value; |
842 | 953 | ||
843 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, &ntype, 1, &nformat, 3, &value, -1); | 954 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, |
955 | PUBLISH_METADATA_MC_TYPE, &ntype, | ||
956 | PUBLISH_METADATA_MC_FORMAT, &nformat, | ||
957 | PUBLISH_METADATA_MC_VALUE, &value, | ||
958 | -1); | ||
844 | if (ntype > 0) | 959 | if (ntype > 0) |
845 | { | 960 | { |
846 | GNUNET_CONTAINER_meta_data_insert (meta, "<user>", ntype, nformat, | 961 | GNUNET_CONTAINER_meta_data_insert (meta, "<user>", ntype, nformat, |
@@ -941,8 +1056,8 @@ add_keyword (void *cls, const char *keyword, int is_mandatory) | |||
941 | 1056 | ||
942 | ls = GTK_LIST_STORE (cls); | 1057 | ls = GTK_LIST_STORE (cls); |
943 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, | 1058 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
944 | 0, keyword, | 1059 | PUBLISH_TYPES_MC_KEYWORD, keyword, |
945 | 1, FALSE, | 1060 | PUBLISH_TYPES_MC_ADDED, FALSE, |
946 | -1); | 1061 | -1); |
947 | return GNUNET_OK; | 1062 | return GNUNET_OK; |
948 | } | 1063 | } |
@@ -1154,7 +1269,8 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, | |||
1154 | (ctx->builder, "GNUNET_GTK_edit_publication_type_combo")); | 1269 | (ctx->builder, "GNUNET_GTK_edit_publication_type_combo")); |
1155 | if (gtk_combo_box_get_active_iter (pubtypes_combo, &iter)) | 1270 | if (gtk_combo_box_get_active_iter (pubtypes_combo, &iter)) |
1156 | { | 1271 | { |
1157 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter, 0, &code, -1); | 1272 | gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter, |
1273 | PUBLISH_TYPES_MC_TYPE, &code, -1); | ||
1158 | change_metatypes (ctx, 0); | 1274 | change_metatypes (ctx, 0); |
1159 | } | 1275 | } |
1160 | else | 1276 | else |
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c index 4ece8faa..afd3a90a 100644 --- a/src/gns/gnunet-gns-gtk.c +++ b/src/gns/gnunet-gns-gtk.c | |||
@@ -27,6 +27,76 @@ | |||
27 | #include "gnunet-gns-gtk.h" | 27 | #include "gnunet-gns-gtk.h" |
28 | #include <gnunet/gnunet_namestore_service.h> | 28 | #include <gnunet/gnunet_namestore_service.h> |
29 | 29 | ||
30 | |||
31 | /** | ||
32 | * Columns in the gns model. | ||
33 | */ | ||
34 | enum GNS_ModelColumns | ||
35 | { | ||
36 | /** | ||
37 | * A gchararray | ||
38 | */ | ||
39 | GNS_MC_NAME = 0, | ||
40 | |||
41 | /** | ||
42 | * A gboolean | ||
43 | */ | ||
44 | GNS_MC_IS_PUBLIC = 1, | ||
45 | |||
46 | /** | ||
47 | * A guint | ||
48 | */ | ||
49 | GNS_MC_RECORD_TYPE = 2, | ||
50 | |||
51 | /** | ||
52 | * A gchararray | ||
53 | */ | ||
54 | GNS_MC_RECORD_TYPE_AS_STRING = 3, | ||
55 | |||
56 | /** | ||
57 | * A guint64 | ||
58 | */ | ||
59 | GNS_MC_EXPIRATION_TIME = 4, | ||
60 | |||
61 | /** | ||
62 | * A gboolean | ||
63 | */ | ||
64 | GNS_MC_EXPIRATION_TIME_IS_RELATIVE = 5, | ||
65 | |||
66 | /** | ||
67 | * A gchararray | ||
68 | */ | ||
69 | GNS_MC_EXPIRATION_TIME_AS_STRING = 6, | ||
70 | |||
71 | /** | ||
72 | * A gchararray | ||
73 | */ | ||
74 | GNS_MC_VALUE_AS_STRING = 7, | ||
75 | |||
76 | /** | ||
77 | * A gchararray | ||
78 | */ | ||
79 | GNS_MC_VALUE_COLOR = 8, | ||
80 | }; | ||
81 | |||
82 | |||
83 | /** | ||
84 | * Columns in the gns type model. | ||
85 | */ | ||
86 | enum GNS_TypeModelColumns | ||
87 | { | ||
88 | /** | ||
89 | * A guint | ||
90 | */ | ||
91 | GNS_TYPE_MC_TYPE = 0, | ||
92 | |||
93 | /** | ||
94 | * A gchararray | ||
95 | */ | ||
96 | GNS_TYPE_MC_TYPENAME = 1, | ||
97 | }; | ||
98 | |||
99 | |||
30 | /** | 100 | /** |
31 | * Handle to our main loop. | 101 | * Handle to our main loop. |
32 | */ | 102 | */ |
diff --git a/src/setup/gnunet-setup-hostlist-editing.c b/src/setup/gnunet-setup-hostlist-editing.c index 981645c2..4c7a6fb3 100644 --- a/src/setup/gnunet-setup-hostlist-editing.c +++ b/src/setup/gnunet-setup-hostlist-editing.c | |||
@@ -64,11 +64,17 @@ GNUNET_setup_hostlist_url_cellrenderertext_edited_cb (GtkCellRendererText * | |||
64 | if (strlen (oldtext) == 0) | 64 | if (strlen (oldtext) == 0) |
65 | { | 65 | { |
66 | gtk_list_store_insert_before (ls, &iter, &old); | 66 | gtk_list_store_insert_before (ls, &iter, &old); |
67 | gtk_list_store_set (ls, &iter, 0, new_text, 1, FALSE, -1); | 67 | gtk_list_store_set (ls, &iter, |
68 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, new_text, | ||
69 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, FALSE, | ||
70 | -1); | ||
68 | } | 71 | } |
69 | else | 72 | else |
70 | { | 73 | { |
71 | gtk_list_store_set (ls, &old, 0, new_text, 1, FALSE, -1); | 74 | gtk_list_store_set (ls, &old, |
75 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, new_text, | ||
76 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, FALSE, | ||
77 | -1); | ||
72 | } | 78 | } |
73 | g_free (oldtext); | 79 | g_free (oldtext); |
74 | } | 80 | } |
diff --git a/src/setup/gnunet-setup-options.c b/src/setup/gnunet-setup-options.c index c9b16350..bc6e2cb7 100644 --- a/src/setup/gnunet-setup-options.c +++ b/src/setup/gnunet-setup-options.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * @brief configuration details | 23 | * @brief configuration details |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "gnunet-setup.h" | ||
26 | #include "gnunet-setup-options.h" | 27 | #include "gnunet-setup-options.h" |
27 | #include <gnunet/gnunet_util_lib.h> | 28 | #include <gnunet/gnunet_util_lib.h> |
28 | #include <gdk/gdkkeysyms.h> | 29 | #include <gdk/gdkkeysyms.h> |
@@ -605,7 +606,9 @@ GNUNET_setup_treeview_key_press_event_cb (GtkTreeView * tv, GdkEventKey * event, | |||
605 | sel = gtk_tree_view_get_selection (tv); | 606 | sel = gtk_tree_view_get_selection (tv); |
606 | if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) | 607 | if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) |
607 | return FALSE; | 608 | return FALSE; |
608 | gtk_tree_model_get (tm, &iter, 1, &editable, -1); | 609 | gtk_tree_model_get (tm, &iter, |
610 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, &editable, | ||
611 | -1); | ||
609 | if (TRUE == editable) | 612 | if (TRUE == editable) |
610 | return FALSE; /* likely currently editing... */ | 613 | return FALSE; /* likely currently editing... */ |
611 | gtk_list_store_remove (ls, &iter); | 614 | gtk_list_store_remove (ls, &iter); |
@@ -641,9 +644,17 @@ load_string_list_store (const void *cls, const char *section, | |||
641 | return GNUNET_SYSERR; | 644 | return GNUNET_SYSERR; |
642 | t = GNUNET_strdup (value); | 645 | t = GNUNET_strdup (value); |
643 | for (w = strtok (t, " "); w != NULL; w = strtok (NULL, " ")) | 646 | for (w = strtok (t, " "); w != NULL; w = strtok (NULL, " ")) |
644 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, w, 1, FALSE, -1); | 647 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
648 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, w, | ||
649 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, | ||
650 | FALSE, | ||
651 | -1); | ||
645 | GNUNET_free (t); | 652 | GNUNET_free (t); |
646 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, "", 1, TRUE, -1); | 653 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
654 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, "", | ||
655 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, | ||
656 | TRUE, | ||
657 | -1); | ||
647 | return GNUNET_OK; | 658 | return GNUNET_OK; |
648 | } | 659 | } |
649 | 660 | ||
@@ -678,7 +689,8 @@ save_string_list_store (const void *cls, const char *section, | |||
678 | { | 689 | { |
679 | do | 690 | do |
680 | { | 691 | { |
681 | gtk_tree_model_get (tm, &iter, 0, &val, -1); | 692 | gtk_tree_model_get (tm, &iter, |
693 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, &val, -1); | ||
682 | if (0 < strlen (val)) | 694 | if (0 < strlen (val)) |
683 | { | 695 | { |
684 | if (value == NULL) | 696 | if (value == NULL) |
@@ -725,9 +737,16 @@ add_dns_entry_to_list_store (void *cls, const char *section) | |||
725 | 737 | ||
726 | if (NULL == section) | 738 | if (NULL == section) |
727 | { | 739 | { |
728 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, "", 1, | 740 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
729 | (guint) 80, 2, (guint) 8080, 3, | 741 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, "", |
730 | "localhost4", 4, "tcp", -1); | 742 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, |
743 | (guint) 80, | ||
744 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, | ||
745 | (guint) 8080, | ||
746 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, | ||
747 | "localhost4", | ||
748 | GNUNET_GTK_SETUP_GNS_MC_ISUDP, "tcp", | ||
749 | -1); | ||
731 | return; | 750 | return; |
732 | } | 751 | } |
733 | 752 | ||
@@ -781,9 +800,16 @@ add_dns_entry_to_list_store (void *cls, const char *section) | |||
781 | _("`%s' is not a valid port number!\n"), hostport); | 800 | _("`%s' is not a valid port number!\n"), hostport); |
782 | continue; | 801 | continue; |
783 | } | 802 | } |
784 | gtk_list_store_insert_with_values (ls, &iter, 0, 0, sld, 1, | 803 | gtk_list_store_insert_with_values (ls, &iter, 0, |
785 | (guint) local_port, 2, | 804 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, |
786 | (guint) host_port, 3, hostname, 4, | 805 | sld, |
806 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, | ||
807 | (guint) local_port, | ||
808 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, | ||
809 | (guint) host_port, | ||
810 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, | ||
811 | hostname, | ||
812 | GNUNET_GTK_SETUP_GNS_MC_ISUDP, | ||
787 | (TRUE == udp) ? "udp" : "tcp", -1); | 813 | (TRUE == udp) ? "udp" : "tcp", -1); |
788 | } | 814 | } |
789 | GNUNET_free (cpy); | 815 | GNUNET_free (cpy); |
@@ -916,8 +942,13 @@ update_vpn_dns_configuration (GtkTreeModel * tm) | |||
916 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) | 942 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) |
917 | do | 943 | do |
918 | { | 944 | { |
919 | gtk_tree_model_get (tm, &iter, 0, &hostname, 1, &srcport, 2, &targetport, | 945 | gtk_tree_model_get (tm, &iter, |
920 | 3, &targethost, 4, &tcpudp, -1); | 946 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, &hostname, |
947 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, &srcport, | ||
948 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, &targetport, | ||
949 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, &targethost, | ||
950 | GNUNET_GTK_SETUP_GNS_MC_ISUDP, &tcpudp, | ||
951 | -1); | ||
921 | if (0 != strlen (hostname)) | 952 | if (0 != strlen (hostname)) |
922 | { | 953 | { |
923 | pos = head; | 954 | pos = head; |
@@ -1025,7 +1056,7 @@ save_vpn_dns_service_dnsname (GtkCellRendererText * renderer, gchar * path, | |||
1025 | GNUNET_break (0); | 1056 | GNUNET_break (0); |
1026 | return; | 1057 | return; |
1027 | } | 1058 | } |
1028 | gtk_tree_model_get (tm, &iter, 0, &old, -1); | 1059 | gtk_tree_model_get (tm, &iter, GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, &old, -1); |
1029 | if ((0 != strlen (old)) && (0 == strlen (new_text))) | 1060 | if ((0 != strlen (old)) && (0 == strlen (new_text))) |
1030 | { | 1061 | { |
1031 | /* deletion */ | 1062 | /* deletion */ |
@@ -1036,7 +1067,8 @@ save_vpn_dns_service_dnsname (GtkCellRendererText * renderer, gchar * path, | |||
1036 | return; | 1067 | return; |
1037 | } | 1068 | } |
1038 | /* update model */ | 1069 | /* update model */ |
1039 | gtk_list_store_set (ls, &iter, 0, new_text, -1); | 1070 | gtk_list_store_set (ls, &iter, |
1071 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, new_text, -1); | ||
1040 | /* update configuration */ | 1072 | /* update configuration */ |
1041 | update_vpn_dns_configuration (tm); | 1073 | update_vpn_dns_configuration (tm); |
1042 | if ((0 == strlen (old)) && (0 != strlen (new_text))) | 1074 | if ((0 == strlen (old)) && (0 != strlen (new_text))) |
@@ -1126,7 +1158,7 @@ save_vpn_dns_service_tcpudp (GtkCellRendererText * renderer, gchar * path, | |||
1126 | return; | 1158 | return; |
1127 | } | 1159 | } |
1128 | /* update model */ | 1160 | /* update model */ |
1129 | gtk_list_store_set (ls, &iter, 4, new_text, -1); | 1161 | gtk_list_store_set (ls, &iter, GNUNET_GTK_SETUP_GNS_MC_ISUDP, new_text, -1); |
1130 | /* update configuration */ | 1162 | /* update configuration */ |
1131 | update_vpn_dns_configuration (tm); | 1163 | update_vpn_dns_configuration (tm); |
1132 | } | 1164 | } |
@@ -1210,7 +1242,8 @@ save_vpn_dns_service_sourceport (GtkCellRendererText * renderer, gchar * path, | |||
1210 | return; | 1242 | return; |
1211 | } | 1243 | } |
1212 | /* update model */ | 1244 | /* update model */ |
1213 | gtk_list_store_set (ls, &iter, 1, (guint) port, -1); | 1245 | gtk_list_store_set (ls, &iter, |
1246 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, (guint) port, -1); | ||
1214 | /* update configuration */ | 1247 | /* update configuration */ |
1215 | update_vpn_dns_configuration (tm); | 1248 | update_vpn_dns_configuration (tm); |
1216 | } | 1249 | } |
@@ -1289,7 +1322,8 @@ save_vpn_dns_service_targethostname (GtkCellRendererText * renderer, | |||
1289 | return; | 1322 | return; |
1290 | } | 1323 | } |
1291 | /* update model */ | 1324 | /* update model */ |
1292 | gtk_list_store_set (ls, &iter, 3, new_text, -1); | 1325 | gtk_list_store_set (ls, &iter, |
1326 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, new_text, -1); | ||
1293 | /* update configuration */ | 1327 | /* update configuration */ |
1294 | update_vpn_dns_configuration (tm); | 1328 | update_vpn_dns_configuration (tm); |
1295 | } | 1329 | } |
diff --git a/src/setup/gnunet-setup.h b/src/setup/gnunet-setup.h index bc7deef8..4864c902 100644 --- a/src/setup/gnunet-setup.h +++ b/src/setup/gnunet-setup.h | |||
@@ -32,6 +32,56 @@ | |||
32 | #include <gladeui/glade.h> | 32 | #include <gladeui/glade.h> |
33 | #include <gtk/gtk.h> | 33 | #include <gtk/gtk.h> |
34 | 34 | ||
35 | |||
36 | /** | ||
37 | * Columns in the gns setup model. | ||
38 | */ | ||
39 | enum GNUNET_GTK_SETUP_HostlistUrlModelColumns | ||
40 | { | ||
41 | /** | ||
42 | * A gchararray | ||
43 | */ | ||
44 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL = 0, | ||
45 | |||
46 | /** | ||
47 | * A gboolean | ||
48 | */ | ||
49 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE = 1, | ||
50 | }; | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Columns in the hostlist url setup model. | ||
55 | */ | ||
56 | enum GNUNET_GTK_SETUP_GnsModelColumns | ||
57 | { | ||
58 | /** | ||
59 | * A gchararray | ||
60 | */ | ||
61 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME = 0, | ||
62 | |||
63 | /** | ||
64 | * A guint | ||
65 | */ | ||
66 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT = 1, | ||
67 | |||
68 | /** | ||
69 | * A guint | ||
70 | */ | ||
71 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT = 2, | ||
72 | |||
73 | /** | ||
74 | * A gchararray | ||
75 | */ | ||
76 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME = 3, | ||
77 | |||
78 | /** | ||
79 | * A gchararray | ||
80 | */ | ||
81 | GNUNET_GTK_SETUP_GNS_MC_ISUDP = 4, | ||
82 | }; | ||
83 | |||
84 | |||
35 | /** | 85 | /** |
36 | * Get an object from the main window. | 86 | * Get an object from the main window. |
37 | * | 87 | * |