gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r26278 - in gnunet-gtk: contrib src/fs
Date: Mon, 4 Mar 2013 02:18:58 +0100

Author: LRN
Date: 2013-03-04 02:18:58 +0100 (Mon, 04 Mar 2013)
New Revision: 26278

Modified:
   gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade
   gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
Log:
Show an icon 'gnunet-fs-gtk-ns-association' for results with associated 
namespaces

Modified: gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade   2013-03-04 01:18:54 UTC 
(rev 26277)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade   2013-03-04 01:18:58 UTC 
(rev 26278)
@@ -42,6 +42,8 @@
       <column type="GdkPixbuf"/>
       <!-- column-name unknown_availability -->
       <column type="gint"/>
+      <!-- column-name show_ns_association -->
+      <column type="gboolean"/>
     </columns>
   </object>
   <object class="GtkWindow" id="_search_result_frame_window">
@@ -87,6 +89,15 @@
                     <attribute name="text">6</attribute>
                   </attributes>
                 </child>
+                <child>
+                  <object class="GtkCellRendererPixbuf" 
id="search_result_description_renderer_pixbuf">
+                    <property name="xalign">1</property>
+                    <property 
name="icon_name">gnunet-fs-gtk-ns-association</property>
+                  </object>
+                  <attributes>
+                    <attribute name="visible">19</attribute>
+                  </attributes>
+                </child>
               </object>
             </child>
             <child>
@@ -113,7 +124,7 @@
                   <object class="GtkCellRendererProgress" 
id="search_result_availability_renderer"/>
                   <attributes>
                     <attribute name="cell-background">8</attribute>
-                    <attribute name="pulse"> 18</attribute>
+                    <attribute name="pulse">18</attribute>
                     <attribute name="value">5</attribute>
                   </attributes>
                 </child>

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2013-03-04 01:18:54 UTC 
(rev 26277)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2013-03-04 01:18:58 UTC 
(rev 26278)
@@ -128,8 +128,12 @@
     /**
      * A guint.
      */
-    SEARCH_TAB_MC_UNKNOWN_AVAILABILITY = 18
+    SEARCH_TAB_MC_UNKNOWN_AVAILABILITY = 18,
 
+    /**
+     * A gboolean.
+     */
+    SEARCH_TAB_MC_SHOW_NS_ASSOCIATION = 19
 
   };
 
@@ -1045,7 +1049,7 @@
   child = gtk_image_menu_item_new_with_label (label);
   GNUNET_free (label);
 
-  ns_association_icon = gtk_image_new_from_icon_name ("gnunet-ns-association", 
GTK_ICON_SIZE_MENU);
+  ns_association_icon = gtk_image_new_from_icon_name 
("gnunet-fs-gtk-ns-association", GTK_ICON_SIZE_MENU);
 
   /* Takes ownership of the icon */
   gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (child), 
ns_association_icon);
@@ -1388,6 +1392,7 @@
   gint availability_rank;
   gchar *downloaded_filename;
   gint downloaded_anonymity;
+  gboolean show_ns_association;
 
   if (! gtk_tree_model_iter_children (src_model, &src_child, src_iter))
     return;
@@ -1416,6 +1421,7 @@
                         SEARCH_TAB_MC_DOWNLOADED_FILENAME, 
&downloaded_filename,
                         SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
                         &downloaded_anonymity,
+                        SEARCH_TAB_MC_SHOW_NS_ASSOCIATION, 
&show_ns_association,
                         -1);
     search_result_new = GNUNET_malloc (sizeof (struct SearchResult));
     search_result_new->tab = dst_tab;
@@ -1458,6 +1464,8 @@
                                        downloaded_filename,
                                        SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
                                        downloaded_anonymity,
+                                       SEARCH_TAB_MC_SHOW_NS_ASSOCIATION,
+                                       show_ns_association,
                                        -1);
     g_free (filename);
     g_free (downloaded_filename);
@@ -1505,6 +1513,7 @@
   gchar *downloaded_filename;
   gint downloaded_anonymity;
   GdkPixbuf *status_animation;
+  gboolean show_ns_association;
 
   /* find the 'old' root */
   tm_old = GTK_TREE_MODEL (de->sr->tab->ts);
@@ -1532,6 +1541,7 @@
                       SEARCH_TAB_MC_DOWNLOADED_FILENAME, &downloaded_filename,
                       SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, 
&downloaded_anonymity,
                      SEARCH_TAB_MC_STATUS_ICON, &status_animation,
+                      SEARCH_TAB_MC_SHOW_NS_ASSOCIATION, &show_ns_association,
                       -1);
   GNUNET_assert (GNUNET_YES == GNUNET_FS_uri_test_equal (uri, de->uri));
   GNUNET_assert (de->sr->download == de);
@@ -1569,6 +1579,7 @@
                       SEARCH_TAB_MC_DOWNLOADED_FILENAME, downloaded_filename,
                       SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, downloaded_anonymity,
                      SEARCH_TAB_MC_STATUS_ICON, status_animation,
+                      SEARCH_TAB_MC_SHOW_NS_ASSOCIATION, show_ns_association,
                       -1);
   g_free (filename);
   g_free (downloaded_filename);
@@ -2122,6 +2133,13 @@
   gtk_tree_path_free (tp);
 }
 
+static int
+see_if_there_are_any_sks_uris (void *cls, const struct GNUNET_FS_Uri *sks_uri,
+    const char *sks_uri_string, struct GNUNET_HashCode *nsid)
+{
+  * ((gboolean *) cls) = TRUE;
+  return GNUNET_SYSERR;
+}
 
 /**
  * Add a search result to the given search tab.  This function is called 
@@ -2164,7 +2182,9 @@
   GtkTreeStore *ts;
   uint64_t fsize;
   int desc_is_a_dup;
+  gboolean show_ns_association;
 
+  show_ns_association = FALSE;
   if (NULL == uri)
   {
     /* opened directory file */
@@ -2189,12 +2209,17 @@
       fsize = 0;
       mime = GNUNET_strdup ("GNUnet namespace"); 
       status_colour = "lightgreen";
+      /* FIXME: maybe do this? Would it confuse users?
+      show_ns_association = TRUE;
+      */
     }
     uris = GNUNET_FS_uri_to_string (uri);
   }
   desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup);
   pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
 
+  find_embedded_sks (meta, see_if_there_are_any_sks_uris, 
&show_ns_association);
+
   sr = GNUNET_malloc (sizeof (struct SearchResult));
   sr->result = result;
   sr->tab = tab;
@@ -2249,6 +2274,7 @@
                                      SEARCH_TAB_MC_COMPLETED, (guint64) 0,
                                      SEARCH_TAB_MC_DOWNLOADED_FILENAME, NULL,
                                      SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, 
(guint) -1,
+                                     SEARCH_TAB_MC_SHOW_NS_ASSOCIATION, 
show_ns_association,
                                      -1);
   if (pixbuf != NULL)
     g_object_unref (pixbuf);




reply via email to

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