[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4914 - in gnunet-gtk: . src/common src/core src/include sr
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4914 - in gnunet-gtk: . src/common src/core src/include src/plugins/fs |
Date: |
Sun, 3 Jun 2007 17:59:49 -0600 (MDT) |
Author: grothoff
Date: 2007-06-03 17:59:48 -0600 (Sun, 03 Jun 2007)
New Revision: 4914
Removed:
gnunet-gtk/src/plugins/fs/search_namespace.c
Modified:
gnunet-gtk/TODO
gnunet-gtk/gnunet-gtk.glade
gnunet-gtk/src/common/helper.c
gnunet-gtk/src/common/logging.c
gnunet-gtk/src/core/main.c
gnunet-gtk/src/include/gnunetgtk_common.h
gnunet-gtk/src/plugins/fs/namespace_search.c
Log:
fixing logging, also doing mantis 1040
Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO 2007-06-03 23:17:21 UTC (rev 4913)
+++ gnunet-gtk/TODO 2007-06-03 23:59:48 UTC (rev 4914)
@@ -6,14 +6,12 @@
0.7.2 (goal: re-enable all 0.7.0 features):
- create custom gtk logger (via memory logger?) [see also #1027]
- => currently, "infoMessage" opens a window that cannot be closed
- and that does not have a frame!!! [RC]
-- test namespace search
+- test namespace search (gnunetd currently prints 0000-query WARNING
+ when NS operations are done...)
0.7.3 (goal: polish):
- #1045: ability to pause a search => requires FSUI changes! [RC]
-- #1040: announce newly found namespaces to user [RC]
- improve collection handling [RC]
+ show content of current collection somewhere
+ does it make sense to have "no update" for collections?
Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2007-06-03 23:17:21 UTC (rev 4913)
+++ gnunet-gtk/gnunet-gtk.glade 2007-06-03 23:59:48 UTC (rev 4914)
@@ -6436,18 +6436,18 @@
<property name="height_request">300</property>
<property agent="glademm" name="cxx_visibility">public</property>
<property name="title" translatable="yes">Messages</property>
- <property name="type">GTK_WINDOW_POPUP</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="icon_name">gtk-dialog-info</property>
<property name="decorated">True</property>
- <property name="skip_taskbar_hint">True</property>
- <property name="skip_pager_hint">True</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_SPLASHSCREEN</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
+ <property name="focus_on_map">False</property>
<property name="urgency_hint">False</property>
<child>
Modified: gnunet-gtk/src/common/helper.c
===================================================================
--- gnunet-gtk/src/common/helper.c 2007-06-03 23:17:21 UTC (rev 4913)
+++ gnunet-gtk/src/common/helper.c 2007-06-03 23:59:48 UTC (rev 4914)
@@ -186,7 +186,7 @@
module = g_module_open(NULL, 0);
if ( (module == NULL) ||
(TRUE != g_module_symbol(module,
- handler_name,
+ handler_name,
&method)) ) {
GE_LOG(ectx,
GE_WARNING | GE_DEVELOPER | GE_IMMEDIATE,
Modified: gnunet-gtk/src/common/logging.c
===================================================================
--- gnunet-gtk/src/common/logging.c 2007-06-03 23:17:21 UTC (rev 4913)
+++ gnunet-gtk/src/common/logging.c 2007-06-03 23:59:48 UTC (rev 4914)
@@ -37,6 +37,8 @@
static GladeXML * statusXML;
static void init() {
+ GtkWidget * button;
+
if (statusXML != NULL)
return;
statusXML
@@ -49,7 +51,23 @@
infoWindowTextView
= glade_xml_get_widget(statusXML,
"messageWindowTextView");
+ button
+ = glade_xml_get_widget(statusXML,
+ "messageWindowCloseButton");
connectGladeWithPlugins(statusXML);
+
+ g_signal_connect_data(infoWindow,
+ "delete-event",
+ G_CALLBACK(>k_widget_hide_on_delete),
+ NULL,
+ NULL,
+ 0);
+ g_signal_connect_data(button,
+ "clicked",
+ G_CALLBACK(>k_widget_hide_on_delete),
+ infoWindow,
+ NULL,
+ G_CONNECT_SWAPPED);
}
/**
@@ -61,12 +79,18 @@
} InfoMessage;
/**
+ * Do not track more than MAX messages
+ */
+#define MAX_LINES 1000
+
+/**
* Callback for infoMessage()
*/
static void * doInfoMessage(void * args) {
const InfoMessage * info = args;
GtkTextIter iter;
GtkTextBuffer * buffer;
+ GtkTextIter end;
init();
if (info->doPopup==YES)
@@ -78,6 +102,11 @@
&iter,
info->note,
-1);
+ if (gtk_text_buffer_get_line_count(buffer) >= MAX_LINES) {
+ gtk_text_buffer_get_iter_at_line(buffer, &iter, MAX_LINES-1);
+ gtk_text_buffer_get_iter_at_line(buffer, &end, MAX_LINES);
+ gtk_text_buffer_delete(buffer, &iter, &end);
+ }
return NULL;
}
@@ -142,7 +171,33 @@
g_free(note);
}
-void __attribute__ ((destructor)) gnunet_crypto_ltdl_fini() {
+static void ge_gtk_log_handler(void * ctx,
+ GE_KIND kind,
+ const char * date,
+ const char * msg) {
+ int popUp;
+
+ popUp = NO;
+ if ( (kind & (GE_FATAL | GE_ERROR | GE_WARNING)) > 0)
+ popUp = YES;
+ infoMessage(popUp,
+ "%s: %s",
+ date,
+ msg);
+}
+
+struct GE_Context * createGtkLogger(GE_KIND mask) {
+ struct GE_Context * myLog;
+
+ myLog = GE_create_context_callback(mask,
+ &ge_gtk_log_handler,
+ NULL,
+ NULL,
+ NULL);
+ return myLog;
+}
+
+void __attribute__ ((destructor)) gnunet_gtk_common_ltdl_fini() {
if (statusXML != NULL) {
gtk_widget_destroy(infoWindow);
infoWindow = NULL;
Modified: gnunet-gtk/src/core/main.c
===================================================================
--- gnunet-gtk/src/core/main.c 2007-06-03 23:17:21 UTC (rev 4913)
+++ gnunet-gtk/src/core/main.c 2007-06-03 23:59:48 UTC (rev 4914)
@@ -77,7 +77,10 @@
GtkWidget * root;
int i;
struct GE_Context * ectx;
+ struct GE_Context * my_ctx;
struct GC_Configuration * cfg;
+ char * log;
+ GE_KIND mask;
#if ENABLE_NLS
char * path;
#endif
@@ -116,6 +119,23 @@
initGNUnetGTKCommon(ectx,
cfg,
&gnunet_gtk_main_quit);
+ /* configure GTK logging */
+ GC_get_configuration_value_string(cfg,
+ "LOGGING",
+ "USER-LEVEL",
+ "WARNING",
+ &log);
+ mask = GE_getKIND(log);
+ FREE(log);
+ mask |= mask-1; /* set all bits... */
+ mask |= GE_USER | GE_BULK | GE_IMMEDIATE;
+ if (YES == GC_get_configuration_value_yesno(cfg,
+ "LOGGING",
+ "DEVELOPER",
+ NO))
+ mask |= GE_DEVELOPER | GE_REQUEST;
+ my_ctx = createGtkLogger(mask);
+ GE_setDefaultContext(my_ctx);
root
= glade_xml_get_widget(getMainXML(),
"mainWindow");
@@ -124,9 +144,7 @@
initTrayIcon();
#endif
gtk_widget_show(root);
-#if 0
- GE_setDefaultContext(customLog);
-#endif
+
/* start the event loop */
gdk_threads_enter();
@@ -136,6 +154,8 @@
gtk_main();
gdk_threads_leave();
+ GE_setDefaultContext(ectx);
+ GE_free_context(my_ctx);
doneGNUnetGTKCommon();
GNUNET_fini(ectx, cfg);
return 0;
Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h 2007-06-03 23:17:21 UTC (rev
4913)
+++ gnunet-gtk/src/include/gnunetgtk_common.h 2007-06-03 23:59:48 UTC (rev
4914)
@@ -78,6 +78,8 @@
* @param txt the log entry
*/
void addLogEntry(const char * txt, ...);
+
+struct GE_Context * createGtkLogger(GE_KIND mask);
/**
* Call a callback function from the mainloop/main thread ("SaveCall").
@@ -122,18 +124,18 @@
char * validate_utf8(char * msg);
/**
-* Gtk callback to save the main window state (tray icon use)
-*/
+ * Gtk callback to save the main window state (tray icon use)
+ */
void saveMainWindowState(GtkWidget *main_window,
GdkEventWindowState *event,
gpointer user_data);
/**
-* Get the last main window state when restoring (tray icon use)
-*/
-GdkWindowState getMainWindowState();
+ * Get the last main window state when restoring (tray icon use)
+ */
+GdkWindowState getMainWindowState(void);
-void gnunet_gtk_main_quit();
+void gnunet_gtk_main_quit(void);
/**
* Start gnunet-setup, asking for a password if needed
Modified: gnunet-gtk/src/plugins/fs/namespace_search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace_search.c 2007-06-03 23:17:21 UTC
(rev 4913)
+++ gnunet-gtk/src/plugins/fs/namespace_search.c 2007-06-03 23:59:48 UTC
(rev 4914)
@@ -242,6 +242,11 @@
desc,
20,
&enc);
+ infoMessage(YES,
+ _("Namespace found: %s - %.*s\n"),
+ desc,
+ 20,
+ &enc);
gtk_list_store_append(model,
&iter);
gtk_list_store_set(model,
Deleted: gnunet-gtk/src/plugins/fs/search_namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search_namespace.c 2007-06-03 23:17:21 UTC
(rev 4913)
+++ gnunet-gtk/src/plugins/fs/search_namespace.c 2007-06-03 23:59:48 UTC
(rev 4914)
@@ -1,135 +0,0 @@
-/*
- This file is part of GNUnet.
- (C) 2005, 2006, 2007 Christian Grothoff (and other contributing authors)
-
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file src/plugins/fs/search.c
- * @brief code for searching with gnunet-gtk
- * @author Christian Grothoff
- */
-
-
-static int addNamespace(void * arg,
- const char * namespaceName,
- const HashCode512 * namespaceId,
- const struct ECRS_MetaData * md,
- int rating) {
- GtkListStore * model = arg;
- GtkTreeIter iter;
- EncName enc;
- char * name;
- struct ECRS_MetaData * dmd;
- char * desc;
- size_t n;
-
- DEBUG_BEGIN();
- hash2enc(namespaceId,
- &enc);
- if (md == NULL) {
- dmd = NULL;
- desc = STRDUP("");
- } else {
- dmd = ECRS_dupMetaData(md);
- desc = ECRS_getFirstFromMetaData(md,
- EXTRACTOR_DESCRIPTION,
- EXTRACTOR_TITLE,
- EXTRACTOR_AUTHOR,
- EXTRACTOR_GENRE,
- EXTRACTOR_SUBJECT,
- EXTRACTOR_CREATOR,
- EXTRACTOR_PRODUCER,
- EXTRACTOR_GROUP,
- EXTRACTOR_CREATED_FOR,
- EXTRACTOR_SUMMARY,
- EXTRACTOR_OWNER,
- -1);
- if (desc == NULL)
- desc = STRDUP("");
- }
-
- n = strlen(desc) + 64;
- name = MALLOC(n);
- SNPRINTF(name,
- n,
- "%s: %*.s",
- desc,
- 20,
- &enc);
- gtk_list_store_append(model,
- &iter);
- gtk_list_store_set(model,
- &iter,
- NS_SEARCH_DESCRIPTION, name,
- NS_SEARCH_ENCNAME, &enc,
- NS_SEARCH_METADATA, dmd,
- NS_SEARCH_RATING, rating,
- -1);
- FREE(name);
- DEBUG_END();
- return OK;
-}
-
-#if 0
-/**
- * cron job that periodically updates the model for the
- * namespace selection in the search vbox.
- *
- * FIXME: replace with callback!
- */
-static void updateNCBModelSafe(void * unused) {
- GtkWidget * searchNamespaceCB;
- GtkListStore * model;
- GtkTreeIter iter;
-
- model = gtk_list_store_new(NS_SEARCH_NUM,
- G_TYPE_STRING, /* what we show */
- G_TYPE_STRING, /* EncName of namespace */
- G_TYPE_POINTER,
- G_TYPE_INT); /* Meta-data about namespace */
- gtk_list_store_append(model,
- &iter);
- gtk_list_store_set(model,
- &iter,
- NS_SEARCH_DESCRIPTION, _("globally"),
- NS_SEARCH_ENCNAME, NULL,
- NS_SEARCH_METADATA, NULL,
- NS_SEARCH_RATING, 0,
- -1);
- NS_listNamespaces(ectx,
- cfg,
- NO,
- &addNamespace,
- model);
- searchNamespaceCB
- = glade_xml_get_widget(getMainXML(),
- "searchNamespaceComboBoxEntry");
- gtk_combo_box_set_model(GTK_COMBO_BOX(searchNamespaceCB),
- GTK_TREE_MODEL(model));
- if
(gtk_combo_box_entry_get_text_column(GTK_COMBO_BOX_ENTRY(searchNamespaceCB)) ==
-1)
- gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(searchNamespaceCB),
- 0);
- if (-1 == gtk_combo_box_get_active(GTK_COMBO_BOX(searchNamespaceCB)))
- gtk_combo_box_set_active(GTK_COMBO_BOX(searchNamespaceCB),
- 0);
-}
-
-static void updateNCBModel(void * dummy) {
- gtkSaveCall(&updateNCBModelSafe, NULL);
-}
-#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4914 - in gnunet-gtk: . src/common src/core src/include src/plugins/fs,
gnunet <=