aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk.c')
-rw-r--r--src/fs/gnunet-fs-gtk.c108
1 files changed, 0 insertions, 108 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index bd292426..b3d05be2 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -128,114 +128,6 @@ GNUNET_GTK_quit_cb (GObject * object, gpointer user_data)
128} 128}
129 129
130 130
131
132void
133main_window_search_button_clicked_cb (GtkButton * button, gpointer user_data)
134{
135 GtkBuilder *builder;
136 GtkTreePath *namespace_treepath = NULL;
137 GtkTreeModel *namespace_model = NULL;
138 GtkComboBox *mime_combo;
139 GtkTreeModel *mime_model;
140 GtkEntry *query_entry;
141 guint anonymity_level;
142 GtkTreeRowReference *ref = NULL;
143 GtkTreeIter iter;
144 GtkToggleButton *toggle_button;
145 const char *entry_keywords;
146 gchar *keywords;
147 gchar *mime_keyword;
148
149 GNUNET_HashCode *nsid = NULL;
150 struct GNUNET_FS_Uri *uri;
151 char *emsg;
152
153 builder = GTK_BUILDER (user_data);
154
155 toggle_button =
156 GTK_TOGGLE_BUTTON (gtk_builder_get_object
157 (builder,
158 "main_window_search_namespace_dropdown_button"));
159
160 if (!GNUNET_GTK_get_selected_anonymity_level
161 (builder, "main_window_search_anonymity_combobox", &anonymity_level))
162 return;
163
164 mime_combo =
165 GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
166 ("main_window_search_mime_combobox"));
167 mime_model = gtk_combo_box_get_model (mime_combo);
168 mime_keyword = NULL;
169 if (mime_model && gtk_combo_box_get_active_iter (mime_combo, &iter))
170 gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1);
171 if (strcmp (mime_keyword, " ") == 0)
172 {
173 g_free (mime_keyword);
174 mime_keyword = NULL;
175 }
176
177 ref = g_object_get_data (G_OBJECT (toggle_button), "selected-row-reference");
178 if (ref)
179 {
180 namespace_model = gtk_tree_row_reference_get_model (ref);
181 namespace_treepath = gtk_tree_row_reference_get_path (ref);
182 if ((NULL != namespace_treepath) &&
183 (TRUE ==
184 gtk_tree_model_get_iter (namespace_model, &iter, namespace_treepath)))
185 gtk_tree_model_get (namespace_model, &iter, 1, &nsid, -1);
186 }
187 query_entry =
188 GTK_ENTRY (gtk_builder_get_object (builder, "main_window_search_entry"));
189 entry_keywords = gtk_entry_get_text (query_entry);
190 keywords =
191 g_strdup_printf ("%s %s%s", entry_keywords, mime_keyword ? "+" : "",
192 mime_keyword ? mime_keyword : "");
193 g_free (mime_keyword);
194 if (nsid != NULL)
195 {
196 uri = GNUNET_FS_uri_sks_create_from_nsid (nsid, keywords);
197 GNUNET_assert (uri != NULL);
198 }
199 else
200 {
201 emsg = NULL;
202 uri = GNUNET_FS_uri_ksk_create (keywords, &emsg);
203 if (uri == NULL)
204 {
205 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Invalid keyword string `%s': %s"),
206 keywords, emsg);
207 GNUNET_free_non_null (emsg);
208 return;
209 }
210 }
211 GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), uri, anonymity_level,
212 GNUNET_FS_SEARCH_OPTION_NONE, NULL);
213
214 g_free (keywords);
215 GNUNET_FS_uri_destroy (uri);
216}
217
218
219gboolean
220main_window_search_entry_key_press_event_cb (GtkWidget * widget,
221 GdkEventKey * event,
222 gpointer user_data)
223{
224 GtkBuilder *builder;
225
226 builder = GTK_BUILDER (user_data);
227
228 if (event->keyval == GDK_KEY_Return)
229 {
230 GtkWidget *find = GTK_WIDGET (gtk_builder_get_object (builder,
231 "main_window_search_button"));
232
233 main_window_search_button_clicked_cb (GTK_BUTTON (find), user_data);
234 return TRUE;
235 }
236 return FALSE;
237}
238
239/** 131/**
240 * Add pseudonym data to tree store 132 * Add pseudonym data to tree store
241 * 133 *