aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-02 23:52:15 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-02 23:52:15 +0000
commitb160144c9e0a24f8a53edce72a33adcd6df5652f (patch)
tree942c24bd2139d3c25f3aab3a1766902f624c6bc7
parentbd865fd3e7273b6b7615be751cc10eda28e77818 (diff)
downloadgnunet-gtk-b160144c9e0a24f8a53edce72a33adcd6df5652f.tar.gz
gnunet-gtk-b160144c9e0a24f8a53edce72a33adcd6df5652f.zip
-misc
-rw-r--r--src/fs/gnunet-fs-gtk_advertise-pseudonym.c2
-rw-r--r--src/fs/gnunet-fs-gtk_common.h2
-rw-r--r--src/fs/gnunet-fs-gtk_publish-dialog.c2
-rw-r--r--src/fs/gnunet-fs-gtk_publish-edit-dialog.c48
-rw-r--r--src/fs/gnunet-fs-gtk_publish-edit-dialog.h8
-rw-r--r--src/fs/metatypes.c6
6 files changed, 41 insertions, 27 deletions
diff --git a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
index 17f98825..2af42833 100644
--- a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
+++ b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
@@ -187,7 +187,7 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog,
187 GNUNET_CONTAINER_meta_data_destroy (meta); 187 GNUNET_CONTAINER_meta_data_destroy (meta);
188 GNUNET_FS_GTK_edit_publish_dialog (transient, 188 GNUNET_FS_GTK_edit_publish_dialog (transient,
189 nds->fip, 189 nds->fip,
190 GNUNET_NO, 190 GNUNET_YES,
191 &adv_pseudonym_edit_publish_dialog_cb, 191 &adv_pseudonym_edit_publish_dialog_cb,
192 nds); 192 nds);
193} 193}
diff --git a/src/fs/gnunet-fs-gtk_common.h b/src/fs/gnunet-fs-gtk_common.h
index 3e88c364..98d4c5e2 100644
--- a/src/fs/gnunet-fs-gtk_common.h
+++ b/src/fs/gnunet-fs-gtk_common.h
@@ -46,7 +46,7 @@ GNUNET_FS_GTK_get_thumbnail_from_meta_data (const struct
46 * Initialize the 'expiration_year_adjustment' of the given 46 * Initialize the 'expiration_year_adjustment' of the given
47 * builder to have a lower range of current-year+1 and a 47 * builder to have a lower range of current-year+1 and a
48 * default of current-year+2. 48 * default of current-year+2.
49 * FIXME: odd API... 49 * FIXME-STYLE: odd API...
50 * 50 *
51 * @param builder builder object for which we should manipulate 51 * @param builder builder object for which we should manipulate
52 * the adjustment 52 * the adjustment
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c
index cb7e2c1e..c57ab9d8 100644
--- a/src/fs/gnunet-fs-gtk_publish-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-dialog.c
@@ -1529,7 +1529,7 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
1529 -1); 1529 -1);
1530 GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, 1530 GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog,
1531 epc->fip, 1531 epc->fip,
1532 GNUNET_YES, 1532 GNUNET_NO,
1533 &master_publish_edit_publish_dialog_cb, 1533 &master_publish_edit_publish_dialog_cb,
1534 epc); 1534 epc);
1535} 1535}
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
index d49396a1..0951b316 100644
--- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
@@ -538,6 +538,27 @@ GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable * editable,
538 538
539 539
540/** 540/**
541 * Update the sensitivity of the 'confirm' button based on
542 * the availability of keywords and whether they are required or
543 * not.
544 *
545 * @param ctx the 'struct EditPublicationDialogContext'
546 */
547static void
548update_confirm_sensitivity (struct EditPublicationDialogContext *ctx)
549{
550 GtkTreeIter iter;
551
552 if ( (! ctx->allow_no_keywords) &&
553 (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->keywords_liststore),
554 &iter)) )
555 gtk_widget_set_sensitive (ctx->confirm_button, FALSE);
556 else
557 gtk_widget_set_sensitive (ctx->confirm_button, TRUE);
558}
559
560
561/**
541 * The user has pushed the 'del' button for the keyword. 562 * The user has pushed the 'del' button for the keyword.
542 * If there is a keyword selected, remove it from the list store. 563 * If there is a keyword selected, remove it from the list store.
543 * 564 *
@@ -563,10 +584,7 @@ GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (GtkButton *
563 gtk_tree_selection_select_iter (keywords_selection, &iter); 584 gtk_tree_selection_select_iter (keywords_selection, &iter);
564 585
565 /* disable confirm button if keywords are required and we have no more keywords */ 586 /* disable confirm button if keywords are required and we have no more keywords */
566 if ( (! ctx->allow_no_keywords) && 587 update_confirm_sensitivity (ctx);
567 (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->keywords_liststore),
568 &iter)) )
569 gtk_widget_set_sensitive (ctx->confirm_button, FALSE);
570} 588}
571 589
572 590
@@ -594,8 +612,8 @@ GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (GtkButton *
594 0, keyword, 612 0, keyword,
595 1, TRUE, 613 1, TRUE,
596 -1); 614 -1);
597 gtk_widget_set_sensitive (ctx->confirm_button, TRUE);
598 gtk_entry_set_text (ctx->keyword_entry, ""); 615 gtk_entry_set_text (ctx->keyword_entry, "");
616 update_confirm_sensitivity (ctx);
599} 617}
600 618
601 619
@@ -1005,16 +1023,16 @@ file_information_import (void *cls,
1005 * 1023 *
1006 * @param parent parent window of the dialog 1024 * @param parent parent window of the dialog
1007 * @param fip information about the file information that is to be edited 1025 * @param fip information about the file information that is to be edited
1008 * @param allow_no_keywords is it OK to close the dialog without any keywords? 1026 * @param is_namespace_edit GNUNET_YES if we are editing a namespace advertisement;
1009 * also used to indicate that this is a namespace operation 1027 * this means that keywords are required and that a "root" can be
1010 * (FIXME-UNCLEAN: overloaded/badly-named argument) 1028 * entered
1011 * @param cb function to call when the dialog is closed 1029 * @param cb function to call when the dialog is closed
1012 * @param cb_cls closure for 'cb' 1030 * @param cb_cls closure for 'cb'
1013 */ 1031 */
1014void 1032void
1015GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, 1033GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
1016 struct GNUNET_FS_FileInformation *fip, 1034 struct GNUNET_FS_FileInformation *fip,
1017 int allow_no_keywords, 1035 int is_namespace_edit,
1018 GNUNET_FS_GTK_EditPublishDialogCallback cb, 1036 GNUNET_FS_GTK_EditPublishDialogCallback cb,
1019 gpointer cb_cls) 1037 gpointer cb_cls)
1020{ 1038{
@@ -1030,7 +1048,7 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
1030 ctx = GNUNET_malloc (sizeof (struct EditPublicationDialogContext)); 1048 ctx = GNUNET_malloc (sizeof (struct EditPublicationDialogContext));
1031 ctx->fip = fip; 1049 ctx->fip = fip;
1032 ctx->preview_changed = GNUNET_NO; 1050 ctx->preview_changed = GNUNET_NO;
1033 ctx->allow_no_keywords = allow_no_keywords; 1051 ctx->allow_no_keywords = is_namespace_edit ? GNUNET_NO : GNUNET_YES;
1034 ctx->is_directory = GNUNET_FS_file_information_is_directory (fip); 1052 ctx->is_directory = GNUNET_FS_file_information_is_directory (fip);
1035 ctx->cb = cb; 1053 ctx->cb = cb;
1036 ctx->cb_cls = cb_cls; 1054 ctx->cb_cls = cb_cls;
@@ -1128,16 +1146,11 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
1128 /* show root label only if we must have keywords, which is also only the 1146 /* show root label only if we must have keywords, which is also only the
1129 case for namespaces (FIXME-UNCLEAN: overloaded use of the argument) */ 1147 case for namespaces (FIXME-UNCLEAN: overloaded use of the argument) */
1130 gtk_widget_set_visible (GTK_WIDGET (ctx->root_entry), 1148 gtk_widget_set_visible (GTK_WIDGET (ctx->root_entry),
1131 !allow_no_keywords); 1149 is_namespace_edit ? TRUE : FALSE);
1132 root_label = GTK_LABEL (gtk_builder_get_object 1150 root_label = GTK_LABEL (gtk_builder_get_object
1133 (ctx->builder, "GNUNET_GTK_edit_publication_root_label")); 1151 (ctx->builder, "GNUNET_GTK_edit_publication_root_label"));
1134 gtk_widget_set_visible (GTK_WIDGET (root_label), 1152 gtk_widget_set_visible (GTK_WIDGET (root_label),
1135 !allow_no_keywords); 1153 is_namespace_edit ? TRUE : FALSE);
1136
1137 /* FIXME-UNCLEAN: what if we already have keywords? Again, does not really
1138 apply to namespace-case, but this seems a bit ugly */
1139 gtk_widget_set_sensitive (ctx->confirm_button, allow_no_keywords ? TRUE : FALSE);
1140
1141 1154
1142 /* FIXME-UNCLEAN: these signal handlers can be set by (modern) versions of Glade */ 1155 /* FIXME-UNCLEAN: these signal handlers can be set by (modern) versions of Glade */
1143 keywords_selection = gtk_tree_view_get_selection (ctx->keywords_treeview); 1156 keywords_selection = gtk_tree_view_get_selection (ctx->keywords_treeview);
@@ -1152,6 +1165,7 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
1152 1165
1153 1166
1154 /* Finally, display window */ 1167 /* Finally, display window */
1168 update_confirm_sensitivity (ctx);
1155 gtk_window_set_transient_for (ctx->edit_publication_window, parent); 1169 gtk_window_set_transient_for (ctx->edit_publication_window, parent);
1156 gtk_window_present (ctx->edit_publication_window); 1170 gtk_window_present (ctx->edit_publication_window);
1157} 1171}
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.h b/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
index 8ee7d52c..0635d058 100644
--- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
+++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
@@ -47,16 +47,16 @@ typedef void (*GNUNET_FS_GTK_EditPublishDialogCallback) (gpointer cls,
47 * 47 *
48 * @param parent parent window of the dialog 48 * @param parent parent window of the dialog
49 * @param fip information about the file information that is to be edited 49 * @param fip information about the file information that is to be edited
50 * @param allow_no_keywords is it OK to close the dialog without any keywords? 50 * @param is_namespace_edit GNUNET_YES if we are editing a namespace advertisement;
51 * also used to indicate that this is a namespace operation 51 * this means that keywords are required and that a "root" can be
52 * (FIXME: overloaded/badly-named argument) 52 * entered
53 * @param cb function to call when the dialog is closed 53 * @param cb function to call when the dialog is closed
54 * @param cb_cls closure for 'cb' 54 * @param cb_cls closure for 'cb'
55 */ 55 */
56void 56void
57GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, 57GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
58 struct GNUNET_FS_FileInformation *fip, 58 struct GNUNET_FS_FileInformation *fip,
59 int allow_no_keywords, 59 int is_namespace_edit,
60 GNUNET_FS_GTK_EditPublishDialogCallback cb, 60 GNUNET_FS_GTK_EditPublishDialogCallback cb,
61 gpointer cls); 61 gpointer cls);
62 62
diff --git a/src/fs/metatypes.c b/src/fs/metatypes.c
index 5bc0af67..2b9185f4 100644
--- a/src/fs/metatypes.c
+++ b/src/fs/metatypes.c
@@ -219,9 +219,9 @@ gint types_software[] =
219 219
220 220
221/** 221/**
222 * Must match data in 'gnunet_fs_gt_main_window.glade'. FIXME: should 222 * Must match data in 'gnunet_fs_gt_main_window.glade'.
223 * probably move that name list in here and only have one place for 223 * FIXME-FEATURE-UNCLEAN-MAYBE: should probably move that name list in
224 * both... 224 * here and only have one place for both...
225 */ 225 */
226gint *types[] = { 226gint *types[] = {
227 types_generic, 227 types_generic,