aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c')
-rw-r--r--src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c23
1 files changed, 9 insertions, 14 deletions
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 bf3421ee..f209415d 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
@@ -64,7 +64,7 @@ void
64GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem * menuitem, 64GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem * menuitem,
65 gpointer user_data) 65 gpointer user_data)
66{ 66{
67 GtkBuilder *builder = GTK_BUILDER (user_data); 67 struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
68 GtkTreeView *tree; 68 GtkTreeView *tree;
69 GtkClipboard *cb; 69 GtkClipboard *cb;
70 GList *pairs; 70 GList *pairs;
@@ -75,9 +75,7 @@ GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem * menuitem,
75 gchar *s; 75 gchar *s;
76 gchar *p; 76 gchar *p;
77 77
78 tree = 78 tree = main_ctx->md_treeview;
79 GTK_TREE_VIEW (gtk_builder_get_object
80 (builder, "GNUNET_GTK_main_window_metadata_treeview"));
81 pairs = NULL; 79 pairs = NULL;
82 gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (tree), 80 gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (tree),
83 &copy_metadata_to_clipboard, &pairs); 81 &copy_metadata_to_clipboard, &pairs);
@@ -129,17 +127,18 @@ GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem * menuitem,
129 * 127 *
130 * @param button which button caused the event (0 for none) 128 * @param button which button caused the event (0 for none)
131 * @param event_time time of the event (current time or 'event->time') 129 * @param event_time time of the event (current time or 'event->time')
132 * @param user_data the gtk builder of the main window 130 * @param user_data the context of the main window
133 */ 131 */
134static void 132static void
135do_metadata_popup_menu (int button, 133do_metadata_popup_menu (int button,
136 int event_time, 134 int event_time,
137 GtkBuilder *builder) 135 gpointer user_data)
138{ 136{
139 GtkMenu *menu; 137 GtkMenu *menu;
138 struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
140 139
141 menu = GTK_MENU (gtk_builder_get_object (builder, "metadata_popup_menu")); 140 menu = GTK_MENU (gtk_builder_get_object (main_ctx->builder, "metadata_popup_menu"));
142 gtk_menu_popup (menu, NULL, NULL, NULL, builder, button, event_time); 141 gtk_menu_popup (menu, NULL, NULL, NULL, main_ctx, button, event_time);
143} 142}
144 143
145 144
@@ -158,14 +157,12 @@ GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb (GtkWidget *
158 gpointer 157 gpointer
159 user_data) 158 user_data)
160{ 159{
161 GtkBuilder *builder = GTK_BUILDER (user_data);
162
163 /* Ignore double-clicks and triple-clicks */ 160 /* Ignore double-clicks and triple-clicks */
164 if ( (event->button != 3) || (event->type != GDK_BUTTON_PRESS) ) 161 if ( (event->button != 3) || (event->type != GDK_BUTTON_PRESS) )
165 return FALSE; 162 return FALSE;
166 do_metadata_popup_menu (event->button, 163 do_metadata_popup_menu (event->button,
167 event->time, 164 event->time,
168 builder); 165 user_data);
169 return TRUE; 166 return TRUE;
170} 167}
171 168
@@ -182,11 +179,9 @@ gboolean
182GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb (GtkWidget * widget, 179GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb (GtkWidget * widget,
183 gpointer user_data) 180 gpointer user_data)
184{ 181{
185 GtkBuilder *builder = GTK_BUILDER (user_data);
186
187 do_metadata_popup_menu (0 /* no button */, 182 do_metadata_popup_menu (0 /* no button */,
188 gtk_get_current_event_time (), 183 gtk_get_current_event_time (),
189 builder); 184 user_data);
190 return TRUE; 185 return TRUE;
191} 186}
192 187