aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/fs/namespace.c')
-rw-r--r--src/plugins/fs/namespace.c95
1 files changed, 86 insertions, 9 deletions
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 */