gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19654 - in gnunet-gtk: contrib src/fs


From: gnunet
Subject: [GNUnet-SVN] r19654 - in gnunet-gtk: contrib src/fs
Date: Thu, 2 Feb 2012 20:58:43 +0100

Author: grothoff
Date: 2012-02-02 20:58:43 +0100 (Thu, 02 Feb 2012)
New Revision: 19654

Modified:
   gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
   gnunet-gtk/src/fs/gnunet-fs-gtk.c
   gnunet-gtk/src/fs/gnunet-fs-gtk.h
   gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
   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
Log:
-make sharing of the anonymity level liststore very explicit by making it global

Modified: gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade  2012-02-02 19:37:37 UTC 
(rev 19653)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade  2012-02-02 19:58:43 UTC 
(rev 19654)
@@ -434,7 +434,7 @@
                   <object class="GtkComboBox" 
id="main_window_search_anonymity_combobox">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property 
name="model">main_window_search_anonymity_liststore</property>
+                    <property name="model">anonymity_level_liststore</property>
                     <property name="active">1</property>
                     <child>
                       <object class="GtkCellRendererText" 
id="main_window_search_anonymity_combobox_renderer"/>
@@ -722,7 +722,7 @@
     <property name="can_focus">False</property>
     <property name="stock">gtk-index</property>
   </object>
-  <object class="GtkListStore" id="main_window_search_anonymity_liststore">
+  <object class="GtkListStore" id="anonymity_level_liststore">
     <columns>
       <!-- column-name Name -->
       <column type="gchararray"/>

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c   2012-02-02 19:37:37 UTC (rev 19653)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c   2012-02-02 19:58:43 UTC (rev 19654)
@@ -81,6 +81,18 @@
 
 
 /**
+ * Return the list store with anonymity levels.
+ *
+ * @return the list store
+ */
+GtkTreeModel *
+GNUNET_FS_GTK_get_anonymity_level_list_store ()
+{
+  return GTK_TREE_MODEL (GNUNET_FS_GTK_get_main_window_object 
("anonymity_level_liststore"));
+}
+
+
+/**
  * Task run on shutdown.
  * FIXME: does this need to be a separate task!?
  *

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.h   2012-02-02 19:37:37 UTC (rev 19653)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.h   2012-02-02 19:58:43 UTC (rev 19654)
@@ -39,6 +39,15 @@
 
 
 /**
+ * Return the list store with anonymity levels.
+ *
+ * @return the list store
+ */
+GtkTreeModel *
+GNUNET_FS_GTK_get_anonymity_level_list_store (void);
+
+
+/**
  * Return our handle for file-sharing operations.
  *
  * @return NULL on error
@@ -46,6 +55,7 @@
 struct GNUNET_FS_Handle *
 GNUNET_FS_GTK_get_fs_handle (void);
 
+
 /**
  * Get an object from the main window.
  *

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c       2012-02-02 
19:37:37 UTC (rev 19653)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_advertise-pseudonym.c       2012-02-02 
19:58:43 UTC (rev 19654)
@@ -136,7 +136,6 @@
   struct GNUNET_FS_Namespace *ns;
   struct GNUNET_FS_Namespace *nso;
   GtkWindow *transient;
-  GtkListStore *anon_liststore;
   struct NamespaceAdvertisementContext *nds;
   struct GNUNET_CONTAINER_MetaData *meta;
   struct GNUNET_FS_BlockOptions bo;
@@ -186,14 +185,9 @@
       GNUNET_FS_file_information_create_empty_directory (NULL, NULL, NULL, 
meta,
                                                          &bo, NULL);
   GNUNET_CONTAINER_meta_data_destroy (meta);
-
-  /* FIXME: bad sharing of anon-liststore; also, this store is not even
-     in this builder... */
-  anon_liststore = GTK_LIST_STORE (gtk_builder_get_object (builder, 
"main_window_search_anonymity_liststore"));
   GNUNET_FS_GTK_edit_publish_dialog (transient, 
                                     nds->fip, 
                                     GNUNET_NO,
-                                    anon_liststore,
                                      &adv_pseudonym_edit_publish_dialog_cb,
                                      nds);
 }

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2012-02-02 19:37:37 UTC 
(rev 19653)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2012-02-02 19:58:43 UTC 
(rev 19654)
@@ -1396,7 +1396,6 @@
   struct MainPublishingDialogContext *ctx = user_data;
   GtkWidget *ad;
   GtkComboBox *combo;
-  GtkTreeModel *anon_treemodel;
 
   /* FIXME-UGLY: should we use a fresh, specific context for this dialog?
      FIXME-BUG: how does this right now prevent two dialogs from being opened?
@@ -1416,13 +1415,10 @@
   
   ctx->open_file_handler_id = g_signal_connect (G_OBJECT (ad), "response",
                                                G_CALLBACK 
(publish_file_dialog_response_cb), ctx);
-
-  /* FIXME-BUG-MAYBE: possibly bad sharing of the anonymity tree model */
-  anon_treemodel = GTK_TREE_MODEL (gtk_builder_get_object 
(ctx->main_window_builder,
-                                                          
"main_window_search_anonymity_liststore"));
   combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->open_file_builder,
                                                 
"GNUNET_GTK_publish_file_dialog_anonymity_combobox"));
-  gtk_combo_box_set_model (combo, anon_treemodel);
+  gtk_combo_box_set_model (combo, 
+                          GNUNET_FS_GTK_get_anonymity_level_list_store ());
   
   /* show dialog */
   gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog);
@@ -1589,10 +1585,7 @@
 {
   struct MainPublishingDialogContext *ctx = user_data;
   struct EditPublishContext *epc;
-  GtkListStore *anon_liststore;
 
-  anon_liststore = GTK_LIST_STORE (gtk_builder_get_object 
(ctx->main_window_builder, 
-                                                          
"main_window_search_anonymity_liststore"));
   epc = GNUNET_malloc (sizeof (struct EditPublishContext));
   epc->tm = ctx->file_info_treemodel;
   if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, 
&epc->iter))
@@ -1605,12 +1598,9 @@
                      &epc->iter,
                      5, &epc->fip, 
                      -1);
-  /* FIXME-UGLY: can we just give our anon_liststore out like this? What about
-     (unintended) sharing of state? */
   GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, 
                                      epc->fip, 
                                     GNUNET_YES, 
-                                    anon_liststore,
                                      &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 
19:37:37 UTC (rev 19653)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c       2012-02-02 
19:58:43 UTC (rev 19654)
@@ -1008,7 +1008,6 @@
  * @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 anon_liststore liststore with anonymity options (FIXME-UNCLEAN: bad 
sharing)
  * @param cb function to call when the dialog is closed
  * @param cb_cls closure for 'cb'
  */
@@ -1016,7 +1015,6 @@
 GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
                                    struct GNUNET_FS_FileInformation *fip,
                                    int allow_no_keywords,
-                                   GtkListStore *anon_liststore,
                                    GNUNET_FS_GTK_EditPublishDialogCallback cb,
                                    gpointer cb_cls)
 {
@@ -1099,7 +1097,7 @@
 
   /* Basic initialization of widgets models and visibility */
   gtk_combo_box_set_model (ctx->anonymity_combo, 
-                          GTK_TREE_MODEL (anon_liststore));
+                          GNUNET_FS_GTK_get_anonymity_level_list_store ());
   GNUNET_FS_GTK_setup_expiration_year_adjustment (ctx->builder);
 
   /* FIXME-UNCLEAN: are the following three even required anymore? */

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 
19:37:37 UTC (rev 19653)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.h       2012-02-02 
19:58:43 UTC (rev 19654)
@@ -50,7 +50,6 @@
  * @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 anon_liststore liststore with anonymity options (FIXME: bad sharing)
  * @param cb function to call when the dialog is closed
  * @param cb_cls closure for 'cb'
  */
@@ -58,7 +57,6 @@
 GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
                                    struct GNUNET_FS_FileInformation *fip,
                                    int allow_no_keywords, 
-                                  GtkListStore *anon_liststore,
                                    GNUNET_FS_GTK_EditPublishDialogCallback cb,
                                    gpointer cls);
 




reply via email to

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