aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk_log.c')
-rw-r--r--src/conversation/gnunet-conversation-gtk_log.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_log.c b/src/conversation/gnunet-conversation-gtk_log.c
new file mode 100644
index 00000000..a77954af
--- /dev/null
+++ b/src/conversation/gnunet-conversation-gtk_log.c
@@ -0,0 +1,94 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010-2014 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/conversation/gnunet-conversation-gtk_log.c
23 * @brief logging-related functions for gnunet-conversation-gtk
24 * @author yids
25 * @author hark
26 * @author Christian Grothoff
27 */
28#include "gnunet-conversation-gtk.h"
29#include "gnunet-conversation-gtk_log.h"
30
31
32/**
33 * Log a message to gtk log textbuffer
34 *
35 * @param message format string for message to be logged
36 * @param ... arguments for the format string
37 */
38void
39GCG_log (const char *message,
40 ...)
41{
42 GtkTextBuffer *logbuff;
43 GtkTextView *log_view;
44 GtkTextIter iter;
45 gchar *fmsg;
46 va_list ap;
47
48 log_view = GTK_TEXT_VIEW (GCG_get_main_window_object
49 ("GNUNET_GTK_conversation_log"));
50 logbuff = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (log_view));
51 va_start (ap, message);
52 fmsg = g_strdup_vprintf (message,
53 ap);
54 va_end (ap);
55 gtk_text_buffer_get_start_iter (logbuff,
56 &iter);
57 gtk_text_buffer_insert (logbuff,
58 &iter,
59 fmsg,
60 -1);
61 g_free (fmsg);
62}
63
64
65/**
66 * Update status bar.
67 *
68 * @param message format string for message to put in statusbar
69 * @param ... arguments for the format string
70 */
71void
72GCG_update_status_bar (const gchar *message,
73 ...)
74{
75 GtkStatusbar *status_bar;
76 guint status_bar_context;
77 gchar *buff;
78 va_list ap;
79
80 status_bar = GTK_STATUSBAR (GCG_get_main_window_object
81 ("GNUNET_GTK_conversation_statusbar"));
82 status_bar_context = gtk_statusbar_get_context_id (status_bar,
83 "blaat"); // blaat!?
84 va_start (ap, message);
85 buff = g_strdup_vprintf (message,
86 ap);
87 va_end (ap);
88 gtk_statusbar_push (GTK_STATUSBAR (status_bar),
89 GPOINTER_TO_INT (status_bar_context),
90 buff);
91 g_free (buff);
92}
93
94/* end of gnunet-conversation-gtk_log.c */