Make sure that all timeouts in HildonBanner are removed
[hildon] / hildon / hildon-main.c
1 /*
2  * This file is part of the hildon library
3  *
4  * Copyright (C) 2008, 2009 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(). Note that
32  * this function also initializes gtk by calling gtk_init(). In case
33  * you need a customized initialization of the GTK+ library you have
34  * to use hildon_init() after the 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  *
74  * Initializes the hildon library. Call this function after calling gtk_init()
75  * and before using any hildon or GTK+ functions in your program.
76  *
77  * Since: 2.2
78  **/
79 void
80 hildon_init (void)
81 {
82   static gboolean initialized = FALSE;
83
84   if (initialized) {
85     g_critical ("Tried to initialized Hildon more than once.");
86     return;
87   } else {
88     initialized = TRUE;
89   }
90
91   /* Register icon sizes */
92   gtk_icon_size_register ("hildon-xsmall", 16, 16);
93   gtk_icon_size_register ("hildon-small", 24, 24);
94   gtk_icon_size_register ("hildon-stylus", 32, 32);
95   gtk_icon_size_register ("hildon-finger", 48, 48);
96   gtk_icon_size_register ("hildon-thumb", 64, 64);
97   gtk_icon_size_register ("hildon-large", 96, 96);
98   gtk_icon_size_register ("hildon-xlarge", 128, 128);
99 }
100
101 /**
102  * hildon_gtk_init:
103  * @argc: Address of the <parameter>argc</parameter>
104  * parameter of your main() function. Changed if any arguments were
105  * handled.
106  * @argv: Address of the <parameter>argv</parameter>
107  * parameter of main().  Any parameters understood by gtk_init()
108  * are stripped before return.
109  *
110  * Convenience function to initialize the GTK+ and hildon
111  * libraries. Use this function to replace a call to gtk_init() and also
112  * initialize the hildon library. See hildon_init() and gtk_init() for details.
113  *
114  * Since: 2.2
115  **/
116 void
117 hildon_gtk_init (int *argc, char ***argv)
118 {
119   gtk_init (argc, argv);
120   hildon_init ();
121 }