aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-03 21:41:41 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-03 21:41:41 +0000
commitdf6e30ad7e1c0077b96f11945231f8b0eab00e38 (patch)
tree9fb4031237674a384e577990b19b278be4ea38e4
parentcfe3b19d5ba08a48df1385a9d179bb5bfaa32de3 (diff)
downloadgnunet-gtk-df6e30ad7e1c0077b96f11945231f8b0eab00e38.tar.gz
gnunet-gtk-df6e30ad7e1c0077b96f11945231f8b0eab00e38.zip
-misc bugfixes
-rw-r--r--contrib/gnunet_fs_gtk_publish_tab.glade19
-rw-r--r--src/fs/gnunet-fs-gtk_download-save-as.c2
-rw-r--r--src/fs/gnunet-fs-gtk_event-handler.c52
-rw-r--r--src/fs/gnunet-fs-gtk_publish-edit-dialog.c4
4 files changed, 53 insertions, 24 deletions
diff --git a/contrib/gnunet_fs_gtk_publish_tab.glade b/contrib/gnunet_fs_gtk_publish_tab.glade
index 94f3d812..30e3f782 100644
--- a/contrib/gnunet_fs_gtk_publish_tab.glade
+++ b/contrib/gnunet_fs_gtk_publish_tab.glade
@@ -1,6 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0"?>
2<interface> 2<interface>
3 <requires lib="gtk+" version="2.20"/> 3 <requires lib="gtk+" version="2.20"/>
4 <!-- interface-naming-policy toplevel-contextual -->
4 <object class="GtkTreeStore" id="_publish_frame_tree_store"> 5 <object class="GtkTreeStore" id="_publish_frame_tree_store">
5 <columns> 6 <columns>
6 <!-- column-name filename --> 7 <!-- column-name filename -->
@@ -18,7 +19,6 @@
18 </columns> 19 </columns>
19 </object> 20 </object>
20 <object class="GtkWindow" id="_publish_frame_window"> 21 <object class="GtkWindow" id="_publish_frame_window">
21 <property name="can_focus">False</property>
22 <property name="title">You should never see this</property> 22 <property name="title">You should never see this</property>
23 <child> 23 <child>
24 <object class="GtkScrolledWindow" id="_publish_frame_scrolled_window"> 24 <object class="GtkScrolledWindow" id="_publish_frame_scrolled_window">
@@ -32,13 +32,10 @@
32 <property name="model">_publish_frame_tree_store</property> 32 <property name="model">_publish_frame_tree_store</property>
33 <property name="reorderable">True</property> 33 <property name="reorderable">True</property>
34 <property name="enable_tree_lines">True</property> 34 <property name="enable_tree_lines">True</property>
35 <child internal-child="selection">
36 <object class="GtkTreeSelection" id="treeview-selection1"/>
37 </child>
38 <child> 35 <child>
39 <object class="GtkTreeViewColumn" id="filename"> 36 <object class="GtkTreeViewColumn" id="filename">
40 <property name="sizing">autosize</property> 37 <property name="sizing">autosize</property>
41 <property name="title" translatable="yes">Filename</property> 38 <property name="title">Filename</property>
42 <property name="expand">True</property> 39 <property name="expand">True</property>
43 <child> 40 <child>
44 <object class="GtkCellRendererProgress" id="filename_renderer"/> 41 <object class="GtkCellRendererProgress" id="filename_renderer"/>
@@ -53,7 +50,7 @@
53 <child> 50 <child>
54 <object class="GtkTreeViewColumn" id="filesize"> 51 <object class="GtkTreeViewColumn" id="filesize">
55 <property name="sizing">autosize</property> 52 <property name="sizing">autosize</property>
56 <property name="title" translatable="yes">Size</property> 53 <property name="title">Size</property>
57 <child> 54 <child>
58 <object class="GtkCellRendererText" id="size_renderer"/> 55 <object class="GtkCellRendererText" id="size_renderer"/>
59 <attributes> 56 <attributes>
@@ -69,21 +66,17 @@
69 </child> 66 </child>
70 </object> 67 </object>
71 <object class="GtkWindow" id="_publish_label_window"> 68 <object class="GtkWindow" id="_publish_label_window">
72 <property name="can_focus">False</property>
73 <child> 69 <child>
74 <object class="GtkHBox" id="_publish_label_hbox"> 70 <object class="GtkHBox" id="_publish_label_hbox">
75 <property name="visible">True</property> 71 <property name="visible">True</property>
76 <property name="can_focus">False</property>
77 <property name="border_width">5</property> 72 <property name="border_width">5</property>
78 <child> 73 <child>
79 <object class="GtkLabel" id="_publish_label_window_label"> 74 <object class="GtkLabel" id="_publish_label_window_label">
80 <property name="height_request">30</property> 75 <property name="height_request">30</property>
81 <property name="visible">True</property> 76 <property name="visible">True</property>
82 <property name="can_focus">False</property>
83 <property name="label" translatable="yes">Publishing</property> 77 <property name="label" translatable="yes">Publishing</property>
84 </object> 78 </object>
85 <packing> 79 <packing>
86 <property name="expand">True</property>
87 <property name="fill">False</property> 80 <property name="fill">False</property>
88 <property name="padding">5</property> 81 <property name="padding">5</property>
89 <property name="position">0</property> 82 <property name="position">0</property>
@@ -91,16 +84,14 @@
91 </child> 84 </child>
92 <child> 85 <child>
93 <object class="GtkButton" id="_publish_label_close_button"> 86 <object class="GtkButton" id="_publish_label_close_button">
94 <property name="use_action_appearance">False</property>
95 <property name="visible">True</property> 87 <property name="visible">True</property>
96 <property name="can_focus">True</property> 88 <property name="can_focus">True</property>
97 <property name="receives_default">True</property> 89 <property name="receives_default">True</property>
98 <property name="use_action_appearance">False</property>
99 <property name="relief">half</property> 90 <property name="relief">half</property>
91 <signal name="clicked" handler="GNUNET_FS_GTK_publish_label_close_button_clicked"/>
100 <child> 92 <child>
101 <object class="GtkImage" id="close_icon_stock_image"> 93 <object class="GtkImage" id="close_icon_stock_image">
102 <property name="visible">True</property> 94 <property name="visible">True</property>
103 <property name="can_focus">False</property>
104 <property name="stock">gtk-close</property> 95 <property name="stock">gtk-close</property>
105 <property name="icon-size">2</property> 96 <property name="icon-size">2</property>
106 </object> 97 </object>
diff --git a/src/fs/gnunet-fs-gtk_download-save-as.c b/src/fs/gnunet-fs-gtk_download-save-as.c
index 812e073d..f020111c 100644
--- a/src/fs/gnunet-fs-gtk_download-save-as.c
+++ b/src/fs/gnunet-fs-gtk_download-save-as.c
@@ -263,7 +263,7 @@ GNUNET_FS_GTK_download_context_start_download (struct DownloadContext *dc)
263 opt = GNUNET_FS_DOWNLOAD_OPTION_NONE; 263 opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
264 if (dc->is_recursive) 264 if (dc->is_recursive)
265 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE; 265 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
266 len = GNUNET_FS_uri_chk_get_file_size (dc->uri); 266 len = GNUNET_FS_uri_chk_get_file_size (de->uri);
267 if (NULL != dc->sr) 267 if (NULL != dc->sr)
268 { 268 {
269 GNUNET_break (NULL != 269 GNUNET_break (NULL !=
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c
index bd2378e1..a7aef9ba 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -156,6 +156,26 @@ static struct SearchTab *current_context_search_tab;
156 156
157/* ***************** Search event handling ****************** */ 157/* ***************** Search event handling ****************** */
158 158
159
160/**
161 * Clear the metadata list and the preview widget.
162 */
163static void
164clear_metadata_display ()
165{
166 GtkImage *image;
167 GtkListStore *ms;
168
169 image =
170 GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object
171 ("GNUNET_GTK_main_window_preview_image"));
172 gtk_image_clear (image);
173 ms = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object
174 ("GNUNET_GTK_meta_data_list_store"));
175 gtk_list_store_clear (ms);
176}
177
178
159/** 179/**
160 * This should get the default download directory (so that GNUnet 180 * This should get the default download directory (so that GNUnet
161 * won't offer the user to download files to the 'bin' subdirectory, 181 * won't offer the user to download files to the 'bin' subdirectory,
@@ -605,11 +625,6 @@ search_list_popup (GtkTreeModel *tm,
605 struct SearchResult *sr; 625 struct SearchResult *sr;
606 struct GNUNET_FS_Uri *uri; 626 struct GNUNET_FS_Uri *uri;
607 627
608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
609 "Creating a menu for SR=%p, DE=%p\n",
610 sr,
611 sr->download);
612
613 /* FIXME-UNCLEAN: move these to some menu context struct 628 /* FIXME-UNCLEAN: move these to some menu context struct
614 (de-globalize) */ 629 (de-globalize) */
615 current_context_search_tab = tab; 630 current_context_search_tab = tab;
@@ -623,7 +638,13 @@ search_list_popup (GtkTreeModel *tm,
623 gtk_tree_path_free (path); 638 gtk_tree_path_free (path);
624 639
625 gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1); 640 gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1);
626 641 /* FIXME-BUG: 'sr' can be NULL here, somehow some code fails to setup the record.. */
642 if (NULL == sr)
643 {
644 /* FIXME-BUG: this prevents the crash for now, but does not solve the problem */
645 GNUNET_break (0);
646 return FALSE;
647 }
627 menu = GTK_MENU (gtk_menu_new ()); 648 menu = GTK_MENU (gtk_menu_new ());
628 if ( (NULL == sr->download) && 649 if ( (NULL == sr->download) &&
629 (NULL != uri) ) 650 (NULL != uri) )
@@ -787,6 +808,7 @@ close_search_tab (struct SearchTab *tab)
787 GNUNET_free (tab); 808 GNUNET_free (tab);
788 return; 809 return;
789 } 810 }
811 clear_metadata_display ();
790 notebook = 812 notebook =
791 GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object 813 GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object
792 ("GNUNET_GTK_main_window_notebook")); 814 ("GNUNET_GTK_main_window_notebook"));
@@ -1617,6 +1639,13 @@ stop_download (struct DownloadEntry *de)
1617 } 1639 }
1618 gtk_tree_path_free (path); 1640 gtk_tree_path_free (path);
1619 gtk_tree_model_get (tm, &iter, 9, &search_result, -1); 1641 gtk_tree_model_get (tm, &iter, 9, &search_result, -1);
1642 /* FIXME-BUG: 'search_result' can be NULL here, somehow some code fails to setup the record.. */
1643 if (NULL == search_result)
1644 {
1645 /* FIXME-BUG: this prevents the crash for now, but does not solve the problem */
1646 GNUNET_break (0);
1647 return;
1648 }
1620 GNUNET_assert (search_result->download == de); 1649 GNUNET_assert (search_result->download == de);
1621 search_result->download = NULL; 1650 search_result->download = NULL;
1622 change_download_color (de, "white"); 1651 change_download_color (de, "white");
@@ -1763,11 +1792,17 @@ mark_download_progress (struct DownloadEntry *de, uint64_t size,
1763 return; 1792 return;
1764 } 1793 }
1765 gtk_tree_path_free (path); 1794 gtk_tree_path_free (path);
1766 /* FIXME-FEATURE: update availability-score here as well! */ 1795 /* FIXME-DESIGN: should we replace the 'availability' with
1796 'progress' once the download has started and re-use the
1797 space in the display? Probably yes, at least once we have
1798 a custom CellRenderer... */
1767 gtk_tree_store_set (de->ts, &iter, 1799 gtk_tree_store_set (de->ts, &iter,
1768 4, (guint) ((size > 1800 4, (guint) ((size >
1769 0) ? (100 * completed / 1801 0) ? (100 * completed /
1770 size) : 100) /* progress */ , 1802 size) : 100) /* progress */,
1803 5, (guint) ((size >
1804 0) ? (100 * completed /
1805 size) : 100) /* availability == progress */,
1771 14, completed, 1806 14, completed,
1772 -1); 1807 -1);
1773 if ( (depth == 0) && 1808 if ( (depth == 0) &&
@@ -2287,6 +2322,7 @@ GNUNET_FS_GTK_publish_label_close_button_clicked (GtkButton * button,
2287 } 2322 }
2288 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 2323 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
2289 } 2324 }
2325 clear_metadata_display ();
2290 2326
2291 /* remove tab from notebook */ 2327 /* remove tab from notebook */
2292 notebook = 2328 notebook =
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
index 48b91b8f..53ad9e51 100644
--- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
@@ -842,9 +842,11 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
842 842
843 gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, &ntype, 1, &nformat, 3, &value, -1); 843 gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
844 if (ntype > 0) 844 if (ntype > 0)
845 GNUNET_CONTAINER_meta_data_insert (ctx->md, "<user>", ntype, nformat, 845 {
846 GNUNET_CONTAINER_meta_data_insert (meta, "<user>", ntype, nformat,
846 "text/plain", value, 847 "text/plain", value,
847 strlen (value) + 1); 848 strlen (value) + 1);
849 }
848 g_free (value); 850 g_free (value);
849 } 851 }
850 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->meta_liststore), &iter)); 852 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->meta_liststore), &iter));