File: | _build/../libvnck/test-tasklist.c |
Warning: | line 96, column 5 This statement is never executed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <libvnck/libvnck.h> |
2 | #include <ctk/ctk.h> |
3 | |
4 | static gboolean display_all = FALSE(0); |
5 | static gboolean never_group = FALSE(0); |
6 | static gboolean always_group = FALSE(0); |
7 | static gboolean rtl = FALSE(0); |
8 | static gboolean skip_tasklist = FALSE(0); |
9 | static gboolean transparent = FALSE(0); |
10 | static gboolean vertical = FALSE(0); |
11 | static gint icon_size = VNCK_DEFAULT_MINI_ICON_SIZE16; |
12 | static gboolean enable_scroll = TRUE(!(0)); |
13 | |
14 | static GOptionEntry entries[] = { |
15 | {"always-group", 'g', 0, G_OPTION_ARG_NONE, &always_group, "Always group windows", NULL((void*)0)}, |
16 | {"never-group", 'n', 0, G_OPTION_ARG_NONE, &never_group, "Never group windows", NULL((void*)0)}, |
17 | {"display-all", 'a', 0, G_OPTION_ARG_NONE, &display_all, "Display windows from all workspaces", NULL((void*)0)}, |
18 | {"icon-size", 'i', 0, G_OPTION_ARG_INT, &icon_size, "Icon size for tasklist", NULL((void*)0)}, |
19 | {"rtl", 'r', 0, G_OPTION_ARG_NONE, &rtl, "Use RTL as default direction", NULL((void*)0)}, |
20 | {"skip-tasklist", 's', 0, G_OPTION_ARG_NONE, &skip_tasklist, "Don't show window in tasklist", NULL((void*)0)}, |
21 | {"vertical", 'v', 0, G_OPTION_ARG_NONE, &vertical, "Show in vertical mode", NULL((void*)0)}, |
22 | {"transparent", 't', 0, G_OPTION_ARG_NONE, &transparent, "Enable Transparency", NULL((void*)0)}, |
23 | {"disable-scroll", 'd', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &enable_scroll, "Disable scrolling", NULL((void*)0)}, |
24 | {NULL((void*)0) } |
25 | }; |
26 | |
27 | static gboolean |
28 | window_draw (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)), |
29 | cairo_t *cr, |
30 | gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__))) |
31 | { |
32 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
33 | cairo_set_source_rgba (cr, 1., 1., 1., .5); |
34 | cairo_fill (cr); |
35 | |
36 | return FALSE(0); |
37 | } |
38 | |
39 | static void |
40 | window_composited_changed (CtkWidget *widget, |
41 | gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__))) |
42 | { |
43 | CdkScreen *screen; |
44 | gboolean composited; |
45 | |
46 | screen = cdk_screen_get_default (); |
47 | composited = cdk_screen_is_composited (screen); |
48 | |
49 | ctk_widget_set_app_paintable (widget, composited); |
50 | } |
51 | |
52 | int |
53 | main (int argc, char **argv) |
54 | { |
55 | GOptionContext *ctxt; |
56 | VnckScreen *screen; |
57 | CtkWidget *win; |
58 | CtkWidget *frame; |
59 | CtkWidget *tasklist; |
60 | |
61 | ctxt = g_option_context_new (""); |
62 | g_option_context_add_main_entries (ctxt, entries, NULL((void*)0)); |
63 | g_option_context_add_group (ctxt, ctk_get_option_group (TRUE(!(0)))); |
64 | g_option_context_parse (ctxt, &argc, &argv, NULL((void*)0)); |
65 | g_option_context_free (ctxt); |
66 | ctxt = NULL((void*)0); |
67 | |
68 | ctk_init (&argc, &argv); |
69 | |
70 | if (rtl) |
71 | ctk_widget_set_default_direction (CTK_TEXT_DIR_RTL); |
72 | |
73 | vnck_set_default_mini_icon_size (icon_size); |
74 | screen = vnck_screen_get_default (); |
75 | |
76 | /* because the pager doesn't respond to signals at the moment */ |
77 | vnck_screen_force_update (screen); |
78 | |
79 | win = ctk_window_new (CTK_WINDOW_TOPLEVEL); |
80 | ctk_window_set_default_size (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), 200, 100); |
81 | ctk_window_stick (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ()))))))); |
82 | /* vnck_ctk_window_set_dock_type (CTK_WINDOW (win)); */ |
83 | |
84 | ctk_window_set_title (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), "Task List"); |
85 | ctk_window_set_resizable (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), TRUE(!(0))); |
86 | |
87 | /* quit on window close */ |
88 | g_signal_connect (G_OBJECT (win), "destroy",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((win)), (((GType) ((20) << (2)))))) ))), ("destroy"), (((GCallback) (ctk_main_quit))), (((void*)0 )), ((void*)0), (GConnectFlags) 0) |
89 | G_CALLBACK (ctk_main_quit),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((win)), (((GType) ((20) << (2)))))) ))), ("destroy"), (((GCallback) (ctk_main_quit))), (((void*)0 )), ((void*)0), (GConnectFlags) 0) |
90 | NULL)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((win)), (((GType) ((20) << (2)))))) ))), ("destroy"), (((GCallback) (ctk_main_quit))), (((void*)0 )), ((void*)0), (GConnectFlags) 0); |
91 | |
92 | tasklist = vnck_tasklist_new (); |
93 | |
94 | vnck_tasklist_set_include_all_workspaces (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), display_all); |
95 | if (always_group) |
96 | vnck_tasklist_set_grouping (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), |
This statement is never executed | |
97 | VNCK_TASKLIST_ALWAYS_GROUP); |
98 | else if (never_group) |
99 | vnck_tasklist_set_grouping (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), |
100 | VNCK_TASKLIST_NEVER_GROUP); |
101 | else |
102 | vnck_tasklist_set_grouping (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), |
103 | VNCK_TASKLIST_AUTO_GROUP); |
104 | |
105 | vnck_tasklist_set_scroll_enabled (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), enable_scroll); |
106 | |
107 | vnck_tasklist_set_middle_click_close (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), TRUE(!(0))); |
108 | |
109 | vnck_tasklist_set_orientation (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), |
110 | (vertical ? CTK_ORIENTATION_VERTICAL : |
111 | CTK_ORIENTATION_HORIZONTAL)); |
112 | |
113 | if (transparent) |
114 | { |
115 | CdkVisual *visual; |
116 | |
117 | visual = cdk_screen_get_rgba_visual (ctk_widget_get_screen (win)); |
118 | |
119 | if (visual != NULL((void*)0)) |
120 | { |
121 | ctk_widget_set_visual (win, visual); |
122 | |
123 | g_signal_connect (win, "composited-changed",g_signal_connect_data ((win), ("composited-changed"), (((GCallback ) (window_composited_changed))), (((void*)0)), ((void*)0), (GConnectFlags ) 0) |
124 | G_CALLBACK (window_composited_changed),g_signal_connect_data ((win), ("composited-changed"), (((GCallback ) (window_composited_changed))), (((void*)0)), ((void*)0), (GConnectFlags ) 0) |
125 | NULL)g_signal_connect_data ((win), ("composited-changed"), (((GCallback ) (window_composited_changed))), (((void*)0)), ((void*)0), (GConnectFlags ) 0); |
126 | |
127 | /* draw even if we are not app-painted. |
128 | * this just makes my life a lot easier :) |
129 | */ |
130 | g_signal_connect (win, "draw",g_signal_connect_data ((win), ("draw"), (((GCallback) (window_draw ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
131 | G_CALLBACK (window_draw),g_signal_connect_data ((win), ("draw"), (((GCallback) (window_draw ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
132 | NULL)g_signal_connect_data ((win), ("draw"), (((GCallback) (window_draw ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
133 | |
134 | window_composited_changed (win, NULL((void*)0)); |
135 | } |
136 | |
137 | vnck_tasklist_set_button_relief (VNCK_TASKLIST (tasklist)((((VnckTasklist*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tasklist)), ((vnck_tasklist_get_type ())))))), |
138 | CTK_RELIEF_NONE); |
139 | } |
140 | |
141 | frame = ctk_frame_new (NULL((void*)0)); |
142 | ctk_frame_set_shadow_type (CTK_FRAME (frame)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((frame)), ((ctk_frame_get_type ())))))), CTK_SHADOW_IN); |
143 | ctk_container_add (CTK_CONTAINER (win)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_container_get_type ())))))), frame); |
144 | |
145 | ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((frame)), ((ctk_container_get_type ())))))), tasklist); |
146 | |
147 | ctk_widget_show (tasklist); |
148 | ctk_widget_show (frame); |
149 | |
150 | ctk_window_move (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), 0, 0); |
151 | |
152 | if (skip_tasklist) |
153 | { |
154 | ctk_window_set_skip_taskbar_hint (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), TRUE(!(0))); |
155 | ctk_window_set_keep_above (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), TRUE(!(0))); |
156 | } |
157 | |
158 | ctk_widget_show (win); |
159 | |
160 | ctk_main (); |
161 | |
162 | return 0; |
163 | } |