gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1817 - in gnunet-gtk: . src/plugins/fs


From: grothoff
Subject: [GNUnet-SVN] r1817 - in gnunet-gtk: . src/plugins/fs
Date: Sat, 20 Aug 2005 20:51:57 -0700 (PDT)

Author: grothoff
Date: 2005-08-20 20:51:54 -0700 (Sat, 20 Aug 2005)
New Revision: 1817

Modified:
   gnunet-gtk/gnunet-gtk.glade
   gnunet-gtk/src/plugins/fs/fs.c
   gnunet-gtk/src/plugins/fs/namespace.c
Log:
stuff

Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2005-08-21 03:05:10 UTC (rev 1816)
+++ gnunet-gtk/gnunet-gtk.glade 2005-08-21 03:51:54 UTC (rev 1817)
@@ -2089,22 +2089,154 @@
                      </child>
 
                      <child>
-                       <widget class="GtkLabel" id="label55">
+                       <widget class="GtkHBox" id="hbox46">
                          <property name="visible">True</property>
-                         <property name="label" 
translatable="yes">&lt;b&gt;Available Content&lt;/b&gt;</property>
-                         <property name="use_underline">False</property>
-                         <property name="use_markup">True</property>
-                         <property name="justify">GTK_JUSTIFY_LEFT</property>
-                         <property name="wrap">False</property>
-                         <property name="selectable">False</property>
-                         <property name="xalign">0.5</property>
-                         <property name="yalign">0.5</property>
-                         <property name="xpad">0</property>
-                         <property name="ypad">5</property>
-                         <property 
name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                         <property name="width_chars">-1</property>
-                         <property name="single_line_mode">False</property>
-                         <property name="angle">0</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">12</property>
+
+                         <child>
+                           <widget class="GtkLabel" id="label55">
+                             <property name="visible">True</property>
+                             <property name="label" 
translatable="yes">&lt;b&gt;Available Content&lt;/b&gt;</property>
+                             <property name="use_underline">False</property>
+                             <property name="use_markup">True</property>
+                             <property 
name="justify">GTK_JUSTIFY_LEFT</property>
+                             <property name="wrap">False</property>
+                             <property name="selectable">False</property>
+                             <property name="xalign">0.5</property>
+                             <property name="yalign">0.5</property>
+                             <property name="xpad">0</property>
+                             <property name="ypad">5</property>
+                             <property 
name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkCheckButton" 
id="trackingCheckButton">
+                             <property name="visible">True</property>
+                             <property name="tooltip" 
translatable="yes">should GNUnet track available content (for publishing in 
namespaces)?</property>
+                             <property name="can_focus">True</property>
+                             <property 
name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <property name="active">False</property>
+                             <property name="inconsistent">False</property>
+                             <property name="draw_indicator">True</property>
+                             <signal name="toggled" 
handler="on_trackingCheckButton_toggled" object="trackingCheckButton" 
last_modification_time="Sun, 21 Aug 2005 02:47:48 GMT"/>
+
+                             <child>
+                               <widget class="GtkAlignment" id="alignment13">
+                                 <property name="visible">True</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xscale">0</property>
+                                 <property name="yscale">0</property>
+                                 <property name="top_padding">0</property>
+                                 <property name="bottom_padding">0</property>
+                                 <property name="left_padding">0</property>
+                                 <property name="right_padding">0</property>
+
+                                 <child>
+                                   <widget class="GtkHBox" id="hbox47">
+                                     <property name="visible">True</property>
+                                     <property 
name="homogeneous">False</property>
+                                     <property name="spacing">2</property>
+
+                                     <child>
+                                       <widget class="GtkImage" id="image29">
+                                         <property 
name="visible">True</property>
+                                         <property 
name="stock">gtk-justify-fill</property>
+                                         <property 
name="icon_size">4</property>
+                                         <property name="xalign">0.5</property>
+                                         <property name="yalign">0.5</property>
+                                         <property name="xpad">0</property>
+                                         <property name="ypad">0</property>
+                                       </widget>
+                                       <packing>
+                                         <property name="padding">0</property>
+                                         <property 
name="expand">False</property>
+                                         <property name="fill">False</property>
+                                       </packing>
+                                     </child>
+
+                                     <child>
+                                       <widget class="GtkLabel" id="label117">
+                                         <property 
name="visible">True</property>
+                                         <property name="label" 
translatable="yes">track available content</property>
+                                         <property 
name="use_underline">True</property>
+                                         <property 
name="use_markup">False</property>
+                                         <property 
name="justify">GTK_JUSTIFY_LEFT</property>
+                                         <property name="wrap">False</property>
+                                         <property 
name="selectable">False</property>
+                                         <property name="xalign">0.5</property>
+                                         <property name="yalign">0.5</property>
+                                         <property name="xpad">0</property>
+                                         <property name="ypad">0</property>
+                                         <property 
name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                         <property 
name="width_chars">-1</property>
+                                         <property 
name="single_line_mode">False</property>
+                                         <property name="angle">0</property>
+                                       </widget>
+                                       <packing>
+                                         <property name="padding">0</property>
+                                         <property 
name="expand">False</property>
+                                         <property name="fill">False</property>
+                                       </packing>
+                                     </child>
+                                   </widget>
+                                 </child>
+                               </widget>
+                             </child>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkButton" 
id="refreshContentListButton">
+                             <property name="visible">True</property>
+                             <property name="tooltip" 
translatable="yes">Refresh the available content list now (otherwise this is 
done automatically roughly every 5 minutes)</property>
+                             <property name="can_focus">True</property>
+                             <property name="label">gtk-refresh</property>
+                             <property name="use_stock">True</property>
+                             <property name="relief">GTK_RELIEF_NONE</property>
+                             <property name="focus_on_click">True</property>
+                             <signal name="clicked" 
handler="on_refreshContentListButton_clicked" last_modification_time="Sun, 21 
Aug 2005 03:29:32 GMT"/>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkButton" 
id="clearAvailableContentButton">
+                             <property name="visible">True</property>
+                             <property name="tooltip" 
translatable="yes">deletes the tracked available content shown below</property>
+                             <property name="can_focus">True</property>
+                             <property name="label">gtk-clear</property>
+                             <property name="use_stock">True</property>
+                             <property name="relief">GTK_RELIEF_NONE</property>
+                             <property name="focus_on_click">True</property>
+                             <signal name="clicked" 
handler="on_clearAvailableContentButton_clicked" last_modification_time="Sun, 
21 Aug 2005 02:49:49 GMT"/>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
                        </widget>
                        <packing>
                          <property name="type">label_item</property>

Modified: gnunet-gtk/src/plugins/fs/fs.c
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.c      2005-08-21 03:05:10 UTC (rev 1816)
+++ gnunet-gtk/src/plugins/fs/fs.c      2005-08-21 03:51:54 UTC (rev 1817)
@@ -118,8 +118,10 @@
 static void * shutdownCode(Semaphore * sig) {
   fs_download_stop();
   fs_search_stop();
-  FSUI_stop(ctx);
+  fs_collection_stop();
+  fs_namespace_stop();
   fs_upload_stop();
+  FSUI_stop(ctx);
   SEMAPHORE_UP(sig);
   return NULL;
 }
@@ -155,11 +157,6 @@
   Semaphore * sig;
   void * unused;
 
-  fs_upload_stop();
-  fs_download_stop();
-  fs_search_stop();
-  fs_namespace_stop();
-  fs_collection_stop();
   sig = SEMAPHORE_NEW(0);
   if (0 != PTHREAD_CREATE(&doneThread,
                          (PThreadMain)&shutdownCode,

Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c       2005-08-21 03:05:10 UTC (rev 
1816)
+++ gnunet-gtk/src/plugins/fs/namespace.c       2005-08-21 03:51:54 UTC (rev 
1817)
@@ -32,8 +32,8 @@
 #include "namespace.h"
 #include <extractor.h>
 
+#define UPDATE_CONTENT_LIST_FREQUENCY (5 * cronMINUTES)
 
-
 /**
  * @brief linked list of pages in the search notebook
  */
@@ -215,12 +215,35 @@
   return OK;
 }
 
+static void clearContentList(void * mdl) {
+  GtkTreeModel * model = GTK_TREE_MODEL(mdl);
+  struct ECRS_URI * uri;
+  struct ECRS_MetaData * meta;
+  GtkTreeIter iter;
+
+  if (gtk_tree_model_get_iter_first(model,
+                                   &iter)) {
+    do {       
+      gtk_tree_model_get(model,
+                        &iter,
+                        NAMESPACE_URI, &uri,
+                        NAMESPACE_META, &meta,
+                        -1);
+      ECRS_freeUri(uri);
+      ECRS_freeMetaData(meta);
+      
+    } while (gtk_list_store_remove(GTK_LIST_STORE(model),
+                                  &iter));
+  }  
+}
+
 /**
  * Update the list of the globally available content.
  */
 static void doUpdateContentList(void * unused) {
   GtkWidget * contentList;
   GtkTreeModel * model;
+
   contentList
     = glade_xml_get_widget(getMainXML(),
                           "availableContentList");
@@ -234,6 +257,10 @@
   gtkSaveCall(&doUpdateContentList, NULL);
 }
 
+void on_refreshContentListButton_clicked(gpointer dummy,
+                                        gpointer dummy1) {
+  updateContentList(NULL);
+}
 
 /**
  * Update the model that lists the content of a namespace:
@@ -817,13 +844,45 @@
   gtk_widget_destroy(dialog);      
 }
 
+void on_clearAvailableContentButton_clicked(GtkWidget * dummy1,
+                                           GtkWidget * dummy2) {
+  GtkWidget * contentList;
+  GtkTreeModel * model;
 
+  contentList
+    = glade_xml_get_widget(getMainXML(),
+                          "availableContentList");
+  model
+    = gtk_tree_view_get_model(GTK_TREE_VIEW(contentList));
+  FSUI_clearTrackedURIS();
+  gtkSaveCall(&clearContentList, model);
+  updateContentList(NULL);
+}
 
+void on_trackingCheckButton_toggled(GtkWidget * dummy1,
+                                   GtkWidget * dummy2) {
+  GtkWidget * trackCheckButton;
+
+  trackCheckButton
+    = glade_xml_get_widget(getMainXML(),
+                          "trackingCheckButton");
+  
FSUI_trackURIS(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(trackCheckButton))
 == TRUE ?
+                YES : NO);
+}
+
+
 void fs_namespace_start() {
   GtkWidget * contentList;
   GtkListStore * model;
   GtkCellRenderer * renderer;
+  GtkWidget * trackCheckButton;
 
+  trackCheckButton
+    = glade_xml_get_widget(getMainXML(),
+                          "trackingCheckButton");
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(trackCheckButton),
+                              FSUI_trackStatus() == YES ? TRUE : FALSE);
+
   contentList
     = glade_xml_get_widget(getMainXML(),
                           "availableContentList");
@@ -859,7 +918,7 @@
                                              NULL);    
   addCronJob(&updateContentList,
             0,
-            5 * cronMINUTES,
+            UPDATE_CONTENT_LIST_FREQUENCY,
             NULL);
   FSUI_listNamespaces(ctx,
                      YES,
@@ -867,7 +926,25 @@
                      NULL);
 }
 
-void fs_namespace_stop() {
+#if 0
+void on_availableContentList_destroy(GtkWidget * dummy1,
+                                    GtkWidget * dummy2) {
+  GtkWidget * contentList;
+  GtkTreeModel * model;
+
+  delCronJob(&updateContentList,
+            UPDATE_CONTENT_LIST_FREQUENCY,
+            NULL);
+  contentList
+    = glade_xml_get_widget(getMainXML(),
+                          "availableContentList");
+  model
+    = gtk_tree_view_get_model(GTK_TREE_VIEW(contentList));
+  clearContentList(model);
+}
+
+void on_localNamespacesNotebook_destroy(GtkWidget * dummy1,
+                                       GtkWidget * dummy2) {
   NamespaceList * pos;
   GtkTreeIter iter;
   struct ECRS_URI * u;
@@ -877,9 +954,9 @@
     pos = head->next;
     FREE(head->name);
     ECRS_freeMetaData(head->meta);
-
-  if (gtk_tree_model_get_iter_first(head->model,
-                                   &iter)) {
+    
+    if (gtk_tree_model_get_iter_first(head->model,
+                                     &iter)) {
       do {
        gtk_tree_model_get(head->model,
                           &iter,
@@ -901,10 +978,10 @@
     FREE(head);
     head = pos;
   }
+}
+#endif
 
-  delCronJob(&updateContentList,
-            5 * cronMINUTES,
-            NULL);
+void fs_namespace_stop() {
 }
 
 /* end of namespace.c */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]