aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnunet-gtk.glade162
-rw-r--r--src/plugins/fs/fs.c9
-rw-r--r--src/plugins/fs/namespace.c95
3 files changed, 236 insertions, 30 deletions
diff --git a/gnunet-gtk.glade b/gnunet-gtk.glade
index 5ab6413d..5309e072 100644
--- a/gnunet-gtk.glade
+++ b/gnunet-gtk.glade
@@ -2089,22 +2089,154 @@ Thank you,
2089 </child> 2089 </child>
2090 2090
2091 <child> 2091 <child>
2092 <widget class="GtkLabel" id="label55"> 2092 <widget class="GtkHBox" id="hbox46">
2093 <property name="visible">True</property> 2093 <property name="visible">True</property>
2094 <property name="label" translatable="yes">&lt;b&gt;Available Content&lt;/b&gt;</property> 2094 <property name="homogeneous">False</property>
2095 <property name="use_underline">False</property> 2095 <property name="spacing">12</property>
2096 <property name="use_markup">True</property> 2096
2097 <property name="justify">GTK_JUSTIFY_LEFT</property> 2097 <child>
2098 <property name="wrap">False</property> 2098 <widget class="GtkLabel" id="label55">
2099 <property name="selectable">False</property> 2099 <property name="visible">True</property>
2100 <property name="xalign">0.5</property> 2100 <property name="label" translatable="yes">&lt;b&gt;Available Content&lt;/b&gt;</property>
2101 <property name="yalign">0.5</property> 2101 <property name="use_underline">False</property>
2102 <property name="xpad">0</property> 2102 <property name="use_markup">True</property>
2103 <property name="ypad">5</property> 2103 <property name="justify">GTK_JUSTIFY_LEFT</property>
2104 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> 2104 <property name="wrap">False</property>
2105 <property name="width_chars">-1</property> 2105 <property name="selectable">False</property>
2106 <property name="single_line_mode">False</property> 2106 <property name="xalign">0.5</property>
2107 <property name="angle">0</property> 2107 <property name="yalign">0.5</property>
2108 <property name="xpad">0</property>
2109 <property name="ypad">5</property>
2110 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
2111 <property name="width_chars">-1</property>
2112 <property name="single_line_mode">False</property>
2113 <property name="angle">0</property>
2114 </widget>
2115 <packing>
2116 <property name="padding">0</property>
2117 <property name="expand">False</property>
2118 <property name="fill">False</property>
2119 </packing>
2120 </child>
2121
2122 <child>
2123 <widget class="GtkCheckButton" id="trackingCheckButton">
2124 <property name="visible">True</property>
2125 <property name="tooltip" translatable="yes">should GNUnet track available content (for publishing in namespaces)?</property>
2126 <property name="can_focus">True</property>
2127 <property name="relief">GTK_RELIEF_NORMAL</property>
2128 <property name="focus_on_click">True</property>
2129 <property name="active">False</property>
2130 <property name="inconsistent">False</property>
2131 <property name="draw_indicator">True</property>
2132 <signal name="toggled" handler="on_trackingCheckButton_toggled" object="trackingCheckButton" last_modification_time="Sun, 21 Aug 2005 02:47:48 GMT"/>
2133
2134 <child>
2135 <widget class="GtkAlignment" id="alignment13">
2136 <property name="visible">True</property>
2137 <property name="xalign">0.5</property>
2138 <property name="yalign">0.5</property>
2139 <property name="xscale">0</property>
2140 <property name="yscale">0</property>
2141 <property name="top_padding">0</property>
2142 <property name="bottom_padding">0</property>
2143 <property name="left_padding">0</property>
2144 <property name="right_padding">0</property>
2145
2146 <child>
2147 <widget class="GtkHBox" id="hbox47">
2148 <property name="visible">True</property>
2149 <property name="homogeneous">False</property>
2150 <property name="spacing">2</property>
2151
2152 <child>
2153 <widget class="GtkImage" id="image29">
2154 <property name="visible">True</property>
2155 <property name="stock">gtk-justify-fill</property>
2156 <property name="icon_size">4</property>
2157 <property name="xalign">0.5</property>
2158 <property name="yalign">0.5</property>
2159 <property name="xpad">0</property>
2160 <property name="ypad">0</property>
2161 </widget>
2162 <packing>
2163 <property name="padding">0</property>
2164 <property name="expand">False</property>
2165 <property name="fill">False</property>
2166 </packing>
2167 </child>
2168
2169 <child>
2170 <widget class="GtkLabel" id="label117">
2171 <property name="visible">True</property>
2172 <property name="label" translatable="yes">track available content</property>
2173 <property name="use_underline">True</property>
2174 <property name="use_markup">False</property>
2175 <property name="justify">GTK_JUSTIFY_LEFT</property>
2176 <property name="wrap">False</property>
2177 <property name="selectable">False</property>
2178 <property name="xalign">0.5</property>
2179 <property name="yalign">0.5</property>
2180 <property name="xpad">0</property>
2181 <property name="ypad">0</property>
2182 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
2183 <property name="width_chars">-1</property>
2184 <property name="single_line_mode">False</property>
2185 <property name="angle">0</property>
2186 </widget>
2187 <packing>
2188 <property name="padding">0</property>
2189 <property name="expand">False</property>
2190 <property name="fill">False</property>
2191 </packing>
2192 </child>
2193 </widget>
2194 </child>
2195 </widget>
2196 </child>
2197 </widget>
2198 <packing>
2199 <property name="padding">0</property>
2200 <property name="expand">False</property>
2201 <property name="fill">False</property>
2202 </packing>
2203 </child>
2204
2205 <child>
2206 <widget class="GtkButton" id="refreshContentListButton">
2207 <property name="visible">True</property>
2208 <property name="tooltip" translatable="yes">Refresh the available content list now (otherwise this is done automatically roughly every 5 minutes)</property>
2209 <property name="can_focus">True</property>
2210 <property name="label">gtk-refresh</property>
2211 <property name="use_stock">True</property>
2212 <property name="relief">GTK_RELIEF_NONE</property>
2213 <property name="focus_on_click">True</property>
2214 <signal name="clicked" handler="on_refreshContentListButton_clicked" last_modification_time="Sun, 21 Aug 2005 03:29:32 GMT"/>
2215 </widget>
2216 <packing>
2217 <property name="padding">0</property>
2218 <property name="expand">False</property>
2219 <property name="fill">False</property>
2220 </packing>
2221 </child>
2222
2223 <child>
2224 <widget class="GtkButton" id="clearAvailableContentButton">
2225 <property name="visible">True</property>
2226 <property name="tooltip" translatable="yes">deletes the tracked available content shown below</property>
2227 <property name="can_focus">True</property>
2228 <property name="label">gtk-clear</property>
2229 <property name="use_stock">True</property>
2230 <property name="relief">GTK_RELIEF_NONE</property>
2231 <property name="focus_on_click">True</property>
2232 <signal name="clicked" handler="on_clearAvailableContentButton_clicked" last_modification_time="Sun, 21 Aug 2005 02:49:49 GMT"/>
2233 </widget>
2234 <packing>
2235 <property name="padding">0</property>
2236 <property name="expand">False</property>
2237 <property name="fill">False</property>
2238 </packing>
2239 </child>
2108 </widget> 2240 </widget>
2109 <packing> 2241 <packing>
2110 <property name="type">label_item</property> 2242 <property name="type">label_item</property>
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c
index 1f68b36e..a0d1e227 100644
--- a/src/plugins/fs/fs.c
+++ b/src/plugins/fs/fs.c
@@ -118,8 +118,10 @@ static void eventProcessor(void * cls,
118static void * shutdownCode(Semaphore * sig) { 118static void * shutdownCode(Semaphore * sig) {
119 fs_download_stop(); 119 fs_download_stop();
120 fs_search_stop(); 120 fs_search_stop();
121 FSUI_stop(ctx); 121 fs_collection_stop();
122 fs_namespace_stop();
122 fs_upload_stop(); 123 fs_upload_stop();
124 FSUI_stop(ctx);
123 SEMAPHORE_UP(sig); 125 SEMAPHORE_UP(sig);
124 return NULL; 126 return NULL;
125} 127}
@@ -155,11 +157,6 @@ void done_fs() {
155 Semaphore * sig; 157 Semaphore * sig;
156 void * unused; 158 void * unused;
157 159
158 fs_upload_stop();
159 fs_download_stop();
160 fs_search_stop();
161 fs_namespace_stop();
162 fs_collection_stop();
163 sig = SEMAPHORE_NEW(0); 160 sig = SEMAPHORE_NEW(0);
164 if (0 != PTHREAD_CREATE(&doneThread, 161 if (0 != PTHREAD_CREATE(&doneThread,
165 (PThreadMain)&shutdownCode, 162 (PThreadMain)&shutdownCode,
diff --git a/src/plugins/fs/namespace.c b/src/plugins/fs/namespace.c
index 8f7718d2..bdd67684 100644
--- a/src/plugins/fs/namespace.c
+++ b/src/plugins/fs/namespace.c
@@ -32,7 +32,7 @@
32#include "namespace.h" 32#include "namespace.h"
33#include <extractor.h> 33#include <extractor.h>
34 34
35 35#define UPDATE_CONTENT_LIST_FREQUENCY (5 * cronMINUTES)
36 36
37/** 37/**
38 * @brief linked list of pages in the search notebook 38 * @brief linked list of pages in the search notebook
@@ -215,12 +215,35 @@ static int updateView(const ECRS_FileInfo * fi,
215 return OK; 215 return OK;
216} 216}
217 217
218static void clearContentList(void * mdl) {
219 GtkTreeModel * model = GTK_TREE_MODEL(mdl);
220 struct ECRS_URI * uri;
221 struct ECRS_MetaData * meta;
222 GtkTreeIter iter;
223
224 if (gtk_tree_model_get_iter_first(model,
225 &iter)) {
226 do {
227 gtk_tree_model_get(model,
228 &iter,
229 NAMESPACE_URI, &uri,
230 NAMESPACE_META, &meta,
231 -1);
232 ECRS_freeUri(uri);
233 ECRS_freeMetaData(meta);
234
235 } while (gtk_list_store_remove(GTK_LIST_STORE(model),
236 &iter));
237 }
238}
239
218/** 240/**
219 * Update the list of the globally available content. 241 * Update the list of the globally available content.
220 */ 242 */
221static void doUpdateContentList(void * unused) { 243static void doUpdateContentList(void * unused) {
222 GtkWidget * contentList; 244 GtkWidget * contentList;
223 GtkTreeModel * model; 245 GtkTreeModel * model;
246
224 contentList 247 contentList
225 = glade_xml_get_widget(getMainXML(), 248 = glade_xml_get_widget(getMainXML(),
226 "availableContentList"); 249 "availableContentList");
@@ -234,6 +257,10 @@ static void updateContentList(void * unused) {
234 gtkSaveCall(&doUpdateContentList, NULL); 257 gtkSaveCall(&doUpdateContentList, NULL);
235} 258}
236 259
260void on_refreshContentListButton_clicked(gpointer dummy,
261 gpointer dummy1) {
262 updateContentList(NULL);
263}
237 264
238/** 265/**
239 * Update the model that lists the content of a namespace: 266 * Update the model that lists the content of a namespace:
@@ -817,12 +844,44 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1,
817 gtk_widget_destroy(dialog); 844 gtk_widget_destroy(dialog);
818} 845}
819 846
847void on_clearAvailableContentButton_clicked(GtkWidget * dummy1,
848 GtkWidget * dummy2) {
849 GtkWidget * contentList;
850 GtkTreeModel * model;
851
852 contentList
853 = glade_xml_get_widget(getMainXML(),
854 "availableContentList");
855 model
856 = gtk_tree_view_get_model(GTK_TREE_VIEW(contentList));
857 FSUI_clearTrackedURIS();
858 gtkSaveCall(&clearContentList, model);
859 updateContentList(NULL);
860}
861
862void on_trackingCheckButton_toggled(GtkWidget * dummy1,
863 GtkWidget * dummy2) {
864 GtkWidget * trackCheckButton;
865
866 trackCheckButton
867 = glade_xml_get_widget(getMainXML(),
868 "trackingCheckButton");
869 FSUI_trackURIS(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(trackCheckButton)) == TRUE ?
870 YES : NO);
871}
820 872
821 873
822void fs_namespace_start() { 874void fs_namespace_start() {
823 GtkWidget * contentList; 875 GtkWidget * contentList;
824 GtkListStore * model; 876 GtkListStore * model;
825 GtkCellRenderer * renderer; 877 GtkCellRenderer * renderer;
878 GtkWidget * trackCheckButton;
879
880 trackCheckButton
881 = glade_xml_get_widget(getMainXML(),
882 "trackingCheckButton");
883 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(trackCheckButton),
884 FSUI_trackStatus() == YES ? TRUE : FALSE);
826 885
827 contentList 886 contentList
828 = glade_xml_get_widget(getMainXML(), 887 = glade_xml_get_widget(getMainXML(),
@@ -859,7 +918,7 @@ void fs_namespace_start() {
859 NULL); 918 NULL);
860 addCronJob(&updateContentList, 919 addCronJob(&updateContentList,
861 0, 920 0,
862 5 * cronMINUTES, 921 UPDATE_CONTENT_LIST_FREQUENCY,
863 NULL); 922 NULL);
864 FSUI_listNamespaces(ctx, 923 FSUI_listNamespaces(ctx,
865 YES, 924 YES,
@@ -867,7 +926,25 @@ void fs_namespace_start() {
867 NULL); 926 NULL);
868} 927}
869 928
870void fs_namespace_stop() { 929#if 0
930void on_availableContentList_destroy(GtkWidget * dummy1,
931 GtkWidget * dummy2) {
932 GtkWidget * contentList;
933 GtkTreeModel * model;
934
935 delCronJob(&updateContentList,
936 UPDATE_CONTENT_LIST_FREQUENCY,
937 NULL);
938 contentList
939 = glade_xml_get_widget(getMainXML(),
940 "availableContentList");
941 model
942 = gtk_tree_view_get_model(GTK_TREE_VIEW(contentList));
943 clearContentList(model);
944}
945
946void on_localNamespacesNotebook_destroy(GtkWidget * dummy1,
947 GtkWidget * dummy2) {
871 NamespaceList * pos; 948 NamespaceList * pos;
872 GtkTreeIter iter; 949 GtkTreeIter iter;
873 struct ECRS_URI * u; 950 struct ECRS_URI * u;
@@ -877,9 +954,9 @@ void fs_namespace_stop() {
877 pos = head->next; 954 pos = head->next;
878 FREE(head->name); 955 FREE(head->name);
879 ECRS_freeMetaData(head->meta); 956 ECRS_freeMetaData(head->meta);
880 957
881 if (gtk_tree_model_get_iter_first(head->model, 958 if (gtk_tree_model_get_iter_first(head->model,
882 &iter)) { 959 &iter)) {
883 do { 960 do {
884 gtk_tree_model_get(head->model, 961 gtk_tree_model_get(head->model,
885 &iter, 962 &iter,
@@ -901,10 +978,10 @@ void fs_namespace_stop() {
901 FREE(head); 978 FREE(head);
902 head = pos; 979 head = pos;
903 } 980 }
981}
982#endif
904 983
905 delCronJob(&updateContentList, 984void fs_namespace_stop() {
906 5 * cronMINUTES,
907 NULL);
908} 985}
909 986
910/* end of namespace.c */ 987/* end of namespace.c */