diff options
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-fs-gtk.c | 2 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk.h | 2 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c | 7 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_namespace_manager.c | 63 |
4 files changed, 50 insertions, 24 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index 7cee7ac3..bbb94b13 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c | |||
@@ -173,7 +173,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
173 | void | 173 | void |
174 | GNUNET_GTK_quit_cb (GObject * object, gpointer user_data) | 174 | GNUNET_GTK_quit_cb (GObject * object, gpointer user_data) |
175 | { | 175 | { |
176 | struct GNUNET_GTK_MainWindowContext *main_context; | 176 | struct GNUNET_GTK_MainWindowContext *main_context = user_data; |
177 | 177 | ||
178 | main_window_save_position (main_context->main_window); | 178 | main_window_save_position (main_context->main_window); |
179 | 179 | ||
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h index af533fad..32b78d3d 100644 --- a/src/fs/gnunet-fs-gtk.h +++ b/src/fs/gnunet-fs-gtk.h | |||
@@ -56,6 +56,8 @@ struct GNUNET_GTK_MainWindowContext | |||
56 | GtkTreeRowReference *ns_selector_pushed_row; | 56 | GtkTreeRowReference *ns_selector_pushed_row; |
57 | GtkTreeRowReference *selected_ns_row; | 57 | GtkTreeRowReference *selected_ns_row; |
58 | int ns_callback_registered; | 58 | int ns_callback_registered; |
59 | GtkObject *ns_manager; | ||
60 | gulong ns_manager_delete_handler_id; | ||
59 | }; | 61 | }; |
60 | 62 | ||
61 | /** | 63 | /** |
diff --git a/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c b/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c index f5697ef1..3f5da1cd 100644 --- a/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c +++ b/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "gnunet-fs-gtk_common.h" | 26 | #include "gnunet-fs-gtk_common.h" |
27 | #include "gnunet-fs-gtk.h" | 27 | #include "gnunet-fs-gtk.h" |
28 | #include "gnunet-fs-gtk_event-handler.h" | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * How long until we automatically hide the drop-down if the cursor is outside the bounds? | 31 | * How long until we automatically hide the drop-down if the cursor is outside the bounds? |
@@ -435,4 +436,10 @@ GNUNET_GTK_main_window_refresh_ns_list (struct GNUNET_GTK_MainWindowContext *mai | |||
435 | GNUNET_free_non_null (selected_ns_id); | 436 | GNUNET_free_non_null (selected_ns_id); |
436 | } | 437 | } |
437 | 438 | ||
439 | void | ||
440 | namespace_selector_manage_namespaces_button_clicked_cb (GtkButton *button, gpointer user_data) | ||
441 | { | ||
442 | GNUNET_GTK_open_ns_manager (user_data); | ||
443 | } | ||
444 | |||
438 | /* end of gnunet-fs-gtk_main-window-namespace-dropdown.c */ | 445 | /* end of gnunet-fs-gtk_main-window-namespace-dropdown.c */ |
diff --git a/src/fs/gnunet-fs-gtk_namespace_manager.c b/src/fs/gnunet-fs-gtk_namespace_manager.c index 95763aef..69fe4969 100644 --- a/src/fs/gnunet-fs-gtk_namespace_manager.c +++ b/src/fs/gnunet-fs-gtk_namespace_manager.c | |||
@@ -50,15 +50,6 @@ struct GNUNET_GTK_NamespaceManagerContext | |||
50 | struct GNUNET_GTK_MainWindowContext *main_ctx; | 50 | struct GNUNET_GTK_MainWindowContext *main_ctx; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | /** | ||
54 | * THIS IS EVIL! Used to avoid opening more than one ns manager | ||
55 | * at once. Could be fixed by saving a pointer to the ns manager window | ||
56 | * somewhere in the main gnunet-fs-gtk window, but main window does | ||
57 | * not have a context structure for such things at the moment, hence | ||
58 | * this VERY EVIL GLOBAL VARIABLE! | ||
59 | */ | ||
60 | static struct GNUNET_GTK_NamespaceManagerContext *ns_manager = NULL; | ||
61 | |||
62 | #define GNUNET_GTK_KNOWN_NAMESPACES_IS_MINE_COLUMN 0 | 53 | #define GNUNET_GTK_KNOWN_NAMESPACES_IS_MINE_COLUMN 0 |
63 | #define GNUNET_GTK_KNOWN_NAMESPACES_RANK_COLUMN 1 | 54 | #define GNUNET_GTK_KNOWN_NAMESPACES_RANK_COLUMN 1 |
64 | #define GNUNET_GTK_KNOWN_NAMESPACES_NAME_COLUMN 2 | 55 | #define GNUNET_GTK_KNOWN_NAMESPACES_NAME_COLUMN 2 |
@@ -763,7 +754,6 @@ GNUNET_GTK_namespace_manager_dialog_response_cb (GtkDialog *dialog, | |||
763 | free_lists_contents (ctx); | 754 | free_lists_contents (ctx); |
764 | gtk_widget_destroy (GTK_WIDGET (ctx->namespace_manager)); | 755 | gtk_widget_destroy (GTK_WIDGET (ctx->namespace_manager)); |
765 | GNUNET_free (ctx); | 756 | GNUNET_free (ctx); |
766 | ns_manager = NULL; | ||
767 | } | 757 | } |
768 | } | 758 | } |
769 | 759 | ||
@@ -898,17 +888,10 @@ known_ns_selection_changed (GtkTreeSelection *treeselection, | |||
898 | gtk_widget_set_sensitive (ctx->details_apply_button, FALSE); | 888 | gtk_widget_set_sensitive (ctx->details_apply_button, FALSE); |
899 | } | 889 | } |
900 | 890 | ||
901 | 891 | GtkObject * | |
902 | 892 | GNUNET_GTK_namespace_manager_open (struct GNUNET_GTK_MainWindowContext *main_ctx) | |
903 | void | ||
904 | GNUNET_GTK_main_menu_file_manage_pseudonyms_activate_cb (GtkMenuItem *menuitem, | ||
905 | gpointer user_data) | ||
906 | { | 893 | { |
907 | struct GNUNET_GTK_MainWindowContext *main_ctx = user_data; | 894 | struct GNUNET_GTK_NamespaceManagerContext *ctx; |
908 | struct GNUNET_GTK_NamespaceManagerContext *ctx; | ||
909 | |||
910 | if (ns_manager != NULL) | ||
911 | return; | ||
912 | 895 | ||
913 | ctx = GNUNET_malloc (sizeof (struct GNUNET_GTK_NamespaceManagerContext)); | 896 | ctx = GNUNET_malloc (sizeof (struct GNUNET_GTK_NamespaceManagerContext)); |
914 | ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_namespace_manager.glade", ctx); | 897 | ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_namespace_manager.glade", ctx); |
@@ -916,7 +899,7 @@ GNUNET_GTK_main_menu_file_manage_pseudonyms_activate_cb (GtkMenuItem *menuitem, | |||
916 | { | 899 | { |
917 | GNUNET_break (0); | 900 | GNUNET_break (0); |
918 | GNUNET_free (ctx); | 901 | GNUNET_free (ctx); |
919 | return; | 902 | return NULL; |
920 | } | 903 | } |
921 | 904 | ||
922 | ctx->main_ctx = main_ctx; | 905 | ctx->main_ctx = main_ctx; |
@@ -967,12 +950,46 @@ GNUNET_GTK_main_menu_file_manage_pseudonyms_activate_cb (GtkMenuItem *menuitem, | |||
967 | /* sort namespace order list by rank (initially) */ | 950 | /* sort namespace order list by rank (initially) */ |
968 | sort_order_list (ctx, GNUNET_GTK_NAMESPACE_ORDER_RANK_COLUMN); | 951 | sort_order_list (ctx, GNUNET_GTK_NAMESPACE_ORDER_RANK_COLUMN); |
969 | 952 | ||
970 | ns_manager = ctx; | ||
971 | |||
972 | gtk_widget_set_sensitive (ctx->details_apply_button, FALSE); | 953 | gtk_widget_set_sensitive (ctx->details_apply_button, FALSE); |
973 | 954 | ||
974 | /* show dialog */ | 955 | /* show dialog */ |
975 | gtk_window_present (GTK_WINDOW (ctx->namespace_manager)); | 956 | gtk_window_present (GTK_WINDOW (ctx->namespace_manager)); |
957 | return GTK_OBJECT (ctx->namespace_manager); | ||
958 | } | ||
959 | |||
960 | void | ||
961 | ns_manager_deleted (GtkObject *object, gpointer user_data) | ||
962 | { | ||
963 | struct GNUNET_GTK_MainWindowContext *ctx = user_data; | ||
964 | g_signal_handler_disconnect (object, ctx->ns_manager_delete_handler_id); | ||
965 | g_object_unref (G_OBJECT (ctx->ns_manager)); | ||
966 | ctx->ns_manager = NULL; | ||
967 | ctx->ns_manager_delete_handler_id = 0; | ||
968 | return; | ||
969 | } | ||
970 | |||
971 | void | ||
972 | GNUNET_GTK_open_ns_manager (struct GNUNET_GTK_MainWindowContext *ctx) | ||
973 | { | ||
974 | if (ctx->ns_manager != NULL) | ||
975 | { | ||
976 | gtk_window_present (GTK_WINDOW (ctx->ns_manager)); | ||
977 | return; | ||
978 | } | ||
979 | |||
980 | ctx->ns_manager = GNUNET_GTK_namespace_manager_open (ctx); | ||
981 | if (ctx->ns_manager == NULL) | ||
982 | return; | ||
983 | |||
984 | g_object_ref (G_OBJECT (ctx->ns_manager)); | ||
985 | ctx->ns_manager_delete_handler_id = g_signal_connect (G_OBJECT (ctx->ns_manager), "destroy", G_CALLBACK (ns_manager_deleted), ctx); | ||
986 | } | ||
987 | |||
988 | void | ||
989 | GNUNET_GTK_main_menu_file_manage_pseudonyms_activate_cb (GtkMenuItem *menuitem, | ||
990 | gpointer user_data) | ||
991 | { | ||
992 | GNUNET_GTK_open_ns_manager (user_data); | ||
976 | } | 993 | } |
977 | 994 | ||
978 | /* end of gnunet-fs-gtk_namespace_manager.c */ | 995 | /* end of gnunet-fs-gtk_namespace_manager.c */ |