aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/publish_dialog.glade103
-rw-r--r--contrib/publish_edit_dialog.glade61
-rw-r--r--src/fs_event_handler.c21
-rw-r--r--src/main_window_file_publish.c66
4 files changed, 164 insertions, 87 deletions
diff --git a/contrib/publish_dialog.glade b/contrib/publish_dialog.glade
index 40393d7d..bad2fd1d 100644
--- a/contrib/publish_dialog.glade
+++ b/contrib/publish_dialog.glade
@@ -2,24 +2,40 @@
2<interface> 2<interface>
3 <requires lib="gtk+" version="2.20"/> 3 <requires lib="gtk+" version="2.20"/>
4 <!-- interface-naming-policy project-wide --> 4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store"> 5 <object class="GtkImage" id="right_stock_image">
6 <property name="visible">True</property>
7 <property name="stock">gtk-go-forward</property>
8 </object>
9 <object class="GtkImage" id="left_stock_image">
10 <property name="visible">True</property>
11 <property name="stock">gtk-go-back</property>
12 </object>
13 <object class="GtkImage" id="add_stock_image_2">
14 <property name="visible">True</property>
15 <property name="stock">gtk-add</property>
16 </object>
17 <object class="GtkImage" id="new_stock_image">
18 <property name="visible">True</property>
19 <property name="stock">gtk-new</property>
20 </object>
21 <object class="GtkImage" id="add_stock_image">
22 <property name="visible">True</property>
23 <property name="stock">gtk-add</property>
24 </object>
25 <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store">
6 <columns> 26 <columns>
7 <!-- column-name local_name --> 27 <!-- column-name filesize -->
8 <column type="gchararray"/>
9 <!-- column-name namespace_handle -->
10 <column type="gpointer"/>
11 <!-- column-name last_id -->
12 <column type="gchararray"/> 28 <column type="gchararray"/>
13 <!-- column-name last_uri --> 29 <!-- column-name do_index -->
30 <column type="gboolean"/>
31 <!-- column-name filename -->
14 <column type="gchararray"/> 32 <column type="gchararray"/>
15 <!-- column-name last_meta --> 33 <!-- column-name anonymity_level -->
34 <column type="guint"/>
35 <!-- column-name priority -->
36 <column type="guint"/>
37 <!-- column-name file_information_struct -->
16 <column type="gpointer"/> 38 <column type="gpointer"/>
17 <!-- column-name next_id -->
18 <column type="gchararray"/>
19 <!-- column-name last_description_from_meta -->
20 <column type="gchararray"/>
21 <!-- column-name next_id_editable -->
22 <column type="gboolean"/>
23 </columns> 39 </columns>
24 </object> 40 </object>
25 <object class="GtkDialog" id="GNUNET_GTK_master_publish_dialog"> 41 <object class="GtkDialog" id="GNUNET_GTK_master_publish_dialog">
@@ -92,26 +108,27 @@
92 <property name="visible">True</property> 108 <property name="visible">True</property>
93 <property name="n_rows">2</property> 109 <property name="n_rows">2</property>
94 <property name="n_columns">3</property> 110 <property name="n_columns">3</property>
95 <property name="homogeneous">True</property>
96 <child> 111 <child>
97 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button"> 112 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button">
98 <property name="label">gtk-add</property> 113 <property name="label">Add _File</property>
99 <property name="visible">True</property> 114 <property name="visible">True</property>
100 <property name="can_focus">True</property> 115 <property name="can_focus">True</property>
101 <property name="receives_default">True</property> 116 <property name="receives_default">True</property>
102 <property name="use_action_appearance">False</property> 117 <property name="use_action_appearance">False</property>
103 <property name="use_stock">True</property> 118 <property name="image">add_stock_image</property>
119 <property name="use_underline">True</property>
104 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/> 120 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/>
105 </object> 121 </object>
106 </child> 122 </child>
107 <child> 123 <child>
108 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button"> 124 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button">
109 <property name="label">gtk-open</property> 125 <property name="label">Add _Directory</property>
110 <property name="visible">True</property> 126 <property name="visible">True</property>
111 <property name="can_focus">True</property> 127 <property name="can_focus">True</property>
112 <property name="receives_default">True</property> 128 <property name="receives_default">True</property>
113 <property name="use_action_appearance">False</property> 129 <property name="use_action_appearance">False</property>
114 <property name="use_stock">True</property> 130 <property name="image">add_stock_image_2</property>
131 <property name="use_underline">True</property>
115 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/> 132 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/>
116 </object> 133 </object>
117 <packing> 134 <packing>
@@ -157,26 +174,24 @@
157 </child> 174 </child>
158 <child> 175 <child>
159 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button"> 176 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button">
160 <property name="label">gtk-new</property> 177 <property name="label">_Create empty directory</property>
161 <property name="visible">True</property> 178 <property name="visible">True</property>
162 <property name="can_focus">True</property> 179 <property name="can_focus">True</property>
163 <property name="receives_default">True</property> 180 <property name="receives_default">True</property>
164 <property name="use_action_appearance">False</property> 181 <property name="use_action_appearance">False</property>
165 <property name="use_stock">True</property> 182 <property name="image">new_stock_image</property>
183 <property name="use_underline">True</property>
166 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/> 184 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
167 </object> 185 </object>
168 <packing> 186 <packing>
169 <property name="left_attach">1</property> 187 <property name="left_attach">1</property>
170 <property name="right_attach">2</property> 188 <property name="right_attach">3</property>
171 </packing> 189 </packing>
172 </child> 190 </child>
173 <child>
174 <placeholder/>
175 </child>
176 </object> 191 </object>
177 <packing> 192 <packing>
178 <property name="expand">False</property> 193 <property name="expand">False</property>
179 <property name="padding">50</property> 194 <property name="padding">25</property>
180 <property name="position">0</property> 195 <property name="position">0</property>
181 </packing> 196 </packing>
182 </child> 197 </child>
@@ -222,13 +237,14 @@
222 </child> 237 </child>
223 <child> 238 <child>
224 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button"> 239 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button">
225 <property name="label">gtk-go-back</property> 240 <property name="label">_Left</property>
226 <property name="visible">True</property> 241 <property name="visible">True</property>
227 <property name="sensitive">False</property> 242 <property name="sensitive">False</property>
228 <property name="can_focus">True</property> 243 <property name="can_focus">True</property>
229 <property name="receives_default">True</property> 244 <property name="receives_default">True</property>
230 <property name="use_action_appearance">False</property> 245 <property name="use_action_appearance">False</property>
231 <property name="use_stock">True</property> 246 <property name="image">left_stock_image</property>
247 <property name="use_underline">True</property>
232 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/> 248 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
233 </object> 249 </object>
234 <packing> 250 <packing>
@@ -238,13 +254,14 @@
238 </child> 254 </child>
239 <child> 255 <child>
240 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button"> 256 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button">
241 <property name="label">gtk-go-forward</property> 257 <property name="label">_Right</property>
242 <property name="visible">True</property> 258 <property name="visible">True</property>
243 <property name="sensitive">False</property> 259 <property name="sensitive">False</property>
244 <property name="can_focus">True</property> 260 <property name="can_focus">True</property>
245 <property name="receives_default">True</property> 261 <property name="receives_default">True</property>
246 <property name="use_action_appearance">False</property> 262 <property name="use_action_appearance">False</property>
247 <property name="use_stock">True</property> 263 <property name="image">right_stock_image</property>
264 <property name="use_underline">True</property>
248 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/> 265 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/>
249 </object> 266 </object>
250 <packing> 267 <packing>
@@ -263,7 +280,7 @@
263 </object> 280 </object>
264 <packing> 281 <packing>
265 <property name="expand">False</property> 282 <property name="expand">False</property>
266 <property name="padding">50</property> 283 <property name="padding">25</property>
267 <property name="position">1</property> 284 <property name="position">1</property>
268 </packing> 285 </packing>
269 </child> 286 </child>
@@ -394,20 +411,24 @@
394 <action-widget response="-5">GNUNET_GTK_master_publish_dialog_execute_button</action-widget> 411 <action-widget response="-5">GNUNET_GTK_master_publish_dialog_execute_button</action-widget>
395 </action-widgets> 412 </action-widgets>
396 </object> 413 </object>
397 <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store"> 414 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store">
398 <columns> 415 <columns>
399 <!-- column-name filesize --> 416 <!-- column-name local_name -->
400 <column type="gchararray"/> 417 <column type="gchararray"/>
401 <!-- column-name do_index --> 418 <!-- column-name namespace_handle -->
402 <column type="gboolean"/> 419 <column type="gpointer"/>
403 <!-- column-name filename --> 420 <!-- column-name last_id -->
404 <column type="gchararray"/> 421 <column type="gchararray"/>
405 <!-- column-name anonymity_level --> 422 <!-- column-name last_uri -->
406 <column type="guint"/> 423 <column type="gchararray"/>
407 <!-- column-name priority --> 424 <!-- column-name last_meta -->
408 <column type="guint"/>
409 <!-- column-name file_information_struct -->
410 <column type="gpointer"/> 425 <column type="gpointer"/>
426 <!-- column-name next_id -->
427 <column type="gchararray"/>
428 <!-- column-name last_description_from_meta -->
429 <column type="gchararray"/>
430 <!-- column-name next_id_editable -->
431 <column type="gboolean"/>
411 </columns> 432 </columns>
412 </object> 433 </object>
413</interface> 434</interface>
diff --git a/contrib/publish_edit_dialog.glade b/contrib/publish_edit_dialog.glade
index afc43e16..f4773362 100644
--- a/contrib/publish_edit_dialog.glade
+++ b/contrib/publish_edit_dialog.glade
@@ -2,25 +2,21 @@
2<interface> 2<interface>
3 <requires lib="gtk+" version="2.20"/> 3 <requires lib="gtk+" version="2.20"/>
4 <!-- interface-naming-policy project-wide --> 4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkListStore" id="GNUNET_GTK_metatype_list_store"> 5 <object class="GtkAdjustment" id="priority_adjustment">
6 <columns> 6 <property name="upper">10000000</property>
7 <!-- column-name description --> 7 <property name="value">1000</property>
8 <column type="gchararray"/> 8 <property name="step_increment">1</property>
9 <!-- column-name guint1 --> 9 <property name="page_increment">10</property>
10 <column type="guint"/>
11 <!-- column-name helptext -->
12 <column type="gchararray"/>
13 </columns>
14 </object> 10 </object>
15 <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store"> 11 <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
12 <property name="upper">100000</property>
13 <property name="value">1</property>
14 <property name="step_increment">1</property>
15 <property name="page_increment">10</property>
16 </object>
17 <object class="GtkListStore" id="GNUNET_GTK_keyword_list_store">
16 <columns> 18 <columns>
17 <!-- column-name extractor_meta_type --> 19 <!-- column-name keyword -->
18 <column type="guint"/>
19 <!-- column-name extractor_meta_format -->
20 <column type="guint"/>
21 <!-- column-name extractor_meta_type_string -->
22 <column type="gchararray"/>
23 <!-- column-name extracotr_meta_value -->
24 <column type="gchararray"/> 20 <column type="gchararray"/>
25 </columns> 21 </columns>
26 </object> 22 </object>
@@ -362,6 +358,7 @@
362 <object class="GtkButton" id="GNUNET_GTK_edit_file_information_keyword_list_del_button"> 358 <object class="GtkButton" id="GNUNET_GTK_edit_file_information_keyword_list_del_button">
363 <property name="label">gtk-delete</property> 359 <property name="label">gtk-delete</property>
364 <property name="visible">True</property> 360 <property name="visible">True</property>
361 <property name="sensitive">False</property>
365 <property name="can_focus">True</property> 362 <property name="can_focus">True</property>
366 <property name="receives_default">True</property> 363 <property name="receives_default">True</property>
367 <property name="use_action_appearance">False</property> 364 <property name="use_action_appearance">False</property>
@@ -629,22 +626,26 @@
629 <action-widget response="-5">GNUNET_GTK_edit_file_information_confirm_button</action-widget> 626 <action-widget response="-5">GNUNET_GTK_edit_file_information_confirm_button</action-widget>
630 </action-widgets> 627 </action-widgets>
631 </object> 628 </object>
632 <object class="GtkListStore" id="GNUNET_GTK_keyword_list_store"> 629 <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
633 <columns> 630 <columns>
634 <!-- column-name keyword --> 631 <!-- column-name extractor_meta_type -->
632 <column type="guint"/>
633 <!-- column-name extractor_meta_format -->
634 <column type="guint"/>
635 <!-- column-name extractor_meta_type_string -->
636 <column type="gchararray"/>
637 <!-- column-name extracotr_meta_value -->
635 <column type="gchararray"/> 638 <column type="gchararray"/>
636 </columns> 639 </columns>
637 </object> 640 </object>
638 <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment"> 641 <object class="GtkListStore" id="GNUNET_GTK_metatype_list_store">
639 <property name="upper">100000</property> 642 <columns>
640 <property name="value">1</property> 643 <!-- column-name description -->
641 <property name="step_increment">1</property> 644 <column type="gchararray"/>
642 <property name="page_increment">10</property> 645 <!-- column-name guint1 -->
643 </object> 646 <column type="guint"/>
644 <object class="GtkAdjustment" id="priority_adjustment"> 647 <!-- column-name helptext -->
645 <property name="upper">10000000</property> 648 <column type="gchararray"/>
646 <property name="value">1000</property> 649 </columns>
647 <property name="step_increment">1</property>
648 <property name="page_increment">10</property>
649 </object> 650 </object>
650</interface> 651</interface>
diff --git a/src/fs_event_handler.c b/src/fs_event_handler.c
index 0e285642..a9721acb 100644
--- a/src/fs_event_handler.c
+++ b/src/fs_event_handler.c
@@ -814,13 +814,20 @@ GNUNET_GTK_fs_event_handler (void *cls,
814{ 814{
815 switch (info->status) 815 switch (info->status)
816 { 816 {
817 case GNUNET_FS_STATUS_PUBLISH_START: GNUNET_break (0); break; 817 case GNUNET_FS_STATUS_PUBLISH_START:
818 case GNUNET_FS_STATUS_PUBLISH_RESUME: GNUNET_break (0); break; 818 GNUNET_break (0); break;
819 case GNUNET_FS_STATUS_PUBLISH_SUSPEND: GNUNET_break (0); break; 819 case GNUNET_FS_STATUS_PUBLISH_RESUME:
820 case GNUNET_FS_STATUS_PUBLISH_PROGRESS: GNUNET_break (0); break; 820 GNUNET_break (0); break;
821 case GNUNET_FS_STATUS_PUBLISH_ERROR: GNUNET_break (0); break; 821 case GNUNET_FS_STATUS_PUBLISH_SUSPEND:
822 case GNUNET_FS_STATUS_PUBLISH_COMPLETED: GNUNET_break (0); break; 822 GNUNET_break (0); break;
823 case GNUNET_FS_STATUS_PUBLISH_STOPPED: GNUNET_break (0); break; 823 case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
824 GNUNET_break (0); break;
825 case GNUNET_FS_STATUS_PUBLISH_ERROR:
826 GNUNET_break (0); break;
827 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
828 GNUNET_break (0); break;
829 case GNUNET_FS_STATUS_PUBLISH_STOPPED:
830 GNUNET_break (0); break;
824 case GNUNET_FS_STATUS_DOWNLOAD_START: 831 case GNUNET_FS_STATUS_DOWNLOAD_START:
825 return setup_download (info->value.download.pctx, 832 return setup_download (info->value.download.pctx,
826 info->value.download.sctx, 833 info->value.download.sctx,
diff --git a/src/main_window_file_publish.c b/src/main_window_file_publish.c
index cd831e41..113adcab 100644
--- a/src/main_window_file_publish.c
+++ b/src/main_window_file_publish.c
@@ -854,6 +854,43 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
854 854
855 855
856/** 856/**
857 * Get the file information struct corresponding to the
858 * given iter in the publish dialog tree model. Recursively
859 * builds the file information struct from the subtree.
860 *
861 * @param tm model to grab fi from
862 * @param iter position to grab fi from
863 * @return file information from the given position (never NULL)
864 */
865static struct GNUNET_FS_FileInformation *
866get_file_information (GtkTreeModel *tm,
867 GtkTreeIter *iter)
868{
869 struct GNUNET_FS_FileInformation *fi;
870 struct GNUNET_FS_FileInformation *fic;
871 struct GtkTreeIter child;
872
873 gtk_tree_model_get (tm, iter,
874 5, &fi,
875 -1);
876 GNUNET_assert (fi != NULL);
877 if (gtk_tree_model_iter_children (tm, &child, iter))
878 {
879 GNUNET_break (GNUNET_YES ==
880 GNUNET_FS_file_information_is_directory (fi));
881 do
882 {
883 fic = get_file_information (tm, &child);
884 GNUNET_break (GNUNET_OK ==
885 GNUNET_FS_file_information_add (fi, fic));
886 }
887 while (gtk_tree_model_iter_next (tm, &child));
888 }
889 return fi;
890}
891
892
893/**
857 */ 894 */
858void 895void
859GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, 896GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
@@ -864,6 +901,9 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
864 gint ret; 901 gint ret;
865 GtkTreeView *tv; 902 GtkTreeView *tv;
866 GtkTreeSelection *sel; 903 GtkTreeSelection *sel;
904 GtkTreeIter iter;
905 struct GNUNET_FS_FileInformation *fi;
906 GtkTreeModel *tm;
867 907
868 GNUNET_assert (master_builder == NULL); 908 GNUNET_assert (master_builder == NULL);
869 master_builder = GNUNET_GTK_get_new_builder ("publish_dialog.glade"); 909 master_builder = GNUNET_GTK_get_new_builder ("publish_dialog.glade");
@@ -879,18 +919,26 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
879 ls = GTK_TREE_STORE (gtk_builder_get_object (master_builder, 919 ls = GTK_TREE_STORE (gtk_builder_get_object (master_builder,
880 "GNUNET_GTK_pseudonym_tree_store")); 920 "GNUNET_GTK_pseudonym_tree_store"));
881 /* FIXME: populate 'ls' */ 921 /* FIXME: populate 'ls' */
882#if WTF
883 GtkTreeStore *pts;
884 pts = GTK_TREE_STORE (gtk_builder_get_object (master_builder,
885 "GNUNET_GTK_file_sharing_publishing_tree_store"));
886#endif
887 ret = gtk_dialog_run (GTK_DIALOG (ad)); 922 ret = gtk_dialog_run (GTK_DIALOG (ad));
888 if (ret == GTK_RESPONSE_OK) 923 if (ret == GTK_RESPONSE_OK)
889 { 924 {
890 /* FIXME: trigger publication! */ 925 /* FIXME: grab namespace from ls! */
891 GNUNET_break (0); 926 tm = GTK_TREE_MODEL (gtk_builder_get_object (master_builder,
892 } 927 "GNUNET_GTK_file_sharing_publishing_tree_store"));
893 /* FIXME: free state from 'ls' and pts */ 928 if (gtk_tree_model_get_iter_first (tm, &iter))
929 do
930 {
931 fi = get_file_information (tm, &iter);
932 GNUNET_FS_publish_start (fs,
933 fi,
934 NULL /* FIXME: namespace */,
935 NULL /* FIXME: namespace id */,
936 NULL /* FIXME: namespace uid */,
937 GNUNET_FS_PUBLISH_OPTION_NONE);
938 }
939 while (gtk_tree_model_iter_next (tm, &iter));
940 }
941 /* FIXME: free state from 'ls' */
894 gtk_widget_destroy (ad); 942 gtk_widget_destroy (ad);
895 g_object_unref (G_OBJECT (master_builder)); 943 g_object_unref (G_OBJECT (master_builder));
896 master_builder = NULL; 944 master_builder = NULL;