gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r19673 - in gnunet-gtk: contrib src/fs
Date: Fri, 3 Feb 2012 22:41:41 +0100

Author: grothoff
Date: 2012-02-03 22:41:41 +0100 (Fri, 03 Feb 2012)
New Revision: 19673

Modified:
   gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade
   gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
Log:
-misc bugfixes

Modified: gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade  2012-02-03 17:32:07 UTC 
(rev 19672)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_publish_tab.glade  2012-02-03 21:41:41 UTC 
(rev 19673)
@@ -1,6 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
 <interface>
   <requires lib="gtk+" version="2.20"/>
+  <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkTreeStore" id="_publish_frame_tree_store">
     <columns>
       <!-- column-name filename -->
@@ -18,7 +19,6 @@
     </columns>
   </object>
   <object class="GtkWindow" id="_publish_frame_window">
-    <property name="can_focus">False</property>
     <property name="title">You should never see this</property>
     <child>
       <object class="GtkScrolledWindow" id="_publish_frame_scrolled_window">
@@ -32,13 +32,10 @@
             <property name="model">_publish_frame_tree_store</property>
             <property name="reorderable">True</property>
             <property name="enable_tree_lines">True</property>
-            <child internal-child="selection">
-              <object class="GtkTreeSelection" id="treeview-selection1"/>
-            </child>
             <child>
               <object class="GtkTreeViewColumn" id="filename">
                 <property name="sizing">autosize</property>
-                <property name="title" translatable="yes">Filename</property>
+                <property name="title">Filename</property>
                 <property name="expand">True</property>
                 <child>
                   <object class="GtkCellRendererProgress" 
id="filename_renderer"/>
@@ -53,7 +50,7 @@
             <child>
               <object class="GtkTreeViewColumn" id="filesize">
                 <property name="sizing">autosize</property>
-                <property name="title" translatable="yes">Size</property>
+                <property name="title">Size</property>
                 <child>
                   <object class="GtkCellRendererText" id="size_renderer"/>
                   <attributes>
@@ -69,21 +66,17 @@
     </child>
   </object>
   <object class="GtkWindow" id="_publish_label_window">
-    <property name="can_focus">False</property>
     <child>
       <object class="GtkHBox" id="_publish_label_hbox">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="border_width">5</property>
         <child>
           <object class="GtkLabel" id="_publish_label_window_label">
             <property name="height_request">30</property>
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="label" translatable="yes">Publishing</property>
           </object>
           <packing>
-            <property name="expand">True</property>
             <property name="fill">False</property>
             <property name="padding">5</property>
             <property name="position">0</property>
@@ -91,16 +84,14 @@
         </child>
         <child>
           <object class="GtkButton" id="_publish_label_close_button">
-            <property name="use_action_appearance">False</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
-            <property name="use_action_appearance">False</property>
             <property name="relief">half</property>
+            <signal name="clicked" 
handler="GNUNET_FS_GTK_publish_label_close_button_clicked"/>
             <child>
               <object class="GtkImage" id="close_icon_stock_image">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="stock">gtk-close</property>
                 <property name="icon-size">2</property>
               </object>

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c  2012-02-03 17:32:07 UTC 
(rev 19672)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c  2012-02-03 21:41:41 UTC 
(rev 19673)
@@ -263,7 +263,7 @@
   opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
   if (dc->is_recursive)
     opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
-  len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
+  len = GNUNET_FS_uri_chk_get_file_size (de->uri);
   if (NULL != dc->sr)
   {
     GNUNET_break (NULL !=

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-02-03 17:32:07 UTC 
(rev 19672)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-02-03 21:41:41 UTC 
(rev 19673)
@@ -156,7 +156,27 @@
 
 /* ***************** Search event handling ****************** */
 
+
 /**
+ * Clear the metadata list and the preview widget.
+ */
+static void
+clear_metadata_display ()
+{
+  GtkImage *image;
+  GtkListStore *ms;
+
+  image =
+      GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object
+                 ("GNUNET_GTK_main_window_preview_image"));
+  gtk_image_clear (image);
+  ms = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object
+                       ("GNUNET_GTK_meta_data_list_store"));
+  gtk_list_store_clear (ms);
+}
+
+
+/**
  * This should get the default download directory (so that GNUnet
  * won't offer the user to download files to the 'bin' subdirectory,
  * or whatever is the cwd).  Returns NULL on failure (such as
@@ -605,11 +625,6 @@
   struct SearchResult *sr;
   struct GNUNET_FS_Uri *uri;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Creating a menu for SR=%p, DE=%p\n", 
-             sr,
-             sr->download);
-
   /* FIXME-UNCLEAN: move these to some menu context struct
      (de-globalize) */
   current_context_search_tab = tab;
@@ -623,7 +638,13 @@
   gtk_tree_path_free (path);
 
   gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1);
-
+  /* FIXME-BUG: 'sr' can be NULL here, somehow some code fails to setup the 
record.. */
+  if (NULL == sr)
+  {
+    /* FIXME-BUG: this prevents the crash for now, but does not solve the 
problem */
+    GNUNET_break (0);
+    return FALSE;
+  }
   menu = GTK_MENU (gtk_menu_new ());
   if ( (NULL == sr->download) &&
        (NULL != uri) )
@@ -787,6 +808,7 @@
     GNUNET_free (tab);
     return;
   }
+  clear_metadata_display ();
   notebook =
       GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object
                     ("GNUNET_GTK_main_window_notebook"));
@@ -1617,6 +1639,13 @@
   }
   gtk_tree_path_free (path);
   gtk_tree_model_get (tm, &iter, 9, &search_result, -1);
+  /* FIXME-BUG: 'search_result' can be NULL here, somehow some code fails to 
setup the record.. */
+  if (NULL == search_result)
+  {
+    /* FIXME-BUG: this prevents the crash for now, but does not solve the 
problem */
+    GNUNET_break (0);
+    return;
+  }
   GNUNET_assert (search_result->download == de); 
   search_result->download = NULL;
   change_download_color (de, "white");
@@ -1763,11 +1792,17 @@
     return;
   }
   gtk_tree_path_free (path);
-  /* FIXME-FEATURE: update availability-score here as well! */
+  /* FIXME-DESIGN: should we replace the 'availability' with
+     'progress' once the download has started and re-use the
+     space in the display? Probably yes, at least once we have
+     a custom CellRenderer... */
   gtk_tree_store_set (de->ts, &iter, 
                      4, (guint) ((size >
                                   0) ? (100 * completed /
-                                        size) : 100) /* progress */ ,
+                                        size) : 100) /* progress */,
+                     5, (guint) ((size >
+                                  0) ? (100 * completed /
+                                        size) : 100) /* availability == 
progress */,
                       14, completed, 
                      -1);
   if ( (depth == 0) &&
@@ -2287,6 +2322,7 @@
     }
     while (TRUE == gtk_tree_model_iter_next (tm, &iter));
   }
+  clear_metadata_display ();
 
   /* remove tab from notebook */
   notebook =

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-03 
17:32:07 UTC (rev 19672)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-edit-dialog.c       2012-02-03 
21:41:41 UTC (rev 19673)
@@ -842,9 +842,11 @@
 
       gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, 
&ntype, 1, &nformat, 3, &value, -1);
       if (ntype > 0)
-        GNUNET_CONTAINER_meta_data_insert (ctx->md, "<user>", ntype, nformat,
+      {
+        GNUNET_CONTAINER_meta_data_insert (meta, "<user>", ntype, nformat,
                                            "text/plain", value,
                                            strlen (value) + 1);
+      }
       g_free (value);
     }
     while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->meta_liststore), 
&iter));




reply via email to

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