aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-05 07:49:58 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-05 07:49:58 +0000
commit5a9eae3e99147b2912663b171d55a3828b30ae16 (patch)
tree68b157aeeb036e52f37042fd8a61058e90ee5a30
parent619cfe24b013c7dcf4eae7c7a1bd6472bbd8d043 (diff)
downloadgnunet-gtk-5a9eae3e99147b2912663b171d55a3828b30ae16.tar.gz
gnunet-gtk-5a9eae3e99147b2912663b171d55a3828b30ae16.zip
-LRN: unbuildering the master publication editing dialog --- CG: yayh
-rw-r--r--contrib/gnunet_fs_gtk_main_window.glade504
-rw-r--r--contrib/gnunet_fs_gtk_publish_dialog.glade328
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_file_publish.c649
3 files changed, 446 insertions, 1035 deletions
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 89f3bda4..bb060f3d 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -12,26 +12,6 @@
12 <property name="step_increment">1</property> 12 <property name="step_increment">1</property>
13 <property name="page_increment">10</property> 13 <property name="page_increment">10</property>
14 </object> 14 </object>
15 <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store">
16 <columns>
17 <!-- column-name filesize -->
18 <column type="gchararray"/>
19 <!-- column-name do_index -->
20 <column type="gboolean"/>
21 <!-- column-name filename -->
22 <column type="gchararray"/>
23 <!-- column-name anonymity_level -->
24 <column type="guint"/>
25 <!-- column-name priority -->
26 <column type="guint"/>
27 <!-- column-name file_information_struct -->
28 <column type="gpointer"/>
29 <!-- column-name expiration_time_absolute -->
30 <column type="guint64"/>
31 <!-- column-name replication_level -->
32 <column type="guint"/>
33 </columns>
34 </object>
35 <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store"> 15 <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
36 <columns> 16 <columns>
37 <!-- column-name extractor_meta_type --> 17 <!-- column-name extractor_meta_type -->
@@ -44,6 +24,9 @@
44 <column type="gchararray"/> 24 <column type="gchararray"/>
45 </columns> 25 </columns>
46 </object> 26 </object>
27 <object class="GtkTextBuffer" id="GNUNET_GTK_open_url_dialog_url_textview_buffer">
28 <signal name="changed" handler="GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb" swapped="no"/>
29 </object>
47 <object class="GtkWindow" id="GNUNET_GTK_open_url_window"> 30 <object class="GtkWindow" id="GNUNET_GTK_open_url_window">
48 <property name="can_focus">False</property> 31 <property name="can_focus">False</property>
49 <property name="title" translatable="yes">Enter the URI to be downloaded</property> 32 <property name="title" translatable="yes">Enter the URI to be downloaded</property>
@@ -251,28 +234,6 @@
251 <column type="guint64"/> 234 <column type="guint64"/>
252 </columns> 235 </columns>
253 </object> 236 </object>
254 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store">
255 <columns>
256 <!-- column-name local_name -->
257 <column type="gchararray"/>
258 <!-- column-name namespace_handle -->
259 <column type="gpointer"/>
260 <!-- column-name last_id -->
261 <column type="gchararray"/>
262 <!-- column-name last_uri -->
263 <column type="gchararray"/>
264 <!-- column-name last_meta -->
265 <column type="gpointer"/>
266 <!-- column-name next_id -->
267 <column type="gchararray"/>
268 <!-- column-name last_description_from_meta -->
269 <column type="gchararray"/>
270 <!-- column-name next_id_editable -->
271 <column type="gboolean"/>
272 <!-- column-name current_id_editable -->
273 <column type="gboolean"/>
274 </columns>
275 </object>
276 <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_directory_dialog"> 237 <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_directory_dialog">
277 <property name="can_focus">False</property> 238 <property name="can_focus">False</property>
278 <property name="can_default">True</property> 239 <property name="can_default">True</property>
@@ -287,7 +248,6 @@
287 <property name="action">select-folder</property> 248 <property name="action">select-folder</property>
288 <property name="create_folders">False</property> 249 <property name="create_folders">False</property>
289 <property name="select_multiple">True</property> 250 <property name="select_multiple">True</property>
290 <signal name="response" handler="GNUNET_GTK_publish_directory_dialog_response_cb" swapped="no"/>
291 <child internal-child="vbox"> 251 <child internal-child="vbox">
292 <object class="GtkVBox" id="dialog-vbox1"> 252 <object class="GtkVBox" id="dialog-vbox1">
293 <property name="visible">True</property> 253 <property name="visible">True</property>
@@ -571,7 +531,6 @@
571 <property name="create_folders">False</property> 531 <property name="create_folders">False</property>
572 <property name="select_multiple">True</property> 532 <property name="select_multiple">True</property>
573 <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/> 533 <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/>
574 <signal name="response" handler="GNUNET_GTK_publish_file_dialog_response_cb" swapped="no"/>
575 <child internal-child="vbox"> 534 <child internal-child="vbox">
576 <object class="GtkVBox" id="dialog-vbox5"> 535 <object class="GtkVBox" id="dialog-vbox5">
577 <property name="visible">True</property> 536 <property name="visible">True</property>
@@ -859,410 +818,6 @@
859 <column type="gpointer"/> 818 <column type="gpointer"/>
860 </columns> 819 </columns>
861 </object> 820 </object>
862 <object class="GtkWindow" id="GNUNET_GTK_master_publish_dialog">
863 <property name="height_request">500</property>
864 <property name="can_focus">False</property>
865 <property name="title" translatable="yes">Publish content on GNUnet</property>
866 <property name="window_position">center-on-parent</property>
867 <property name="destroy_with_parent">True</property>
868 <property name="deletable">False</property>
869 <property name="transient_for">GNUNET_GTK_main_window</property>
870 <signal name="realize" handler="GNUNET_GTK_master_publish_dialog_realize_cb" swapped="no"/>
871 <signal name="delete-event" handler="GNUNET_GTK_master_publish_dialog_delete_event_cb" swapped="no"/>
872 <child>
873 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_vbox">
874 <property name="visible">True</property>
875 <property name="can_focus">False</property>
876 <property name="border_width">4</property>
877 <property name="spacing">7</property>
878 <child>
879 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window">
880 <property name="visible">True</property>
881 <property name="can_focus">True</property>
882 <property name="hadjustment">adjustment5</property>
883 <property name="vadjustment">adjustment6</property>
884 <property name="hscrollbar_policy">automatic</property>
885 <property name="vscrollbar_policy">automatic</property>
886 <property name="shadow_type">in</property>
887 <child>
888 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view">
889 <property name="height_request">100</property>
890 <property name="visible">True</property>
891 <property name="can_focus">True</property>
892 <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property>
893 <property name="hadjustment">adjustment5</property>
894 <property name="vadjustment">adjustment6</property>
895 <property name="enable_tree_lines">True</property>
896 <child>
897 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column">
898 <property name="sizing">autosize</property>
899 <property name="title">Size</property>
900 <child>
901 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/>
902 <attributes>
903 <attribute name="text">0</attribute>
904 </attributes>
905 </child>
906 </object>
907 </child>
908 <child>
909 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column">
910 <property name="resizable">True</property>
911 <property name="sizing">autosize</property>
912 <property name="title">Filename</property>
913 <property name="expand">True</property>
914 <property name="clickable">True</property>
915 <property name="reorderable">True</property>
916 <property name="sort_indicator">True</property>
917 <child>
918 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/>
919 <attributes>
920 <attribute name="text">2</attribute>
921 </attributes>
922 </child>
923 </object>
924 </child>
925 </object>
926 </child>
927 </object>
928 <packing>
929 <property name="expand">True</property>
930 <property name="fill">True</property>
931 <property name="position">0</property>
932 </packing>
933 </child>
934 <child>
935 <object class="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox">
936 <property name="visible">True</property>
937 <property name="can_focus">False</property>
938 <child>
939 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table">
940 <property name="visible">True</property>
941 <property name="can_focus">False</property>
942 <property name="n_rows">2</property>
943 <property name="n_columns">3</property>
944 <child>
945 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button">
946 <property name="label" translatable="yes">Add _File</property>
947 <property name="use_action_appearance">False</property>
948 <property name="visible">True</property>
949 <property name="can_focus">True</property>
950 <property name="receives_default">True</property>
951 <property name="use_underline">True</property>
952 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/>
953 </object>
954 </child>
955 <child>
956 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button">
957 <property name="label" translatable="yes">_Create empty directory</property>
958 <property name="use_action_appearance">False</property>
959 <property name="visible">True</property>
960 <property name="can_focus">True</property>
961 <property name="receives_default">True</property>
962 <property name="image">new_stock_image</property>
963 <property name="use_underline">True</property>
964 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
965 </object>
966 <packing>
967 <property name="left_attach">1</property>
968 <property name="right_attach">3</property>
969 </packing>
970 </child>
971 <child>
972 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button">
973 <property name="label" translatable="yes">Add _Directory</property>
974 <property name="use_action_appearance">False</property>
975 <property name="visible">True</property>
976 <property name="can_focus">True</property>
977 <property name="receives_default">True</property>
978 <property name="use_underline">True</property>
979 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/>
980 </object>
981 <packing>
982 <property name="top_attach">1</property>
983 <property name="bottom_attach">2</property>
984 </packing>
985 </child>
986 <child>
987 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button">
988 <property name="label">gtk-edit</property>
989 <property name="use_action_appearance">False</property>
990 <property name="visible">True</property>
991 <property name="sensitive">False</property>
992 <property name="can_focus">True</property>
993 <property name="receives_default">True</property>
994 <property name="use_stock">True</property>
995 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/>
996 </object>
997 <packing>
998 <property name="left_attach">1</property>
999 <property name="right_attach">2</property>
1000 <property name="top_attach">1</property>
1001 <property name="bottom_attach">2</property>
1002 </packing>
1003 </child>
1004 <child>
1005 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button">
1006 <property name="label">gtk-delete</property>
1007 <property name="use_action_appearance">False</property>
1008 <property name="visible">True</property>
1009 <property name="sensitive">False</property>
1010 <property name="can_focus">True</property>
1011 <property name="receives_default">True</property>
1012 <property name="use_stock">True</property>
1013 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
1014 </object>
1015 <packing>
1016 <property name="left_attach">2</property>
1017 <property name="right_attach">3</property>
1018 <property name="top_attach">1</property>
1019 <property name="bottom_attach">2</property>
1020 </packing>
1021 </child>
1022 </object>
1023 <packing>
1024 <property name="expand">False</property>
1025 <property name="fill">True</property>
1026 <property name="padding">25</property>
1027 <property name="position">0</property>
1028 </packing>
1029 </child>
1030 <child>
1031 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table">
1032 <property name="visible">True</property>
1033 <property name="can_focus">False</property>
1034 <property name="n_rows">2</property>
1035 <property name="n_columns">3</property>
1036 <property name="homogeneous">True</property>
1037 <child>
1038 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button">
1039 <property name="label">gtk-go-up</property>
1040 <property name="use_action_appearance">False</property>
1041 <property name="visible">True</property>
1042 <property name="sensitive">False</property>
1043 <property name="can_focus">True</property>
1044 <property name="receives_default">True</property>
1045 <property name="use_stock">True</property>
1046 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/>
1047 </object>
1048 <packing>
1049 <property name="left_attach">1</property>
1050 <property name="right_attach">2</property>
1051 </packing>
1052 </child>
1053 <child>
1054 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button">
1055 <property name="label" translatable="yes">_Left</property>
1056 <property name="use_action_appearance">False</property>
1057 <property name="visible">True</property>
1058 <property name="sensitive">False</property>
1059 <property name="can_focus">True</property>
1060 <property name="receives_default">True</property>
1061 <property name="image">left_stock_image</property>
1062 <property name="use_underline">True</property>
1063 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
1064 </object>
1065 <packing>
1066 <property name="top_attach">1</property>
1067 <property name="bottom_attach">2</property>
1068 </packing>
1069 </child>
1070 <child>
1071 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button">
1072 <property name="label">gtk-go-down</property>
1073 <property name="use_action_appearance">False</property>
1074 <property name="visible">True</property>
1075 <property name="sensitive">False</property>
1076 <property name="can_focus">True</property>
1077 <property name="receives_default">True</property>
1078 <property name="use_stock">True</property>
1079 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/>
1080 </object>
1081 <packing>
1082 <property name="left_attach">1</property>
1083 <property name="right_attach">2</property>
1084 <property name="top_attach">1</property>
1085 <property name="bottom_attach">2</property>
1086 </packing>
1087 </child>
1088 <child>
1089 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button">
1090 <property name="label" translatable="yes">_Right</property>
1091 <property name="use_action_appearance">False</property>
1092 <property name="visible">True</property>
1093 <property name="sensitive">False</property>
1094 <property name="can_focus">True</property>
1095 <property name="receives_default">True</property>
1096 <property name="image">right_stock_image</property>
1097 <property name="use_underline">True</property>
1098 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/>
1099 </object>
1100 <packing>
1101 <property name="left_attach">2</property>
1102 <property name="right_attach">3</property>
1103 <property name="top_attach">1</property>
1104 <property name="bottom_attach">2</property>
1105 </packing>
1106 </child>
1107 <child>
1108 <placeholder/>
1109 </child>
1110 <child>
1111 <placeholder/>
1112 </child>
1113 </object>
1114 <packing>
1115 <property name="expand">False</property>
1116 <property name="fill">True</property>
1117 <property name="padding">25</property>
1118 <property name="position">1</property>
1119 </packing>
1120 </child>
1121 </object>
1122 <packing>
1123 <property name="expand">False</property>
1124 <property name="fill">True</property>
1125 <property name="position">1</property>
1126 </packing>
1127 </child>
1128 <child>
1129 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_pseudonym_scrolled_window">
1130 <property name="visible">True</property>
1131 <property name="can_focus">True</property>
1132 <property name="hadjustment">adjustment7</property>
1133 <property name="vadjustment">adjustment8</property>
1134 <property name="hscrollbar_policy">automatic</property>
1135 <property name="vscrollbar_policy">automatic</property>
1136 <property name="shadow_type">in</property>
1137 <child>
1138 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_pseudonym_tree_view">
1139 <property name="visible">True</property>
1140 <property name="can_focus">True</property>
1141 <property name="model">GNUNET_GTK_pseudonym_tree_store</property>
1142 <property name="hadjustment">adjustment7</property>
1143 <property name="vadjustment">adjustment8</property>
1144 <property name="reorderable">True</property>
1145 <property name="rubber_banding">True</property>
1146 <property name="enable_grid_lines">both</property>
1147 <child>
1148 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_column">
1149 <property name="resizable">True</property>
1150 <property name="title">Pseudonym</property>
1151 <property name="clickable">True</property>
1152 <property name="reorderable">True</property>
1153 <property name="sort_indicator">True</property>
1154 <child>
1155 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_renderer"/>
1156 <attributes>
1157 <attribute name="text">0</attribute>
1158 </attributes>
1159 </child>
1160 </object>
1161 </child>
1162 <child>
1163 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_column">
1164 <property name="resizable">True</property>
1165 <property name="sizing">autosize</property>
1166 <property name="title">Current identifier</property>
1167 <property name="clickable">True</property>
1168 <child>
1169 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer"/>
1170 <attributes>
1171 <attribute name="editable">8</attribute>
1172 <attribute name="text">2</attribute>
1173 </attributes>
1174 </child>
1175 </object>
1176 </child>
1177 <child>
1178 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_column">
1179 <property name="resizable">True</property>
1180 <property name="sizing">autosize</property>
1181 <property name="fixed_width">5</property>
1182 <property name="title">Update identifier</property>
1183 <child>
1184 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer"/>
1185 <attributes>
1186 <attribute name="editable">7</attribute>
1187 <attribute name="text">5</attribute>
1188 </attributes>
1189 </child>
1190 </object>
1191 </child>
1192 <child>
1193 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_column">
1194 <property name="title">Description (of existing content)</property>
1195 <child>
1196 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_renderer">
1197 <property name="wrap_mode">word</property>
1198 </object>
1199 <attributes>
1200 <attribute name="text">6</attribute>
1201 </attributes>
1202 </child>
1203 </object>
1204 </child>
1205 </object>
1206 </child>
1207 </object>
1208 <packing>
1209 <property name="expand">True</property>
1210 <property name="fill">True</property>
1211 <property name="position">2</property>
1212 </packing>
1213 </child>
1214 <child>
1215 <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_master_buttons_hbox">
1216 <property name="visible">True</property>
1217 <property name="can_focus">False</property>
1218 <property name="spacing">2</property>
1219 <child>
1220 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button">
1221 <property name="label" translatable="yes">_Execute</property>
1222 <property name="use_action_appearance">False</property>
1223 <property name="visible">True</property>
1224 <property name="can_focus">True</property>
1225 <property name="receives_default">True</property>
1226 <property name="use_underline">True</property>
1227 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb" swapped="no"/>
1228 </object>
1229 <packing>
1230 <property name="expand">False</property>
1231 <property name="fill">False</property>
1232 <property name="pack_type">end</property>
1233 <property name="position">0</property>
1234 </packing>
1235 </child>
1236 <child>
1237 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button">
1238 <property name="label" translatable="yes">_Cancel</property>
1239 <property name="use_action_appearance">False</property>
1240 <property name="visible">True</property>
1241 <property name="can_focus">True</property>
1242 <property name="receives_default">True</property>
1243 <property name="use_underline">True</property>
1244 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb" swapped="no"/>
1245 </object>
1246 <packing>
1247 <property name="expand">False</property>
1248 <property name="fill">False</property>
1249 <property name="pack_type">end</property>
1250 <property name="position">1</property>
1251 </packing>
1252 </child>
1253 </object>
1254 <packing>
1255 <property name="expand">False</property>
1256 <property name="fill">False</property>
1257 <property name="position">3</property>
1258 </packing>
1259 </child>
1260 </object>
1261 </child>
1262 </object>
1263 <object class="GtkTextBuffer" id="GNUNET_GTK_open_url_dialog_url_textview_buffer">
1264 <signal name="changed" handler="GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb" swapped="no"/>
1265 </object>
1266 <object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog"> 821 <object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog">
1267 <property name="can_focus">False</property> 822 <property name="can_focus">False</property>
1268 <property name="border_width">5</property> 823 <property name="border_width">5</property>
@@ -1376,16 +931,6 @@
1376 <action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget> 931 <action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget>
1377 </action-widgets> 932 </action-widgets>
1378 </object> 933 </object>
1379 <object class="GtkAdjustment" id="adjustment3">
1380 <property name="upper">100</property>
1381 <property name="step_increment">1</property>
1382 <property name="page_increment">10</property>
1383 </object>
1384 <object class="GtkAdjustment" id="adjustment4">
1385 <property name="upper">100</property>
1386 <property name="step_increment">1</property>
1387 <property name="page_increment">10</property>
1388 </object>
1389 <object class="GtkImage" id="add_stock_image"> 934 <object class="GtkImage" id="add_stock_image">
1390 <property name="visible">True</property> 935 <property name="visible">True</property>
1391 <property name="can_focus">False</property> 936 <property name="can_focus">False</property>
@@ -1403,6 +948,16 @@
1403 <property name="page_increment">10</property> 948 <property name="page_increment">10</property>
1404 <property name="page_size">10</property> 949 <property name="page_size">10</property>
1405 </object> 950 </object>
951 <object class="GtkAdjustment" id="adjustment3">
952 <property name="upper">100</property>
953 <property name="step_increment">1</property>
954 <property name="page_increment">10</property>
955 </object>
956 <object class="GtkAdjustment" id="adjustment4">
957 <property name="upper">100</property>
958 <property name="step_increment">1</property>
959 <property name="page_increment">10</property>
960 </object>
1406 <object class="GtkAdjustment" id="adjustment5"> 961 <object class="GtkAdjustment" id="adjustment5">
1407 <property name="upper">100</property> 962 <property name="upper">100</property>
1408 <property name="step_increment">1</property> 963 <property name="step_increment">1</property>
@@ -1438,6 +993,11 @@
1438 <property name="can_focus">False</property> 993 <property name="can_focus">False</property>
1439 <property name="stock">gtk-execute</property> 994 <property name="stock">gtk-execute</property>
1440 </object> 995 </object>
996 <object class="GtkAdjustment" id="expiration_year_adjustment">
997 <property name="upper">9999</property>
998 <property name="step_increment">1</property>
999 <property name="page_increment">10</property>
1000 </object>
1441 <object class="GtkImage" id="find_stock_image"> 1001 <object class="GtkImage" id="find_stock_image">
1442 <property name="visible">True</property> 1002 <property name="visible">True</property>
1443 <property name="can_focus">False</property> 1003 <property name="can_focus">False</property>
@@ -2222,19 +1782,6 @@
2222 <property name="can_focus">False</property> 1782 <property name="can_focus">False</property>
2223 <property name="stock">gtk-open</property> 1783 <property name="stock">gtk-open</property>
2224 </object> 1784 </object>
2225 <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
2226 <property name="mode">vertical</property>
2227 <widgets>
2228 <widget name="main_window_search_entry"/>
2229 <widget name="main_window_search_anonymity_combobox"/>
2230 <widget name="main_window_search_mime_combobox"/>
2231 </widgets>
2232 </object>
2233 <object class="GtkAdjustment" id="expiration_year_adjustment">
2234 <property name="upper">9999</property>
2235 <property name="step_increment">1</property>
2236 <property name="page_increment">10</property>
2237 </object>
2238 <object class="GtkAdjustment" id="priority_adjustment"> 1785 <object class="GtkAdjustment" id="priority_adjustment">
2239 <property name="upper">10000000</property> 1786 <property name="upper">10000000</property>
2240 <property name="value">1000</property> 1787 <property name="value">1000</property>
@@ -2256,16 +1803,19 @@
2256 <property name="can_focus">False</property> 1803 <property name="can_focus">False</property>
2257 <property name="stock">gtk-go-up</property> 1804 <property name="stock">gtk-go-up</property>
2258 </object> 1805 </object>
2259 <object class="GtkSizeGroup" id="sizegroup4"> 1806 <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
1807 <property name="mode">vertical</property>
2260 <widgets> 1808 <widgets>
2261 <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/> 1809 <widget name="main_window_search_entry"/>
2262 <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/> 1810 <widget name="main_window_search_anonymity_combobox"/>
1811 <widget name="main_window_search_mime_combobox"/>
2263 </widgets> 1812 </widgets>
2264 </object> 1813 </object>
2265 <object class="GtkSizeGroup" id="sizegroup5"> 1814 <object class="GtkSizeGroup" id="sizegroup4">
2266 <widgets> 1815 <widgets>
2267 <widget name="GNUNET_GTK_edit_publication_confirm_button"/> 1816 <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/>
2268 <widget name="GNUNET_GTK_edit_publication_cancel_button"/> 1817 <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/>
2269 </widgets> 1818 </widgets>
2270 </object> 1819 </object>
1820 <object class="GtkSizeGroup" id="sizegroup5"/>
2271</interface> 1821</interface>
diff --git a/contrib/gnunet_fs_gtk_publish_dialog.glade b/contrib/gnunet_fs_gtk_publish_dialog.glade
index 409a2e11..d160be7c 100644
--- a/contrib/gnunet_fs_gtk_publish_dialog.glade
+++ b/contrib/gnunet_fs_gtk_publish_dialog.glade
@@ -2,50 +2,6 @@
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="GtkAdjustment" id="adjustment4">
6 <property name="upper">100</property>
7 <property name="step_increment">1</property>
8 <property name="page_increment">10</property>
9 <property name="page_size">10</property>
10 </object>
11 <object class="GtkAdjustment" id="adjustment3">
12 <property name="upper">100</property>
13 <property name="step_increment">1</property>
14 <property name="page_increment">10</property>
15 <property name="page_size">10</property>
16 </object>
17 <object class="GtkAdjustment" id="adjustment2">
18 <property name="upper">100</property>
19 <property name="step_increment">1</property>
20 <property name="page_increment">10</property>
21 <property name="page_size">10</property>
22 </object>
23 <object class="GtkAdjustment" id="adjustment1">
24 <property name="upper">100</property>
25 <property name="step_increment">1</property>
26 <property name="page_increment">10</property>
27 <property name="page_size">10</property>
28 </object>
29 <object class="GtkImage" id="right_stock_image">
30 <property name="visible">True</property>
31 <property name="stock">gtk-go-forward</property>
32 </object>
33 <object class="GtkImage" id="left_stock_image">
34 <property name="visible">True</property>
35 <property name="stock">gtk-go-back</property>
36 </object>
37 <object class="GtkImage" id="add_stock_image_2">
38 <property name="visible">True</property>
39 <property name="stock">gtk-add</property>
40 </object>
41 <object class="GtkImage" id="new_stock_image">
42 <property name="visible">True</property>
43 <property name="stock">gtk-new</property>
44 </object>
45 <object class="GtkImage" id="add_stock_image">
46 <property name="visible">True</property>
47 <property name="stock">gtk-add</property>
48 </object>
49 <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store"> 5 <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store">
50 <columns> 6 <columns>
51 <!-- column-name filesize --> 7 <!-- column-name filesize -->
@@ -60,137 +16,132 @@
60 <column type="guint"/> 16 <column type="guint"/>
61 <!-- column-name file_information_struct --> 17 <!-- column-name file_information_struct -->
62 <column type="gpointer"/> 18 <column type="gpointer"/>
19 <!-- column-name expiration_time_absolute -->
20 <column type="guint64"/>
21 <!-- column-name replication_level -->
22 <column type="guint"/>
63 </columns> 23 </columns>
64 </object> 24 </object>
65 <object class="GtkDialog" id="GNUNET_GTK_master_publish_dialog"> 25 <object class="GtkWindow" id="GNUNET_GTK_master_publish_dialog">
66 <property name="height_request">500</property> 26 <property name="height_request">500</property>
67 <property name="border_width">5</property> 27 <property name="can_focus">False</property>
68 <property name="title" translatable="yes">Publish content on GNUnet</property> 28 <property name="title" translatable="yes">Publish content on GNUnet</property>
69 <property name="modal">True</property>
70 <property name="window_position">center-on-parent</property> 29 <property name="window_position">center-on-parent</property>
71 <property name="type_hint">dialog</property> 30 <property name="destroy_with_parent">True</property>
72 <property name="skip_taskbar_hint">True</property> 31 <property name="transient_for">GNUNET_GTK_main_window</property>
73 <property name="has_separator">False</property> 32 <signal name="delete-event" handler="GNUNET_GTK_master_publish_dialog_delete_event_cb" swapped="no"/>
74 <child internal-child="vbox"> 33 <signal name="realize" handler="GNUNET_GTK_master_publish_dialog_realize_cb" swapped="no"/>
34 <child>
75 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_vbox"> 35 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_vbox">
76 <property name="visible">True</property> 36 <property name="visible">True</property>
77 <property name="spacing">2</property> 37 <property name="can_focus">False</property>
38 <property name="border_width">4</property>
39 <property name="spacing">7</property>
78 <child> 40 <child>
79 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_file_information_vbox"> 41 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window">
80 <property name="visible">True</property> 42 <property name="visible">True</property>
43 <property name="can_focus">True</property>
44 <property name="hadjustment">adjustment5</property>
45 <property name="vadjustment">adjustment6</property>
46 <property name="hscrollbar_policy">automatic</property>
47 <property name="vscrollbar_policy">automatic</property>
48 <property name="shadow_type">in</property>
81 <child> 49 <child>
82 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window"> 50 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view">
83 <property name="height_request">100</property> 51 <property name="height_request">100</property>
84 <property name="visible">True</property> 52 <property name="visible">True</property>
85 <property name="can_focus">True</property> 53 <property name="can_focus">True</property>
86 <property name="hadjustment">adjustment1</property> 54 <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property>
87 <property name="vadjustment">adjustment2</property> 55 <property name="hadjustment">adjustment5</property>
88 <property name="hscrollbar_policy">automatic</property> 56 <property name="vadjustment">adjustment6</property>
89 <property name="vscrollbar_policy">automatic</property> 57 <property name="headers_clickable">False</property>
58 <property name="search_column">0</property>
59 <property name="enable_tree_lines">True</property>
90 <child> 60 <child>
91 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view"> 61 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column">
92 <property name="visible">True</property> 62 <property name="sizing">autosize</property>
93 <property name="can_focus">True</property> 63 <property name="title">Size</property>
94 <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property>
95 <property name="hadjustment">adjustment1</property>
96 <property name="vadjustment">adjustment2</property>
97 <property name="enable_tree_lines">True</property>
98 <child> 64 <child>
99 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column"> 65 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/>
100 <property name="sizing">autosize</property> 66 <attributes>
101 <property name="title" translatable="yes">Size</property> 67 <attribute name="text">0</attribute>
102 <child> 68 </attributes>
103 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/>
104 <attributes>
105 <attribute name="text">0</attribute>
106 </attributes>
107 </child>
108 </object>
109 </child> 69 </child>
70 </object>
71 </child>
72 <child>
73 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column">
74 <property name="sizing">autosize</property>
75 <property name="title">Filename</property>
76 <property name="expand">True</property>
77 <property name="clickable">True</property>
78 <property name="reorderable">True</property>
79 <property name="sort_indicator">True</property>
110 <child> 80 <child>
111 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column"> 81 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/>
112 <property name="resizable">True</property> 82 <attributes>
113 <property name="sizing">autosize</property> 83 <attribute name="text">2</attribute>
114 <property name="title" translatable="yes">Filename</property> 84 </attributes>
115 <property name="expand">True</property>
116 <property name="clickable">True</property>
117 <property name="reorderable">True</property>
118 <property name="sort_indicator">True</property>
119 <child>
120 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/>
121 <attributes>
122 <attribute name="text">2</attribute>
123 </attributes>
124 </child>
125 </object>
126 </child> 85 </child>
127 </object> 86 </object>
128 </child> 87 </child>
129 </object> 88 </object>
130 <packing>
131 <property name="expand">True</property>
132 <property name="fill">True</property>
133 <property name="position">0</property>
134 </packing>
135 </child> 89 </child>
136 </object> 90 </object>
137 <packing> 91 <packing>
138 <property name="expand">True</property> 92 <property name="expand">True</property>
139 <property name="fill">True</property> 93 <property name="fill">True</property>
140 <property name="padding">8</property>
141 <property name="position">0</property> 94 <property name="position">0</property>
142 </packing> 95 </packing>
143 </child> 96 </child>
144 <child> 97 <child>
145 <object class="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox"> 98 <object class="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox">
146 <property name="visible">True</property> 99 <property name="visible">True</property>
100 <property name="can_focus">False</property>
147 <child> 101 <child>
148 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table"> 102 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table">
149 <property name="visible">True</property> 103 <property name="visible">True</property>
104 <property name="can_focus">False</property>
150 <property name="n_rows">2</property> 105 <property name="n_rows">2</property>
151 <property name="n_columns">3</property> 106 <property name="n_columns">3</property>
152 <child> 107 <child>
153 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button"> 108 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button">
154 <property name="label">Add _File</property> 109 <property name="label" translatable="yes">Add _File</property>
110 <property name="use_action_appearance">False</property>
155 <property name="visible">True</property> 111 <property name="visible">True</property>
156 <property name="can_focus">True</property> 112 <property name="can_focus">True</property>
157 <property name="receives_default">True</property> 113 <property name="receives_default">True</property>
158 <property name="use_action_appearance">False</property>
159 <property name="image">add_stock_image</property>
160 <property name="use_underline">True</property> 114 <property name="use_underline">True</property>
161 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/> 115 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/>
162 </object> 116 </object>
163 </child> 117 </child>
164 <child> 118 <child>
165 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button"> 119 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button">
166 <property name="label">Add _Directory</property> 120 <property name="label" translatable="yes">_Create empty directory</property>
121 <property name="use_action_appearance">False</property>
167 <property name="visible">True</property> 122 <property name="visible">True</property>
168 <property name="can_focus">True</property> 123 <property name="can_focus">True</property>
169 <property name="receives_default">True</property> 124 <property name="receives_default">True</property>
170 <property name="use_action_appearance">False</property> 125 <property name="image">new_stock_image</property>
171 <property name="image">add_stock_image_2</property>
172 <property name="use_underline">True</property> 126 <property name="use_underline">True</property>
173 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/> 127 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
174 </object> 128 </object>
175 <packing> 129 <packing>
176 <property name="top_attach">1</property> 130 <property name="left_attach">1</property>
177 <property name="bottom_attach">2</property> 131 <property name="right_attach">3</property>
178 </packing> 132 </packing>
179 </child> 133 </child>
180 <child> 134 <child>
181 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button"> 135 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button">
182 <property name="label">gtk-delete</property> 136 <property name="label" translatable="yes">Add _Directory</property>
137 <property name="use_action_appearance">False</property>
183 <property name="visible">True</property> 138 <property name="visible">True</property>
184 <property name="sensitive">False</property>
185 <property name="can_focus">True</property> 139 <property name="can_focus">True</property>
186 <property name="receives_default">True</property> 140 <property name="receives_default">True</property>
187 <property name="use_action_appearance">False</property> 141 <property name="use_underline">True</property>
188 <property name="use_stock">True</property> 142 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/>
189 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
190 </object> 143 </object>
191 <packing> 144 <packing>
192 <property name="left_attach">2</property>
193 <property name="right_attach">3</property>
194 <property name="top_attach">1</property> 145 <property name="top_attach">1</property>
195 <property name="bottom_attach">2</property> 146 <property name="bottom_attach">2</property>
196 </packing> 147 </packing>
@@ -198,11 +149,11 @@
198 <child> 149 <child>
199 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button"> 150 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button">
200 <property name="label">gtk-edit</property> 151 <property name="label">gtk-edit</property>
152 <property name="use_action_appearance">False</property>
201 <property name="visible">True</property> 153 <property name="visible">True</property>
202 <property name="sensitive">False</property> 154 <property name="sensitive">False</property>
203 <property name="can_focus">True</property> 155 <property name="can_focus">True</property>
204 <property name="receives_default">True</property> 156 <property name="receives_default">True</property>
205 <property name="use_action_appearance">False</property>
206 <property name="use_stock">True</property> 157 <property name="use_stock">True</property>
207 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/> 158 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/>
208 </object> 159 </object>
@@ -214,19 +165,21 @@
214 </packing> 165 </packing>
215 </child> 166 </child>
216 <child> 167 <child>
217 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button"> 168 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button">
218 <property name="label">_Create empty directory</property> 169 <property name="label">gtk-delete</property>
170 <property name="use_action_appearance">False</property>
219 <property name="visible">True</property> 171 <property name="visible">True</property>
172 <property name="sensitive">False</property>
220 <property name="can_focus">True</property> 173 <property name="can_focus">True</property>
221 <property name="receives_default">True</property> 174 <property name="receives_default">True</property>
222 <property name="use_action_appearance">False</property> 175 <property name="use_stock">True</property>
223 <property name="image">new_stock_image</property> 176 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
224 <property name="use_underline">True</property>
225 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
226 </object> 177 </object>
227 <packing> 178 <packing>
228 <property name="left_attach">1</property> 179 <property name="left_attach">2</property>
229 <property name="right_attach">3</property> 180 <property name="right_attach">3</property>
181 <property name="top_attach">1</property>
182 <property name="bottom_attach">2</property>
230 </packing> 183 </packing>
231 </child> 184 </child>
232 </object> 185 </object>
@@ -240,17 +193,18 @@
240 <child> 193 <child>
241 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table"> 194 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table">
242 <property name="visible">True</property> 195 <property name="visible">True</property>
196 <property name="can_focus">False</property>
243 <property name="n_rows">2</property> 197 <property name="n_rows">2</property>
244 <property name="n_columns">3</property> 198 <property name="n_columns">3</property>
245 <property name="homogeneous">True</property> 199 <property name="homogeneous">True</property>
246 <child> 200 <child>
247 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button"> 201 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button">
248 <property name="label">gtk-go-up</property> 202 <property name="label">gtk-go-up</property>
203 <property name="use_action_appearance">False</property>
249 <property name="visible">True</property> 204 <property name="visible">True</property>
250 <property name="sensitive">False</property> 205 <property name="sensitive">False</property>
251 <property name="can_focus">True</property> 206 <property name="can_focus">True</property>
252 <property name="receives_default">True</property> 207 <property name="receives_default">True</property>
253 <property name="use_action_appearance">False</property>
254 <property name="use_stock">True</property> 208 <property name="use_stock">True</property>
255 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/> 209 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/>
256 </object> 210 </object>
@@ -260,48 +214,48 @@
260 </packing> 214 </packing>
261 </child> 215 </child>
262 <child> 216 <child>
263 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button"> 217 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button">
264 <property name="label">gtk-go-down</property> 218 <property name="label" translatable="yes">_Left</property>
219 <property name="use_action_appearance">False</property>
265 <property name="visible">True</property> 220 <property name="visible">True</property>
266 <property name="sensitive">False</property> 221 <property name="sensitive">False</property>
267 <property name="can_focus">True</property> 222 <property name="can_focus">True</property>
268 <property name="receives_default">True</property> 223 <property name="receives_default">True</property>
269 <property name="use_action_appearance">False</property> 224 <property name="image">left_stock_image</property>
270 <property name="use_stock">True</property> 225 <property name="use_underline">True</property>
271 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/> 226 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
272 </object> 227 </object>
273 <packing> 228 <packing>
274 <property name="left_attach">1</property>
275 <property name="right_attach">2</property>
276 <property name="top_attach">1</property> 229 <property name="top_attach">1</property>
277 <property name="bottom_attach">2</property> 230 <property name="bottom_attach">2</property>
278 </packing> 231 </packing>
279 </child> 232 </child>
280 <child> 233 <child>
281 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button"> 234 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button">
282 <property name="label">_Left</property> 235 <property name="label">gtk-go-down</property>
236 <property name="use_action_appearance">False</property>
283 <property name="visible">True</property> 237 <property name="visible">True</property>
284 <property name="sensitive">False</property> 238 <property name="sensitive">False</property>
285 <property name="can_focus">True</property> 239 <property name="can_focus">True</property>
286 <property name="receives_default">True</property> 240 <property name="receives_default">True</property>
287 <property name="use_action_appearance">False</property> 241 <property name="use_stock">True</property>
288 <property name="image">left_stock_image</property> 242 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/>
289 <property name="use_underline">True</property>
290 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
291 </object> 243 </object>
292 <packing> 244 <packing>
245 <property name="left_attach">1</property>
246 <property name="right_attach">2</property>
293 <property name="top_attach">1</property> 247 <property name="top_attach">1</property>
294 <property name="bottom_attach">2</property> 248 <property name="bottom_attach">2</property>
295 </packing> 249 </packing>
296 </child> 250 </child>
297 <child> 251 <child>
298 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button"> 252 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button">
299 <property name="label">_Right</property> 253 <property name="label" translatable="yes">_Right</property>
254 <property name="use_action_appearance">False</property>
300 <property name="visible">True</property> 255 <property name="visible">True</property>
301 <property name="sensitive">False</property> 256 <property name="sensitive">False</property>
302 <property name="can_focus">True</property> 257 <property name="can_focus">True</property>
303 <property name="receives_default">True</property> 258 <property name="receives_default">True</property>
304 <property name="use_action_appearance">False</property>
305 <property name="image">right_stock_image</property> 259 <property name="image">right_stock_image</property>
306 <property name="use_underline">True</property> 260 <property name="use_underline">True</property>
307 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/> 261 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/>
@@ -336,27 +290,29 @@
336 </child> 290 </child>
337 <child> 291 <child>
338 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_pseudonym_scrolled_window"> 292 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_pseudonym_scrolled_window">
339 <property name="height_request">100</property>
340 <property name="visible">True</property> 293 <property name="visible">True</property>
341 <property name="can_focus">True</property> 294 <property name="can_focus">True</property>
342 <property name="hadjustment">adjustment3</property> 295 <property name="hadjustment">adjustment7</property>
343 <property name="vadjustment">adjustment4</property> 296 <property name="vadjustment">adjustment8</property>
344 <property name="hscrollbar_policy">automatic</property> 297 <property name="hscrollbar_policy">automatic</property>
345 <property name="vscrollbar_policy">automatic</property> 298 <property name="vscrollbar_policy">automatic</property>
299 <property name="shadow_type">in</property>
346 <child> 300 <child>
347 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"> 301 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_pseudonym_tree_view">
348 <property name="visible">True</property> 302 <property name="visible">True</property>
349 <property name="can_focus">True</property> 303 <property name="can_focus">True</property>
350 <property name="model">GNUNET_GTK_pseudonym_tree_store</property> 304 <property name="model">GNUNET_GTK_pseudonym_tree_store</property>
351 <property name="hadjustment">adjustment3</property> 305 <property name="hadjustment">adjustment7</property>
352 <property name="vadjustment">adjustment4</property> 306 <property name="vadjustment">adjustment8</property>
307 <property name="headers_clickable">False</property>
353 <property name="reorderable">True</property> 308 <property name="reorderable">True</property>
309 <property name="search_column">0</property>
354 <property name="rubber_banding">True</property> 310 <property name="rubber_banding">True</property>
355 <property name="enable_grid_lines">both</property> 311 <property name="enable_grid_lines">both</property>
356 <child> 312 <child>
357 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_column"> 313 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_column">
358 <property name="resizable">True</property> 314 <property name="resizable">True</property>
359 <property name="title" translatable="yes">Pseudonym</property> 315 <property name="title">Pseudonym</property>
360 <property name="clickable">True</property> 316 <property name="clickable">True</property>
361 <property name="reorderable">True</property> 317 <property name="reorderable">True</property>
362 <property name="sort_indicator">True</property> 318 <property name="sort_indicator">True</property>
@@ -370,14 +326,11 @@
370 </child> 326 </child>
371 <child> 327 <child>
372 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_column"> 328 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_column">
373 <property name="resizable">True</property>
374 <property name="sizing">autosize</property> 329 <property name="sizing">autosize</property>
375 <property name="title" translatable="yes">Current identifier</property> 330 <property name="title">Current identifier</property>
376 <property name="clickable">True</property> 331 <property name="clickable">True</property>
377 <child> 332 <child>
378 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer"> 333 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer"/>
379 <signal name="edited" handler="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb" swapped="no"/>
380 </object>
381 <attributes> 334 <attributes>
382 <attribute name="editable">8</attribute> 335 <attribute name="editable">8</attribute>
383 <attribute name="text">2</attribute> 336 <attribute name="text">2</attribute>
@@ -387,14 +340,11 @@
387 </child> 340 </child>
388 <child> 341 <child>
389 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_column"> 342 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_column">
390 <property name="resizable">True</property>
391 <property name="sizing">autosize</property> 343 <property name="sizing">autosize</property>
392 <property name="fixed_width">5</property> 344 <property name="fixed_width">5</property>
393 <property name="title" translatable="yes">Update identifier</property> 345 <property name="title">Update identifier</property>
394 <child> 346 <child>
395 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer"> 347 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer"/>
396 <signal name="edited" handler="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb" swapped="no"/>
397 </object>
398 <attributes> 348 <attributes>
399 <attribute name="editable">7</attribute> 349 <attribute name="editable">7</attribute>
400 <attribute name="text">5</attribute> 350 <attribute name="text">5</attribute>
@@ -404,7 +354,7 @@
404 </child> 354 </child>
405 <child> 355 <child>
406 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_column"> 356 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_column">
407 <property name="title" translatable="yes">Description (of existing content)</property> 357 <property name="title">Description (of existing content)</property>
408 <child> 358 <child>
409 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_renderer"> 359 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_renderer">
410 <property name="wrap_mode">word</property> 360 <property name="wrap_mode">word</property>
@@ -419,60 +369,59 @@
419 </child> 369 </child>
420 </object> 370 </object>
421 <packing> 371 <packing>
422 <property name="expand">False</property> 372 <property name="expand">True</property>
423 <property name="fill">True</property> 373 <property name="fill">True</property>
424 <property name="position">2</property> 374 <property name="position">2</property>
425 </packing> 375 </packing>
426 </child> 376 </child>
427 <child internal-child="action_area"> 377 <child>
428 <object class="GtkHButtonBox" id="GNUNET_GTK_master_publish_dialog_master_action_area"> 378 <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_master_buttons_hbox">
429 <property name="visible">True</property> 379 <property name="visible">True</property>
430 <property name="layout_style">end</property> 380 <property name="can_focus">False</property>
381 <property name="spacing">2</property>
431 <child> 382 <child>
432 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button"> 383 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button">
433 <property name="label">gtk-cancel</property> 384 <property name="label" translatable="yes">_Execute</property>
385 <property name="use_action_appearance">False</property>
434 <property name="visible">True</property> 386 <property name="visible">True</property>
435 <property name="can_focus">True</property> 387 <property name="can_focus">True</property>
436 <property name="receives_default">True</property> 388 <property name="receives_default">True</property>
437 <property name="use_action_appearance">False</property> 389 <property name="use_underline">True</property>
438 <property name="use_stock">True</property> 390 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb" swapped="no"/>
439 </object> 391 </object>
440 <packing> 392 <packing>
441 <property name="expand">False</property> 393 <property name="expand">False</property>
442 <property name="fill">False</property> 394 <property name="fill">False</property>
395 <property name="pack_type">end</property>
443 <property name="position">0</property> 396 <property name="position">0</property>
444 </packing> 397 </packing>
445 </child> 398 </child>
446 <child> 399 <child>
447 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button"> 400 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button">
448 <property name="label">gtk-execute</property> 401 <property name="label" translatable="yes">_Cancel</property>
402 <property name="use_action_appearance">False</property>
449 <property name="visible">True</property> 403 <property name="visible">True</property>
450 <property name="sensitive">False</property>
451 <property name="can_focus">True</property> 404 <property name="can_focus">True</property>
452 <property name="receives_default">True</property> 405 <property name="receives_default">True</property>
453 <property name="use_action_appearance">False</property> 406 <property name="use_underline">True</property>
454 <property name="use_stock">True</property> 407 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb" swapped="no"/>
455 </object> 408 </object>
456 <packing> 409 <packing>
457 <property name="expand">False</property> 410 <property name="expand">False</property>
458 <property name="fill">False</property> 411 <property name="fill">False</property>
412 <property name="pack_type">end</property>
459 <property name="position">1</property> 413 <property name="position">1</property>
460 </packing> 414 </packing>
461 </child> 415 </child>
462 </object> 416 </object>
463 <packing> 417 <packing>
464 <property name="expand">False</property> 418 <property name="expand">False</property>
465 <property name="fill">True</property> 419 <property name="fill">False</property>
466 <property name="pack_type">end</property>
467 <property name="position">3</property> 420 <property name="position">3</property>
468 </packing> 421 </packing>
469 </child> 422 </child>
470 </object> 423 </object>
471 </child> 424 </child>
472 <action-widgets>
473 <action-widget response="-6">GNUNET_GTK_master_publish_dialog_cancel_button</action-widget>
474 <action-widget response="-5">GNUNET_GTK_master_publish_dialog_execute_button</action-widget>
475 </action-widgets>
476 </object> 425 </object>
477 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store"> 426 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store">
478 <columns> 427 <columns>
@@ -496,4 +445,35 @@
496 <column type="gboolean"/> 445 <column type="gboolean"/>
497 </columns> 446 </columns>
498 </object> 447 </object>
448 <object class="GtkAdjustment" id="adjustment5">
449 <property name="upper">100</property>
450 <property name="step_increment">1</property>
451 <property name="page_increment">10</property>
452 </object>
453 <object class="GtkAdjustment" id="adjustment6">
454 <property name="upper">100</property>
455 <property name="step_increment">1</property>
456 <property name="page_increment">10</property>
457 </object>
458 <object class="GtkImage" id="left_stock_image">
459 <property name="visible">True</property>
460 <property name="can_focus">False</property>
461 <property name="stock">gtk-go-back</property>
462 </object>
463 <object class="GtkImage" id="new_stock_image">
464 <property name="visible">True</property>
465 <property name="can_focus">False</property>
466 <property name="stock">gtk-new</property>
467 </object>
468 <object class="GtkImage" id="right_stock_image">
469 <property name="visible">True</property>
470 <property name="can_focus">False</property>
471 <property name="stock">gtk-go-forward</property>
472 </object>
473 <object class="GtkSizeGroup" id="sizegroup1">
474 <widgets>
475 <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/>
476 <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/>
477 </widgets>
478 </object>
499</interface> 479</interface>
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
index 34e8481e..18be9531 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -30,6 +30,38 @@
30 30
31#define MARKER_DIR_FILE_SIZE "-" 31#define MARKER_DIR_FILE_SIZE "-"
32 32
33struct MainPublishingDialogContext
34{
35 GtkBuilder *builder;
36 GtkBuilder *main_window_builder;
37 GtkTreeView *pseudonym_treeview;
38 GtkTreeSelection *pseudonym_selection;
39 GtkTreeModel *pseudonym_treemodel;
40 GtkWidget *up_button;
41 GtkWidget *down_button;
42 GtkWidget *left_button;
43 GtkWidget *right_button;
44 GtkWidget *delete_button;
45 GtkWidget *edit_button;
46 GtkWidget *execute_button;
47 GtkTreeView *file_info_treeview;
48 GtkTreeSelection *file_info_selection;
49 GtkTreeModel *file_info_treemodel;
50 GtkWindow *master_pubdialog;
51
52 gulong open_directory_handler_id;
53 gulong open_file_handler_id;
54};
55
56void
57GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog,
58 gint response_id,
59 struct MainPublishingDialogContext *ctx);
60
61static void
62selection_changed_cb (GtkTreeSelection * ts, struct MainPublishingDialogContext *ctx);
63
64
33/** 65/**
34 * Check if two GtkTreeIters refer to the same element. 66 * Check if two GtkTreeIters refer to the same element.
35 * 67 *
@@ -53,136 +85,129 @@ gtk_tree_iter_equals (GtkTreeModel * tm, GtkTreeIter * i1, GtkTreeIter * i2)
53 return (0 == ret) ? GNUNET_YES : GNUNET_NO; 85 return (0 == ret) ? GNUNET_YES : GNUNET_NO;
54} 86}
55 87
88static void
89init_ctx (struct MainPublishingDialogContext *ctx)
90{
91 ctx->pseudonym_treeview = GTK_TREE_VIEW (gtk_builder_get_object
92 (ctx->builder, "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
93
94 ctx->up_button = GTK_WIDGET (gtk_builder_get_object
95 (ctx->builder, "GNUNET_GTK_master_publish_dialog_up_button"));
96 ctx->down_button = GTK_WIDGET (gtk_builder_get_object
97 (ctx->builder, "GNUNET_GTK_master_publish_dialog_down_button"));
98 ctx->left_button = GTK_WIDGET (gtk_builder_get_object
99 (ctx->builder, "GNUNET_GTK_master_publish_dialog_left_button"));
100 ctx->right_button = GTK_WIDGET (gtk_builder_get_object
101 (ctx->builder, "GNUNET_GTK_master_publish_dialog_right_button"));
102 ctx->delete_button = GTK_WIDGET (gtk_builder_get_object
103 (ctx->builder, "GNUNET_GTK_master_publish_dialog_delete_button"));
104 ctx->edit_button = GTK_WIDGET (gtk_builder_get_object
105 (ctx->builder, "GNUNET_GTK_master_publish_dialog_edit_button"));
106 ctx->execute_button = GTK_WIDGET (gtk_builder_get_object
107 (ctx->builder, "GNUNET_GTK_master_publish_dialog_execute_button"));
108 ctx->file_info_treeview = GTK_TREE_VIEW (gtk_builder_get_object
109 (ctx->builder, "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
110
111 ctx->master_pubdialog =
112 GTK_WINDOW (gtk_builder_get_object
113 (ctx->builder, "GNUNET_GTK_master_publish_dialog"));
114
115 ctx->file_info_selection = gtk_tree_view_get_selection (ctx->file_info_treeview);
116 ctx->file_info_treemodel = gtk_tree_view_get_model (ctx->file_info_treeview);
117 ctx->pseudonym_selection = gtk_tree_view_get_selection (ctx->pseudonym_treeview);
118 ctx->pseudonym_treemodel = gtk_tree_view_get_model (ctx->pseudonym_treeview);
119
120 g_signal_connect (G_OBJECT (ctx->file_info_selection), "changed",
121 G_CALLBACK (selection_changed_cb), ctx);
122 g_signal_connect (G_OBJECT (ctx->pseudonym_selection), "changed",
123 G_CALLBACK (selection_changed_cb), ctx);
124}
56 125
57/** 126/**
58 * Update selectivity in the master dialog. 127 * Update selectivity in the master dialog.
59 */ 128 */
60static void 129static void
61update_selectivity (gpointer data) 130update_selectivity (struct MainPublishingDialogContext *ctx)
62{ 131{
63 GtkTreeView *tv;
64 GtkTreeModel *tm;
65 GtkTreeModel *ptm;
66 GtkTreeSelection *sel;
67 GtkTreeIter iter; 132 GtkTreeIter iter;
68 GtkTreeIter parent; 133 GtkTreeIter parent;
69 GtkTreeIter pred; 134 GtkTreeIter pred;
70 GtkWidget *up_button;
71 GtkWidget *down_button;
72 GtkWidget *left_button;
73 GtkWidget *right_button;
74 GtkWidget *delete_button;
75 GtkWidget *edit_button;
76 GtkWidget *execute_button;
77 int is_dir; 135 int is_dir;
78 struct GNUNET_FS_FileInformation *fip; 136 struct GNUNET_FS_FileInformation *fip;
79 int ns_ok; 137 int ns_ok;
80 gchar *namespace_id; 138 gchar *namespace_id;
81 GtkBuilder *builder;
82
83 builder = GTK_BUILDER (data);
84 139
85 tv = GTK_TREE_VIEW (gtk_builder_get_object
86 (builder,
87 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
88 sel = gtk_tree_view_get_selection (tv);
89 ns_ok = GNUNET_YES; 140 ns_ok = GNUNET_YES;
90 if (TRUE == gtk_tree_selection_get_selected (sel, &ptm, &iter)) 141 if (TRUE == gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter))
91 { 142 {
92 gtk_tree_model_get (ptm, &iter, 2, &namespace_id, -1); 143 gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 2, &namespace_id, -1);
93 if (namespace_id == NULL) 144 if (namespace_id == NULL)
94 ns_ok = GNUNET_NO; 145 ns_ok = GNUNET_NO;
95 else 146 else
96 g_free (namespace_id); 147 g_free (namespace_id);
97 } 148 }
98 up_button = 149 if ((gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) && (ns_ok == GNUNET_YES))
99 GTK_WIDGET (gtk_builder_get_object 150 gtk_widget_set_sensitive (ctx->execute_button, TRUE);
100 (builder, "GNUNET_GTK_master_publish_dialog_up_button"));
101 down_button =
102 GTK_WIDGET (gtk_builder_get_object
103 (builder, "GNUNET_GTK_master_publish_dialog_down_button"));
104 left_button =
105 GTK_WIDGET (gtk_builder_get_object
106 (builder, "GNUNET_GTK_master_publish_dialog_left_button"));
107 right_button =
108 GTK_WIDGET (gtk_builder_get_object
109 (builder, "GNUNET_GTK_master_publish_dialog_right_button"));
110 delete_button =
111 GTK_WIDGET (gtk_builder_get_object
112 (builder, "GNUNET_GTK_master_publish_dialog_delete_button"));
113 edit_button =
114 GTK_WIDGET (gtk_builder_get_object
115 (builder, "GNUNET_GTK_master_publish_dialog_edit_button"));
116 execute_button =
117 GTK_WIDGET (gtk_builder_get_object
118 (builder, "GNUNET_GTK_master_publish_dialog_execute_button"));
119 tv = GTK_TREE_VIEW (gtk_builder_get_object
120 (builder,
121 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
122 sel = gtk_tree_view_get_selection (tv);
123 tm = gtk_tree_view_get_model (tv);
124 if ((gtk_tree_model_get_iter_first (tm, &iter)) && (ns_ok == GNUNET_YES))
125 gtk_widget_set_sensitive (execute_button, TRUE);
126 else 151 else
127 gtk_widget_set_sensitive (execute_button, FALSE); 152 gtk_widget_set_sensitive (ctx->execute_button, FALSE);
128 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 153 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
129 { 154 {
130 gtk_widget_set_sensitive (up_button, FALSE); 155 gtk_widget_set_sensitive (ctx->up_button, FALSE);
131 gtk_widget_set_sensitive (down_button, FALSE); 156 gtk_widget_set_sensitive (ctx->down_button, FALSE);
132 gtk_widget_set_sensitive (left_button, FALSE); 157 gtk_widget_set_sensitive (ctx->left_button, FALSE);
133 gtk_widget_set_sensitive (right_button, FALSE); 158 gtk_widget_set_sensitive (ctx->right_button, FALSE);
134 gtk_widget_set_sensitive (delete_button, FALSE); 159 gtk_widget_set_sensitive (ctx->delete_button, FALSE);
135 gtk_widget_set_sensitive (edit_button, FALSE); 160 gtk_widget_set_sensitive (ctx->edit_button, FALSE);
136 return; 161 return;
137 } 162 }
138 gtk_widget_set_sensitive (delete_button, TRUE); 163 gtk_widget_set_sensitive (ctx->delete_button, TRUE);
139 gtk_widget_set_sensitive (edit_button, TRUE); 164 gtk_widget_set_sensitive (ctx->edit_button, TRUE);
140 165
141 /* now figure out which move operations are currently legal */ 166 /* now figure out which move operations are currently legal */
142 GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, NULL, &iter)); 167 GNUNET_assert (TRUE == gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
143 if (TRUE == gtk_tree_model_iter_next (tm, &iter)) 168 if (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter))
144 { 169 {
145 gtk_widget_set_sensitive (down_button, TRUE); 170 gtk_widget_set_sensitive (ctx->down_button, TRUE);
146 } 171 }
147 else 172 else
148 { 173 {
149 gtk_widget_set_sensitive (down_button, FALSE); 174 gtk_widget_set_sensitive (ctx->down_button, FALSE);
150 } 175 }
151 GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, NULL, &iter)); 176 GNUNET_assert (TRUE == gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
152 if (TRUE == gtk_tree_model_iter_parent (tm, &parent, &iter)) 177 if (TRUE == gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
153 { 178 {
154 gtk_widget_set_sensitive (left_button, TRUE); 179 gtk_widget_set_sensitive (ctx->left_button, TRUE);
155 GNUNET_assert (TRUE == gtk_tree_model_iter_children (tm, &pred, &parent)); 180 GNUNET_assert (TRUE == gtk_tree_model_iter_children (ctx->file_info_treemodel, &pred, &parent));
156 } 181 }
157 else 182 else
158 { 183 {
159 gtk_widget_set_sensitive (left_button, FALSE); 184 gtk_widget_set_sensitive (ctx->left_button, FALSE);
160 GNUNET_assert (TRUE == gtk_tree_model_get_iter_first (tm, &pred)); 185 GNUNET_assert (TRUE == gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &pred));
161 } 186 }
162 /* iterate over 'next' of pred to find out if our 187 /* iterate over 'next' of pred to find out if our
163 * predecessor is a directory! */ 188 * predecessor is a directory! */
164 is_dir = GNUNET_SYSERR; 189 is_dir = GNUNET_SYSERR;
165 while (GNUNET_YES != gtk_tree_iter_equals (tm, &pred, &iter)) 190 while (GNUNET_YES != gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
166 { 191 {
167 gtk_tree_model_get (tm, &pred, 5, &fip, -1); 192 gtk_tree_model_get (ctx->file_info_treemodel, &pred, 5, &fip, -1);
168 is_dir = GNUNET_FS_file_information_is_directory (fip); 193 is_dir = GNUNET_FS_file_information_is_directory (fip);
169 GNUNET_assert (TRUE == gtk_tree_model_iter_next (tm, &pred)); 194 GNUNET_assert (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
170 } 195 }
171 if (GNUNET_YES == is_dir) 196 if (GNUNET_YES == is_dir)
172 { 197 {
173 gtk_widget_set_sensitive (right_button, TRUE); 198 gtk_widget_set_sensitive (ctx->right_button, TRUE);
174 } 199 }
175 else 200 else
176 { 201 {
177 gtk_widget_set_sensitive (right_button, FALSE); 202 gtk_widget_set_sensitive (ctx->right_button, FALSE);
178 } 203 }
179 if (GNUNET_SYSERR != is_dir) 204 if (GNUNET_SYSERR != is_dir)
180 { 205 {
181 gtk_widget_set_sensitive (up_button, TRUE); 206 gtk_widget_set_sensitive (ctx->up_button, TRUE);
182 } 207 }
183 else 208 else
184 { 209 {
185 gtk_widget_set_sensitive (up_button, FALSE); 210 gtk_widget_set_sensitive (ctx->up_button, FALSE);
186 } 211 }
187} 212}
188 213
@@ -196,7 +221,7 @@ update_selectivity (gpointer data)
196 * @param iter parent entry, or NULL for top-level addition 221 * @param iter parent entry, or NULL for top-level addition
197 */ 222 */
198static void 223static void
199add_file_at_iter (gpointer data, const char *filename, 224add_file_at_iter (struct MainPublishingDialogContext *ctx, const char *filename,
200 const struct GNUNET_FS_BlockOptions *bo, int do_index, 225 const struct GNUNET_FS_BlockOptions *bo, int do_index,
201 GtkTreeIter * iter) 226 GtkTreeIter * iter)
202{ 227{
@@ -207,14 +232,10 @@ add_file_at_iter (gpointer data, const char *filename,
207 const char *short_fn; 232 const char *short_fn;
208 struct GNUNET_CONTAINER_MetaData *meta; 233 struct GNUNET_CONTAINER_MetaData *meta;
209 struct GNUNET_FS_Uri *ksk_uri; 234 struct GNUNET_FS_Uri *ksk_uri;
210 GtkTreeStore *ts;
211 GtkTreeIter pos; 235 GtkTreeIter pos;
212 char *file_size_fancy; 236 char *file_size_fancy;
213 const char *ss; 237 const char *ss;
214 struct stat sbuf; 238 struct stat sbuf;
215 GtkBuilder *builder;
216
217 builder = GTK_BUILDER (data);
218 239
219 if (0 != STAT (filename, &sbuf)) 240 if (0 != STAT (filename, &sbuf))
220 return; 241 return;
@@ -230,9 +251,6 @@ add_file_at_iter (gpointer data, const char *filename,
230 return; 251 return;
231 } 252 }
232 } 253 }
233 ts = GTK_TREE_STORE (gtk_builder_get_object
234 (builder,
235 "GNUNET_GTK_file_sharing_publishing_tree_store"));
236 254
237 meta = GNUNET_CONTAINER_meta_data_create (); 255 meta = GNUNET_CONTAINER_meta_data_create ();
238 GNUNET_FS_meta_data_extract_from_file (meta, filename, 256 GNUNET_FS_meta_data_extract_from_file (meta, filename,
@@ -247,9 +265,9 @@ add_file_at_iter (gpointer data, const char *filename,
247 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 265 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
248 short_fn, strlen (short_fn) + 1); 266 short_fn, strlen (short_fn) + 1);
249 ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (meta); 267 ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (meta);
250 gtk_tree_store_insert_before (ts, &pos, iter, NULL); 268 gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, iter, NULL);
251 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &pos); 269 path = gtk_tree_model_get_path (ctx->file_info_treemodel, &pos);
252 row_reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path); 270 row_reference = gtk_tree_row_reference_new (ctx->file_info_treemodel, path);
253 gtk_tree_path_free (path); 271 gtk_tree_path_free (path);
254 fi = GNUNET_FS_file_information_create_from_file (GNUNET_FS_GTK_get_fs_handle 272 fi = GNUNET_FS_file_information_create_from_file (GNUNET_FS_GTK_get_fs_handle
255 (), row_reference, filename, 273 (), row_reference, filename,
@@ -261,14 +279,14 @@ add_file_at_iter (gpointer data, const char *filename,
261 file_size_fancy = GNUNET_strdup (MARKER_DIR_FILE_SIZE); 279 file_size_fancy = GNUNET_strdup (MARKER_DIR_FILE_SIZE);
262 else 280 else
263 file_size_fancy = GNUNET_STRINGS_byte_size_fancy (file_size); 281 file_size_fancy = GNUNET_STRINGS_byte_size_fancy (file_size);
264 gtk_tree_store_set (ts, &pos, 0, file_size_fancy, 1, (gboolean) do_index, 2, 282 gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, 0, file_size_fancy, 1, (gboolean) do_index, 2,
265 short_fn, 3, (guint) bo->anonymity_level, 4, 283 short_fn, 3, (guint) bo->anonymity_level, 4,
266 (guint) bo->content_priority, 5, fi, 284 (guint) bo->content_priority, 5, fi,
267 6, (guint64) bo->expiration_time.abs_value, 285 6, (guint64) bo->expiration_time.abs_value,
268 7, (guint) bo->replication_level, 286 7, (guint) bo->replication_level,
269 -1); 287 -1);
270 GNUNET_free (file_size_fancy); 288 GNUNET_free (file_size_fancy);
271 update_selectivity (data); 289 update_selectivity (ctx);
272} 290}
273 291
274 292
@@ -281,7 +299,7 @@ add_file_at_iter (gpointer data, const char *filename,
281 * @param pos iterator to set to the location of the new element 299 * @param pos iterator to set to the location of the new element
282 */ 300 */
283static void 301static void
284create_dir_at_iter (gpointer data, const char *name, 302create_dir_at_iter (struct MainPublishingDialogContext *ctx, const char *name,
285 const struct GNUNET_FS_BlockOptions *bo, GtkTreeIter * iter, 303 const struct GNUNET_FS_BlockOptions *bo, GtkTreeIter * iter,
286 GtkTreeIter * pos) 304 GtkTreeIter * pos)
287{ 305{
@@ -289,35 +307,27 @@ create_dir_at_iter (gpointer data, const char *name,
289 GtkTreeRowReference *row_reference; 307 GtkTreeRowReference *row_reference;
290 GtkTreePath *path; 308 GtkTreePath *path;
291 struct GNUNET_CONTAINER_MetaData *meta; 309 struct GNUNET_CONTAINER_MetaData *meta;
292 GtkTreeStore *ts;
293 GtkBuilder *builder;
294
295 310
296 builder = GTK_BUILDER (data);
297
298 ts = GTK_TREE_STORE (gtk_builder_get_object
299 (builder,
300 "GNUNET_GTK_file_sharing_publishing_tree_store"));
301 meta = GNUNET_CONTAINER_meta_data_create (); 311 meta = GNUNET_CONTAINER_meta_data_create ();
302 GNUNET_FS_meta_data_make_directory (meta); 312 GNUNET_FS_meta_data_make_directory (meta);
303 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet-gtk>", 313 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet-gtk>",
304 EXTRACTOR_METATYPE_FILENAME, 314 EXTRACTOR_METATYPE_FILENAME,
305 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 315 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
306 name, strlen (name) + 1); 316 name, strlen (name) + 1);
307 gtk_tree_store_insert_before (ts, pos, iter, NULL); 317 gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel), pos, iter, NULL);
308 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), pos); 318 path = gtk_tree_model_get_path (ctx->file_info_treemodel, pos);
309 row_reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path); 319 row_reference = gtk_tree_row_reference_new (ctx->file_info_treemodel, path);
310 gtk_tree_path_free (path); 320 gtk_tree_path_free (path);
311 fi = GNUNET_FS_file_information_create_empty_directory 321 fi = GNUNET_FS_file_information_create_empty_directory
312 (GNUNET_FS_GTK_get_fs_handle (), row_reference, NULL, meta, bo); 322 (GNUNET_FS_GTK_get_fs_handle (), row_reference, NULL, meta, bo);
313 GNUNET_CONTAINER_meta_data_destroy (meta); 323 GNUNET_CONTAINER_meta_data_destroy (meta);
314 gtk_tree_store_set (ts, pos, 0, MARKER_DIR_FILE_SIZE, 1, (gboolean) GNUNET_NO, 324 gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel), pos, 0, MARKER_DIR_FILE_SIZE, 1, (gboolean) GNUNET_NO,
315 2, name, 3, (guint) bo->anonymity_level, 4, 325 2, name, 3, (guint) bo->anonymity_level, 4,
316 (guint) bo->content_priority, 5, fi, 326 (guint) bo->content_priority, 5, fi,
317 6, (guint64) bo->expiration_time.abs_value, 327 6, (guint64) bo->expiration_time.abs_value,
318 7, (guint) bo->replication_level, 328 7, (guint) bo->replication_level,
319 -1); 329 -1);
320 update_selectivity (data); 330 update_selectivity (ctx);
321} 331}
322 332
323 333
@@ -379,9 +389,9 @@ struct AddDirContext
379 GtkTreeIter *parent; 389 GtkTreeIter *parent;
380 390
381 /** 391 /**
382 * Tree store to manipulate. 392 * Master publication dialog context (used to access treestore)
383 */ 393 */
384 GtkTreeStore *ts; 394 struct MainPublishingDialogContext *ctx;
385 395
386 /** 396 /**
387 * Map from the hash over the keyword to an 'struct KeywordCounter' 397 * Map from the hash over the keyword to an 'struct KeywordCounter'
@@ -486,7 +496,7 @@ extract_file (struct AddDirContext *adc, const char *filename)
486 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 496 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
487 short_fn, strlen (short_fn) + 1); 497 short_fn, strlen (short_fn) + 1);
488 498
489 gtk_tree_store_insert_before (adc->ts, &pd->iter, adc->parent, NULL); 499 gtk_tree_store_insert_before (GTK_TREE_STORE (adc->ctx->file_info_treemodel), &pd->iter, adc->parent, NULL);
490 500
491 GNUNET_CRYPTO_hash (filename, strlen (filename), &hc); 501 GNUNET_CRYPTO_hash (filename, strlen (filename), &hc);
492 GNUNET_CONTAINER_multihashmap_put (adc->metamap, &hc, pd, 502 GNUNET_CONTAINER_multihashmap_put (adc->metamap, &hc, pd,
@@ -616,7 +626,7 @@ publish_entry (void *cls, const char *filename)
616 626
617 GNUNET_CRYPTO_hash (filename, strlen (filename), &hc); 627 GNUNET_CRYPTO_hash (filename, strlen (filename), &hc);
618 pd = GNUNET_CONTAINER_multihashmap_get (adc->metamap, &hc); 628 pd = GNUNET_CONTAINER_multihashmap_get (adc->metamap, &hc);
619 add_entry_to_ts (adc->ts, &pd->iter, filename, &adc->bo, adc->do_index, 629 add_entry_to_ts (GTK_TREE_STORE (adc->ctx->file_info_treemodel), &pd->iter, filename, &adc->bo, adc->do_index,
620 pd->ksk_uri, adc->exclude_ksk, pd->meta); 630 pd->ksk_uri, adc->exclude_ksk, pd->meta);
621 GNUNET_CONTAINER_multihashmap_remove (adc->metamap, &hc, pd); 631 GNUNET_CONTAINER_multihashmap_remove (adc->metamap, &hc, pd);
622 GNUNET_free (pd); 632 GNUNET_free (pd);
@@ -726,7 +736,7 @@ scan_directory (void *cls, const char *filename)
726 adc->keywordcounter = GNUNET_CONTAINER_multihashmap_create (1024); 736 adc->keywordcounter = GNUNET_CONTAINER_multihashmap_create (1024);
727 adc->dir_entry_count = 0; 737 adc->dir_entry_count = 0;
728 pd = GNUNET_malloc (sizeof (struct PublishData)); 738 pd = GNUNET_malloc (sizeof (struct PublishData));
729 gtk_tree_store_insert_before (adc->ts, &pd->iter, parent, NULL); 739 gtk_tree_store_insert_before (GTK_TREE_STORE (adc->ctx->file_info_treemodel), &pd->iter, parent, NULL);
730 adc->parent = &pd->iter; 740 adc->parent = &pd->iter;
731 GNUNET_DISK_directory_scan (filename, &scan_directory, adc); 741 GNUNET_DISK_directory_scan (filename, &scan_directory, adc);
732 pd->ksk_uri = process_keywords (adc); 742 pd->ksk_uri = process_keywords (adc);
@@ -771,7 +781,7 @@ scan_directory (void *cls, const char *filename)
771 else 781 else
772 { 782 {
773 GNUNET_assert (kcm == NULL); 783 GNUNET_assert (kcm == NULL);
774 add_entry_to_ts (adc->ts, &pd->iter, filename, &adc->bo, adc->do_index, 784 add_entry_to_ts (GTK_TREE_STORE (adc->ctx->file_info_treemodel), &pd->iter, filename, &adc->bo, adc->do_index,
775 pd->ksk_uri, NULL, pd->meta); 785 pd->ksk_uri, NULL, pd->meta);
776 } 786 }
777 GNUNET_FS_uri_destroy (adc->exclude_ksk); 787 GNUNET_FS_uri_destroy (adc->exclude_ksk);
@@ -785,6 +795,12 @@ scan_directory (void *cls, const char *filename)
785} 795}
786 796
787 797
798static void
799add_dir_finish (struct AddDirContext *scan_ctx)
800{
801 GNUNET_free (scan_ctx);
802}
803
788/** 804/**
789 * Add a directory to the tree model. 805 * Add a directory to the tree model.
790 * 806 *
@@ -793,14 +809,11 @@ scan_directory (void *cls, const char *filename)
793 * @param do_index should we index? 809 * @param do_index should we index?
794 */ 810 */
795static void 811static void
796add_dir (gpointer data, const char *filename, 812add_dir (struct MainPublishingDialogContext *ctx, const char *filename,
797 const struct GNUNET_FS_BlockOptions *bo, int do_index) 813 const struct GNUNET_FS_BlockOptions *bo, int do_index)
798{ 814{
799 struct stat sbuf; 815 struct stat sbuf;
800 struct AddDirContext scan_ctx; 816 struct AddDirContext *scan_ctx;
801 GtkBuilder *builder;
802
803 builder = GTK_BUILDER (data);
804 817
805 if (0 != STAT (filename, &sbuf)) 818 if (0 != STAT (filename, &sbuf))
806 return; 819 return;
@@ -809,14 +822,12 @@ add_dir (gpointer data, const char *filename,
809 GNUNET_break (0); 822 GNUNET_break (0);
810 return; 823 return;
811 } 824 }
812 memset (&scan_ctx, 0, sizeof (scan_ctx)); 825 scan_ctx = GNUNET_malloc (sizeof (struct AddDirContext));
813 scan_ctx.bo = *bo; 826 scan_ctx->bo = *bo;
814 scan_ctx.do_index = do_index; 827 scan_ctx->do_index = do_index;
815 scan_ctx.ts = 828 scan_ctx->ctx = ctx;
816 GTK_TREE_STORE (gtk_builder_get_object 829 scan_directory (scan_ctx, filename);
817 (builder, 830 add_dir_finish (scan_ctx);
818 "GNUNET_GTK_file_sharing_publishing_tree_store"));
819 scan_directory (&scan_ctx, filename);
820} 831}
821 832
822 833
@@ -824,9 +835,9 @@ add_dir (gpointer data, const char *filename,
824 835
825 836
826static void 837static void
827selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) 838selection_changed_cb (GtkTreeSelection * ts, struct MainPublishingDialogContext *ctx)
828{ 839{
829 update_selectivity (user_data); 840 update_selectivity (ctx);
830} 841}
831 842
832 843
@@ -846,11 +857,10 @@ remove_old_entry (GtkTreeStore * ts, GtkTreeIter * root)
846 * Move an entry in the tree. 857 * Move an entry in the tree.
847 */ 858 */
848static void 859static void
849move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old, 860move_entry (struct MainPublishingDialogContext *ctx, GtkTreeModel * tm, GtkTreeIter * old,
850 GtkTreeIter * newpos, int dsel) 861 GtkTreeIter * newpos, int dsel)
851{ 862{
852 struct GNUNET_FS_FileInformation *fip; 863 struct GNUNET_FS_FileInformation *fip;
853 GtkTreeView *tv;
854 gint do_index; 864 gint do_index;
855 gchar *short_fn; 865 gchar *short_fn;
856 guint anonymity_level; 866 guint anonymity_level;
@@ -859,14 +869,11 @@ move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old,
859 guint64 expiration_time_abs; 869 guint64 expiration_time_abs;
860 char *fsf; 870 char *fsf;
861 GtkTreePath *path; 871 GtkTreePath *path;
862 GtkTreeSelection *sel;
863 GtkTreeIter child; 872 GtkTreeIter child;
864 GtkTreeIter cnewpos; 873 GtkTreeIter cnewpos;
865 GtkTreeRowReference *rr; 874 GtkTreeRowReference *rr;
866 GtkTreeRowReference *rr2; 875 GtkTreeRowReference *rr2;
867 GtkBuilder *builder;
868 876
869 builder = GTK_BUILDER (data);
870 gtk_tree_model_get (tm, old, 0, &fsf, 1, &do_index, 2, &short_fn, 3, 877 gtk_tree_model_get (tm, old, 0, &fsf, 1, &do_index, 2, &short_fn, 3,
871 &anonymity_level, 4, &priority, 5, &fip, 878 &anonymity_level, 4, &priority, 5, &fip,
872 6, &expiration_time_abs, 7, &replication_level, -1); 879 6, &expiration_time_abs, 7, &replication_level, -1);
@@ -875,14 +882,8 @@ move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old,
875 5, fip, 882 5, fip,
876 6, expiration_time_abs, 883 6, expiration_time_abs,
877 7, replication_level, -1); 884 7, replication_level, -1);
878 sel = NULL;
879 tv = NULL;
880 if (dsel == GNUNET_YES) 885 if (dsel == GNUNET_YES)
881 { 886 {
882 tv = GTK_TREE_VIEW (gtk_builder_get_object
883 (builder,
884 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
885 sel = gtk_tree_view_get_selection (tv);
886 path = gtk_tree_model_get_path (tm, newpos); 887 path = gtk_tree_model_get_path (tm, newpos);
887 rr = gtk_tree_row_reference_new (tm, path); 888 rr = gtk_tree_row_reference_new (tm, path);
888 gtk_tree_path_free (path); 889 gtk_tree_path_free (path);
@@ -900,7 +901,7 @@ move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old,
900 gtk_tree_path_free (path); 901 gtk_tree_path_free (path);
901 gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &cnewpos, newpos, 902 gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &cnewpos, newpos,
902 NULL); 903 NULL);
903 move_entry (data, tm, &child, &cnewpos, GNUNET_NO); 904 move_entry (ctx, tm, &child, &cnewpos, GNUNET_NO);
904 path = gtk_tree_row_reference_get_path (rr2); 905 path = gtk_tree_row_reference_get_path (rr2);
905 gtk_tree_row_reference_free (rr2); 906 gtk_tree_row_reference_free (rr2);
906 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &child, path)); 907 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &child, path));
@@ -914,12 +915,12 @@ move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old,
914 { 915 {
915 path = gtk_tree_row_reference_get_path (rr); 916 path = gtk_tree_row_reference_get_path (rr);
916 gtk_tree_row_reference_free (rr); 917 gtk_tree_row_reference_free (rr);
917 gtk_tree_view_expand_to_path (tv, path); 918 gtk_tree_view_expand_to_path (ctx->file_info_treeview, path);
918 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, newpos, path)); 919 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, newpos, path));
919 gtk_tree_path_free (path); 920 gtk_tree_path_free (path);
920 gtk_tree_selection_select_iter (sel, newpos); 921 gtk_tree_selection_select_iter (ctx->file_info_selection, newpos);
921 } 922 }
922 update_selectivity (data); 923 update_selectivity (ctx);
923} 924}
924 925
925 926
@@ -929,24 +930,18 @@ move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old,
929 */ 930 */
930void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb 931void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb
931 (GtkCellRendererText * renderer, gchar * cpath, gchar * new_text, 932 (GtkCellRendererText * renderer, gchar * cpath, gchar * new_text,
932 gpointer user_data) 933 struct MainPublishingDialogContext *ctx)
933{ 934{
934 GtkTreeIter iter; 935 GtkTreeIter iter;
935 GtkTreeStore *ts;
936 GtkBuilder *builder;
937
938 builder = GTK_BUILDER (user_data);
939 ts = GTK_TREE_STORE (gtk_builder_get_object
940 (builder, "GNUNET_GTK_pseudonym_tree_store"));
941 936
942 if (TRUE != 937 if (TRUE !=
943 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath)) 938 gtk_tree_model_get_iter_from_string (ctx->pseudonym_treemodel, &iter, cpath))
944 { 939 {
945 GNUNET_break (0); 940 GNUNET_break (0);
946 return; 941 return;
947 } 942 }
948 gtk_tree_store_set (ts, &iter, 5, new_text, -1); 943 gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, 5, new_text, -1);
949 update_selectivity (user_data); 944 update_selectivity (ctx);
950} 945}
951 946
952 947
@@ -956,150 +951,115 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb
956 */ 951 */
957void GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb 952void GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb
958 (GtkCellRendererText * renderer, gchar * cpath, gchar * new_text, 953 (GtkCellRendererText * renderer, gchar * cpath, gchar * new_text,
959 gpointer user_data) 954 struct MainPublishingDialogContext *ctx)
960{ 955{
961 GtkTreeIter iter; 956 GtkTreeIter iter;
962 GtkTreeStore *ts;
963 GtkBuilder *builder;
964
965 builder = GTK_BUILDER (user_data);
966 ts = GTK_TREE_STORE (gtk_builder_get_object
967 (builder, "GNUNET_GTK_pseudonym_tree_store"));
968 957
969 if (TRUE != 958 if (TRUE !=
970 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath)) 959 gtk_tree_model_get_iter_from_string (ctx->pseudonym_treemodel, &iter, cpath))
971 { 960 {
972 GNUNET_break (0); 961 GNUNET_break (0);
973 return; 962 return;
974 } 963 }
975 gtk_tree_store_set (ts, &iter, 2, new_text, -1); 964 gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, 2, new_text, -1);
976 update_selectivity (user_data); 965 update_selectivity (ctx);
977} 966}
978 967
979 968
980void 969void
981GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget * dummy, 970GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget * dummy,
982 gpointer data) 971 struct MainPublishingDialogContext *ctx)
983{ 972{
984 GtkTreeView *tv;
985 GtkTreeModel *tm;
986 GtkTreeSelection *sel;
987 GtkTreeIter iter; 973 GtkTreeIter iter;
988 GtkTreeIter parent; 974 GtkTreeIter parent;
989 GtkTreeIter pred; 975 GtkTreeIter pred;
990 GtkTreeIter prev; 976 GtkTreeIter prev;
991 GtkTreeIter pos; 977 GtkTreeIter pos;
992 GtkBuilder *builder;
993 978
994 builder = GTK_BUILDER (data); 979 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
995
996 tv = GTK_TREE_VIEW (gtk_builder_get_object
997 (builder,
998 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
999 sel = gtk_tree_view_get_selection (tv);
1000 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
1001 { 980 {
1002 GNUNET_break (0); 981 GNUNET_break (0);
1003 return; 982 return;
1004 } 983 }
1005 if (TRUE == gtk_tree_model_iter_parent (tm, &parent, &iter)) 984 if (TRUE == gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
1006 { 985 {
1007 GNUNET_assert (TRUE == gtk_tree_model_iter_children (tm, &pred, &parent)); 986 GNUNET_assert (TRUE == gtk_tree_model_iter_children (ctx->file_info_treemodel, &pred, &parent));
1008 } 987 }
1009 else if (TRUE != gtk_tree_model_get_iter_first (tm, &pred)) 988 else if (TRUE != gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &pred))
1010 { 989 {
1011 GNUNET_break (0); 990 GNUNET_break (0);
1012 return; 991 return;
1013 } 992 }
1014 /* iterate over 'next' of pred to find out who our predecessor is! */ 993 /* iterate over 'next' of pred to find out who our predecessor is! */
1015 memset (&prev, 0, sizeof (GtkTreeIter)); 994 memset (&prev, 0, sizeof (GtkTreeIter));
1016 while (GNUNET_YES != gtk_tree_iter_equals (tm, &pred, &iter)) 995 while (GNUNET_YES != gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
1017 { 996 {
1018 prev = pred; 997 prev = pred;
1019 GNUNET_assert (TRUE == gtk_tree_model_iter_next (tm, &pred)); 998 GNUNET_assert (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
1020 } 999 }
1021 gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &pos, &prev, NULL); 1000 gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, &prev, NULL);
1022 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1001 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1023 { 1002 {
1024 GNUNET_break (0); 1003 GNUNET_break (0);
1025 return; 1004 return;
1026 } 1005 }
1027 move_entry (data, tm, &iter, &pos, GNUNET_YES); 1006 move_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
1028 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1007 remove_old_entry (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
1029} 1008}
1030 1009
1031 1010
1032void 1011void
1033GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget * dummy, 1012GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget * dummy,
1034 gpointer data) 1013 struct MainPublishingDialogContext *ctx)
1035{ 1014{
1036 GtkTreeView *tv;
1037 GtkTreeModel *tm;
1038 GtkTreeSelection *sel;
1039 GtkTreeIter iter; 1015 GtkTreeIter iter;
1040 GtkTreeIter parent; 1016 GtkTreeIter parent;
1041 GtkTreeIter pos; 1017 GtkTreeIter pos;
1042 GtkBuilder *builder;
1043 1018
1044 builder = GTK_BUILDER (data);
1045 1019
1046 tv = GTK_TREE_VIEW (gtk_builder_get_object 1020 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1047 (builder,
1048 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1049 sel = gtk_tree_view_get_selection (tv);
1050 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
1051 { 1021 {
1052 GNUNET_break (0); 1022 GNUNET_break (0);
1053 return; 1023 return;
1054 } 1024 }
1055 if (TRUE != gtk_tree_model_iter_parent (tm, &parent, &iter)) 1025 if (TRUE != gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
1056 { 1026 {
1057 GNUNET_break (0); 1027 GNUNET_break (0);
1058 return; 1028 return;
1059 } 1029 }
1060 gtk_tree_store_insert_after (GTK_TREE_STORE (tm), &pos, NULL, &parent); 1030 gtk_tree_store_insert_after (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, NULL, &parent);
1061 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1031 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1062 { 1032 {
1063 GNUNET_break (0); 1033 GNUNET_break (0);
1064 return; 1034 return;
1065 } 1035 }
1066 move_entry (data, tm, &iter, &pos, GNUNET_YES); 1036 move_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
1067 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1037 remove_old_entry (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
1068} 1038}
1069 1039
1070 1040
1071void 1041void
1072GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy, 1042GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy,
1073 gpointer data) 1043 struct MainPublishingDialogContext *ctx)
1074{ 1044{
1075 GtkTreeView *tv;
1076 GtkTreeModel *tm;
1077 GtkTreeSelection *sel;
1078 GtkTreeIter iter; 1045 GtkTreeIter iter;
1079 GtkTreeIter parent; 1046 GtkTreeIter parent;
1080 GtkTreeIter pred; 1047 GtkTreeIter pred;
1081 GtkTreeIter prev; 1048 GtkTreeIter prev;
1082 GtkTreeIter *pprev; 1049 GtkTreeIter *pprev;
1083 GtkTreeIter pos; 1050 GtkTreeIter pos;
1084 GtkBuilder *builder;
1085
1086 builder = GTK_BUILDER (data);
1087 1051
1088 tv = GTK_TREE_VIEW (gtk_builder_get_object 1052 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1089 (builder,
1090 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1091 sel = gtk_tree_view_get_selection (tv);
1092 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
1093 { 1053 {
1094 GNUNET_break (0); 1054 GNUNET_break (0);
1095 return; 1055 return;
1096 } 1056 }
1097 if (TRUE == gtk_tree_model_iter_parent (tm, &parent, &iter)) 1057 if (TRUE == gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
1098 { 1058 {
1099 GNUNET_assert (TRUE == gtk_tree_model_iter_children (tm, &pred, &parent)); 1059 GNUNET_assert (TRUE == gtk_tree_model_iter_children (ctx->file_info_treemodel, &pred, &parent));
1100 pprev = &parent; 1060 pprev = &parent;
1101 } 1061 }
1102 else if (TRUE == gtk_tree_model_get_iter_first (tm, &pred)) 1062 else if (TRUE == gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &pred))
1103 { 1063 {
1104 pprev = NULL; 1064 pprev = NULL;
1105 } 1065 }
@@ -1109,80 +1069,61 @@ GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy,
1109 return; 1069 return;
1110 } 1070 }
1111 /* iterate over 'next' of pred to find out who our predecessor is! */ 1071 /* iterate over 'next' of pred to find out who our predecessor is! */
1112 while (GNUNET_YES != gtk_tree_iter_equals (tm, &pred, &iter)) 1072 while (GNUNET_YES != gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
1113 { 1073 {
1114 prev = pred; 1074 prev = pred;
1115 pprev = &prev; 1075 pprev = &prev;
1116 GNUNET_assert (TRUE == gtk_tree_model_iter_next (tm, &pred)); 1076 GNUNET_assert (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
1117 } 1077 }
1118 gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &pos, NULL, pprev); 1078 gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, NULL, pprev);
1119 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1079 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1120 { 1080 {
1121 GNUNET_break (0); 1081 GNUNET_break (0);
1122 return; 1082 return;
1123 } 1083 }
1124 move_entry (data, tm, &iter, &pos, GNUNET_YES); 1084 move_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
1125 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1085 remove_old_entry (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
1126} 1086}
1127 1087
1128 1088
1129void 1089void
1130GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget * dummy, 1090GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget * dummy,
1131 gpointer data) 1091 struct MainPublishingDialogContext *ctx)
1132{ 1092{
1133 GtkTreeView *tv;
1134 GtkTreeModel *tm;
1135 GtkTreeSelection *sel;
1136 GtkTreeIter iter; 1093 GtkTreeIter iter;
1137 GtkTreeIter next; 1094 GtkTreeIter next;
1138 GtkTreeIter pos; 1095 GtkTreeIter pos;
1139 GtkBuilder *builder;
1140
1141 builder = GTK_BUILDER (data);
1142 1096
1143 tv = GTK_TREE_VIEW (gtk_builder_get_object 1097 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1144 (builder,
1145 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1146 sel = gtk_tree_view_get_selection (tv);
1147 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
1148 { 1098 {
1149 GNUNET_break (0); 1099 GNUNET_break (0);
1150 return; 1100 return;
1151 } 1101 }
1152 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &next)) 1102 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &next))
1153 { 1103 {
1154 GNUNET_break (0); 1104 GNUNET_break (0);
1155 return; 1105 return;
1156 } 1106 }
1157 GNUNET_assert (TRUE == gtk_tree_model_iter_next (tm, &next)); 1107 GNUNET_assert (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &next));
1158 gtk_tree_store_insert_after (GTK_TREE_STORE (tm), &pos, NULL, &next); 1108 gtk_tree_store_insert_after (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, NULL, &next);
1159 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1109 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1160 { 1110 {
1161 GNUNET_break (0); 1111 GNUNET_break (0);
1162 return; 1112 return;
1163 } 1113 }
1164 move_entry (data, tm, &iter, &pos, GNUNET_YES); 1114 move_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
1165 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1115 remove_old_entry (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
1166} 1116}
1167 1117
1168 1118
1169void 1119void
1170GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy, 1120GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy,
1171 gpointer data) 1121 struct MainPublishingDialogContext *ctx)
1172{ 1122{
1173 GtkTreeView *tv;
1174 GtkTreeSelection *sel;
1175 GtkTreeIter iter; 1123 GtkTreeIter iter;
1176 GtkTreeIter pos; 1124 GtkTreeIter pos;
1177 struct GNUNET_FS_BlockOptions bo; 1125 struct GNUNET_FS_BlockOptions bo;
1178 GtkBuilder *builder;
1179
1180 builder = GTK_BUILDER (data);
1181 1126
1182 tv = GTK_TREE_VIEW (gtk_builder_get_object
1183 (builder,
1184 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1185 sel = gtk_tree_view_get_selection (tv);
1186 /* FIXME: consider opening a dialog to get 1127 /* FIXME: consider opening a dialog to get
1187 * anonymity, priority and expiration prior 1128 * anonymity, priority and expiration prior
1188 * to calling this function (currently we 1129 * to calling this function (currently we
@@ -1193,33 +1134,28 @@ GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy,
1193 bo.expiration_time = 1134 bo.expiration_time =
1194 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS); 1135 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
1195 bo.replication_level = 1; 1136 bo.replication_level = 1;
1196 if (TRUE != gtk_tree_selection_get_selected (sel, NULL, &iter)) 1137 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1197 { 1138 {
1198 create_dir_at_iter (data, "unnamed/", &bo, NULL, &pos); 1139 create_dir_at_iter (ctx, "unnamed/", &bo, NULL, &pos);
1199 return; 1140 return;
1200 } 1141 }
1201 create_dir_at_iter (data, "unnamed/", &bo, &iter, &pos); 1142 create_dir_at_iter (ctx, "unnamed/", &bo, &iter, &pos);
1202} 1143}
1203 1144
1204 1145
1205void 1146void
1206GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget * dummy, 1147GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget * dummy,
1207 gpointer data) 1148 struct MainPublishingDialogContext *ctx)
1208{ 1149{
1209 GtkWidget *ad; 1150 GtkWidget *ad;
1210 GtkBuilder *builder;
1211 GtkWindow *master_pubdialog;
1212
1213 builder = GTK_BUILDER (data);
1214 1151
1215 ad = GTK_WIDGET (gtk_builder_get_object 1152 ad = GTK_WIDGET (gtk_builder_get_object
1216 (builder, "GNUNET_GTK_publish_file_dialog")); 1153 (ctx->main_window_builder, "GNUNET_GTK_publish_file_dialog"));
1217 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder); 1154 GNUNET_FS_GTK_setup_expiration_year_adjustment (ctx->main_window_builder);
1218 1155
1219 master_pubdialog = 1156 ctx->open_file_handler_id = g_signal_connect (G_OBJECT (ad), "response", G_CALLBACK (GNUNET_GTK_publish_file_dialog_response_cb), ctx);
1220 GTK_WINDOW (gtk_builder_get_object 1157
1221 (builder, "GNUNET_GTK_master_publish_dialog")); 1158 gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog);
1222 gtk_window_set_transient_for (GTK_WINDOW (ad), master_pubdialog);
1223 1159
1224 gtk_window_present (GTK_WINDOW (ad)); 1160 gtk_window_present (GTK_WINDOW (ad));
1225} 1161}
@@ -1265,14 +1201,9 @@ master_publish_edit_publish_dialog_cb (gpointer cls, int do_index,
1265 1201
1266void 1202void
1267GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy, 1203GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
1268 gpointer data) 1204 struct MainPublishingDialogContext *ctx)
1269{ 1205{
1270 GtkTreeView *tv;
1271 GtkTreeModel *tm;
1272 GtkTreeSelection *sel;
1273 struct EditPublishContext *cbargs; 1206 struct EditPublishContext *cbargs;
1274 GtkBuilder *builder;
1275 GtkWindow *master_pubdialog;
1276 gint do_index; 1207 gint do_index;
1277 char *short_fn; 1208 char *short_fn;
1278 guint anonymity_level; 1209 guint anonymity_level;
@@ -1283,28 +1214,18 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
1283 struct GNUNET_FS_BlockOptions bo; 1214 struct GNUNET_FS_BlockOptions bo;
1284 GtkListStore *anon_liststore; 1215 GtkListStore *anon_liststore;
1285 1216
1286 builder = GTK_BUILDER (data); 1217 anon_liststore = GTK_LIST_STORE (gtk_builder_get_object (ctx->main_window_builder, "main_window_search_anonymity_liststore"));
1287 tv = GTK_TREE_VIEW (gtk_builder_get_object
1288 (builder,
1289 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1290
1291 anon_liststore = GTK_LIST_STORE (gtk_builder_get_object (builder, "main_window_search_anonymity_liststore"));
1292
1293 1218
1294 cbargs = GNUNET_malloc (sizeof (struct EditPublishContext)); 1219 cbargs = GNUNET_malloc (sizeof (struct EditPublishContext));
1295 cbargs->tm = gtk_tree_view_get_model (tv); 1220 cbargs->tm = ctx->file_info_treemodel;
1296 master_pubdialog = 1221 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &cbargs->iter))
1297 GTK_WINDOW (gtk_builder_get_object
1298 (builder, "GNUNET_GTK_master_publish_dialog"));
1299 sel = gtk_tree_view_get_selection (tv);
1300 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &cbargs->iter))
1301 { 1222 {
1302 GNUNET_break (0); 1223 GNUNET_break (0);
1303 GNUNET_free (cbargs); 1224 GNUNET_free (cbargs);
1304 return; 1225 return;
1305 } 1226 }
1306 1227
1307 gtk_tree_model_get (tm, &cbargs->iter, 1, &do_index, 2, &short_fn, 3, 1228 gtk_tree_model_get (ctx->file_info_treemodel, &cbargs->iter, 1, &do_index, 2, &short_fn, 3,
1308 &anonymity_level, 4, &priority, 5, &fip, 1229 &anonymity_level, 4, &priority, 5, &fip,
1309 6, &abs_etime, 1230 6, &abs_etime,
1310 7, &replication_level, 1231 7, &replication_level,
@@ -1314,7 +1235,7 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
1314 bo.expiration_time.abs_value = (uint64_t) abs_etime; 1235 bo.expiration_time.abs_value = (uint64_t) abs_etime;
1315 bo.replication_level = replication_level; 1236 bo.replication_level = replication_level;
1316 1237
1317 GNUNET_FS_GTK_edit_publish_dialog (master_pubdialog, do_index, 1238 GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, do_index,
1318 short_fn, bo, fip, TRUE, anon_liststore, 1239 short_fn, bo, fip, TRUE, anon_liststore,
1319 &master_publish_edit_publish_dialog_cb, 1240 &master_publish_edit_publish_dialog_cb,
1320 cbargs); 1241 cbargs);
@@ -1346,36 +1267,27 @@ free_fi_row_reference (void *cls, struct GNUNET_FS_FileInformation *fi,
1346 1267
1347void 1268void
1348GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy, 1269GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
1349 gpointer data) 1270 struct MainPublishingDialogContext *ctx)
1350{ 1271{
1351 GtkTreeView *tv;
1352 GtkTreeModel *tm;
1353 GtkTreeSelection *sel;
1354 GtkTreeIter iter; 1272 GtkTreeIter iter;
1355 struct GNUNET_FS_FileInformation *fip; 1273 struct GNUNET_FS_FileInformation *fip;
1356 GtkBuilder *builder;
1357 1274
1358 builder = GTK_BUILDER (data); 1275 if (TRUE != gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1359 tv = GTK_TREE_VIEW (gtk_builder_get_object
1360 (builder,
1361 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1362 sel = gtk_tree_view_get_selection (tv);
1363 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
1364 { 1276 {
1365 GNUNET_break (0); 1277 GNUNET_break (0);
1366 return; 1278 return;
1367 } 1279 }
1368 gtk_tree_model_get (tm, &iter, 5, &fip, -1); 1280 gtk_tree_model_get (ctx->file_info_treemodel, &iter, 5, &fip, -1);
1369 GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL); 1281 GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
1370 gtk_tree_store_remove (GTK_TREE_STORE (tm), &iter); 1282 gtk_tree_store_remove (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
1371 update_selectivity (data); 1283 update_selectivity (ctx);
1372} 1284}
1373 1285
1374 1286
1375void 1287void
1376GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog, 1288GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog,
1377 gint response_id, 1289 gint response_id,
1378 gpointer user_data) 1290 struct MainPublishingDialogContext *ctx)
1379{ 1291{
1380 char *filename; 1292 char *filename;
1381 int do_index; 1293 int do_index;
@@ -1384,7 +1296,11 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog,
1384 GtkWidget *ad; 1296 GtkWidget *ad;
1385 GtkBuilder *builder; 1297 GtkBuilder *builder;
1386 1298
1387 builder = GTK_BUILDER (user_data); 1299 if (g_signal_handler_is_connected (G_OBJECT (dialog), ctx->open_directory_handler_id))
1300 g_signal_handler_disconnect (G_OBJECT (dialog), ctx->open_directory_handler_id);
1301 ctx->open_directory_handler_id = 0;
1302
1303 builder = ctx->main_window_builder;
1388 ad = GTK_WIDGET (gtk_builder_get_object 1304 ad = GTK_WIDGET (gtk_builder_get_object
1389 (builder, "GNUNET_GTK_publish_directory_dialog")); 1305 (builder, "GNUNET_GTK_publish_directory_dialog"));
1390 if (response_id == -5) 1306 if (response_id == -5)
@@ -1415,9 +1331,9 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog,
1415 "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton"))); 1331 "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
1416 1332
1417 /* FIXME: open progress dialog here... */ 1333 /* FIXME: open progress dialog here... */
1418 add_dir (user_data, filename, &bo, do_index); 1334 add_dir (ctx, filename, &bo, do_index);
1419 g_free (filename); 1335 g_free (filename);
1420 update_selectivity (user_data); 1336 update_selectivity (ctx);
1421 } 1337 }
1422 gtk_widget_hide (ad); 1338 gtk_widget_hide (ad);
1423} 1339}
@@ -1425,21 +1341,19 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog,
1425 1341
1426void 1342void
1427GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy, 1343GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
1428 gpointer data) 1344 struct MainPublishingDialogContext *ctx)
1429{ 1345{
1430 GtkWidget *ad; 1346 GtkWidget *ad;
1431 GtkBuilder *builder; 1347 GtkBuilder *builder;
1432 GtkWindow *master_pubdialog;
1433 1348
1434 builder = GTK_BUILDER (data); 1349 builder = ctx->main_window_builder;
1435 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder); 1350 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
1436 ad = GTK_WIDGET (gtk_builder_get_object 1351 ad = GTK_WIDGET (gtk_builder_get_object
1437 (builder, "GNUNET_GTK_publish_directory_dialog")); 1352 (builder, "GNUNET_GTK_publish_directory_dialog"));
1438 1353
1439 master_pubdialog = 1354 ctx->open_directory_handler_id = g_signal_connect (G_OBJECT (ad), "response", G_CALLBACK (GNUNET_GTK_publish_directory_dialog_response_cb), ctx);
1440 GTK_WINDOW (gtk_builder_get_object 1355
1441 (builder, "GNUNET_GTK_master_publish_dialog")); 1356 gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog);
1442 gtk_window_set_transient_for (GTK_WINDOW (ad), master_pubdialog);
1443 1357
1444 gtk_window_present (GTK_WINDOW (ad)); 1358 gtk_window_present (GTK_WINDOW (ad));
1445} 1359}
@@ -1686,63 +1600,25 @@ free_file_information_tree_store (GtkTreeModel * tm, GtkTreeIter * iter)
1686 1600
1687void 1601void
1688GNUNET_GTK_master_publish_dialog_realize_cb (GtkWidget * widget, 1602GNUNET_GTK_master_publish_dialog_realize_cb (GtkWidget * widget,
1689 gpointer user_data) 1603 struct MainPublishingDialogContext *ctx)
1690{ 1604{
1691 GtkTreeView *tv;
1692 GtkTreeSelection *sel;
1693 GtkBuilder *builder;
1694
1695 builder = GTK_BUILDER (user_data);
1696
1697 tv = GTK_TREE_VIEW (gtk_builder_get_object
1698 (builder,
1699 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1700 sel = gtk_tree_view_get_selection (tv);
1701 g_signal_connect (G_OBJECT (sel), "changed",
1702 G_CALLBACK (selection_changed_cb), user_data);
1703 tv = GTK_TREE_VIEW (gtk_builder_get_object
1704 (builder,
1705 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
1706 sel = gtk_tree_view_get_selection (tv);
1707 g_signal_connect (G_OBJECT (sel), "changed",
1708 G_CALLBACK (selection_changed_cb), user_data);
1709} 1605}
1710 1606
1711 1607
1712static void 1608static void
1713hide_master_publish_dialog (gpointer user_data, gint ret) 1609hide_master_publish_dialog (struct MainPublishingDialogContext *ctx, gint ret)
1714{ 1610{
1715 GtkTreeView *tv, *ptv;
1716 GtkTreeSelection *sel;
1717 GtkTreeModel *tm, *ptm;
1718 GtkTreeIter iter; 1611 GtkTreeIter iter;
1719 gpointer namespace; 1612 gpointer namespace;
1720 gchar *namespace_id; 1613 gchar *namespace_id;
1721 gchar *namespace_uid; 1614 gchar *namespace_uid;
1722 struct GNUNET_FS_FileInformation *fi; 1615 struct GNUNET_FS_FileInformation *fi;
1723 GtkWidget *ad;
1724 GtkBuilder *builder;
1725
1726 builder = GTK_BUILDER (user_data);
1727 ad = GTK_WIDGET (gtk_builder_get_object
1728 (builder, "GNUNET_GTK_master_publish_dialog"));
1729 ptv =
1730 GTK_TREE_VIEW (gtk_builder_get_object
1731 (builder,
1732 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
1733 sel = gtk_tree_view_get_selection (ptv);
1734 ptm = gtk_tree_view_get_model (ptv);
1735
1736 tv = GTK_TREE_VIEW (gtk_builder_get_object
1737 (builder,
1738 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1739 tm = gtk_tree_view_get_model (tv);
1740 1616
1741 if (ret == GTK_RESPONSE_OK) 1617 if (ret == GTK_RESPONSE_OK)
1742 { 1618 {
1743 if (TRUE == gtk_tree_selection_get_selected (sel, &ptm, &iter)) 1619 if (TRUE == gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
1744 { 1620 {
1745 gtk_tree_model_get (ptm, &iter, 1, &namespace, 2, &namespace_id, 5, 1621 gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 1, &namespace, 2, &namespace_id, 5,
1746 &namespace_uid, -1); 1622 &namespace_uid, -1);
1747 } 1623 }
1748 else 1624 else
@@ -1751,65 +1627,65 @@ hide_master_publish_dialog (gpointer user_data, gint ret)
1751 namespace_id = NULL; 1627 namespace_id = NULL;
1752 namespace_uid = NULL; 1628 namespace_uid = NULL;
1753 } 1629 }
1754 if (gtk_tree_model_get_iter_first (tm, &iter)) 1630 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
1755 do 1631 do
1756 { 1632 {
1757 fi = get_file_information (tm, &iter); 1633 fi = get_file_information (ctx->file_info_treemodel, &iter);
1758 /* FIXME: should we convert namespace id and uid from UTF8? */ 1634 /* FIXME: should we convert namespace id and uid from UTF8? */
1759 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), fi, namespace, 1635 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), fi, namespace,
1760 namespace_id, namespace_uid, 1636 namespace_id, namespace_uid,
1761 GNUNET_FS_PUBLISH_OPTION_NONE); 1637 GNUNET_FS_PUBLISH_OPTION_NONE);
1762 } 1638 }
1763 while (gtk_tree_model_iter_next (tm, &iter)); 1639 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
1764 g_free (namespace_id); 1640 g_free (namespace_id);
1765 g_free (namespace_uid); 1641 g_free (namespace_uid);
1766 } 1642 }
1767 1643
1768 /* free state from 'ptm' */ 1644 /* free state from 'ptm' */
1769 if (TRUE == gtk_tree_model_get_iter_first (ptm, &iter)) 1645 if (TRUE == gtk_tree_model_get_iter_first (ctx->pseudonym_treemodel, &iter))
1770 do 1646 do
1771 { 1647 {
1772 free_pseudonym_tree_store (ptm, &iter); 1648 free_pseudonym_tree_store (ctx->pseudonym_treemodel, &iter);
1773 } 1649 }
1774 while (TRUE == gtk_tree_model_iter_next (ptm, &iter)); 1650 while (TRUE == gtk_tree_model_iter_next (ctx->pseudonym_treemodel, &iter));
1775 gtk_tree_store_clear (GTK_TREE_STORE (ptm)); 1651 gtk_tree_store_clear (GTK_TREE_STORE (ctx->pseudonym_treemodel));
1776 1652
1777 /* free state from 'tm' */ 1653 /* free state from 'tm' */
1778 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) 1654 if (TRUE == gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
1779 do 1655 do
1780 { 1656 {
1781 free_file_information_tree_store (tm, &iter); 1657 free_file_information_tree_store (ctx->file_info_treemodel, &iter);
1782 } 1658 }
1783 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 1659 while (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
1784 gtk_tree_store_clear (GTK_TREE_STORE (tm)); 1660 gtk_tree_store_clear (GTK_TREE_STORE (ctx->file_info_treemodel));
1785 gtk_widget_hide (ad); 1661 gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog));
1786 /* FIXME: doesn't this leak everything (builder + window)? 1662 gtk_object_unref (GTK_OBJECT (ctx->builder));
1787 * I think we need to unref the builder here! */ 1663 GNUNET_free (ctx);
1788} 1664}
1789 1665
1790 1666
1791void 1667void
1792GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton * button, 1668GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton * button,
1793 gpointer user_data) 1669 struct MainPublishingDialogContext *ctx)
1794{ 1670{
1795 hide_master_publish_dialog (user_data, GTK_RESPONSE_OK); 1671 hide_master_publish_dialog (ctx, GTK_RESPONSE_OK);
1796} 1672}
1797 1673
1798 1674
1799void 1675void
1800GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb (GtkButton * button, 1676GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb (GtkButton * button,
1801 gpointer user_data) 1677 struct MainPublishingDialogContext *ctx)
1802{ 1678{
1803 hide_master_publish_dialog (user_data, GTK_RESPONSE_CANCEL); 1679 hide_master_publish_dialog (ctx, GTK_RESPONSE_CANCEL);
1804} 1680}
1805 1681
1806 1682
1807gboolean 1683gboolean
1808GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget * widget, 1684GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget * widget,
1809 GdkEvent * event, 1685 GdkEvent * event,
1810 gpointer user_data) 1686 struct MainPublishingDialogContext *ctx)
1811{ 1687{
1812 hide_master_publish_dialog (user_data, GTK_RESPONSE_CANCEL); 1688 hide_master_publish_dialog (ctx, GTK_RESPONSE_CANCEL);
1813 return TRUE; 1689 return TRUE;
1814} 1690}
1815 1691
@@ -1817,7 +1693,7 @@ GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget * widget,
1817void 1693void
1818GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog, 1694GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog,
1819 gint response_id, 1695 gint response_id,
1820 gpointer user_data) 1696 struct MainPublishingDialogContext *ctx)
1821{ 1697{
1822 char *filename; 1698 char *filename;
1823 struct GNUNET_FS_BlockOptions bo; 1699 struct GNUNET_FS_BlockOptions bo;
@@ -1825,7 +1701,11 @@ GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog,
1825 GtkSpinButton *sb; 1701 GtkSpinButton *sb;
1826 GtkWidget *ad; 1702 GtkWidget *ad;
1827 1703
1828 GtkBuilder *builder = GTK_BUILDER (user_data); 1704 GtkBuilder *builder = ctx->main_window_builder;
1705
1706 if (g_signal_handler_is_connected (G_OBJECT (dialog), ctx->open_file_handler_id))
1707 g_signal_handler_disconnect (G_OBJECT (dialog), ctx->open_file_handler_id);
1708 ctx->open_file_handler_id = 0;
1829 1709
1830 ad = GTK_WIDGET (gtk_builder_get_object 1710 ad = GTK_WIDGET (gtk_builder_get_object
1831 (builder, "GNUNET_GTK_publish_file_dialog")); 1711 (builder, "GNUNET_GTK_publish_file_dialog"));
@@ -1859,9 +1739,9 @@ GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog,
1859 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton"))); 1739 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
1860 1740
1861 filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (ad)); 1741 filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (ad));
1862 add_file_at_iter (user_data, filename, &bo, do_index, NULL); 1742 add_file_at_iter (ctx, filename, &bo, do_index, NULL);
1863 g_free (filename); 1743 g_free (filename);
1864 update_selectivity (user_data); 1744 update_selectivity (ctx);
1865 } 1745 }
1866 else 1746 else
1867 { 1747 {
@@ -1874,23 +1754,24 @@ GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog,
1874/** 1754/**
1875 */ 1755 */
1876void 1756void
1877GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data) 1757GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer user_data)
1878{ 1758{
1879 GtkWidget *ad; 1759 struct MainPublishingDialogContext *ctx;
1880 GtkTreeStore *ts;
1881 GtkBuilder *builder;
1882 1760
1883 builder = GTK_BUILDER (data); 1761 ctx = GNUNET_malloc (sizeof (struct MainPublishingDialogContext));
1884 ad = GTK_WIDGET (gtk_builder_get_object 1762 ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade", ctx);
1885 (builder, "GNUNET_GTK_master_publish_dialog")); 1763
1886 if (!gtk_widget_get_visible (ad)) 1764 if (ctx->builder == NULL)
1887 { 1765 {
1888 ts = GTK_TREE_STORE (gtk_builder_get_object 1766 GNUNET_free (ctx);
1889 (builder, "GNUNET_GTK_pseudonym_tree_store")); 1767 return;
1890 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
1891 &add_namespace_to_ts, ts);
1892 } 1768 }
1893 gtk_window_present (GTK_WINDOW (ad)); 1769
1770 init_ctx (ctx);
1771 ctx->main_window_builder = GTK_BUILDER (user_data);
1772 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
1773 &add_namespace_to_ts, GTK_TREE_STORE (ctx->pseudonym_treemodel));
1774 gtk_window_present (GTK_WINDOW (ctx->master_pubdialog));
1894} 1775}
1895 1776
1896 1777