diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/fs/download.c | 42 | ||||
-rw-r--r-- | src/plugins/fs/fs.c | 52 |
2 files changed, 54 insertions, 40 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index 7ada558c..2e7fe3fe 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -764,6 +764,19 @@ on_downloadButton_clicked_fs (GtkWidget * treeview, | |||
764 | NULL); | 764 | NULL); |
765 | } | 765 | } |
766 | 766 | ||
767 | /** | ||
768 | * Double-click on a search result | ||
769 | */ | ||
770 | gboolean | ||
771 | on_searchResults_button_press_fs (GtkWidget * treeview, | ||
772 | GdkEventButton * event, | ||
773 | gpointer data) | ||
774 | { | ||
775 | if (event->type == GDK_2BUTTON_PRESS) | ||
776 | on_downloadButton_clicked_fs (treeview, NULL); | ||
777 | return FALSE; | ||
778 | } | ||
779 | |||
767 | 780 | ||
768 | /** | 781 | /** |
769 | * User used the URI download entry. Start download | 782 | * User used the URI download entry. Start download |
@@ -875,7 +888,7 @@ clearCompletedDownloadCallback (GtkTreeModel * model, | |||
875 | } | 888 | } |
876 | 889 | ||
877 | void | 890 | void |
878 | on_clearCompletedDownloadsButton_clicked_fs (void *unused, | 891 | on_clearCompletedDownloads_clicked_fs (void *unused, |
879 | GtkWidget * clearButton) | 892 | GtkWidget * clearButton) |
880 | { | 893 | { |
881 | GNUNET_GTK_tree_model_foreach (GTK_TREE_MODEL (download_summary), | 894 | GNUNET_GTK_tree_model_foreach (GTK_TREE_MODEL (download_summary), |
@@ -898,7 +911,7 @@ fsuiCallDownloadCallback (GtkTreeModel * model, | |||
898 | } | 911 | } |
899 | 912 | ||
900 | void | 913 | void |
901 | on_abortDownloadButton_clicked_fs (void *unused, GtkWidget * abortButton) | 914 | on_abortDownload_clicked_fs (void *unused, GtkWidget * dummy) |
902 | { | 915 | { |
903 | GtkTreeSelection *selection; | 916 | GtkTreeSelection *selection; |
904 | GtkWidget *downloadList; | 917 | GtkWidget *downloadList; |
@@ -914,7 +927,7 @@ on_abortDownloadButton_clicked_fs (void *unused, GtkWidget * abortButton) | |||
914 | } | 927 | } |
915 | 928 | ||
916 | void | 929 | void |
917 | on_stopDownloadButton_clicked_fs (void *unused, GtkWidget * stopButton) | 930 | on_stopDownload_clicked_fs (void *unused, GtkWidget * dummy) |
918 | { | 931 | { |
919 | GtkTreeSelection *selection; | 932 | GtkTreeSelection *selection; |
920 | GtkWidget *downloadList; | 933 | GtkWidget *downloadList; |
@@ -927,4 +940,27 @@ on_stopDownloadButton_clicked_fs (void *unused, GtkWidget * stopButton) | |||
927 | (selection, &fsuiCallDownloadCallback, &GNUNET_FSUI_download_stop); | 940 | (selection, &fsuiCallDownloadCallback, &GNUNET_FSUI_download_stop); |
928 | } | 941 | } |
929 | 942 | ||
943 | |||
944 | /** | ||
945 | * Right-click on an active download | ||
946 | */ | ||
947 | gboolean | ||
948 | on_activeDownloadsList_button_press_fs (GtkWidget * treeview, | ||
949 | GdkEventButton * event_button, | ||
950 | gpointer dummy) | ||
951 | { | ||
952 | GtkWidget *menu; | ||
953 | GladeXML *contextMenuXML; | ||
954 | |||
955 | contextMenuXML = | ||
956 | glade_xml_new (GNUNET_GTK_get_glade_filename (), | ||
957 | "downloadsContextMenu", PACKAGE_NAME); | ||
958 | GNUNET_GTK_connect_glade_with_plugins (contextMenuXML); | ||
959 | menu = glade_xml_get_widget (contextMenuXML, "downloadsContextMenu"); | ||
960 | if (event_button->button == 3) | ||
961 | gtk_menu_popup (GTK_MENU(menu), | ||
962 | NULL, NULL, NULL, NULL, | ||
963 | event_button->button, event_button->time); | ||
964 | return FALSE; | ||
965 | } | ||
930 | /* end of download.c */ | 966 | /* end of download.c */ |
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c index ccc2e2a1..9219bf8e 100644 --- a/src/plugins/fs/fs.c +++ b/src/plugins/fs/fs.c | |||
@@ -358,10 +358,12 @@ on_search_summary_selection_changed (gpointer signal, gpointer cls) | |||
358 | > 0); | 358 | > 0); |
359 | } | 359 | } |
360 | 360 | ||
361 | static int | 361 | int |
362 | on_upload_copy_uri_activate (void *cls, GtkWidget * searchEntry) | 362 | on_upload_copy_uri_activate_fs (void *dummy1, GtkWidget *dummy2) |
363 | { | 363 | { |
364 | GtkTreeView *uploadList = cls; | 364 | GtkWidget *uploadsList = |
365 | glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
366 | "activeUploadsList"); | ||
365 | GtkTreePath *path; | 367 | GtkTreePath *path; |
366 | GtkTreeIter iter; | 368 | GtkTreeIter iter; |
367 | struct GNUNET_ECRS_URI *uri; | 369 | struct GNUNET_ECRS_URI *uri; |
@@ -369,7 +371,7 @@ on_upload_copy_uri_activate (void *cls, GtkWidget * searchEntry) | |||
369 | GtkClipboard *clip; | 371 | GtkClipboard *clip; |
370 | 372 | ||
371 | path = NULL; | 373 | path = NULL; |
372 | if (FALSE == gtk_tree_view_get_path_at_pos (uploadList, | 374 | if (FALSE == gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(uploadsList), |
373 | last_x, | 375 | last_x, |
374 | last_y, | 376 | last_y, |
375 | &path, NULL, NULL, NULL)) | 377 | &path, NULL, NULL, NULL)) |
@@ -394,37 +396,6 @@ on_upload_copy_uri_activate (void *cls, GtkWidget * searchEntry) | |||
394 | return FALSE; | 396 | return FALSE; |
395 | } | 397 | } |
396 | 398 | ||
397 | static gint | ||
398 | upload_click_handler (void *cls, GdkEvent * event) | ||
399 | { | ||
400 | GtkTreeView *uploadList = cls; | ||
401 | GtkMenu *menu; | ||
402 | GtkWidget *entry; | ||
403 | GdkEventButton *event_button; | ||
404 | |||
405 | if ((event == NULL) || (event->type != GDK_BUTTON_PRESS)) | ||
406 | return FALSE; | ||
407 | event_button = (GdkEventButton *) event; | ||
408 | if (event_button->button != 3) | ||
409 | return FALSE; | ||
410 | last_x = event_button->x; | ||
411 | last_y = event_button->y; | ||
412 | entry = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard")); | ||
413 | g_signal_connect_swapped (entry, | ||
414 | "activate", | ||
415 | G_CALLBACK (on_upload_copy_uri_activate), | ||
416 | uploadList); | ||
417 | gtk_label_set_use_underline (GTK_LABEL | ||
418 | (gtk_bin_get_child (GTK_BIN (entry))), TRUE); | ||
419 | gtk_widget_show (entry); | ||
420 | menu = GTK_MENU (gtk_menu_new ()); | ||
421 | gtk_menu_shell_append (GTK_MENU_SHELL (menu), entry); | ||
422 | gtk_menu_popup (menu, | ||
423 | NULL, | ||
424 | NULL, NULL, NULL, event_button->button, event_button->time); | ||
425 | return TRUE; | ||
426 | } | ||
427 | |||
428 | /** | 399 | /** |
429 | * Setup the summary views (in particular the models | 400 | * Setup the summary views (in particular the models |
430 | * and the renderers). | 401 | * and the renderers). |
@@ -441,6 +412,7 @@ fs_summary_start () | |||
441 | GtkCellRenderer *renderer; | 412 | GtkCellRenderer *renderer; |
442 | GtkTreeViewColumn *column; | 413 | GtkTreeViewColumn *column; |
443 | int col; | 414 | int col; |
415 | GladeXML *contextMenuXML; | ||
444 | 416 | ||
445 | /* keyword list setup */ | 417 | /* keyword list setup */ |
446 | searchCB | 418 | searchCB |
@@ -530,6 +502,10 @@ fs_summary_start () | |||
530 | "changed", | 502 | "changed", |
531 | G_CALLBACK (&on_download_summary_selection_changed), | 503 | G_CALLBACK (&on_download_summary_selection_changed), |
532 | NULL, NULL, 0); | 504 | NULL, NULL, 0); |
505 | contextMenuXML = | ||
506 | glade_xml_new (GNUNET_GTK_get_glade_filename (), | ||
507 | "downloadsContextMenu", PACKAGE_NAME); | ||
508 | GNUNET_GTK_connect_glade_with_plugins (contextMenuXML); | ||
533 | 509 | ||
534 | renderer = gtk_cell_renderer_text_new (); | 510 | renderer = gtk_cell_renderer_text_new (); |
535 | col = gtk_tree_view_insert_column_with_attributes (downloadList, | 511 | col = gtk_tree_view_insert_column_with_attributes (downloadList, |
@@ -597,8 +573,6 @@ fs_summary_start () | |||
597 | uploadList = | 573 | uploadList = |
598 | GTK_TREE_VIEW (glade_xml_get_widget | 574 | GTK_TREE_VIEW (glade_xml_get_widget |
599 | (GNUNET_GTK_get_main_glade_XML (), "activeUploadsList")); | 575 | (GNUNET_GTK_get_main_glade_XML (), "activeUploadsList")); |
600 | g_signal_connect_swapped (uploadList, "button-press-event", | ||
601 | G_CALLBACK (upload_click_handler), uploadList); | ||
602 | upload_summary = gtk_tree_store_new (UPLOAD_NUM, G_TYPE_STRING, /* filename */ | 576 | upload_summary = gtk_tree_store_new (UPLOAD_NUM, G_TYPE_STRING, /* filename */ |
603 | G_TYPE_INT, /* progress */ | 577 | G_TYPE_INT, /* progress */ |
604 | G_TYPE_STRING, /* URI as string */ | 578 | G_TYPE_STRING, /* URI as string */ |
@@ -610,6 +584,10 @@ fs_summary_start () | |||
610 | "changed", | 584 | "changed", |
611 | G_CALLBACK (&on_upload_summary_selection_changed), | 585 | G_CALLBACK (&on_upload_summary_selection_changed), |
612 | NULL, NULL, 0); | 586 | NULL, NULL, 0); |
587 | contextMenuXML = | ||
588 | glade_xml_new (GNUNET_GTK_get_glade_filename (), | ||
589 | "uploadsContextMenu", PACKAGE_NAME); | ||
590 | GNUNET_GTK_connect_glade_with_plugins (contextMenuXML); | ||
613 | 591 | ||
614 | renderer = gtk_cell_renderer_progress_new (); | 592 | renderer = gtk_cell_renderer_progress_new (); |
615 | col = gtk_tree_view_insert_column_with_attributes (uploadList, | 593 | col = gtk_tree_view_insert_column_with_attributes (uploadList, |