diff options
Diffstat (limited to 'src/lib/eventloop.c')
-rw-r--r-- | src/lib/eventloop.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index b7d5869e..aabcfa63 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c | |||
@@ -24,7 +24,9 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "gnunet_gtk.h" | 26 | #include "gnunet_gtk.h" |
27 | 27 | #if HAVE_GTK_GTKX_H | |
28 | #include <gtk/gtkx.h> | ||
29 | #endif | ||
28 | 30 | ||
29 | /** | 31 | /** |
30 | * Initial size of our poll array cache. | 32 | * Initial size of our poll array cache. |
@@ -168,6 +170,45 @@ struct GNUNET_GTK_MainLoop | |||
168 | }; | 170 | }; |
169 | 171 | ||
170 | 172 | ||
173 | /** | ||
174 | * If desired, enable plugging of this main window in the meta window. | ||
175 | * | ||
176 | * @param env_name environment variable to check | ||
177 | * @param main_window main window to plug | ||
178 | * @return new main window to initialize | ||
179 | */ | ||
180 | GtkWidget * | ||
181 | GNUNET_GTK_plug_me (const char *env_name, | ||
182 | GtkWidget *main_window) | ||
183 | { | ||
184 | #if HAVE_GTK_GTKX_H | ||
185 | const char *plugid; | ||
186 | GtkWidget *plug; | ||
187 | GtkWidget *child; | ||
188 | unsigned long long id; | ||
189 | |||
190 | if (NULL == (plugid = getenv (env_name))) | ||
191 | return main_window; /* no plugging */ | ||
192 | if (1 != sscanf (plugid, | ||
193 | "%llu", | ||
194 | &id)) | ||
195 | { | ||
196 | fprintf (stderr, | ||
197 | _("Invalid plug name `%s'\n"), | ||
198 | plugid); | ||
199 | return main_window; | ||
200 | } | ||
201 | plug = gtk_plug_new ((Window) id); | ||
202 | child = gtk_bin_get_child (GTK_BIN (main_window)); | ||
203 | gtk_widget_reparent (child, | ||
204 | plug); | ||
205 | gtk_widget_destroy (main_window); | ||
206 | return plug; | ||
207 | #else | ||
208 | return main_window; | ||
209 | #endif | ||
210 | } | ||
211 | |||
171 | 212 | ||
172 | /** | 213 | /** |
173 | * Get the configuration. | 214 | * Get the configuration. |