diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk.c | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index b44b970c..b34f0f03 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "gnunet-fs-gtk.h" | 26 | #include "gnunet-fs-gtk.h" |
27 | #include "gnunet-fs-gtk_common.h" | 27 | #include "gnunet-fs-gtk_common.h" |
28 | #include "gnunet-fs-gtk_event-handler.h" | 28 | #include "gnunet-fs-gtk_event-handler.h" |
29 | 29 | #include "gnunet-fs-gtk_open-uri.h" | |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * How many block requests can we have outstanding in parallel at a time by default? | 32 | * How many block requests can we have outstanding in parallel at a time by default? |
@@ -110,7 +110,7 @@ GNUNET_FS_GTK_get_anonymity_level_list_store () | |||
110 | * | 110 | * |
111 | * @param main_window main window widget | 111 | * @param main_window main window widget |
112 | */ | 112 | */ |
113 | void | 113 | static void |
114 | main_window_save_position (GtkWidget *main_window) | 114 | main_window_save_position (GtkWidget *main_window) |
115 | { | 115 | { |
116 | GdkWindow *main_window_gdk; | 116 | GdkWindow *main_window_gdk; |
@@ -249,6 +249,65 @@ GNUNET_FS_GTK_delete_event_cb (GtkWidget *object, | |||
249 | 249 | ||
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Text was pasted into the main window. Check if it is a URL | ||
253 | * and perform the appropriate action. | ||
254 | * | ||
255 | * @param cb source clipboard | ||
256 | * @param text pasted text | ||
257 | * @param data NULL | ||
258 | */ | ||
259 | static void | ||
260 | process_paste (GtkClipboard *cb, | ||
261 | const gchar *text, | ||
262 | gpointer data) | ||
263 | { | ||
264 | struct GNUNET_FS_Uri *kskuri; | ||
265 | char *emsg; | ||
266 | |||
267 | if (strlen (text) == 0) | ||
268 | return; | ||
269 | if (GNUNET_OK == GNUNET_FS_GTK_handle_uri_string (text, 1)) | ||
270 | return; | ||
271 | emsg = NULL; | ||
272 | kskuri = GNUNET_FS_uri_ksk_create (text, &emsg); | ||
273 | if (NULL == kskuri) | ||
274 | { | ||
275 | GNUNET_free_non_null (emsg); | ||
276 | return; | ||
277 | } | ||
278 | GNUNET_FS_GTK_handle_uri (kskuri, 1); | ||
279 | GNUNET_FS_uri_destroy (kskuri); | ||
280 | } | ||
281 | |||
282 | |||
283 | /** | ||
284 | * We got an event in the main window. Check for clipboard action. | ||
285 | * | ||
286 | * @param widget the main window | ||
287 | * @param event the event, we only care about button events | ||
288 | * @param user_data the 'struct SearchTab' the widget is in | ||
289 | * @return FALSE if no menu could be popped up, | ||
290 | * TRUE if there is now a pop-up menu | ||
291 | */ | ||
292 | gboolean | ||
293 | GNUNET_FS_GTK_main_window_button_press_event (GtkWidget * widget, | ||
294 | GdkEvent * event, | ||
295 | gpointer user_data) | ||
296 | { | ||
297 | GdkEventButton *event_button = (GdkEventButton *) event; | ||
298 | GtkClipboard *cb; | ||
299 | |||
300 | if ( (event->type != GDK_BUTTON_PRESS) || | ||
301 | (event_button->button != 2) ) | ||
302 | return FALSE; | ||
303 | cb = gtk_clipboard_get (gdk_atom_intern ("PRIMARY", FALSE)); | ||
304 | gtk_clipboard_request_text (cb, &process_paste, NULL); | ||
305 | return FALSE; | ||
306 | } | ||
307 | |||
308 | |||
309 | |||
310 | /** | ||
252 | * Actual main function run right after GNUnet's scheduler | 311 | * Actual main function run right after GNUnet's scheduler |
253 | * is initialized. Initializes up GTK and Glade. | 312 | * is initialized. Initializes up GTK and Glade. |
254 | * | 313 | * |