1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include <stdlib.h>
#include <dirent.h>
#include <hildon/hildon.h>
static gboolean Block;
static unsigned cntfiles(char const *path)
{
DIR *dir;
struct dirent const *dent;
unsigned n;
if (!(dir = opendir(path)))
return 0;
for (n = 0; (dent = readdir(dir)) != NULL; n++)
;
closedir(dir);
return n;
}
static gboolean cb(gpointer win)
{
extern void hildon_gtk_window_take_screenshot_sync (
GtkWindow *window, gboolean take);
void (*fun)(GtkWindow *, gboolean) = Block
? hildon_gtk_window_take_screenshot_sync
: hildon_gtk_window_take_screenshot;
g_warning("CREATE: %u", cntfiles("/home/user/.cache/launch"));
fun(win, TRUE);
g_warning(" %u", cntfiles("/home/user/.cache/launch"));
g_warning("DELETE: %u", cntfiles("/home/user/.cache/launch"));
fun(win, FALSE);
g_warning(" %u", cntfiles("/home/user/.cache/launch"));
return FALSE;
}
int main(int argc, char const *argv[])
{
GtkWidget *win, *text;
GdkWindow *window;
Block = !argv[1];
gtk_init(NULL, NULL);
text = gtk_label_new("Moi!");
gtk_widget_modify_font(text, pango_font_description_from_string("300"));
win = hildon_window_new();
gtk_window_set_wmclass(GTK_WINDOW(win), "osso_calculator", "Osso_calculator");
g_signal_connect(win, "destroy", G_CALLBACK(exit), NULL);
g_signal_connect(win, "button_press_event", G_CALLBACK(cb), NULL);
gtk_container_add(GTK_CONTAINER(win), text);
gtk_widget_realize(win);
window = GDK_WINDOW (gtk_widget_get_window (win));
gdk_window_set_events(window,
gdk_window_get_events(window) | GDK_BUTTON_PRESS_MASK);
gtk_widget_show_all(win);
gtk_main();
return 0;
}
|