aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_main-window-search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_main-window-search.c')
-rw-r--r--src/fs/gnunet-fs-gtk_main-window-search.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c
index fdab7b94..ff43ff62 100644
--- a/src/fs/gnunet-fs-gtk_main-window-search.c
+++ b/src/fs/gnunet-fs-gtk_main-window-search.c
@@ -34,7 +34,7 @@
34 * @param builder the main dialog builder 34 * @param builder the main dialog builder
35 */ 35 */
36static void 36static void
37start_search (GtkBuilder *builder) 37start_search (struct GNUNET_GTK_MainWindowContext *main_ctx)
38{ 38{
39 guint anonymity_level; 39 guint anonymity_level;
40 gchar *keywords; 40 gchar *keywords;
@@ -44,7 +44,7 @@ start_search (GtkBuilder *builder)
44 44
45 /* get anonymity level */ 45 /* get anonymity level */
46 if (!GNUNET_GTK_get_selected_anonymity_level 46 if (!GNUNET_GTK_get_selected_anonymity_level
47 (builder, "main_window_search_anonymity_combobox", &anonymity_level)) 47 (main_ctx->builder, "main_window_search_anonymity_combobox", &anonymity_level))
48 { 48 {
49 GNUNET_break (0); 49 GNUNET_break (0);
50 return; 50 return;
@@ -73,15 +73,10 @@ start_search (GtkBuilder *builder)
73 /* get selected namespace */ 73 /* get selected namespace */
74 { 74 {
75 GtkTreeRowReference *ref; 75 GtkTreeRowReference *ref;
76 GtkToggleButton *toggle_button;
77 GtkTreeIter iter; 76 GtkTreeIter iter;
78 77
79 nsid = NULL; 78 nsid = NULL;
80 toggle_button = 79 ref = g_object_get_data (G_OBJECT (main_ctx->ns_dropdown_button), "selected-row-reference");
81 GTK_TOGGLE_BUTTON (gtk_builder_get_object
82 (builder,
83 "main_window_search_namespace_dropdown_button"));
84 ref = g_object_get_data (G_OBJECT (toggle_button), "selected-row-reference");
85 if (NULL != ref) 80 if (NULL != ref)
86 { 81 {
87 GtkTreePath *namespace_treepath; 82 GtkTreePath *namespace_treepath;
@@ -97,12 +92,9 @@ start_search (GtkBuilder *builder)
97 92
98 /* get keywords and compose keyword string */ 93 /* get keywords and compose keyword string */
99 { 94 {
100 GtkEntry *query_entry;
101 const char *entry_keywords; 95 const char *entry_keywords;
102 96
103 query_entry = GTK_ENTRY (gtk_builder_get_object (builder, 97 entry_keywords = gtk_entry_get_text (main_ctx->search_entry);
104 "main_window_search_entry"));
105 entry_keywords = gtk_entry_get_text (query_entry);
106 if (NULL != mime_keyword) 98 if (NULL != mime_keyword)
107 { 99 {
108 keywords = g_strdup_printf ("%s +%s", 100 keywords = g_strdup_printf ("%s +%s",
@@ -156,9 +148,8 @@ void
156main_window_search_button_clicked_cb (GtkButton * button, 148main_window_search_button_clicked_cb (GtkButton * button,
157 gpointer user_data) 149 gpointer user_data)
158{ 150{
159 GtkBuilder *builder = GTK_BUILDER (user_data); 151 struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
160 152 start_search (main_ctx);
161 start_search (builder);
162} 153}
163 154
164 155
@@ -176,11 +167,11 @@ main_window_search_entry_key_press_event_cb (GtkWidget * widget,
176 GdkEventKey * event, 167 GdkEventKey * event,
177 gpointer user_data) 168 gpointer user_data)
178{ 169{
179 GtkBuilder *builder = GTK_BUILDER (user_data); 170 struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
180 171
181 if (event->keyval == GDK_KEY_Return) 172 if (event->keyval == GDK_KEY_Return)
182 { 173 {
183 start_search (builder); 174 start_search (main_ctx);
184 return TRUE; 175 return TRUE;
185 } 176 }
186 return FALSE; 177 return FALSE;