File: | _build/../libvnck/test-pager.c |
Warning: | line 95, column 18 This statement is never executed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* vim: set sw=2 et: */ |
2 | |
3 | #include <libvnck/libvnck.h> |
4 | #include <ctk/ctk.h> |
5 | |
6 | static int n_rows = 1; |
7 | static gboolean only_current = FALSE(0); |
8 | static gboolean rtl = FALSE(0); |
9 | static gboolean show_name = FALSE(0); |
10 | static gboolean simple_scrolling = FALSE(0); |
11 | static gboolean vertical = FALSE(0); |
12 | static gboolean wrap_on_scroll = FALSE(0); |
13 | |
14 | static GOptionEntry entries[] = { |
15 | {"n-rows", 'n', 0, G_OPTION_ARG_INT, &n_rows, "Use N_ROWS rows", "N_ROWS"}, |
16 | {"only-current", 'c', 0, G_OPTION_ARG_NONE, &only_current, "Only show current workspace", NULL((void*)0)}, |
17 | {"rtl", 'r', 0, G_OPTION_ARG_NONE, &rtl, "Use RTL as default direction", NULL((void*)0)}, |
18 | {"show-name", 's', 0, G_OPTION_ARG_NONE, &show_name, "Show workspace names instead of workspace contents", NULL((void*)0)}, |
19 | {"simple-scrolling", 'd', 0, G_OPTION_ARG_NONE, &simple_scrolling, "Use the simple 1d scroll mode", NULL((void*)0)}, |
20 | {"vertical-orientation", 'v', 0, G_OPTION_ARG_NONE, &vertical, "Use a vertical orientation", NULL((void*)0)}, |
21 | {"wrap-on-scroll", 'w', 0, G_OPTION_ARG_NONE, &wrap_on_scroll, "Wrap on scrolling over borders", NULL((void*)0)}, |
22 | {NULL((void*)0) } |
23 | }; |
24 | |
25 | static void |
26 | create_pager_window (CtkOrientation orientation, |
27 | gboolean show_all, |
28 | VnckPagerDisplayMode mode, |
29 | VnckPagerScrollMode scroll_mode, |
30 | int rows, |
31 | gboolean wrap) |
32 | { |
33 | CtkWidget *win; |
34 | CtkWidget *pager; |
35 | |
36 | win = ctk_window_new (CTK_WINDOW_TOPLEVEL); |
37 | |
38 | ctk_window_stick (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ()))))))); |
39 | #if 0 |
40 | vnck_ctk_window_set_dock_type (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ()))))))); |
41 | #endif |
42 | |
43 | ctk_window_set_title (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), "Pager"); |
44 | |
45 | /* very very random */ |
46 | ctk_window_move (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_window_get_type ())))))), 0, 0); |
47 | |
48 | /* quit on window close */ |
49 | 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) |
50 | 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) |
51 | 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); |
52 | |
53 | pager = vnck_pager_new (); |
54 | |
55 | vnck_pager_set_show_all (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), show_all); |
56 | vnck_pager_set_display_mode (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), mode); |
57 | vnck_pager_set_scroll_mode (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), scroll_mode); |
58 | vnck_pager_set_orientation (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), orientation); |
59 | vnck_pager_set_n_rows (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), rows); |
60 | vnck_pager_set_shadow_type (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), CTK_SHADOW_IN); |
61 | vnck_pager_set_wrap_on_scroll (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((pager)), ((vnck_pager_get_type ())))))), wrap); |
62 | |
63 | ctk_container_add (CTK_CONTAINER (win)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((win)), ((ctk_container_get_type ())))))), pager); |
64 | |
65 | ctk_widget_show_all (win); |
66 | } |
67 | |
68 | int |
69 | main (int argc, char **argv) |
70 | { |
71 | GOptionContext *ctxt; |
72 | CtkOrientation orientation; |
73 | VnckPagerDisplayMode mode; |
74 | VnckPagerScrollMode scroll_mode; |
75 | VnckScreen *screen; |
76 | |
77 | ctxt = g_option_context_new (""); |
78 | g_option_context_add_main_entries (ctxt, entries, NULL((void*)0)); |
79 | g_option_context_add_group (ctxt, ctk_get_option_group (TRUE(!(0)))); |
80 | g_option_context_parse (ctxt, &argc, &argv, NULL((void*)0)); |
81 | g_option_context_free (ctxt); |
82 | ctxt = NULL((void*)0); |
83 | |
84 | ctk_init (&argc, &argv); |
85 | |
86 | if (rtl) |
87 | ctk_widget_set_default_direction (CTK_TEXT_DIR_RTL); |
88 | |
89 | screen = vnck_screen_get_default (); |
90 | |
91 | /* because the pager doesn't respond to signals at the moment */ |
92 | vnck_screen_force_update (screen); |
93 | |
94 | if (vertical) |
95 | orientation = CTK_ORIENTATION_VERTICAL; |
This statement is never executed | |
96 | else |
97 | orientation = CTK_ORIENTATION_HORIZONTAL; |
98 | |
99 | if (show_name) |
100 | mode = VNCK_PAGER_DISPLAY_NAME; |
101 | else |
102 | mode = VNCK_PAGER_DISPLAY_CONTENT; |
103 | |
104 | if (simple_scrolling) |
105 | scroll_mode = VNCK_PAGER_SCROLL_1D; |
106 | else |
107 | scroll_mode = VNCK_PAGER_SCROLL_2D; |
108 | |
109 | create_pager_window (orientation, !only_current, mode, scroll_mode, n_rows, wrap_on_scroll); |
110 | |
111 | ctk_main (); |
112 | |
113 | return 0; |
114 | } |