2009-03-12 Alberto Garcia <agarcia@igalia.com>
[hildon] / src / hildon-main.c
1 /*
2  * This file is part of the hildon library
3  *
4  * Copyright (C) 2008 Nokia Corporation, all rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  *
21  */
22
23 /**
24  * SECTION:hildon-main
25  * @Short_Description: Library initialization.
26  *
27  * Before using Hildon, you need to initialize it; initialization connects
28  * to the window system display, and parses some standard command line
29  * arguments. See also gtk_init () to know more details on this topic.
30  *
31  * Hildon should be initialized by using hildon_gtk_init (). Notice this function
32  * also initialize gtk by calling gtk_init (). In case you need a customized
33  * initialization of GTK+ library you could use hildon_init () after the
34  * customized GTK+ initialization.
35  *
36  * <example>
37  * <title>Typical <function>main</function> function for a Hildon application</title>
38  *   <programlisting>
39  * int
40  * main (int argc, char **argv)
41  * {
42  *   /<!-- -->* Initialize i18n support *<!-- -->/
43  *   gtk_set_locale (<!-- -->);
44  * <!-- -->
45  *   /<!-- -->* Initialize the widget set *<!-- -->/
46  *   hildon_gtk_init (&amp;argc, &amp;argv);
47  * <!-- -->
48  *   /<!-- -->* Create the main window *<!-- -->/
49  *   mainwin = hildon_stackable_window_new();
50  * <!-- -->
51  *   /<!-- -->* Set up our GUI elements *<!-- -->/
52  *  ...
53  * <!-- -->
54  *   /<!-- -->* Show the application window *<!-- -->/
55  *   gtk_widget_show_all (mainwin);
56  * <!-- -->
57  *   /<!-- -->* Enter the main event loop, and wait for user interaction *<!-- -->/
58  *   gtk_main (<!-- -->);
59  * <!-- -->
60  *   /<!-- -->* The user lost interest *<!-- -->/
61  *   return 0;
62  *}
63  *  </programlisting>
64  * </example>
65  */
66
67
68 #include <gtk/gtk.h>
69 #include "hildon-main.h"
70
71 /**
72  * hildon_init:
73  * @void:
74  *
75  * Initializes the hildon library. Call this function after calling gtk_init()
76  * and before using any hildon or GTK+ functions in your program.
77  *
78  **/
79 void
80 hildon_init (void)
81 {
82   /* Register icon sizes */
83   gtk_icon_size_register ("hildon-xsmall", 16, 16);
84   gtk_icon_size_register ("hildon-small", 24, 24);
85   gtk_icon_size_register ("hildon-stylus", 32, 32);
86   gtk_icon_size_register ("hildon-finger", 48, 48);
87   gtk_icon_size_register ("hildon-thumb", 64, 64);
88   gtk_icon_size_register ("hildon-large", 96, 96);
89   gtk_icon_size_register ("hildon-xlarge", 128, 128);
90 }
91
92 /**
93  * hildon_gtk_init:
94  * @argc: Address of the <parameter>argc</parameter>
95  * parameter of your main() function. Changed if any arguments were
96  * handled.
97  * @argv: Address of the <parameter>argv</parameter>
98  * parameter of main().  Any parameters understood by gtk_init()
99  * are stripped before return.
100  *
101  * Convenience function to initialize the GTK+ and hildon
102  * libraries. Use this function to replace a call to gtk_init() and also
103  * initialize the hildon library. See hildon_init() and gtk_init() for details.
104  *
105  **/
106 void
107 hildon_gtk_init (int *argc, char ***argv)
108 {
109   gtk_init (argc, argv);
110   hildon_init ();
111 }