evolution-3.6.4/widgets/misc/test-source-config.c

No issues found

 1 #include <stdlib.h>
 2 #include <gtk/gtk.h>
 3 
 4 #include <libedataserver/libedataserver.h>
 5 
 6 #include "e-source-config-dialog.h"
 7 
 8 static void
 9 dialog_response (GtkDialog *dialog,
10                  gint response_id)
11 {
12 	gtk_main_quit ();
13 }
14 
15 gint
16 main (gint argc,
17       gchar **argv)
18 {
19 	ESourceRegistry *registry;
20 	ESource *source = NULL;
21 	GtkWidget *config;
22 	GtkWidget *dialog;
23 	GError *error = NULL;
24 
25 	gtk_init (&argc, &argv);
26 
27 	registry = e_source_registry_new_sync (NULL, &error);
28 
29 	if (error != NULL) {
30 		g_printerr ("%s\n", error->message);
31 		exit (EXIT_FAILURE);
32 	}
33 
34 	if (argc > 1) {
35 		source = e_source_registry_ref_source (registry, argv[1]);
36 		if (source == NULL) {
37 			g_printerr ("No such UID: %s\n", argv[1]);
38 			exit (EXIT_FAILURE);
39 		}
40 	}
41 
42 	config = e_source_config_new (registry, source);
43 	dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config));
44 
45 	g_signal_connect (
46 		dialog, "response",
47 		G_CALLBACK (dialog_response), NULL);
48 
49 	gtk_widget_show (config);
50 	gtk_widget_show (dialog);
51 
52 	g_object_unref (source);
53 
54 	gtk_main ();
55 
56 	return 0;
57 }