File: | tests/testdialog.c |
Warning: | line 392, column 3 Value stored to 'button' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <ctk/ctk.h> |
2 | |
3 | static void |
4 | show_message_dialog1 (CtkWindow *parent) |
5 | { |
6 | CtkWidget *dialog; |
7 | |
8 | dialog = CTK_WIDGET (ctk_message_dialog_new (parent,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))) |
9 | CTK_DIALOG_MODAL|((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))) |
10 | CTK_DIALOG_DESTROY_WITH_PARENT|((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))) |
11 | CTK_DIALOG_USE_HEADER_BAR,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))) |
12 | CTK_MESSAGE_INFO,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))) |
13 | CTK_BUTTONS_OK,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))) |
14 | "Oops! Something went wrong."))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "Oops! Something went wrong."))), ((ctk_widget_get_type ()) ))))); |
15 | ctk_message_dialog_format_secondary_text (CTK_MESSAGE_DIALOG (dialog)((((CtkMessageDialog*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((dialog)), ((ctk_message_dialog_get_type ()) ))))), |
16 | "Unhandled error message: SSH program unexpectedly exited"); |
17 | |
18 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
19 | ctk_widget_destroy (dialog); |
20 | } |
21 | |
22 | static void |
23 | show_message_dialog1a (CtkWindow *parent) |
24 | { |
25 | CtkWidget *dialog; |
26 | CtkWidget *image; |
27 | |
28 | dialog = CTK_WIDGET (ctk_message_dialog_new (parent,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))) |
29 | CTK_DIALOG_MODAL|((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))) |
30 | CTK_DIALOG_DESTROY_WITH_PARENT|((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))) |
31 | CTK_DIALOG_USE_HEADER_BAR,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))) |
32 | CTK_MESSAGE_INFO,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))) |
33 | CTK_BUTTONS_OK,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))) |
34 | "The system network services are not compatible with this version."))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_OK , "The system network services are not compatible with this version." ))), ((ctk_widget_get_type ())))))); |
35 | |
36 | image = ctk_image_new_from_icon_name ("computer-fail", CTK_ICON_SIZE_DIALOG); |
37 | ctk_widget_show (image); |
38 | G_GNUC_BEGIN_IGNORE_DEPRECATIONSclang diagnostic push
clang diagnostic ignored "-Wdeprecated-declarations" ; |
39 | ctk_message_dialog_set_image (CTK_MESSAGE_DIALOG (dialog)((((CtkMessageDialog*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((dialog)), ((ctk_message_dialog_get_type ()) ))))), image); |
40 | G_GNUC_END_IGNORE_DEPRECATIONSclang diagnostic pop ; |
41 | |
42 | |
43 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
44 | ctk_widget_destroy (dialog); |
45 | } |
46 | |
47 | static void |
48 | show_message_dialog2 (CtkWindow *parent) |
49 | { |
50 | CtkWidget *dialog; |
51 | |
52 | dialog = CTK_WIDGET (ctk_message_dialog_new (parent,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))) |
53 | CTK_DIALOG_MODAL|((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))) |
54 | CTK_DIALOG_DESTROY_WITH_PARENT|((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))) |
55 | CTK_DIALOG_USE_HEADER_BAR,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))) |
56 | CTK_MESSAGE_INFO,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))) |
57 | CTK_BUTTONS_NONE,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))) |
58 | "Empty all items from Wastebasket?"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_message_dialog_new (parent, CTK_DIALOG_MODAL| CTK_DIALOG_DESTROY_WITH_PARENT | CTK_DIALOG_USE_HEADER_BAR, CTK_MESSAGE_INFO, CTK_BUTTONS_NONE , "Empty all items from Wastebasket?"))), ((ctk_widget_get_type ())))))); |
59 | ctk_message_dialog_format_secondary_text (CTK_MESSAGE_DIALOG (dialog)((((CtkMessageDialog*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((dialog)), ((ctk_message_dialog_get_type ()) ))))), |
60 | "All items in the Wastebasket will be permanently deleted"); |
61 | ctk_dialog_add_buttons (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ())))))), |
62 | "Cancel", CTK_RESPONSE_CANCEL, |
63 | "Empty Wastebasket", CTK_RESPONSE_OK, |
64 | NULL((void*)0)); |
65 | |
66 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
67 | ctk_widget_destroy (dialog); |
68 | } |
69 | |
70 | static void |
71 | show_color_chooser (CtkWindow *parent) |
72 | { |
73 | CtkWidget *dialog; |
74 | |
75 | dialog = ctk_color_chooser_dialog_new ("Builtin", parent); |
76 | |
77 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
78 | ctk_widget_destroy (dialog); |
79 | } |
80 | |
81 | static void |
82 | show_color_chooser_generic (CtkWindow *parent) |
83 | { |
84 | CtkWidget *dialog; |
85 | |
86 | dialog = g_object_new (CTK_TYPE_COLOR_CHOOSER_DIALOG(ctk_color_chooser_dialog_get_type ()), |
87 | "title", "Generic Builtin", |
88 | "transient-for", parent, |
89 | NULL((void*)0)); |
90 | |
91 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
92 | ctk_widget_destroy (dialog); |
93 | } |
94 | |
95 | static void |
96 | add_content (CtkWidget *dialog) |
97 | { |
98 | CtkWidget *label; |
99 | |
100 | label = ctk_label_new ("content"); |
101 | g_object_set (label, "margin", 50, NULL((void*)0)); |
102 | ctk_widget_show (label); |
103 | |
104 | ctk_container_add (CTK_CONTAINER (ctk_dialog_get_content_area (CTK_DIALOG (dialog)))((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_dialog_get_content_area (((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog)), ((ctk_dialog_get_type ())))))) ))), ((ctk_container_get_type ())))))), label); |
105 | } |
106 | |
107 | static void |
108 | add_buttons (CtkWidget *dialog) |
109 | { |
110 | ctk_dialog_add_button (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ())))))), "Done", CTK_RESPONSE_OK); |
111 | ctk_dialog_set_default_response (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ())))))), CTK_RESPONSE_OK); |
112 | } |
113 | |
114 | static void |
115 | show_dialog (CtkWindow *parent) |
116 | { |
117 | CtkWidget *dialog; |
118 | |
119 | dialog = ctk_dialog_new_with_buttons ("Simple", parent, |
120 | CTK_DIALOG_MODAL|CTK_DIALOG_DESTROY_WITH_PARENT, |
121 | "Close", CTK_RESPONSE_CLOSE, |
122 | NULL((void*)0)); |
123 | |
124 | add_content (dialog); |
125 | |
126 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
127 | ctk_widget_destroy (dialog); |
128 | } |
129 | |
130 | static void |
131 | show_dialog_with_header (CtkWindow *parent) |
132 | { |
133 | CtkWidget *dialog; |
134 | |
135 | dialog = ctk_dialog_new_with_buttons ("With Header", parent, |
136 | CTK_DIALOG_MODAL|CTK_DIALOG_DESTROY_WITH_PARENT|CTK_DIALOG_USE_HEADER_BAR, |
137 | "Close", CTK_RESPONSE_CLOSE, |
138 | NULL((void*)0)); |
139 | |
140 | add_content (dialog); |
141 | |
142 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
143 | ctk_widget_destroy (dialog); |
144 | } |
145 | |
146 | static void |
147 | show_dialog_with_buttons (CtkWindow *parent) |
148 | { |
149 | CtkWidget *dialog; |
150 | |
151 | dialog = ctk_dialog_new_with_buttons ("With Buttons", parent, |
152 | CTK_DIALOG_MODAL|CTK_DIALOG_DESTROY_WITH_PARENT, |
153 | "Close", CTK_RESPONSE_CLOSE, |
154 | "Frob", 25, |
155 | NULL((void*)0)); |
156 | |
157 | add_content (dialog); |
158 | |
159 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
160 | ctk_widget_destroy (dialog); |
161 | } |
162 | |
163 | static void |
164 | show_dialog_with_header_buttons (CtkWindow *parent) |
165 | { |
166 | CtkWidget *dialog; |
167 | |
168 | dialog = ctk_dialog_new_with_buttons ("Header & Buttons", parent, |
169 | CTK_DIALOG_MODAL|CTK_DIALOG_DESTROY_WITH_PARENT|CTK_DIALOG_USE_HEADER_BAR, |
170 | "Close", CTK_RESPONSE_CLOSE, |
171 | "Frob", 25, |
172 | NULL((void*)0)); |
173 | |
174 | add_content (dialog); |
175 | |
176 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
177 | ctk_widget_destroy (dialog); |
178 | } |
179 | |
180 | static void |
181 | show_dialog_with_header_buttons2 (CtkWindow *parent G_GNUC_UNUSED__attribute__ ((__unused__))) |
182 | { |
183 | CtkBuilder *builder; |
184 | CtkWidget *dialog; |
185 | |
186 | builder = ctk_builder_new (); |
187 | ctk_builder_add_from_file (builder, "dialog.ui", NULL((void*)0)); |
188 | dialog = (CtkWidget *)ctk_builder_get_object (builder, "dialog"); |
189 | g_object_unref (builder); |
190 | |
191 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
192 | ctk_widget_destroy (dialog); |
193 | } |
194 | |
195 | typedef struct { |
196 | CtkDialog parent; |
197 | } MyDialog; |
198 | |
199 | typedef struct { |
200 | CtkDialogClass parent_class; |
201 | } MyDialogClass; |
202 | |
203 | G_DEFINE_TYPE (MyDialog, my_dialog, CTK_TYPE_DIALOG)static void my_dialog_init (MyDialog *self); static void my_dialog_class_init (MyDialogClass *klass); static GType my_dialog_get_type_once (void); static gpointer my_dialog_parent_class = ((void*)0); static gint MyDialog_private_offset; static void my_dialog_class_intern_init (gpointer klass) { my_dialog_parent_class = g_type_class_peek_parent (klass); if (MyDialog_private_offset != 0) g_type_class_adjust_private_offset (klass, &MyDialog_private_offset); my_dialog_class_init ( (MyDialogClass*) klass); } __attribute__ ((__unused__)) static inline gpointer my_dialog_get_instance_private (MyDialog *self ) { return (((gpointer) ((guint8*) (self) + (glong) (MyDialog_private_offset )))); } GType my_dialog_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); (void ) (0 ? (gpointer) * (&static_g_define_type_id) : ((void*) 0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = my_dialog_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id ) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer ((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id )); })) ; } return static_g_define_type_id; } __attribute__ ( (__noinline__)) static GType my_dialog_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_dialog_get_type ()), g_intern_static_string ("MyDialog"), sizeof (MyDialogClass ), (GClassInitFunc)(void (*)(void)) my_dialog_class_intern_init , sizeof (MyDialog), (GInstanceInitFunc)(void (*)(void)) my_dialog_init , (GTypeFlags) 0); { {{};} } return g_define_type_id; }; |
204 | |
205 | static void |
206 | my_dialog_init (MyDialog *dialog) |
207 | { |
208 | ctk_widget_init_template (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_widget_get_type ()))))))); |
209 | } |
210 | |
211 | static void |
212 | my_dialog_class_init (MyDialogClass *class) |
213 | { |
214 | gchar *buffer; |
215 | gsize size; |
216 | GBytes *bytes; |
217 | |
218 | if (!g_file_get_contents ("mydialog.ui", &buffer, &size, NULL((void*)0))) |
219 | g_error ("Template file mydialog.ui not found"); |
220 | |
221 | bytes = g_bytes_new_static (buffer, size); |
222 | ctk_widget_class_set_template (CTK_WIDGET_CLASS (class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((class)), ((ctk_widget_get_type ())))))), bytes); |
223 | g_bytes_unref (bytes); |
224 | } |
225 | |
226 | static void |
227 | show_dialog_from_template (CtkWindow *parent) |
228 | { |
229 | CtkWidget *dialog; |
230 | |
231 | dialog = g_object_new (my_dialog_get_type (), |
232 | "title", "Template", |
233 | "transient-for", parent, |
234 | NULL((void*)0)); |
235 | |
236 | add_content (dialog); |
237 | |
238 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
239 | ctk_widget_destroy (dialog); |
240 | } |
241 | |
242 | static void |
243 | show_dialog_flex_template (CtkWindow *parent) |
244 | { |
245 | CtkWidget *dialog; |
246 | gboolean use_header; |
247 | |
248 | g_object_get (ctk_settings_get_default (), |
249 | "ctk-dialogs-use-header", &use_header, |
250 | NULL((void*)0)); |
251 | dialog = g_object_new (my_dialog_get_type (), |
252 | "title", "Flexible Template", |
253 | "transient-for", parent, |
254 | "use-header-bar", use_header, |
255 | NULL((void*)0)); |
256 | |
257 | add_content (dialog); |
258 | |
259 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
260 | ctk_widget_destroy (dialog); |
261 | } |
262 | |
263 | typedef struct { |
264 | CtkDialog parent; |
265 | |
266 | CtkWidget *content; |
267 | } MyDialog2; |
268 | |
269 | typedef struct { |
270 | CtkDialogClass parent_class; |
271 | } MyDialog2Class; |
272 | |
273 | G_DEFINE_TYPE (MyDialog2, my_dialog2, CTK_TYPE_DIALOG)static void my_dialog2_init (MyDialog2 *self); static void my_dialog2_class_init (MyDialog2Class *klass); static GType my_dialog2_get_type_once (void); static gpointer my_dialog2_parent_class = ((void*)0) ; static gint MyDialog2_private_offset; static void my_dialog2_class_intern_init (gpointer klass) { my_dialog2_parent_class = g_type_class_peek_parent (klass); if (MyDialog2_private_offset != 0) g_type_class_adjust_private_offset (klass, &MyDialog2_private_offset); my_dialog2_class_init ((MyDialog2Class*) klass); } __attribute__ ((__unused__)) static inline gpointer my_dialog2_get_instance_private (MyDialog2 * self) { return (((gpointer) ((guint8*) (self) + (glong) (MyDialog2_private_offset )))); } GType my_dialog2_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); (void ) (0 ? (gpointer) * (&static_g_define_type_id) : ((void*) 0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = my_dialog2_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id ) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer ((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id )); })) ; } return static_g_define_type_id; } __attribute__ ( (__noinline__)) static GType my_dialog2_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_dialog_get_type ()), g_intern_static_string ("MyDialog2"), sizeof (MyDialog2Class ), (GClassInitFunc)(void (*)(void)) my_dialog2_class_intern_init , sizeof (MyDialog2), (GInstanceInitFunc)(void (*)(void)) my_dialog2_init , (GTypeFlags) 0); { {{};} } return g_define_type_id; }; |
274 | |
275 | static void |
276 | my_dialog2_init (MyDialog2 *dialog) |
277 | { |
278 | ctk_widget_init_template (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_widget_get_type ()))))))); |
279 | } |
280 | |
281 | static void |
282 | my_dialog2_class_init (MyDialog2Class *class) |
283 | { |
284 | gchar *buffer; |
285 | gsize size; |
286 | GBytes *bytes; |
287 | |
288 | if (!g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL((void*)0))) |
289 | g_error ("Template file mydialog2.ui not found"); |
290 | |
291 | bytes = g_bytes_new_static (buffer, size); |
292 | ctk_widget_class_set_template (CTK_WIDGET_CLASS (class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((class)), ((ctk_widget_get_type ())))))), bytes); |
293 | g_bytes_unref (bytes); |
294 | |
295 | ctk_widget_class_bind_template_child (CTK_WIDGET_CLASS (class), MyDialog2, content)ctk_widget_class_bind_template_child_full (((((CtkWidgetClass *) (void *) g_type_check_class_cast ((GTypeClass*) ((class)), ((ctk_widget_get_type ())))))), "content", (0), ((glong) __builtin_offsetof (MyDialog2, content))); |
296 | } |
297 | |
298 | static void |
299 | show_dialog_from_template_with_header (CtkWindow *parent) |
300 | { |
301 | CtkWidget *dialog; |
302 | |
303 | dialog = g_object_new (my_dialog2_get_type (), |
304 | "transient-for", parent, |
305 | "use-header-bar", TRUE(!(0)), |
306 | NULL((void*)0)); |
307 | |
308 | add_buttons (dialog); |
309 | add_content (dialog); |
310 | |
311 | ctk_dialog_run (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
312 | ctk_widget_destroy (dialog); |
313 | } |
314 | |
315 | int |
316 | main (int argc G_GNUC_UNUSED__attribute__ ((__unused__)), |
317 | char *argv[] G_GNUC_UNUSED__attribute__ ((__unused__))) |
318 | { |
319 | CtkWidget *window; |
320 | CtkWidget *vbox; |
321 | CtkWidget *box; |
322 | CtkWidget *button; |
323 | |
324 | ctk_init (NULL((void*)0), NULL((void*)0)); |
325 | |
326 | window = ctk_window_new (CTK_WINDOW_TOPLEVEL); |
327 | ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_window_get_type ())))))), 600, 400); |
328 | |
329 | vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5); |
330 | ctk_widget_set_halign (vbox, CTK_ALIGN_FILL); |
331 | ctk_widget_set_valign (vbox, CTK_ALIGN_CENTER); |
332 | ctk_widget_show (vbox); |
333 | ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_container_get_type ())))))), vbox); |
334 | |
335 | box = ctk_flow_box_new (); |
336 | ctk_flow_box_set_selection_mode (CTK_FLOW_BOX (box)((((CtkFlowBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_flow_box_get_type ())))))), CTK_SELECTION_NONE); |
337 | ctk_widget_set_hexpand (box, TRUE(!(0))); |
338 | ctk_widget_show (box); |
339 | ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_container_get_type ())))))), box); |
340 | |
341 | button = ctk_button_new_with_label ("Message dialog"); |
342 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog1), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_message_dialog1))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
343 | ctk_widget_show (button); |
344 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
345 | |
346 | button = ctk_button_new_with_label ("Message with icon"); |
347 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog1a), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_message_dialog1a))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
348 | ctk_widget_show (button); |
349 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
350 | |
351 | button = ctk_button_new_with_label ("Confirmation dialog"); |
352 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog2), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_message_dialog2))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
353 | ctk_widget_show (button); |
354 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
355 | |
356 | button = ctk_button_new_with_label ("Builtin"); |
357 | button = ctk_button_new_with_label ("Builtin"); |
358 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_color_chooser), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_color_chooser))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
359 | ctk_widget_show (button); |
360 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
361 | |
362 | button = ctk_button_new_with_label ("Generic Builtin"); |
363 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_color_chooser_generic), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_color_chooser_generic))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
364 | ctk_widget_show (button); |
365 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
366 | |
367 | button = ctk_button_new_with_label ("Simple"); |
368 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog))), (window), ((void*)0), G_CONNECT_SWAPPED); |
369 | ctk_widget_show (button); |
370 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
371 | |
372 | button = ctk_button_new_with_label ("With Header"); |
373 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_with_header))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
374 | ctk_widget_show (button); |
375 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
376 | |
377 | button = ctk_button_new_with_label ("With Buttons"); |
378 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_buttons), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_with_buttons))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
379 | ctk_widget_show (button); |
380 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
381 | |
382 | button = ctk_button_new_with_label ("Header & Buttons"); |
383 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_with_header_buttons))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
384 | ctk_widget_show (button); |
385 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
386 | |
387 | button = ctk_button_new_with_label ("Header & Buttons & Builder"); |
388 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons2), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_with_header_buttons2))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
389 | ctk_widget_show (button); |
390 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
391 | |
392 | button = ctk_button_new_with_label ("Template"); |
Value stored to 'button' is never read | |
393 | button = ctk_button_new_with_label ("Template"); |
394 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_from_template))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
395 | ctk_widget_show (button); |
396 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
397 | |
398 | button = ctk_button_new_with_label ("Template With Header"); |
399 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template_with_header), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_from_template_with_header))), (window), ((void*)0 ), G_CONNECT_SWAPPED); |
400 | ctk_widget_show (button); |
401 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
402 | |
403 | button = ctk_button_new_with_label ("Flexible Template"); |
404 | g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_flex_template), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( show_dialog_flex_template))), (window), ((void*)0), G_CONNECT_SWAPPED ); |
405 | ctk_widget_show (button); |
406 | ctk_container_add (CTK_CONTAINER (box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((box)), ((ctk_container_get_type ())))))), button); |
407 | |
408 | button = ctk_check_button_new_with_label ("Dialogs have headers"); |
409 | g_object_bind_property (ctk_settings_get_default (), "ctk-dialogs-use-header", |
410 | button, "active", |
411 | G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE); |
412 | ctk_widget_show (button); |
413 | ctk_widget_set_halign (button, CTK_ALIGN_CENTER); |
414 | ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_container_get_type ())))))), button); |
415 | |
416 | button = ctk_spinner_new (); |
417 | ctk_spinner_start (CTK_SPINNER (button)((((CtkSpinner*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_spinner_get_type ()))))))); |
418 | ctk_widget_show (button); |
419 | ctk_widget_set_halign (button, CTK_ALIGN_CENTER); |
420 | ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_container_get_type ())))))), button); |
421 | |
422 | ctk_widget_show (window); |
423 | ctk_main (); |
424 | |
425 | return 0; |
426 | } |
427 |