Fixes NB#106423, added proper license information
[modest] / src / maemo / easysetup / main.c
1 /*
2  * Copyright (C) 2008 Nokia Corporation, all rights reserved.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  *   notice, this list of conditions and the following disclaimer in the
13  *   documentation and/or other materials provided with the distribution.
14  * * Neither the name of the Nokia Corporation nor the names of its
15  *   contributors may be used to endorse or promote products derived from
16  *   this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include <config.h> /* For GETTEXT_PACKAGE, etc */
32
33 #include <glib.h>
34 #include <glib/gi18n.h>
35 #include <gtk/gtkwidget.h>
36 #include <gtk/gtkmain.h>
37 #include "modest-easysetup-wizard.h"
38
39 /* Copied from modest-main.c: */
40 typedef enum {
41         MODEST_ERR_NONE    = 0,   /* no error */
42         MODEST_ERR_OPTIONS = 1,   /* error in the options */
43         MODEST_ERR_CONF    = 2,   /* error getting confuration db */
44         MODEST_ERR_UI      = 3,   /* error in the UI */
45         MODEST_ERR_HILDON  = 4,   /* error with Hildon (maemo-only) */
46         MODEST_ERR_RUN     = 5,   /* error running */
47         MODEST_ERR_PARAM   = 7,   /* error in one or more of the parameters */
48         MODEST_ERR_INIT    = 8    /* error in initialization */
49 } ModestErrorCode;
50
51 static gboolean modest_easysetup_init(int argc, char *argv[])
52 {
53         /* Setup gettext, to use our .po files: */
54         /* GETTEXT_PACKAGE is defined in config.h */
55         /* OSSO_MODEST_EASYSETUP_LOCALEDIR is defined in config.h */
56         bindtextdomain (GETTEXT_PACKAGE, OSSO_MODEST_EASYSETUP_LOCALEDIR);
57         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
58         textdomain (GETTEXT_PACKAGE);
59
60         if (!gtk_init_check(&argc, &argv)) {
61                 g_printerr ("osso-modest-easysetup: failed to initialize GTK+\n");
62                 return FALSE;
63         }
64
65         return TRUE;
66 }
67
68 static gboolean modest_easysetup_uninit()
69 {
70         return TRUE;
71 }
72
73 int
74 main (int argc, char *argv[])
75 {       
76         if (!modest_easysetup_init (argc, argv)) {
77                 g_printerr ("osso-modest-easysetup: cannot init runtime\n");
78                 return MODEST_ERR_INIT;
79         }
80
81         ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new ();
82         gtk_dialog_run (GTK_DIALOG (wizard));
83
84         if (!modest_easysetup_uninit ()) 
85                 g_printerr ("osso-modest-easysetup: shutdown failed\n");
86
87         return MODEST_ERR_NONE;
88 }
89