diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-18 10:46:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-18 10:46:48 +0000 |
commit | d3a838946bb9c7f111bde91fc3d9e7bc583588ac (patch) | |
tree | 01df0e76afc6c70c385cd4f7004b569145167f0e | |
parent | ec747d880c47e61b03c98c5d9b0080af6c442edd (diff) | |
download | gnunet-gtk-d3a838946bb9c7f111bde91fc3d9e7bc583588ac.tar.gz gnunet-gtk-d3a838946bb9c7f111bde91fc3d9e7bc583588ac.zip |
LRN: Make download-by-uri dialogue-less
-rw-r--r-- | contrib/gnunet_fs_gtk_main_window.glade | 198 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk-main_window_file_download.c | 182 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk.c | 8 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk.h | 12 | ||||
-rw-r--r-- | src/lib/about.c | 5 |
5 files changed, 330 insertions, 75 deletions
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade index a47a445c..d8b4d108 100644 --- a/contrib/gnunet_fs_gtk_main_window.glade +++ b/contrib/gnunet_fs_gtk_main_window.glade | |||
@@ -677,6 +677,189 @@ | |||
677 | <column type="gchararray"/> | 677 | <column type="gchararray"/> |
678 | </columns> | 678 | </columns> |
679 | </object> | 679 | </object> |
680 | <object class="GtkTextBuffer" id="GNUNET_GTK_open_url_dialog_url_textview_buffer"> | ||
681 | <signal name="changed" handler="GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb" swapped="no"/> | ||
682 | </object> | ||
683 | <object class="GtkWindow" id="GNUNET_GTK_open_url_window"> | ||
684 | <property name="can_focus">False</property> | ||
685 | <property name="title" translatable="yes">Enter the URI to be downloaded</property> | ||
686 | <property name="modal">True</property> | ||
687 | <property name="default_width">640</property> | ||
688 | <property name="default_height">240</property> | ||
689 | <property name="destroy_with_parent">True</property> | ||
690 | <property name="skip_taskbar_hint">True</property> | ||
691 | <property name="skip_pager_hint">True</property> | ||
692 | <property name="deletable">False</property> | ||
693 | <property name="transient_for">GNUNET_GTK_main_window</property> | ||
694 | <child> | ||
695 | <object class="GtkVBox" id="GNUNET_GTK_open_url_dialog_main_vbox"> | ||
696 | <property name="visible">True</property> | ||
697 | <property name="can_focus">False</property> | ||
698 | <property name="spacing">2</property> | ||
699 | <child> | ||
700 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_query_hbox"> | ||
701 | <property name="visible">True</property> | ||
702 | <property name="can_focus">False</property> | ||
703 | <child> | ||
704 | <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_url_label"> | ||
705 | <property name="visible">True</property> | ||
706 | <property name="can_focus">False</property> | ||
707 | <property name="label" translatable="yes">_URI:</property> | ||
708 | <property name="use_underline">True</property> | ||
709 | <property name="selectable">True</property> | ||
710 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property> | ||
711 | </object> | ||
712 | <packing> | ||
713 | <property name="expand">False</property> | ||
714 | <property name="fill">False</property> | ||
715 | <property name="padding">4</property> | ||
716 | <property name="position">0</property> | ||
717 | </packing> | ||
718 | </child> | ||
719 | <child> | ||
720 | <object class="GtkFrame" id="frame1"> | ||
721 | <property name="visible">True</property> | ||
722 | <property name="can_focus">False</property> | ||
723 | <property name="label_xalign">0</property> | ||
724 | <property name="shadow_type">in</property> | ||
725 | <child> | ||
726 | <object class="GtkAlignment" id="alignment1"> | ||
727 | <property name="visible">True</property> | ||
728 | <property name="can_focus">False</property> | ||
729 | <child> | ||
730 | <object class="GtkTextView" id="GNUNET_GTK_open_url_dialog_url_textview"> | ||
731 | <property name="visible">True</property> | ||
732 | <property name="can_focus">True</property> | ||
733 | <property name="events">GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK</property> | ||
734 | <property name="wrap_mode">char</property> | ||
735 | <property name="indent">20</property> | ||
736 | <property name="buffer">GNUNET_GTK_open_url_dialog_url_textview_buffer</property> | ||
737 | <property name="accepts_tab">False</property> | ||
738 | <signal name="key-press-event" handler="GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb" swapped="no"/> | ||
739 | </object> | ||
740 | </child> | ||
741 | </object> | ||
742 | </child> | ||
743 | <child type="label_item"> | ||
744 | <placeholder/> | ||
745 | </child> | ||
746 | </object> | ||
747 | <packing> | ||
748 | <property name="expand">True</property> | ||
749 | <property name="fill">True</property> | ||
750 | <property name="position">1</property> | ||
751 | </packing> | ||
752 | </child> | ||
753 | <child> | ||
754 | <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_anonymity_label"> | ||
755 | <property name="visible">True</property> | ||
756 | <property name="can_focus">False</property> | ||
757 | <property name="label" translatable="yes">_Anonymity:</property> | ||
758 | <property name="use_underline">True</property> | ||
759 | <property name="selectable">True</property> | ||
760 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property> | ||
761 | </object> | ||
762 | <packing> | ||
763 | <property name="expand">False</property> | ||
764 | <property name="fill">False</property> | ||
765 | <property name="padding">4</property> | ||
766 | <property name="position">2</property> | ||
767 | </packing> | ||
768 | </child> | ||
769 | <child> | ||
770 | <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_alignment"> | ||
771 | <property name="visible">True</property> | ||
772 | <property name="can_focus">False</property> | ||
773 | <property name="yscale">0</property> | ||
774 | <child> | ||
775 | <object class="GtkComboBox" id="GNUNET_GTK_open_url_dialog_anonymity_combobox"> | ||
776 | <property name="visible">True</property> | ||
777 | <property name="can_focus">False</property> | ||
778 | <property name="model">main_window_search_anonymity_liststore</property> | ||
779 | <property name="active">1</property> | ||
780 | <child> | ||
781 | <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renderer"/> | ||
782 | <attributes> | ||
783 | <attribute name="foreground">2</attribute> | ||
784 | <attribute name="text">0</attribute> | ||
785 | </attributes> | ||
786 | </child> | ||
787 | <child> | ||
788 | <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renerer_level"/> | ||
789 | <attributes> | ||
790 | <attribute name="text">1</attribute> | ||
791 | </attributes> | ||
792 | </child> | ||
793 | </object> | ||
794 | </child> | ||
795 | </object> | ||
796 | <packing> | ||
797 | <property name="expand">False</property> | ||
798 | <property name="fill">False</property> | ||
799 | <property name="position">3</property> | ||
800 | </packing> | ||
801 | </child> | ||
802 | </object> | ||
803 | <packing> | ||
804 | <property name="expand">True</property> | ||
805 | <property name="fill">True</property> | ||
806 | <property name="padding">5</property> | ||
807 | <property name="position">0</property> | ||
808 | </packing> | ||
809 | </child> | ||
810 | <child> | ||
811 | <object class="GtkHBox" id="hbox1"> | ||
812 | <property name="visible">True</property> | ||
813 | <property name="can_focus">False</property> | ||
814 | <child> | ||
815 | <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_execute_button"> | ||
816 | <property name="label">_Execute</property> | ||
817 | <property name="use_action_appearance">False</property> | ||
818 | <property name="visible">True</property> | ||
819 | <property name="sensitive">False</property> | ||
820 | <property name="can_focus">True</property> | ||
821 | <property name="receives_default">True</property> | ||
822 | <property name="image">execute_stock_image2</property> | ||
823 | <property name="use_underline">True</property> | ||
824 | <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/> | ||
825 | </object> | ||
826 | <packing> | ||
827 | <property name="expand">False</property> | ||
828 | <property name="fill">False</property> | ||
829 | <property name="padding">4</property> | ||
830 | <property name="pack_type">end</property> | ||
831 | <property name="position">0</property> | ||
832 | </packing> | ||
833 | </child> | ||
834 | <child> | ||
835 | <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_cancel_button"> | ||
836 | <property name="label">gtk-cancel</property> | ||
837 | <property name="use_action_appearance">False</property> | ||
838 | <property name="visible">True</property> | ||
839 | <property name="can_focus">True</property> | ||
840 | <property name="receives_default">True</property> | ||
841 | <property name="use_stock">True</property> | ||
842 | <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb" swapped="no"/> | ||
843 | </object> | ||
844 | <packing> | ||
845 | <property name="expand">False</property> | ||
846 | <property name="fill">False</property> | ||
847 | <property name="padding">4</property> | ||
848 | <property name="pack_type">end</property> | ||
849 | <property name="position">1</property> | ||
850 | </packing> | ||
851 | </child> | ||
852 | </object> | ||
853 | <packing> | ||
854 | <property name="expand">False</property> | ||
855 | <property name="fill">False</property> | ||
856 | <property name="padding">4</property> | ||
857 | <property name="position">1</property> | ||
858 | </packing> | ||
859 | </child> | ||
860 | </object> | ||
861 | </child> | ||
862 | </object> | ||
680 | <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store"> | 863 | <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store"> |
681 | <columns> | 864 | <columns> |
682 | <!-- column-name peer_identity --> | 865 | <!-- column-name peer_identity --> |
@@ -715,6 +898,21 @@ | |||
715 | <property name="page_increment">10</property> | 898 | <property name="page_increment">10</property> |
716 | <property name="page_size">10</property> | 899 | <property name="page_size">10</property> |
717 | </object> | 900 | </object> |
901 | <object class="GtkImage" id="execute_stock_image"> | ||
902 | <property name="visible">True</property> | ||
903 | <property name="can_focus">False</property> | ||
904 | <property name="stock">gtk-execute</property> | ||
905 | </object> | ||
906 | <object class="GtkImage" id="execute_stock_image1"> | ||
907 | <property name="visible">True</property> | ||
908 | <property name="can_focus">False</property> | ||
909 | <property name="stock">gtk-execute</property> | ||
910 | </object> | ||
911 | <object class="GtkImage" id="execute_stock_image2"> | ||
912 | <property name="visible">True</property> | ||
913 | <property name="can_focus">False</property> | ||
914 | <property name="stock">gtk-execute</property> | ||
915 | </object> | ||
718 | <object class="GtkImage" id="image1"> | 916 | <object class="GtkImage" id="image1"> |
719 | <property name="visible">True</property> | 917 | <property name="visible">True</property> |
720 | <property name="can_focus">False</property> | 918 | <property name="can_focus">False</property> |
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_download.c b/src/fs/gnunet-fs-gtk-main_window_file_download.c index 19f78172..0d1114af 100644 --- a/src/fs/gnunet-fs-gtk-main_window_file_download.c +++ b/src/fs/gnunet-fs-gtk-main_window_file_download.c | |||
@@ -25,82 +25,66 @@ | |||
25 | #include "gnunet-fs-gtk-common.h" | 25 | #include "gnunet-fs-gtk-common.h" |
26 | #include "gnunet-fs-gtk-download.h" | 26 | #include "gnunet-fs-gtk-download.h" |
27 | #include "gnunet-fs-gtk.h" | 27 | #include "gnunet-fs-gtk.h" |
28 | #include <gdk/gdkkeysyms.h> | ||
28 | 29 | ||
29 | static GtkBuilder *builder; | 30 | /** |
30 | 31 | * User selected "Open URI" in main window. | |
32 | */ | ||
31 | void | 33 | void |
32 | GNUNET_GTK_open_url_dialog_url_entry_changed_cb (GtkEditable * editable, | 34 | GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy, |
33 | gpointer user_data) | 35 | gpointer user_data) |
34 | { | 36 | { |
35 | struct GNUNET_FS_Uri *uri; | 37 | GtkBuilder *builder; |
36 | char *perr; | 38 | GtkWidget *dialog; |
37 | const char *uris; | 39 | GtkTextBuffer *tb; |
40 | GtkTextIter ti_start, ti_end; | ||
38 | 41 | ||
39 | perr = NULL; | 42 | builder = GTK_BUILDER (user_data); |
40 | uris = | ||
41 | gtk_entry_get_text (GTK_ENTRY | ||
42 | (gtk_builder_get_object | ||
43 | (builder, "GNUNET_GTK_open_url_dialog_url_entry"))); | ||
44 | if (uris != NULL) | ||
45 | uri = GNUNET_FS_uri_parse (uris, &perr); | ||
46 | else | ||
47 | uri = NULL; | ||
48 | gtk_widget_set_sensitive (GTK_WIDGET | ||
49 | (gtk_builder_get_object | ||
50 | (builder, | ||
51 | "GNUNET_GTK_open_url_dialog_execute_button")), | ||
52 | (uri == NULL) ? FALSE : TRUE); | ||
53 | if (uri != NULL) | ||
54 | GNUNET_FS_uri_destroy (uri); | ||
55 | else | ||
56 | GNUNET_free_non_null (perr); | ||
57 | } | ||
58 | 43 | ||
44 | dialog = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_window")); | ||
45 | |||
46 | tb = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_dialog_url_textview_buffer")); | ||
47 | gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0); | ||
48 | gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1); | ||
49 | gtk_text_buffer_delete (tb, &ti_start, &ti_end); | ||
50 | |||
51 | /* TODO: queue the clipboard, maybe there's valid URI in there? | ||
52 | * If so, get it. */ | ||
53 | |||
54 | gtk_widget_show (dialog); | ||
55 | } | ||
59 | 56 | ||
60 | /** | ||
61 | * User selected "Open URI" in main window. | ||
62 | */ | ||
63 | void | 57 | void |
64 | GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy, | 58 | GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GtkButton *button, |
65 | gpointer data) | 59 | gpointer user_data) |
66 | { | 60 | { |
67 | GtkWidget *ad; | 61 | GtkBuilder *builder; |
68 | const char *uris; | 62 | GtkWidget *dialog; |
69 | uint32_t anonymity; | 63 | GtkTextBuffer *tb; |
70 | struct GNUNET_FS_Uri *uri; | 64 | GtkTextIter ti_start, ti_end; |
65 | guint anonymity_level; | ||
71 | char *perr; | 66 | char *perr; |
72 | struct DownloadContext *dc; | 67 | char *uris; |
68 | struct GNUNET_FS_Uri *uri; | ||
73 | 69 | ||
74 | GNUNET_assert (builder == NULL); | 70 | builder = GTK_BUILDER (user_data); |
75 | builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_url_dialog.glade"); | 71 | |
76 | if (builder == NULL) | 72 | dialog = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_window")); |
77 | { | 73 | |
78 | GNUNET_break (0); | 74 | gtk_widget_hide (dialog); |
79 | return; | 75 | |
80 | } | 76 | tb = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_dialog_url_textview_buffer")); |
81 | ad = GTK_WIDGET (gtk_builder_get_object | 77 | gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0); |
82 | (builder, "GNUNET_GTK_open_url_dialog")); | 78 | gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1); |
83 | if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad))) | 79 | |
84 | { | 80 | uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE); |
85 | gtk_widget_destroy (ad); | 81 | |
86 | g_object_unref (G_OBJECT (builder)); | 82 | if (!GNUNET_GTK_get_selected_anonymity_level (builder, |
87 | builder = NULL; | 83 | "main_window_search_anonymity_combobox", &anonymity_level)) |
88 | fprintf (stderr, "Dialog closed!\n"); | ||
89 | return; | 84 | return; |
90 | } | 85 | |
91 | uris = | ||
92 | gtk_entry_get_text (GTK_ENTRY | ||
93 | (gtk_builder_get_object | ||
94 | (builder, "GNUNET_GTK_open_url_dialog_url_entry"))); | ||
95 | anonymity = | ||
96 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | ||
97 | (gtk_builder_get_object | ||
98 | (builder, | ||
99 | "GNUNET_GTK_open_url_dialog_anonymity_spin_button"))); | ||
100 | uri = GNUNET_FS_uri_parse (uris, &perr); | 86 | uri = GNUNET_FS_uri_parse (uris, &perr); |
101 | gtk_widget_destroy (ad); | 87 | g_free (uris); |
102 | g_object_unref (G_OBJECT (builder)); | ||
103 | builder = NULL; | ||
104 | if (uri == NULL) | 88 | if (uri == NULL) |
105 | { | 89 | { |
106 | GNUNET_free (perr); | 90 | GNUNET_free (perr); |
@@ -113,16 +97,17 @@ GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy, | |||
113 | fprintf (stderr, "Starting search!\n"); | 97 | fprintf (stderr, "Starting search!\n"); |
114 | GNUNET_break (NULL != | 98 | GNUNET_break (NULL != |
115 | GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), uri, | 99 | GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), uri, |
116 | anonymity, | 100 | anonymity_level, |
117 | GNUNET_FS_SEARCH_OPTION_NONE, NULL)); | 101 | GNUNET_FS_SEARCH_OPTION_NONE, NULL)); |
118 | GNUNET_FS_uri_destroy (uri); | 102 | GNUNET_FS_uri_destroy (uri); |
119 | return; | 103 | return; |
120 | } | 104 | } |
121 | if (GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri)) | 105 | if (GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri)) |
122 | { | 106 | { |
107 | struct DownloadContext *dc; | ||
123 | dc = GNUNET_malloc (sizeof (struct DownloadContext)); | 108 | dc = GNUNET_malloc (sizeof (struct DownloadContext)); |
124 | dc->uri = uri; | 109 | dc->uri = uri; |
125 | dc->anonymity = anonymity; | 110 | dc->anonymity = anonymity_level; |
126 | GNUNET_FS_GTK_open_download_as_dialog (dc); | 111 | GNUNET_FS_GTK_open_download_as_dialog (dc); |
127 | return; | 112 | return; |
128 | } | 113 | } |
@@ -130,4 +115,69 @@ GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy, | |||
130 | GNUNET_FS_uri_destroy (uri); | 115 | GNUNET_FS_uri_destroy (uri); |
131 | } | 116 | } |
132 | 117 | ||
118 | void | ||
119 | GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb (GtkButton *button, | ||
120 | gpointer user_data) | ||
121 | { | ||
122 | GtkBuilder *builder; | ||
123 | builder = GTK_BUILDER (user_data); | ||
124 | |||
125 | gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_window"))); | ||
126 | return; | ||
127 | } | ||
128 | |||
129 | gboolean | ||
130 | GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb (GtkWidget *widget, | ||
131 | GdkEventKey *event, gpointer user_data) | ||
132 | { | ||
133 | GtkBuilder *builder; | ||
134 | builder = GTK_BUILDER (user_data); | ||
135 | |||
136 | if (event->keyval == GDK_KEY_Return) | ||
137 | { | ||
138 | GtkWidget *execute = GTK_WIDGET (gtk_builder_get_object (builder, | ||
139 | "GNUNET_GTK_open_url_dialog_execute_button")); | ||
140 | if (gtk_widget_get_sensitive (execute)) | ||
141 | GNUNET_GTK_open_url_dialog_execute_button_clicked_cb ( | ||
142 | GTK_BUTTON (execute), user_data); | ||
143 | return TRUE; | ||
144 | } | ||
145 | return FALSE; | ||
146 | } | ||
147 | |||
148 | void | ||
149 | GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb ( | ||
150 | GtkTextBuffer *textbuffer, gpointer user_data) | ||
151 | { | ||
152 | struct GNUNET_FS_Uri *uri; | ||
153 | GtkTextBuffer *tb; | ||
154 | GtkTextIter ti_start, ti_end; | ||
155 | GtkBuilder *builder; | ||
156 | char *perr; | ||
157 | char *uris; | ||
158 | |||
159 | builder = GTK_BUILDER (user_data); | ||
160 | |||
161 | perr = NULL; | ||
162 | tb = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_dialog_url_textview_buffer")); | ||
163 | gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0); | ||
164 | gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1); | ||
165 | |||
166 | uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE); | ||
167 | if (uris != NULL) | ||
168 | uri = GNUNET_FS_uri_parse (uris, &perr); | ||
169 | else | ||
170 | uri = NULL; | ||
171 | g_free (uris); | ||
172 | gtk_widget_set_sensitive (GTK_WIDGET | ||
173 | (gtk_builder_get_object | ||
174 | (builder, | ||
175 | "GNUNET_GTK_open_url_dialog_execute_button")), | ||
176 | (uri == NULL) ? FALSE : TRUE); | ||
177 | if (uri != NULL) | ||
178 | GNUNET_FS_uri_destroy (uri); | ||
179 | else | ||
180 | GNUNET_free_non_null (perr); | ||
181 | } | ||
182 | |||
133 | /* end of gnunet-fs-gtk-main_window_file_download.c */ | 183 | /* end of gnunet-fs-gtk-main_window_file_download.c */ |
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index dd4c9512..2e0f2999 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c | |||
@@ -240,15 +240,14 @@ GNUNET_GTK_get_tree_string (GtkTreeView *treeview, GtkTreePath *treepath, | |||
240 | } | 240 | } |
241 | 241 | ||
242 | gboolean | 242 | gboolean |
243 | get_selected_anonymity_level (GtkBuilder *builder, guint *p_level) | 243 | GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, gchar *combo_name, guint *p_level) |
244 | { | 244 | { |
245 | GtkComboBox *combo; | 245 | GtkComboBox *combo; |
246 | GtkTreeIter iter; | 246 | GtkTreeIter iter; |
247 | GtkTreeModel *model; | 247 | GtkTreeModel *model; |
248 | guint level; | 248 | guint level; |
249 | 249 | ||
250 | combo = GTK_COMBO_BOX(gtk_builder_get_object (builder, | 250 | combo = GTK_COMBO_BOX(gtk_builder_get_object (builder, combo_name)); |
251 | "main_window_search_anonymity_combobox")); | ||
252 | if (!combo) | 251 | if (!combo) |
253 | return FALSE; | 252 | return FALSE; |
254 | 253 | ||
@@ -447,7 +446,8 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data) | |||
447 | toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, | 446 | toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, |
448 | "main_window_search_namespace_dropdown_button")); | 447 | "main_window_search_namespace_dropdown_button")); |
449 | 448 | ||
450 | if (!get_selected_anonymity_level (builder, &anonymity_level)) | 449 | if (!GNUNET_GTK_get_selected_anonymity_level (builder, |
450 | "main_window_search_anonymity_combobox", &anonymity_level)) | ||
451 | return; | 451 | return; |
452 | 452 | ||
453 | mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object | 453 | mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object |
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h index 3b3228f2..4cd76de6 100644 --- a/src/fs/gnunet-fs-gtk.h +++ b/src/fs/gnunet-fs-gtk.h | |||
@@ -63,6 +63,18 @@ GObject * | |||
63 | GNUNET_FS_GTK_get_main_window_object (const char *name); | 63 | GNUNET_FS_GTK_get_main_window_object (const char *name); |
64 | 64 | ||
65 | 65 | ||
66 | /** | ||
67 | * Get the selected anonymity level. | ||
68 | * | ||
69 | * @param builder builder object for the window | ||
70 | * @param combo_name name of the combobox widget to get anonymity from | ||
71 | * @param p_level pointer to a guint to receive the level value | ||
72 | * @return TRUE on success, FALSE on error | ||
73 | */ | ||
74 | gboolean | ||
75 | GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, | ||
76 | gchar *combo_name, guint *p_level); | ||
77 | |||
66 | 78 | ||
67 | #endif | 79 | #endif |
68 | /* end of gnunet-fs-gtk.h */ | 80 | /* end of gnunet-fs-gtk.h */ |
diff --git a/src/lib/about.c b/src/lib/about.c index 52a01451..6e2b80f1 100644 --- a/src/lib/about.c +++ b/src/lib/about.c | |||
@@ -121,11 +121,6 @@ GNUNET_GTK_display_about (const char *dialogfile) | |||
121 | ad = GTK_WIDGET (gtk_builder_get_object (builder, "about_window")); | 121 | ad = GTK_WIDGET (gtk_builder_get_object (builder, "about_window")); |
122 | g_object_set_data (G_OBJECT (ad), "gnunet-gtk-builder", builder); | 122 | g_object_set_data (G_OBJECT (ad), "gnunet-gtk-builder", builder); |
123 | gtk_widget_show (ad); | 123 | gtk_widget_show (ad); |
124 | /* | ||
125 | gtk_dialog_run (GTK_DIALOG (ad)); | ||
126 | gtk_widget_destroy (ad); | ||
127 | g_object_unref (G_OBJECT (builder)); | ||
128 | */ | ||
129 | } | 124 | } |
130 | 125 | ||
131 | 126 | ||