Changed the old code to work as a daemon
[googlelatitude] / src / settingsplugin / settingsplugin.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
7 #ifdef MAEMO_CHANGES
8 #include <libosso.h>
9
10 static const char binary[] = "/opt/linfati.com/googlelatitude-settings";
11
12 osso_return_t execute(osso_context_t *osso_context, gpointer parent, gboolean user_activated)
13 {
14     char args[sizeof(binary) + 64];
15     Window id = None;
16
17     (void) osso_context;
18
19     if (parent && GTK_WIDGET(parent) && GTK_WIDGET(parent)->window)
20         id = gdk_x11_drawable_get_xid(GTK_WIDGET(parent)->window);
21
22     sprintf(args, "%s --parent 0x%08x%s", binary, (unsigned int) id, user_activated ? " --user" : "");
23     return system(args);
24 }
25
26 osso_return_t save_state(osso_context_t *osso_context, gpointer parent)
27 {
28     (void) osso_context;
29     (void) parent;
30
31     return OSSO_OK;
32 }
33
34 #endif