gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2701 - in gnunet-gtk/src: include plugins/fs


From: grothoff
Subject: [GNUnet-SVN] r2701 - in gnunet-gtk/src: include plugins/fs
Date: Sun, 30 Apr 2006 20:53:43 -0700 (PDT)

Author: grothoff
Date: 2006-04-30 20:53:39 -0700 (Sun, 30 Apr 2006)
New Revision: 2701

Modified:
   gnunet-gtk/src/include/gnunetgtk_common.h
   gnunet-gtk/src/plugins/fs/download.c
   gnunet-gtk/src/plugins/fs/meta.c
   gnunet-gtk/src/plugins/fs/namespace.c
   gnunet-gtk/src/plugins/fs/search.c
   gnunet-gtk/src/plugins/fs/upload.c
Log:
fixing Mantis 1064

Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h   2006-04-30 21:28:51 UTC (rev 
2700)
+++ gnunet-gtk/src/include/gnunetgtk_common.h   2006-05-01 03:53:39 UTC (rev 
2701)
@@ -27,6 +27,19 @@
 #ifndef GTKUI_HELPER_H
 #define GTKUI_HELPER_H
 
+#define DEBUG_GTK 0
+
+#if DEBUG_GTK
+#define DEBUG_BEGIN() fprintf(stderr, "BEGIN of %s\n", __FUNCTION__)
+#define DEBUG_MARK() fprintf(stderr, "AT %s:%d\n", __FILE__, __LINE__)
+#define DEBUG_END() fprintf(stderr, "END of %s\n", __FUNCTION__)
+#else
+#define DEBUG_BEGIN()
+#define DEBUG_MARK()
+#define DEBUG_END()
+#endif
+
+
 void initGNUnetGTKCommon(void * callback);
 
 void shutdownPlugins(void);

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2006-04-30 21:28:51 UTC (rev 
2700)
+++ gnunet-gtk/src/plugins/fs/download.c        2006-05-01 03:53:39 UTC (rev 
2701)
@@ -58,6 +58,7 @@
 
   if (isRoot == YES)
     return OK;
+  DEBUG_BEGIN();
   FSUI_trackURI(fi);
   pos = head;
   while (pos != NULL) {
@@ -100,6 +101,7 @@
                          fi->uri,
                          fi->meta);
   }
+  DEBUG_END();
   return OK;
 }
 
@@ -128,6 +130,7 @@
   char *filehash;
 #endif
 
+  DEBUG_BEGIN();
   uri = NULL;
   meta = NULL;
   name = NULL;
@@ -332,6 +335,7 @@
                      anon,
                      uri,
                      final_download_destination);
+  DEBUG_END();
 }
 
 void on_downloadButton_clicked(GtkWidget * treeview,
@@ -358,7 +362,7 @@
   struct ECRS_URI * u;
   struct ECRS_MetaData * meta;
 
-
+  DEBUG_BEGIN();
   if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
                                     &iter)) {
     do {
@@ -391,6 +395,7 @@
                      (void*)uri);
   if (meta != NULL)
     ECRS_freeMetaData(meta);
+  DEBUG_END();
 }
 
 /**
@@ -403,6 +408,7 @@
   struct ECRS_MetaData * meta;
   DownloadList * pos;
 
+  DEBUG_BEGIN();
   LOG(LOG_DEBUG,
       "Download '%s' complete\n",
       filename);
@@ -454,6 +460,7 @@
       }
     }
   }
+  DEBUG_END();
 }
 
 static int delDownloadView(void * cls,
@@ -469,6 +476,7 @@
   char * fn;
   struct ECRS_URI * u;
 
+  DEBUG_BEGIN();
   if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
                                     &iter)) {
     do {
@@ -490,6 +498,7 @@
     } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
                                       &iter));
   }
+  DEBUG_END();
   return OK;
 }
 
@@ -538,6 +547,7 @@
   GtkTreeSelection * selection;
   GtkWidget * downloadList;
 
+  DEBUG_BEGIN();
   downloadList = glade_xml_get_widget(getMainXML(),
                                       "activeDownloadsList");
   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
@@ -545,6 +555,7 @@
     (selection,
      (GtkTreeSelectionForeachFunc) &abortDownloadCallback,
      NULL);
+  DEBUG_END();
 }
 
 static int addDownloadView(void * cls,
@@ -560,6 +571,7 @@
   char * uriname;
   const char * sname;
 
+  DEBUG_BEGIN();
   if (filesize != 0)
     progress = bytesCompleted * 100 / filesize;
   else
@@ -585,6 +597,7 @@
                      DOWNLOAD_TREEPATH, NULL,
                      -1);
   FREE(uriname);
+  DEBUG_END();
   return OK;
 }
 
@@ -595,7 +608,7 @@
   GtkTreeViewColumn * column;
   int col;
 
-
+  DEBUG_BEGIN();
   downloadList = glade_xml_get_widget(getMainXML(),
                                       "activeDownloadsList");
   summary =
@@ -664,6 +677,7 @@
                      NULL,
                      &addDownloadView,
                      NULL);
+  DEBUG_END();
 }
 
 
@@ -673,6 +687,7 @@
   DownloadList * pos;
   char *dirPath;
 
+  DEBUG_BEGIN();
   /* free URIs in summary model */
   if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
                                       &iter))
@@ -700,6 +715,7 @@
     FREE(head);
     head = pos;
   }
+  DEBUG_END();
 }
 
 

Modified: gnunet-gtk/src/plugins/fs/meta.c
===================================================================
--- gnunet-gtk/src/plugins/fs/meta.c    2006-04-30 21:28:51 UTC (rev 2700)
+++ gnunet-gtk/src/plugins/fs/meta.c    2006-05-01 03:53:39 UTC (rev 2701)
@@ -66,6 +66,7 @@
   GtkTreeViewColumn * column;
   int col;
 
+  DEBUG_BEGIN();
   metamodel
     = gtk_list_store_new(META_NUM,
                         G_TYPE_INT,
@@ -142,6 +143,7 @@
     }
     UNREF(loader);
   }
+  DEBUG_END();
 }
 
 static int publishKeyword(const char * data,
@@ -149,12 +151,14 @@
   GtkListStore * store = cls;
   GtkTreeIter iter;
 
+  DEBUG_BEGIN();
   gtk_list_store_append(store,
                        &iter);
   gtk_list_store_set(store,
                     &iter,
                     0, data,
                     -1);
+  DEBUG_END();
   return OK;
 }
 
@@ -166,6 +170,7 @@
   GtkCellRenderer * renderer;
   GtkTreeViewColumn * column;
   
+  DEBUG_BEGIN();
   keymodel
     = gtk_list_store_new(1,
                        G_TYPE_STRING);
@@ -191,6 +196,7 @@
     ECRS_getKeywordsFromUri(init,
                            &publishKeyword,
                            keymodel);
+  DEBUG_END();
 }
 
 void createMetaTypeComboBox(GladeXML * xml,
@@ -202,6 +208,7 @@
   GtkTreeIter iter;
   EXTRACTOR_KeywordType type;
 
+  DEBUG_BEGIN();
   keywordTypeModel
     = gtk_list_store_new(KTYPE_NUM,
                         G_TYPE_STRING,
@@ -229,6 +236,7 @@
                                "text", KTYPE_STRING);
   gtk_combo_box_set_active(GTK_COMBO_BOX(metaType),
                           0);
+  DEBUG_END();
 }
 
 void handleKeywordListUpdate(GladeXML * xml,
@@ -240,6 +248,7 @@
   GtkListStore * keymodel;
   GtkTreeIter iter;
 
+  DEBUG_BEGIN();
   keywordList = glade_xml_get_widget(xml,
                                     keywordListName);
   keymodel
@@ -255,6 +264,7 @@
                     0, keyword,
                     -1);
   gtk_entry_set_text(GTK_ENTRY(entryLine), "");
+  DEBUG_END();
 }
 
 void handleMetaDataListUpdate(GladeXML * xml,                  
@@ -271,6 +281,7 @@
   GtkTreeIter iter;
   char * stype;
 
+  DEBUG_BEGIN();
   metaList = glade_xml_get_widget(xml,
                                  metaDataListName);
   metamodel
@@ -302,6 +313,7 @@
                     META_VALUE, value,
                     -1);
   gtk_entry_set_text(GTK_ENTRY(entryLine), "");
+  DEBUG_END();
 }
 
 struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml,
@@ -316,6 +328,7 @@
   GdkPixbuf * pixbuf;
   char * mvalue;
 
+  DEBUG_BEGIN();
   metaList = glade_xml_get_widget(xml,
                                  name);
   metamodel = gtk_tree_view_get_model(GTK_TREE_VIEW(metaList));
@@ -366,6 +379,7 @@
       }
     }
   }
+  DEBUG_END();
   return meta;
 }
 
@@ -380,6 +394,7 @@
   unsigned int kpos;
   unsigned int ksize;
 
+  DEBUG_BEGIN();
   keyList = GTK_TREE_VIEW(glade_xml_get_widget(xml,
                                               name));
   keymodel = gtk_tree_view_get_model(keyList);
@@ -413,6 +428,7 @@
   GROW(keywords,
        ksize,
        0);
+  DEBUG_END();
   return keywordURI;
 }
 

Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c       2006-04-30 21:28:51 UTC (rev 
2700)
+++ gnunet-gtk/src/plugins/fs/namespace.c       2006-05-01 03:53:39 UTC (rev 
2701)
@@ -63,6 +63,7 @@
   GtkTreeViewColumn * column;
   int col;
 
+  DEBUG_BEGIN();
   namespaceXML
     = glade_xml_new(getGladeFileName(),
                    "namespaceContentFrame",
@@ -227,6 +228,7 @@
                       child);
   gtk_widget_destroy(window);
   UNREF(namespaceXML);
+  DEBUG_END();
 
   return child;
 }
@@ -247,6 +249,7 @@
   char * uriString;
   unsigned long long size;
 
+  DEBUG_BEGIN();
   if (gtk_tree_model_get_iter_first(model,
                                    &iter)) {
     do {       
@@ -298,6 +301,7 @@
                     -1);
   FREE(filename);
   FREE(uriString);
+  DEBUG_END();
   return OK;
 }
 
@@ -307,6 +311,7 @@
   struct ECRS_MetaData * meta;
   GtkTreeIter iter;
 
+  DEBUG_BEGIN();
   if (gtk_tree_model_get_iter_first(model,
                                    &iter)) {
     do {       
@@ -325,6 +330,7 @@
     } while (gtk_list_store_remove(GTK_LIST_STORE(model),
                                   &iter));
   }
+  DEBUG_END();
 }
 
 /**
@@ -334,6 +340,7 @@
   GtkWidget * contentList;
   GtkTreeModel * model;
 
+  DEBUG_BEGIN();
   contentList
     = glade_xml_get_widget(getMainXML(),
                           "availableContentList");
@@ -341,6 +348,7 @@
     = gtk_tree_view_get_model(GTK_TREE_VIEW(contentList));
   FSUI_listURIs(&updateView,
                model);
+  DEBUG_END();
 }
 
 static void updateContentList(void * unused) {
@@ -382,6 +390,7 @@
   char * date;
   unsigned long long size;
 
+  DEBUG_BEGIN();
   filename = ECRS_getFirstFromMetaData(fi->meta,
                                       EXTRACTOR_FILENAME,
                                       EXTRACTOR_TITLE,
@@ -454,7 +463,7 @@
   FREE(freq);
   FREE(date);
   FREE(mime);
-
+  DEBUG_END();
   return OK;
 }
 
@@ -472,6 +481,7 @@
   GtkWidget * notebook;
   GtkListStore * model;
 
+  DEBUG_BEGIN();
   label = gtk_label_new(namespaceName);
   list = MALLOC(sizeof(NamespaceList));
   list->name = STRDUP(namespaceName);
@@ -502,6 +512,7 @@
      namespaceName,
      &addNamespaceContentToModel,
      model);
+  DEBUG_END();
   return OK;
 }
 
@@ -532,6 +543,7 @@
   HashCode512 namespaceId;
   HashCode512 rootEntry;
 
+  DEBUG_BEGIN();
   metaXML
     = glade_xml_new(getGladeFileName(),
                    "namespaceMetaDataDialog",
@@ -609,6 +621,7 @@
   gtk_widget_destroy(dialog);
   UNREF(metaXML);
   metaXML = NULL;
+  DEBUG_END();
 }
 
 void namespaceDelete_clicked(GtkWidget * dummy1,
@@ -621,6 +634,7 @@
   GtkWidget * dialog;
   gint ret;
 
+  DEBUG_BEGIN();
   notebook
     = glade_xml_get_widget(getMainXML(),
                           "localNamespacesNotebook");
@@ -680,6 +694,7 @@
   FREE(list->name);
   ECRS_freeMetaData(list->meta);
   FREE(list);
+  DEBUG_END();
 }
 
 typedef struct {
@@ -708,6 +723,7 @@
   NamespaceList * list;
   ECRS_FileInfo fi;
 
+  DEBUG_BEGIN();
   dst = NULL;
   meta = cls->meta;
   gtk_tree_model_get(model,
@@ -758,6 +774,7 @@
                _("Failed to insert content into namespace "
                  "(consult logs).\n"));
   }
+  DEBUG_END();
 }
 
 void on_namespaceInsertMetaDataDialogMetaDataAddButton_clicked(GtkWidget * 
dummy1,
@@ -784,6 +801,7 @@
   gint num;
   GtkTreeIter iter;
 
+  DEBUG_BEGIN();
   contentList
     = glade_xml_get_widget(getMainXML(),
                           "availableContentList");
@@ -902,6 +920,7 @@
   gtk_widget_destroy(dialog);
   UNREF(metaXML);
   metaXML = NULL;
+  DEBUG_END();
 }
 
 void on_namespaceUpdateButton_clicked(GtkWidget * dummy1,
@@ -927,6 +946,7 @@
   const char * next;
   const char * freq;
 
+  DEBUG_BEGIN();
   contentList
     = glade_xml_get_widget(getMainXML(),
                           "availableContentList");
@@ -1122,6 +1142,7 @@
   gtk_widget_destroy(dialog);
   UNREF(metaXML);
   metaXML = NULL;
+  DEBUG_END();
 }
 
 void on_clearAvailableContentButton_clicked(GtkWidget * dummy1,
@@ -1129,6 +1150,7 @@
   GtkWidget * contentList;
   GtkTreeModel * model;
 
+  DEBUG_BEGIN();
   contentList
     = glade_xml_get_widget(getMainXML(),
                           "availableContentList");
@@ -1137,6 +1159,7 @@
   FSUI_clearTrackedURIS();
   gtkSaveCall(&clearContentList, model);
   updateContentList(NULL);
+  DEBUG_END();
 }
 
 void on_trackingCheckButton_toggled(GtkWidget * dummy1,
@@ -1159,6 +1182,7 @@
   GtkTreeViewColumn * column;
   int col;
 
+  DEBUG_BEGIN();
   trackCheckButton
     = glade_xml_get_widget(getMainXML(),
                           "trackingCheckButton");
@@ -1234,6 +1258,7 @@
                      YES,
                      &addTabForNamespace,
                      NULL);
+  DEBUG_END();
 }
 
 #if 0

Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c  2006-04-30 21:28:51 UTC (rev 2700)
+++ gnunet-gtk/src/plugins/fs/search.c  2006-05-01 03:53:39 UTC (rev 2701)
@@ -70,7 +70,8 @@
   GdkPixbuf * pixbuf;
   GdkPixbufLoader * loader;
   unsigned long long size;
-
+  
+  DEBUG_BEGIN();
   mime = ECRS_getFromMetaData(meta,
                              EXTRACTOR_MIMETYPE);
   if (mime == NULL)
@@ -99,9 +100,9 @@
                                   EXTRACTOR_PRODUCER,
                                   EXTRACTOR_UNKNOWN,
                                   -1);
-  if (name == NULL)
+  if (name == NULL) {
     name = STRDUP(_("no name given"));
-  else {
+  } else {
     char * dotdot;
     
     while (NULL != (dotdot = strstr(name, "..")))
@@ -126,7 +127,8 @@
     pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
     gdk_pixbuf_loader_close(loader,
                            NULL);
-    g_object_ref(pixbuf);
+    if (pixbuf != NULL)
+      g_object_ref(pixbuf);
     UNREF(loader);
   } else {
     pixbuf = NULL;
@@ -146,6 +148,7 @@
   FREE(desc);
   FREE(name);
   FREENONNULL(thumb);
+  DEBUG_END();
 }
                        
 
@@ -212,6 +215,7 @@
   int rating;
   int newrating;
 
+  DEBUG_BEGIN();
   spin
     = glade_xml_get_widget(getMainXML(),
                           "namespaceRatingSpinButton");
@@ -259,6 +263,7 @@
     gtk_widget_set_sensitive(spin,
                             FALSE);
   }
+  DEBUG_END();
 }
 
 /**
@@ -280,6 +285,7 @@
   HashCode512 root;
   EncName enc;
 
+  DEBUG_BEGIN();
   spin
     = glade_xml_get_widget(getMainXML(),
                           "namespaceRatingSpinButton");
@@ -328,7 +334,7 @@
     gtk_widget_set_sensitive(spin,
                             FALSE);
   }
-
+  DEBUG_END();
 }
 
 void on_searchResults_destroy(GtkWidget * dummy,
@@ -361,6 +367,7 @@
   GtkTreeIter * pparent;
   GtkTreePath * path;
 
+  DEBUG_BEGIN();
   if (! gtk_tree_row_reference_valid(row))
     path = NULL;
   else
@@ -383,6 +390,7 @@
                       &iter,
                       info->uri,
                       info->meta);
+  DEBUG_END();
 }
 
 /**
@@ -401,6 +409,7 @@
   unsigned int count;
   GtkTreeIter iter;
 
+  DEBUG_BEGIN();
   list = head;
   while (list != NULL) {
     if (ECRS_equalsUri(list->uri,
@@ -435,6 +444,7 @@
                         &iter,
                         SER_SUM_COUNT, count,
                         -1);
+      DEBUG_END();
       return;
     }
 
@@ -445,8 +455,11 @@
 
 static void * stopSearch(void * u) {
   struct ECRS_URI * uri = u;
+
+  DEBUG_BEGIN();
   FSUI_stopSearch(ctx,
                  uri);
+  DEBUG_END();
   return NULL;
 }
 
@@ -456,6 +469,7 @@
   struct ECRS_MetaData * m;
   GtkTreeIter iter;
 
+  DEBUG_BEGIN();
   if (gtk_tree_model_iter_children(model,
                                   &iter,
                                   parent)) {
@@ -478,6 +492,7 @@
     } while (gtk_tree_model_iter_next(model,
                                      &iter));
   }  
+  DEBUG_END();
 }
 
 static void closeSearchPage(SearchList * list) {
@@ -487,6 +502,7 @@
   GtkTreeIter iter;
   struct ECRS_URI * euri;
 
+  DEBUG_BEGIN();
   notebook
     = glade_xml_get_widget(getMainXML(),
                           "downloadNotebook");
@@ -524,6 +540,7 @@
       ECRS_freeUri(euri);
       ECRS_freeUri(list->uri);
       list->uri = NULL;
+      DEBUG_END();
       return;
     }
   } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
@@ -538,6 +555,7 @@
   SearchList * list;
   SearchList * prev;
 
+  DEBUG_BEGIN();
   list = head;
   prev = NULL;
   while (list != NULL) {
@@ -557,6 +575,7 @@
                      list->uri);
   closeSearchPage(list);
   FREE(list);
+  DEBUG_END();
 }
 
 static GtkWidget * makeResultFrame(GtkWidget ** treeview,
@@ -570,6 +589,7 @@
   GladeXML * searchXML;
   int col;
 
+  DEBUG_BEGIN();
   searchXML
     = glade_xml_new(getGladeFileName(),
                    "searchResultsFrame",
@@ -690,7 +710,7 @@
                       child);
   gtk_widget_destroy(window);
   UNREF(searchXML);
-
+  DEBUG_END();
   return child;
 }
 
@@ -715,6 +735,7 @@
   SearchList * list;
   const char * descStr;
 
+  DEBUG_BEGIN();
   searchKeywordGtkCB
     = glade_xml_get_widget(getMainXML(),
                           "fssearchKeywordComboBoxEntry");
@@ -857,6 +878,7 @@
                                     "searchAnonymitySelectionSpinButton"),
                   uri);
   FREE(tabtxt);
+  DEBUG_END();
 }
 
 static int addNamespace(void * arg,
@@ -872,6 +894,7 @@
   char * desc;
   size_t n;
 
+  DEBUG_BEGIN();
   hash2enc(namespaceId,
           &enc);
   if (md == NULL) {
@@ -914,6 +937,7 @@
                     NS_SEARCH_RATING, rating,
                     -1);
   FREE(name);
+  DEBUG_END();
   return OK;
 }
 
@@ -980,6 +1004,7 @@
   GtkTreeIter iter;
   int i;
 
+  DEBUG_BEGIN();
   description = ECRS_uriToString(uri);
   if (description == NULL) {
     BREAK();
@@ -1033,6 +1058,7 @@
                           list->treeview,
                           NULL);
   }
+  DEBUG_END();
   return OK;
 }
 
@@ -1044,6 +1070,7 @@
   GtkTreeViewColumn * column;
   int col;
 
+  DEBUG_BEGIN();
   searchCB
     = glade_xml_get_widget(getMainXML(),
                           "fssearchKeywordComboBoxEntry");
@@ -1109,6 +1136,7 @@
   FSUI_listSearches(ctx,
                    &openTabForSearch,
                    NULL);
+  DEBUG_END();
 }
 
 void fs_search_stop() {

Modified: gnunet-gtk/src/plugins/fs/upload.c
===================================================================
--- gnunet-gtk/src/plugins/fs/upload.c  2006-04-30 21:28:51 UTC (rev 2700)
+++ gnunet-gtk/src/plugins/fs/upload.c  2006-05-01 03:53:39 UTC (rev 2701)
@@ -60,6 +60,7 @@
   int progress;
   char * name;
 
+  DEBUG_BEGIN();
   if (total != 0)
     progress = 100 * completed / total;
   else
@@ -143,6 +144,7 @@
                       UPLOAD_URISTRING, NULL,
                       -1);
   }
+  DEBUG_END();
 }
 
 /**
@@ -155,8 +157,8 @@
   char * name;
   char * us;
 
+  DEBUG_BEGIN();
   us = ECRS_uriToString(uri);
-
   if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
                                    &iter)) {
     do {       
@@ -241,6 +243,7 @@
                       -1);
   }
   FREE(us);
+  DEBUG_END();
 }
 
 
@@ -295,6 +298,7 @@
   struct ECRS_URI * keywordURI;
   struct ECRS_URI * gkeywordURI;
 
+  DEBUG_BEGIN();
   extractors = EXTRACTOR_loadDefaultLibraries();
   config = getConfigurationString("FS",
                                  "EXTRACTORS");
@@ -397,6 +401,7 @@
   gtk_widget_destroy (dialog);
   UNREF(metaXML);
   metaXML = NULL;
+  DEBUG_END();
 }
 
 static char * selectFile() {





reply via email to

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