3cd0d746bf3552a1af4f91a63a442a6c45a0628d
[modest] / src / maemo / easysetup / main.c
1 /* Copyright (c) 2007, Nokia Corporation
2  * All rights reserved.
3  *
4  */
5
6 #include <config.h> /* For GETTEXT_PACKAGE, etc */
7
8 #include <glib.h>
9 #include <glib/gi18n.h>
10 #include <gtk/gtkwidget.h>
11 #include <gtk/gtkmain.h>
12 #include "modest-easysetup-wizard.h"
13
14 /* Copied from modest-main.c: */
15 typedef enum {
16         MODEST_ERR_NONE    = 0,   /* no error */
17         MODEST_ERR_OPTIONS = 1,   /* error in the options */
18         MODEST_ERR_CONF    = 2,   /* error getting confuration db */
19         MODEST_ERR_UI      = 3,   /* error in the UI */
20         MODEST_ERR_HILDON  = 4,   /* error with Hildon (maemo-only) */
21         MODEST_ERR_RUN     = 5,   /* error running */
22         MODEST_ERR_PARAM   = 7,   /* error in one or more of the parameters */
23         MODEST_ERR_INIT    = 8    /* error in initialization */
24 } ModestErrorCode;
25
26 static gboolean modest_easysetup_init(int argc, char *argv[])
27 {
28         /* Setup gettext, to use our .po files: */
29         /* GETTEXT_PACKAGE is defined in config.h */
30         /* OSSO_MODEST_EASYSETUP_LOCALEDIR is defined in the Makefile.am */
31         bindtextdomain (GETTEXT_PACKAGE, OSSO_MODEST_EASYSETUP_LOCALEDIR);
32         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
33         textdomain (GETTEXT_PACKAGE);
34
35         if (!gtk_init_check(&argc, &argv)) {
36                 g_printerr ("osso-modest-easysetup: failed to initialize GTK+\n");
37                 return FALSE;
38         }
39
40         return TRUE;
41 }
42
43 static gboolean modest_easysetup_uninit()
44 {
45         return TRUE;
46 }
47
48 int
49 main (int argc, char *argv[])
50 {       
51         if (!modest_easysetup_init (argc, argv)) {
52                 g_printerr ("osso-modest-easysetup: cannot init runtime\n");
53                 return MODEST_ERR_INIT;
54         }
55
56         ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new ();
57         gtk_dialog_run (GTK_DIALOG (wizard));
58
59         if (!modest_easysetup_uninit ()) 
60                 g_printerr ("osso-modest-easysetup: shutdown failed\n");
61
62         return MODEST_ERR_NONE;
63 }
64