add hook for statusbar logging
authorColin Leroy <colin@colino.net>
Sun, 8 Dec 2002 11:37:28 +0000 (11:37 +0000)
committerColin Leroy <colin@colino.net>
Sun, 8 Dec 2002 11:37:28 +0000 (11:37 +0000)
ChangeLog.claws
configure.in
src/common/log.c
src/common/log.h
src/statusbar.c

index 20a3d52a6047fb1c7ca14cb160d3341f0fb70431..f26e750ff4b4caf9f1b309990161354fc8dad48d 100644 (file)
@@ -1,3 +1,11 @@
+2002-12-08 [colin]     0.8.6claws73
+
+       * src/statusbar.c
+         src/common/log.h
+               Register a hook for statusbar_puts_all
+       * src/common/log.c
+               invoke statusbar_puts_all's hook
+       
 2002-12-08 [colin]     0.8.6claws72
 
        * src/ssl_certificate.c
index f6d0237be1f39a0859ac6daf3d1d9ac0415f6f2a..efd68a63c38ce7a89609527b208139d39b8c06a8 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws72
+EXTRA_VERSION=claws73
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index e9cdc268894ef0f61049c29000c7c37fb09bc348..a26470de8c76370a7c208ed7b25a17e54b2e0a30 100644 (file)
@@ -81,11 +81,10 @@ void log_print(const gchar *format, ...)
                fputs(buf, log_fp);
                fflush(log_fp);
        }
-/*     FIXME:
-       callback for gui logging
 
+       logtext.text = buf + TIME_LEN;
        if (log_verbosity_count)
-               statusbar_puts_all(buf + TIME_LEN); */
+               hooks_invoke(STATUSBAR_PUTS_ALL_HOOKLIST, &logtext);
 }
 
 void log_message(const gchar *format, ...)
@@ -112,10 +111,9 @@ void log_message(const gchar *format, ...)
                fputs(buf + TIME_LEN, log_fp);
                fflush(log_fp);
        }
-/*     FIXME:
-       callback for gui logging
 
-       statusbar_puts_all(buf + TIME_LEN); */
+       logtext.text = buf + TIME_LEN;
+       hooks_invoke(STATUSBAR_PUTS_ALL_HOOKLIST, &logtext);
 }
 
 void log_warning(const gchar *format, ...)
index 6ce345eab7b9a8c0ce7057b025fc4c6c516eca8d..e9d6b6d7ccdbf879450b5cf6f66b2fd10459dc8c 100644 (file)
@@ -27,6 +27,7 @@
 #include <glib.h>
 
 #define LOG_APPEND_TEXT_HOOKLIST "log_append_text"
+#define STATUSBAR_PUTS_ALL_HOOKLIST "statusbar_puts_all"
 
 typedef enum
 {
index df55616a948f5ba64a3b5cf0c080744f78591cce..6cb3e789728d2034a1bf9b9d9a570054b9f4d5d6 100644 (file)
 #include "statusbar.h"
 #include "gtkutils.h"
 #include "utils.h"
+#include "log.h"
+#include "hooks.h"
 
 #define BUFFSIZE 1024
 
 static GList *statusbar_list = NULL;
+void statusbar_puts_all_hook (gpointer source, gpointer data);
 
 GtkWidget *statusbar_create(void)
 {
        GtkWidget *statusbar;
 
        statusbar = gtk_statusbar_new();
+       
+       if(statusbar_list == NULL)
+               hooks_register_hook(STATUSBAR_PUTS_ALL_HOOKLIST, statusbar_puts_all_hook, NULL);
+
        statusbar_list = g_list_append(statusbar_list, statusbar);
 
        return statusbar;
 }
 
+void statusbar_puts_all_hook (gpointer source, gpointer data)
+{
+       LogText *logtext = (LogText *) source;
+       statusbar_puts_all(logtext->text);
+}
+
 void statusbar_puts(GtkStatusbar *statusbar, const gchar *str)
 {
        gint cid;