aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_event-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r--src/fs/gnunet-fs-gtk_event-handler.c74
1 files changed, 25 insertions, 49 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c
index 3df59cf1..93e5c27a 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -440,9 +440,11 @@ search_list_popup_selection_done (GtkMenuShell *menushell,
440 * @param column unused entry specifying which column the mouse was in 440 * @param column unused entry specifying which column the mouse was in
441 * @param user_data the 'struct SearchTab' that was activated 441 * @param user_data the 'struct SearchTab' that was activated
442 */ 442 */
443static void 443void
444start_download_row_activated (GtkTreeView * tree_view, GtkTreePath * path, 444GNUNET_FS_GTK_search_treeview_row_activated (GtkTreeView * tree_view,
445 GtkTreeViewColumn * column, gpointer user_data) 445 GtkTreePath * path,
446 GtkTreeViewColumn * column,
447 gpointer user_data)
446{ 448{
447 struct SearchTab *tab = user_data; 449 struct SearchTab *tab = user_data;
448 450
@@ -681,8 +683,9 @@ search_list_popup (GtkTreeModel *tm,
681 * @return FALSE if no menu could be popped up, 683 * @return FALSE if no menu could be popped up,
682 * TRUE if there is now a pop-up menu 684 * TRUE if there is now a pop-up menu
683 */ 685 */
684static gboolean 686gboolean
685search_list_on_popup (GtkWidget *widget, gpointer user_data) 687GNUNET_FS_GTK_search_treeview_popup_menu (GtkWidget *widget,
688 gpointer user_data)
686{ 689{
687 GtkTreeView *tv = GTK_TREE_VIEW (widget); 690 GtkTreeView *tv = GTK_TREE_VIEW (widget);
688 struct SearchTab *tab = user_data; 691 struct SearchTab *tab = user_data;
@@ -707,10 +710,10 @@ search_list_on_popup (GtkWidget *widget, gpointer user_data)
707 * @return FALSE if no menu could be popped up, 710 * @return FALSE if no menu could be popped up,
708 * TRUE if there is now a pop-up menu 711 * TRUE if there is now a pop-up menu
709 */ 712 */
710static gboolean 713gboolean
711search_list_on_menu (GtkWidget * widget, 714GNUNET_FS_GTK_search_treeview_button_press_event (GtkWidget * widget,
712 GdkEvent * event, 715 GdkEvent * event,
713 gpointer user_data) 716 gpointer user_data)
714{ 717{
715 GtkTreeView *tv = GTK_TREE_VIEW (widget); 718 GtkTreeView *tv = GTK_TREE_VIEW (widget);
716 GdkEventButton *event_button = (GdkEventButton *) event; 719 GdkEventButton *event_button = (GdkEventButton *) event;
@@ -854,8 +857,9 @@ free_search_result (struct SearchResult *sr)
854 * @param tv the tree view in a search tab where the selection changed 857 * @param tv the tree view in a search tab where the selection changed
855 * @param user_data the 'struct SearchTab' that contains the tree view 858 * @param user_data the 'struct SearchTab' that contains the tree view
856 */ 859 */
857static void 860void
858update_meta_data_views (GtkTreeView *tv, gpointer user_data) 861GNUNET_FS_GTK_search_treeview_cursor_changed (GtkTreeView *tv,
862 gpointer user_data)
859{ 863{
860 struct SearchTab *tab = user_data; 864 struct SearchTab *tab = user_data;
861 GtkImage *image; 865 GtkImage *image;
@@ -925,7 +929,7 @@ GNUNET_GTK_main_window_notebook_switch_page_cb (GtkWidget * dummy,
925 continue; 929 continue;
926 tv = GTK_TREE_VIEW (gtk_builder_get_object 930 tv = GTK_TREE_VIEW (gtk_builder_get_object
927 (tab->builder, "_search_result_frame")); 931 (tab->builder, "_search_result_frame"));
928 update_meta_data_views (tv, tab); 932 GNUNET_FS_GTK_search_treeview_cursor_changed (tv, tab);
929 return; 933 return;
930 } 934 }
931 /* active tab is not a search tab (likely the 'publish' tab), 935 /* active tab is not a search tab (likely the 'publish' tab),
@@ -946,8 +950,8 @@ GNUNET_GTK_main_window_notebook_switch_page_cb (GtkWidget * dummy,
946 * @param button the 'close' button 950 * @param button the 'close' button
947 * @param user_data the 'struct SearchTab' of the tab to close 951 * @param user_data the 'struct SearchTab' of the tab to close
948 */ 952 */
949static void 953void
950stop_search (GtkButton *button, gpointer user_data) 954GNUNET_FS_GTK_search_result_close_button_clicked (GtkButton *button, gpointer user_data)
951{ 955{
952 struct SearchTab *tab = user_data; 956 struct SearchTab *tab = user_data;
953 struct GNUNET_FS_SearchContext *sc; 957 struct GNUNET_FS_SearchContext *sc;
@@ -972,8 +976,8 @@ stop_search (GtkButton *button, gpointer user_data)
972 * @param button the 'pause' button 976 * @param button the 'pause' button
973 * @param user_data the 'struct SearchTab' of the tab to pause 977 * @param user_data the 'struct SearchTab' of the tab to pause
974 */ 978 */
975static void 979void
976pause_search (GtkButton *button, gpointer user_data) 980GNUNET_FS_GTK_search_result_pause_button_clicked (GtkButton *button, gpointer user_data)
977{ 981{
978 struct SearchTab *tab = user_data; 982 struct SearchTab *tab = user_data;
979 983
@@ -994,8 +998,8 @@ pause_search (GtkButton *button, gpointer user_data)
994 * @param button the 'resume' button 998 * @param button the 'resume' button
995 * @param user_data the 'struct SearchTab' of the tab to resume 999 * @param user_data the 'struct SearchTab' of the tab to resume
996 */ 1000 */
997static void 1001void
998continue_search (GtkButton * button, gpointer user_data) 1002GNUNET_FS_GTK_search_result_play_button_clicked (GtkButton * button, gpointer user_data)
999{ 1003{
1000 struct SearchTab *tab = user_data; 1004 struct SearchTab *tab = user_data;
1001 1005
@@ -1021,8 +1025,8 @@ continue_search (GtkButton * button, gpointer user_data)
1021 * @param button the button pressed by the user 1025 * @param button the button pressed by the user
1022 * @param user_data the 'struct SearchTab' of the respective tab to clean up 1026 * @param user_data the 'struct SearchTab' of the respective tab to clean up
1023 */ 1027 */
1024static void 1028void
1025clear_downloads (GtkButton * button, gpointer user_data) 1029GNUNET_FS_GTK_search_result_clear_button_clicked (GtkButton * button, gpointer user_data)
1026{ 1030{
1027 struct SearchTab *tab = user_data; 1031 struct SearchTab *tab = user_data;
1028 struct SearchResult *sr; 1032 struct SearchResult *sr;
@@ -1204,7 +1208,7 @@ update_search_result (struct SearchResult *sr,
1204 { 1208 {
1205 tv = GTK_TREE_VIEW (gtk_builder_get_object 1209 tv = GTK_TREE_VIEW (gtk_builder_get_object
1206 (sr->tab->builder, "_search_result_frame")); 1210 (sr->tab->builder, "_search_result_frame"));
1207 update_meta_data_views (tv, sr->tab); 1211 GNUNET_FS_GTK_search_treeview_cursor_changed (tv, sr->tab);
1208 } 1212 }
1209} 1213}
1210 1214
@@ -1399,7 +1403,6 @@ setup_search_tab (struct GNUNET_FS_SearchContext *sc,
1399 const struct GNUNET_FS_Uri *query) 1403 const struct GNUNET_FS_Uri *query)
1400{ 1404{
1401 struct SearchTab *tab; 1405 struct SearchTab *tab;
1402 GtkTreeView *tv;
1403 GtkNotebook *notebook; 1406 GtkNotebook *notebook;
1404 GtkWindow *sf; 1407 GtkWindow *sf;
1405 gint pages; 1408 gint pages;
@@ -1446,44 +1449,18 @@ setup_search_tab (struct GNUNET_FS_SearchContext *sc,
1446 tab->label = 1449 tab->label =
1447 GTK_LABEL (gtk_builder_get_object 1450 GTK_LABEL (gtk_builder_get_object
1448 (tab->builder, "_search_result_label_window_label")); 1451 (tab->builder, "_search_result_label_window_label"));
1449
1450 /* FIXME-UNCLEAN: connect these signals using glade!!! */
1451 tab->close_button = 1452 tab->close_button =
1452 GTK_WIDGET (gtk_builder_get_object 1453 GTK_WIDGET (gtk_builder_get_object
1453 (tab->builder, "_search_result_label_close_button")); 1454 (tab->builder, "_search_result_label_close_button"));
1454 g_signal_connect (G_OBJECT (tab->close_button), "clicked",
1455 G_CALLBACK (stop_search), tab);
1456 tab->clear_button =
1457 GTK_WIDGET (gtk_builder_get_object
1458 (tab->builder, "_search_result_label_clear_button"));
1459 g_signal_connect (G_OBJECT (tab->clear_button), "clicked",
1460 G_CALLBACK (clear_downloads), tab);
1461 tab->play_button = 1455 tab->play_button =
1462 GTK_WIDGET (gtk_builder_get_object 1456 GTK_WIDGET (gtk_builder_get_object
1463 (tab->builder, "_search_result_label_play_button")); 1457 (tab->builder, "_search_result_label_play_button"));
1464 g_signal_connect (G_OBJECT (tab->play_button), "clicked",
1465 G_CALLBACK (continue_search), tab);
1466 tab->pause_button = 1458 tab->pause_button =
1467 GTK_WIDGET (gtk_builder_get_object 1459 GTK_WIDGET (gtk_builder_get_object
1468 (tab->builder, "_search_result_label_pause_button")); 1460 (tab->builder, "_search_result_label_pause_button"));
1469 g_signal_connect (G_OBJECT (tab->pause_button), "clicked",
1470 G_CALLBACK (pause_search), tab);
1471 /* patch text */ 1461 /* patch text */
1472 update_search_label (tab); 1462 update_search_label (tab);
1473 1463
1474 /* add signal handlers; FIXME-UNCLEAN: again, connect these with glade... */
1475 tv = GTK_TREE_VIEW (gtk_builder_get_object
1476 (tab->builder, "_search_result_frame"));
1477 g_signal_connect (G_OBJECT (tv), "row-activated",
1478 G_CALLBACK (start_download_row_activated), tab);
1479 g_signal_connect (G_OBJECT (tv), "cursor-changed",
1480 G_CALLBACK (update_meta_data_views), tab);
1481 g_signal_connect (G_OBJECT (tv), "button_press_event",
1482 G_CALLBACK (search_list_on_menu), tab);
1483 g_signal_connect (G_OBJECT (tv), "popup-menu",
1484 G_CALLBACK (search_list_on_popup), tab);
1485
1486
1487 /* make visible */ 1464 /* make visible */
1488 notebook = 1465 notebook =
1489 GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object 1466 GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object
@@ -1534,7 +1511,6 @@ setup_inner_search (struct GNUNET_FS_SearchContext *sc,
1534 ret->frame = parent->tab->frame; 1511 ret->frame = parent->tab->frame;
1535 ret->tab_label = parent->tab->tab_label; 1512 ret->tab_label = parent->tab->tab_label;
1536 ret->close_button = parent->tab->close_button; 1513 ret->close_button = parent->tab->close_button;
1537 ret->clear_button = parent->tab->clear_button;
1538 ret->play_button = parent->tab->play_button; 1514 ret->play_button = parent->tab->play_button;
1539 ret->label = parent->tab->label; 1515 ret->label = parent->tab->label;
1540 1516