turn app into a control panel applet
[bootcreen] / plugin / plugin.c
1 #include <string.h>
2 #include <stdlib.h>
3 #include <X11/Xlib.h>
4 #include <gdk/gdkx.h>
5 #include <gtk/gtk.h>
6 #include <libosso.h>
7
8 static const char binary[] = "/usr/bin/bootscreen";
9
10 osso_return_t execute(osso_context_t *osso_context, gpointer parent, gboolean user_activated)
11 {
12     char args[sizeof(binary) + 64];
13     Window id = None;
14
15     (void) osso_context;
16
17     if (parent && GTK_WIDGET(parent) && GTK_WIDGET(parent)->window)
18         id = gdk_x11_drawable_get_xid(GTK_WIDGET(parent)->window);
19
20     sprintf(args, "sudo %s --parent 0x%08x", binary, (unsigned int) id);
21     return system(args);
22 }
23
24 osso_return_t save_state(osso_context_t *osso_context, gpointer parent)
25 {
26     (void) osso_context;
27     (void) parent;
28
29     return OSSO_OK;
30 }