#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <gtk/gtk.h>
GtkWidget* window;
GtkWidget* label;
static char strbuf[255];
char* appname;
static gboolean show_time(gpointer user_data) {
time_t rawtime;
struct tm* time_info;
gtk_label_set_text(GTK_LABEL(label), strbuf);
}
static gboolean show_ten(gpointer user_data) {
static int count = 0;
sprintf(strbuf
, "count: %d", count
);
count = (count + 1) % 10;
gtk_label_set_text(GTK_LABEL(label), strbuf);
}
static gboolean show_sum(gpointer user_data) {
static int sum = 0;
static int counter = 0;
if (counter < 1000) {
++counter;
sum += counter;
gtk_label_set_text(GTK_LABEL(label), strbuf);
}
}
static void activate (GtkApplication *app, gpointer user_data) {
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), appname);
gtk_window_set_default_size (GTK_WINDOW (window), 150, 150);
label = gtk_label_new("");
gtk_container_add(GTK_CONTAINER(window), label);
gtk_widget_show_all (window);
}
int run_app(char* _appname, GSourceFunc function, int argc, char** argv) {
appname = _appname;
GtkApplication *app;
int status;
app = gtk_application_new (appname, G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK (activate), NULL);
g_timeout_add(1000, function, NULL);
status = g_application_run(G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
int main (int argc, char **argv) {
if (fork() == 0) {
return run_app("org.weathfold.Count", show_ten, argc, argv);
}
if (fork() == 0) {
return run_app("org.weathfold.Sum", show_sum, argc, argv);
}
if (fork() == 0) {
return run_app("org.weathfold.Time", show_time, argc, argv);
}
}
Replies to GtkMultiProcess 
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}