From a84f12987f2ab515b93b9928b751b438d058f326 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 2 Feb 2012 17:34:54 +0000 Subject: -eliminating dead glade file --- contrib/Makefile.am | 1 - .../gnunet_fs_gtk_advertise_pseudonym_dialog.glade | 793 --------------------- src/fs/gnunet-fs-gtk_advertise-pseudonym.c | 135 ++-- 3 files changed, 75 insertions(+), 854 deletions(-) delete mode 100644 contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 4b6f8b4a..2ac5e305 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -14,7 +14,6 @@ EXTRA_DIST = \ pkgdata_DATA = \ gnunet_fs_gtk_about_window.glade \ - gnunet_fs_gtk_advertise_pseudonym_dialog.glade \ gnunet_fs_gtk_create_namespace_dialog.glade \ gnunet_fs_gtk_download_as_dialog.glade \ gnunet_fs_gtk_main_window.glade \ diff --git a/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade b/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade deleted file mode 100644 index e77a41d9..00000000 --- a/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade +++ /dev/null @@ -1,793 +0,0 @@ - - - - - 100 - 1 - 10 - 10 - - - 100000 - 1 - 1 - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 100 - 1 - 10 - 10 - - - 100 - 1 - 10 - 10 - - - 100 - 1 - 10 - 10 - - - 9999 - 1 - 5 - - - False - 5 - Advertise namespace - True - dialog - True - - - True - False - vertical - 2 - - - True - False - end - - - gtk-cancel - False - True - True - True - False - True - - - False - False - 0 - - - - - gtk-ok - False - True - False - True - True - False - True - - - False - False - 1 - - - - - False - True - end - 0 - - - - - True - False - - - True - False - 5 - - - True - False - - - True - False - Type: - - - False - False - 0 - - - - - 100 - True - True - never - - - True - True - GNUNET_GTK_metatype_list_store - False - False - True - False - 2 - - - - - - Value - 0 - - - - 0 - - - - - - - - - True - True - 1 - - - - - True - False - Value: - - - False - False - 5 - 2 - - - - - True - True - - - - - True - True - 3 - - - - - False - False - 0 - - - - - 400 - 120 - True - False - adjustment1 - adjustment2 - - - True - True - adjustment1 - adjustment2 - GNUNET_GTK_meta_data_list_store - False - - - - - - fixed - 120 - Type - True - 2 - - - - 2 - - - - - - - Value - True - True - 3 - - - - 3 - - - - - - - - - True - True - 1 - - - - - True - True - 0 - - - - - True - False - - - gtk-add - False - True - False - True - True - False - True - - - - False - False - 0 - - - - - gtk-delete - False - True - False - True - True - False - True - - - - False - False - 5 - 1 - - - - - True - False - Preview: - - - False - False - 10 - 2 - - - - - False - False - gtk-missing-image - - - True - True - 3 - - - - - False - False - Select file - - - - False - False - 4 - - - - - True - True - 5 - 1 - - - - - False - True - 1 - - - - - True - False - - - True - False - - - True - False - - - True - False - _Keyword: - True - GNUNET_GTK_advertise_pseudonym_keyword_entry - - - False - False - 0 - - - - - True - True - - False - - - - - True - True - 1 - - - - - False - False - 5 - 0 - - - - - True - False - - - 400 - 120 - True - False - adjustment3 - adjustment4 - never - - - True - True - adjustment3 - adjustment4 - GNUNET_GTK_keyword_list_store - 0 - - - - - - Keywords - True - 0 - - - - 0 - - - - - - - - - True - True - 0 - - - - - True - False - - - gtk-add - False - True - False - True - True - False - True - - - - False - False - 0 - - - - - gtk-delete - False - True - False - True - True - False - True - - - - False - False - 5 - 1 - - - - - False - False - 5 - 1 - - - - - True - True - 1 - - - - - True - True - 5 - 0 - - - - - True - False - - - True - False - Options - center - - - False - False - 5 - 0 - - - - - True - False - - - False - True - 5 - 1 - - - - - True - False - - - True - False - _Anonymity: - True - - - False - False - 5 - 0 - - - - - True - True - Anonymity of zero means no anonymity. Values larger than one require GNUnet to have cover traffic (with larger values implying more cover traffic). - - GNUNET_GTK_anonymity_adjustment - - - - True - True - 1 - - - - - False - False - 2 - - - - - True - False - - - False - False - 3 - - - - - True - False - - - True - False - _Priority: - True - - - False - True - 5 - 0 - - - - - True - True - The content priority determines when content is discarded in favour of other, more popular content. - - priority_adjustment - True - - - True - True - 1 - - - - - False - False - 4 - - - - - True - False - - - False - True - 5 - - - - - True - False - - - True - False - _Root: - True - True - - - True - True - 5 - 0 - - - - - True - True - - root - - - True - True - 1 - - - - - True - True - 6 - - - - - True - False - - - False - True - 7 - - - - - True - False - - - True - False - _Expiration year: - True - - - False - True - 5 - 0 - - - - - True - True - 4 - - expiration_year_adjustment - 1 - True - - - True - True - 1 - - - - - True - True - 8 - - - - - False - False - 11 - 1 - - - - - False - True - 5 - 2 - - - - - - GNUNET_GTK_advertise_pseudonym_cancel_button - GNUNET_GTK_advertise_pseudonym_confirm_button - - - - 10000000 - 1000 - 1 - 10 - - diff --git a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c index b3355a48..7f8ab544 100644 --- a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c +++ b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c @@ -27,39 +27,7 @@ #include "gnunet-fs-gtk_publish-edit-dialog.h" - -gboolean -GNUNET_GTK_select_pseudonym_dialog_delete_event_cb (GtkWidget * widget, - GdkEvent * event, - gpointer user_Data) -{ - /* FIXME-LEAK: this doesn't destroy the dialog properly... */ - gtk_widget_hide (widget); - return TRUE; -} - - -/** - * Callback with information about local (!) namespaces. - * Contains the names of the local namespace and the global - * ID. Adds the to the list store. - * - * @param cls closure, the list store. - * @param name human-readable identifier of the namespace - * @param id hash identifier for the namespace - */ -static void -add_to_list (void *cls, const char *name, const GNUNET_HashCode * id) -{ - GtkListStore *ls = cls; - GtkTreeIter iter; - - gtk_list_store_insert_with_values (ls, &iter, -1, - 0, name, - 1, GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), - name), - -1); -} +/* *************************** handlers run on closing of the dialog ********************** */ /** @@ -100,7 +68,8 @@ struct NamespaceAdvertisementContext * to abort the iteration */ static int -advertise_namespace (void *cls, struct GNUNET_FS_FileInformation *fi, +advertise_namespace (void *cls, + struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, @@ -144,7 +113,7 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog, gint response_id, gpointer user_data) { - GtkBuilder *builder; + GtkBuilder *builder = GTK_BUILDER (user_data); GtkWidget *ad; GtkTreeView *tv; GtkTreeSelection *sel; @@ -158,7 +127,6 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog, struct GNUNET_CONTAINER_MetaData *meta; struct GNUNET_FS_BlockOptions bo; - builder = GTK_BUILDER (user_data); ad = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_select_pseudonym_dialog")); @@ -214,36 +182,63 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog, } +/** + * User deleted 'select pseudonym' dialog. Clean up. + * + * @param widget the dialog + * @param event the destroying event + * @param user_data the builder of the dialog + * @return TRUE + */ +gboolean +GNUNET_GTK_select_pseudonym_dialog_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + GtkBuilder *builder = GTK_BUILDER (user_data); + + /* FIXME: do we need to also explicitly destroy the window? */ + g_object_unref (G_OBJECT (builder)); + return TRUE; +} + + + +/* *************************** code to create the dialog ********************** */ + /** - * Advertise pseudonym selected. + * Callback with information about local (!) namespaces. + * Contains the names of the local namespace and the global + * ID. Adds the to the list store. + * + * @param cls closure, the list store. + * @param name human-readable identifier of the namespace + * @param id hash identifier for the namespace */ -void -GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy, - gpointer data) +static void +add_to_list (void *cls, + const char *name, + const GNUNET_HashCode * id) { - GtkWidget *ad; - GtkListStore *ls; - GtkWidget *toplevel; - GtkBuilder *builder; + GtkListStore *ls = cls; + GtkTreeIter iter; - builder = GTK_BUILDER (data); - ad = GTK_WIDGET (gtk_builder_get_object - (builder, "GNUNET_GTK_select_pseudonym_dialog")); - ls = GTK_LIST_STORE (gtk_builder_get_object - (builder, "GNUNET_GTK_select_pseudonym_liststore")); - gtk_list_store_clear (ls); - GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), &add_to_list, ls); - toplevel = gtk_widget_get_toplevel (dummy); - if (GTK_IS_WINDOW (toplevel)) - gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel)); - gtk_window_present (GTK_WINDOW (ad)); + gtk_list_store_insert_with_values (ls, &iter, -1, + 0, name, + 1, GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), + name), + -1); } /** + * Selection of the pseudonym changed, update the sensitivity + * of the buttons. * + * @param ts the selection instance + * @param user_data the builder of the selection dialog */ static void selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) @@ -255,7 +250,7 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_select_pseudonym_ok_button")); - if (TRUE == gtk_tree_selection_get_selected (ts, NULL, &iter)) + if (gtk_tree_selection_get_selected (ts, NULL, &iter)) gtk_widget_set_sensitive (ok_button, TRUE); else gtk_widget_set_sensitive (ok_button, FALSE); @@ -263,23 +258,43 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) /** + * Advertise pseudonym selected in the menu. * + * @param dummy the menu item + * @param user_data the builder of the main window, unused */ void -GNUNET_GTK_select_pseudonym_dialog_realize_cb (GtkWidget * widget, - gpointer user_data) +GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy, + gpointer user_data) { + GtkWidget *ad; + GtkListStore *ls; + GtkWidget *toplevel; GtkTreeView *tv; GtkTreeSelection *sel; GtkBuilder *builder; - builder = GTK_BUILDER (user_data); + builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_select_pseudonym_dialog.glade", NULL); + ad = GTK_WIDGET (gtk_builder_get_object + (builder, "GNUNET_GTK_select_pseudonym_dialog")); + ls = GTK_LIST_STORE (gtk_builder_get_object + (builder, "GNUNET_GTK_select_pseudonym_liststore")); + GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), + &add_to_list, + ls); + + /* FIXME: this signal can be connected by (modern) Glade automatically */ tv = GTK_TREE_VIEW (gtk_builder_get_object (builder, "GNUNET_GTK_select_pseudonym_tree_view")); sel = gtk_tree_view_get_selection (tv); g_signal_connect (G_OBJECT (sel), "changed", - G_CALLBACK (selection_changed_cb), user_data); + G_CALLBACK (selection_changed_cb), builder); + + toplevel = gtk_widget_get_toplevel (dummy); + if (GTK_IS_WINDOW (toplevel)) + gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel)); + gtk_window_present (GTK_WINDOW (ad)); } -- cgit v1.2.3