diff options
Diffstat (limited to 'src/common/logging.c')
-rw-r--r-- | src/common/logging.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/common/logging.c b/src/common/logging.c index d49298fd..aad69f96 100644 --- a/src/common/logging.c +++ b/src/common/logging.c | |||
@@ -30,6 +30,28 @@ | |||
30 | #include <glib.h> | 30 | #include <glib.h> |
31 | #include <gmodule.h> | 31 | #include <gmodule.h> |
32 | 32 | ||
33 | static GtkWidget * infoWindow; | ||
34 | |||
35 | static GtkWidget * infoWindowTextView; | ||
36 | |||
37 | static GladeXML * statusXML; | ||
38 | |||
39 | static void init() { | ||
40 | if (statusXML != NULL) | ||
41 | return; | ||
42 | statusXML | ||
43 | = glade_xml_new(getGladeFileName(), | ||
44 | "statusWindow", | ||
45 | PACKAGE_NAME); | ||
46 | infoWindow | ||
47 | = glade_xml_get_widget(statusXML, | ||
48 | "statusWindow"); | ||
49 | infoWindowTextView | ||
50 | = glade_xml_get_widget(statusXML, | ||
51 | "messageWindowTextView"); | ||
52 | connectGladeWithPlugins(statusXML); | ||
53 | } | ||
54 | |||
33 | /** | 55 | /** |
34 | * Closure for doInfoMessage. | 56 | * Closure for doInfoMessage. |
35 | */ | 57 | */ |
@@ -46,6 +68,7 @@ static void * doInfoMessage(void * args) { | |||
46 | GtkTextIter iter; | 68 | GtkTextIter iter; |
47 | GtkTextBuffer * buffer; | 69 | GtkTextBuffer * buffer; |
48 | 70 | ||
71 | init(); | ||
49 | if (info->doPopup==YES) | 72 | if (info->doPopup==YES) |
50 | gtk_widget_show(infoWindow); | 73 | gtk_widget_show(infoWindow); |
51 | buffer | 74 | buffer |
@@ -83,9 +106,10 @@ static void * saveAddLogEntry(void * args) { | |||
83 | static int once = 1; | 106 | static int once = 1; |
84 | static guint id; | 107 | static guint id; |
85 | 108 | ||
109 | init(); | ||
86 | if (once) { | 110 | if (once) { |
87 | once = 0; | 111 | once = 0; |
88 | s = glade_xml_get_widget(mainXML, | 112 | s = glade_xml_get_widget(getMainXML(), |
89 | "statusbar"); | 113 | "statusbar"); |
90 | id = gtk_statusbar_get_context_id(GTK_STATUSBAR(s), | 114 | id = gtk_statusbar_get_context_id(GTK_STATUSBAR(s), |
91 | "LOG"); | 115 | "LOG"); |
@@ -118,3 +142,11 @@ void addLogEntry(const char * txt, | |||
118 | g_free(note); | 142 | g_free(note); |
119 | } | 143 | } |
120 | 144 | ||
145 | void __attribute__ ((destructor)) gnunet_crypto_ltdl_fini() { | ||
146 | if (statusXML != NULL) { | ||
147 | gtk_widget_destroy(infoWindow); | ||
148 | infoWindow = NULL; | ||
149 | UNREF(statusXML); | ||
150 | statusXML = NULL; | ||
151 | } | ||
152 | } | ||