gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19661 - gnunet-gtk/src/fs


From: gnunet
Subject: [GNUnet-SVN] r19661 - gnunet-gtk/src/fs
Date: Fri, 3 Feb 2012 00:52:15 +0100

Author: grothoff
Date: 2012-02-03 00:52:15 +0100 (Fri, 03 Feb 2012)
New Revision: 19661

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_common.h
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
   gnunet-gtk/src/fs/metatypes.c
Log:
-misc

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c       2012-02-02 
23:39:49 UTC (rev 19660)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c       2012-02-02 
23:52:15 UTC (rev 19661)
@@ -187,7 +187,7 @@
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_FS_GTK_edit_publish_dialog (transient, 
                                     nds->fip, 
-                                    GNUNET_NO,
+                                    GNUNET_YES,
                                      &adv_pseudonym_edit_publish_dialog_cb,
                                      nds);
 }

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_common.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_common.h    2012-02-02 23:39:49 UTC (rev 
19660)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_common.h    2012-02-02 23:52:15 UTC (rev 
19661)
@@ -46,7 +46,7 @@
  * Initialize the 'expiration_year_adjustment' of the given
  * builder to have a lower range of current-year+1 and a
  * default of current-year+2.
- * FIXME: odd API...
+ * FIXME-STYLE: odd API...
  *
  * @param builder builder object for which we should manipulate
  * the adjustment

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2012-02-02 23:39:49 UTC 
(rev 19660)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2012-02-02 23:52:15 UTC 
(rev 19661)
@@ -1529,7 +1529,7 @@
                      -1);
   GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, 
                                      epc->fip, 
-                                    GNUNET_YES, 
+                                    GNUNET_NO, 
                                      &master_publish_edit_publish_dialog_cb,
                                      epc);
 }

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c       2012-02-02 
23:39:49 UTC (rev 19660)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c       2012-02-02 
23:52:15 UTC (rev 19661)
@@ -538,6 +538,27 @@
 
 
 /**
+ * Update the sensitivity of the 'confirm' button based on 
+ * the availability of keywords and whether they are required or 
+ * not.
+ *
+ * @param ctx the 'struct EditPublicationDialogContext'
+ */
+static void
+update_confirm_sensitivity (struct EditPublicationDialogContext *ctx)
+{
+  GtkTreeIter iter;
+
+  if ( (! ctx->allow_no_keywords) && 
+       (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL 
(ctx->keywords_liststore),
+                                        &iter)) )
+    gtk_widget_set_sensitive (ctx->confirm_button, FALSE);
+  else
+    gtk_widget_set_sensitive (ctx->confirm_button, TRUE);
+}
+
+
+/**
  * The user has pushed the 'del' button for the keyword.
  * If there is a keyword selected, remove it from the list store.
  *
@@ -563,10 +584,7 @@
     gtk_tree_selection_select_iter (keywords_selection, &iter);
 
   /* disable confirm button if keywords are required and we have no more 
keywords */
-  if ( (! ctx->allow_no_keywords) && 
-       (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL 
(ctx->keywords_liststore),
-                                        &iter)) )
-    gtk_widget_set_sensitive (ctx->confirm_button, FALSE);
+  update_confirm_sensitivity (ctx);
 }
 
 
@@ -594,8 +612,8 @@
                                     0, keyword,
                                     1, TRUE,
                                     -1);
-  gtk_widget_set_sensitive (ctx->confirm_button, TRUE);
   gtk_entry_set_text (ctx->keyword_entry, "");
+  update_confirm_sensitivity (ctx);
 }
 
 
@@ -1005,16 +1023,16 @@
  *
  * @param parent parent window of the dialog
  * @param fip information about the file information that is to be edited
- * @param allow_no_keywords is it OK to close the dialog without any keywords?
- *                          also used to indicate that this is a namespace 
operation
- *                          (FIXME-UNCLEAN: overloaded/badly-named argument)
+ * @param is_namespace_edit GNUNET_YES if we are editing a namespace 
advertisement;
+ *        this means that keywords are required and that a "root" can be
+ *        entered
  * @param cb function to call when the dialog is closed
  * @param cb_cls closure for 'cb'
  */
 void
 GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
                                    struct GNUNET_FS_FileInformation *fip,
-                                   int allow_no_keywords,
+                                   int is_namespace_edit,
                                    GNUNET_FS_GTK_EditPublishDialogCallback cb,
                                    gpointer cb_cls)
 {
@@ -1030,7 +1048,7 @@
   ctx = GNUNET_malloc (sizeof (struct EditPublicationDialogContext));
   ctx->fip = fip;
   ctx->preview_changed = GNUNET_NO;
-  ctx->allow_no_keywords = allow_no_keywords;
+  ctx->allow_no_keywords = is_namespace_edit ? GNUNET_NO : GNUNET_YES;
   ctx->is_directory = GNUNET_FS_file_information_is_directory (fip);
   ctx->cb = cb;
   ctx->cb_cls = cb_cls;
@@ -1128,17 +1146,12 @@
   /* show root label only if we must have keywords, which is also only the
      case for namespaces (FIXME-UNCLEAN: overloaded use of the argument) */
   gtk_widget_set_visible (GTK_WIDGET (ctx->root_entry),
-                         !allow_no_keywords);
+                         is_namespace_edit ? TRUE : FALSE);
   root_label = GTK_LABEL (gtk_builder_get_object
                          (ctx->builder, 
"GNUNET_GTK_edit_publication_root_label"));
   gtk_widget_set_visible (GTK_WIDGET (root_label),
-                         !allow_no_keywords);
-  
-  /* FIXME-UNCLEAN: what if we already have keywords? Again, does not really
-     apply to namespace-case, but this seems a bit ugly */
-  gtk_widget_set_sensitive (ctx->confirm_button, allow_no_keywords ? TRUE : 
FALSE);
+                         is_namespace_edit ? TRUE : FALSE);
 
-
   /* FIXME-UNCLEAN: these signal handlers can be set by (modern) versions of 
Glade */
   keywords_selection = gtk_tree_view_get_selection (ctx->keywords_treeview);
   g_signal_connect (G_OBJECT (keywords_selection), "changed",
@@ -1152,6 +1165,7 @@
 
 
   /* Finally, display window */
+  update_confirm_sensitivity (ctx);
   gtk_window_set_transient_for (ctx->edit_publication_window, parent);
   gtk_window_present (ctx->edit_publication_window);
 }

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.h       2012-02-02 
23:39:49 UTC (rev 19660)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.h       2012-02-02 
23:52:15 UTC (rev 19661)
@@ -47,16 +47,16 @@
  *
  * @param parent parent window of the dialog
  * @param fip information about the file information that is to be edited
- * @param allow_no_keywords is it OK to close the dialog without any keywords?
- *                          also used to indicate that this is a namespace 
operation
- *                          (FIXME: overloaded/badly-named argument)
+ * @param is_namespace_edit GNUNET_YES if we are editing a namespace 
advertisement;
+ *        this means that keywords are required and that a "root" can be
+ *        entered
  * @param cb function to call when the dialog is closed
  * @param cb_cls closure for 'cb'
  */
 void
 GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
                                    struct GNUNET_FS_FileInformation *fip,
-                                   int allow_no_keywords, 
+                                   int is_namespace_edit,
                                    GNUNET_FS_GTK_EditPublishDialogCallback cb,
                                    gpointer cls);
 

Modified: gnunet-gtk/src/fs/metatypes.c
===================================================================
--- gnunet-gtk/src/fs/metatypes.c       2012-02-02 23:39:49 UTC (rev 19660)
+++ gnunet-gtk/src/fs/metatypes.c       2012-02-02 23:52:15 UTC (rev 19661)
@@ -219,9 +219,9 @@
 
 
 /**
- * Must match data in 'gnunet_fs_gt_main_window.glade'.  FIXME: should
- * probably move that name list in here and only have one place for
- * both...
+ * Must match data in 'gnunet_fs_gt_main_window.glade'.
+ * FIXME-FEATURE-UNCLEAN-MAYBE: should probably move that name list in
+ * here and only have one place for both...
  */
 gint *types[] = {
   types_generic,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]