1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*
This file is part of GNUnet.
(C) 2010-2014 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 3, 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/conversation/gnunet-conversation-gtk_log.c
* @brief logging-related functions for gnunet-conversation-gtk
* @author yids
* @author hark
* @author Christian Grothoff
*/
#include "gnunet-conversation-gtk.h"
#include "gnunet-conversation-gtk_log.h"
/**
* Log a message to gtk log textbuffer
*
* @param message format string for message to be logged
* @param ... arguments for the format string
*/
void
GCG_log (const char *message,
...)
{
GtkTextBuffer *logbuff;
GtkTextView *log_view;
GtkTextIter iter;
gchar *fmsg;
va_list ap;
log_view = GTK_TEXT_VIEW (GCG_get_main_window_object
("GNUNET_GTK_conversation_log"));
logbuff = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (log_view));
va_start (ap, message);
fmsg = g_strdup_vprintf (message,
ap);
va_end (ap);
gtk_text_buffer_get_start_iter (logbuff,
&iter);
gtk_text_buffer_insert (logbuff,
&iter,
fmsg,
-1);
g_free (fmsg);
}
/**
* Update status bar.
*
* @param message format string for message to put in statusbar
* @param ... arguments for the format string
*/
void
GCG_update_status_bar (const gchar *message,
...)
{
GtkStatusbar *status_bar;
guint status_bar_context;
gchar *buff;
va_list ap;
status_bar = GTK_STATUSBAR (GCG_get_main_window_object
("GNUNET_GTK_conversation_statusbar"));
status_bar_context = gtk_statusbar_get_context_id (status_bar,
"blaat"); // blaat!?
va_start (ap, message);
buff = g_strdup_vprintf (message,
ap);
va_end (ap);
gtk_statusbar_push (GTK_STATUSBAR (status_bar),
GPOINTER_TO_INT (status_bar_context),
buff);
g_free (buff);
}
/* end of gnunet-conversation-gtk_log.c */
|