diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-13 18:13:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-13 18:13:48 +0000 |
commit | fcd72cae9f74e73d6278385b6468d298af08474c (patch) | |
tree | e3e0efdcf4b0c71d37e27239059eb5ee75587829 | |
parent | 1448ad63eb900be494f144b2a3946f1f496e8293 (diff) | |
download | gnunet-gtk-fcd72cae9f74e73d6278385b6468d298af08474c.tar.gz gnunet-gtk-fcd72cae9f74e73d6278385b6468d298af08474c.zip |
fixing crash for adding pseudonyms with no keywords by disabling OK button as long as there are no keywords (#2002)
-rw-r--r-- | contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade | 1 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade b/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade index b83b6c9e..82cb3a2f 100644 --- a/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade +++ b/contrib/gnunet_fs_gtk_advertise_pseudonym_dialog.glade | |||
@@ -648,6 +648,7 @@ | |||
648 | <object class="GtkButton" id="GNUNET_GTK_advertise_pseudonym_confirm_button"> | 648 | <object class="GtkButton" id="GNUNET_GTK_advertise_pseudonym_confirm_button"> |
649 | <property name="label">gtk-ok</property> | 649 | <property name="label">gtk-ok</property> |
650 | <property name="visible">True</property> | 650 | <property name="visible">True</property> |
651 | <property name="sensitive">False</property> | ||
651 | <property name="can_focus">True</property> | 652 | <property name="can_focus">True</property> |
652 | <property name="receives_default">True</property> | 653 | <property name="receives_default">True</property> |
653 | <property name="use_action_appearance">False</property> | 654 | <property name="use_action_appearance">False</property> |
diff --git a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c index 2068d69a..bb3265e0 100644 --- a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c +++ b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c | |||
@@ -83,6 +83,7 @@ GNUNET_GTK_advertise_pseudonym_keyword_list_del_button_clicked_cb () | |||
83 | GtkTreeSelection *sel; | 83 | GtkTreeSelection *sel; |
84 | GtkTreeModel *tm; | 84 | GtkTreeModel *tm; |
85 | GtkTreeIter iter; | 85 | GtkTreeIter iter; |
86 | GtkWidget *w; | ||
86 | 87 | ||
87 | tv = GTK_TREE_VIEW (gtk_builder_get_object | 88 | tv = GTK_TREE_VIEW (gtk_builder_get_object |
88 | (builder, | 89 | (builder, |
@@ -94,6 +95,13 @@ GNUNET_GTK_advertise_pseudonym_keyword_list_del_button_clicked_cb () | |||
94 | return; | 95 | return; |
95 | } | 96 | } |
96 | gtk_list_store_remove (GTK_LIST_STORE (tm), &iter); | 97 | gtk_list_store_remove (GTK_LIST_STORE (tm), &iter); |
98 | if (TRUE != gtk_tree_model_get_iter_first (tm, &iter)) | ||
99 | { | ||
100 | /* keyword list now empty, disable 'Ok' button! */ | ||
101 | w = GTK_WIDGET (gtk_builder_get_object (builder, | ||
102 | "GNUNET_GTK_advertise_pseudonym_confirm_button")); | ||
103 | gtk_widget_set_sensitive (w, FALSE); | ||
104 | } | ||
97 | } | 105 | } |
98 | 106 | ||
99 | 107 | ||
@@ -107,6 +115,7 @@ GNUNET_GTK_advertise_pseudonym_keyword_list_add_button_clicked_cb () | |||
107 | GtkEntry *entry; | 115 | GtkEntry *entry; |
108 | GtkListStore *ls; | 116 | GtkListStore *ls; |
109 | GtkTreeIter iter; | 117 | GtkTreeIter iter; |
118 | GtkWidget *w; | ||
110 | 119 | ||
111 | ls = GTK_LIST_STORE (gtk_builder_get_object | 120 | ls = GTK_LIST_STORE (gtk_builder_get_object |
112 | (builder, "GNUNET_GTK_keyword_list_store")); | 121 | (builder, "GNUNET_GTK_keyword_list_store")); |
@@ -115,7 +124,12 @@ GNUNET_GTK_advertise_pseudonym_keyword_list_add_button_clicked_cb () | |||
115 | (builder, "GNUNET_GTK_advertise_pseudonym_keyword_entry")); | 124 | (builder, "GNUNET_GTK_advertise_pseudonym_keyword_entry")); |
116 | keyword = gtk_entry_get_text (entry); | 125 | keyword = gtk_entry_get_text (entry); |
117 | if (strlen (keyword) > 0) | 126 | if (strlen (keyword) > 0) |
118 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1); | 127 | { |
128 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1); | ||
129 | /* enable OK button */ | ||
130 | w = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_advertise_pseudonym_confirm_button")); | ||
131 | gtk_widget_set_sensitive (w, TRUE); | ||
132 | } | ||
119 | gtk_entry_set_text (entry, ""); | 133 | gtk_entry_set_text (entry, ""); |
120 | } | 134 | } |
121 | 135 | ||