2009-03-19 Alejandro G. Castro <alex@igalia.com>
[hildon] / src / hildon-main.c
index b9f1b58..10782e9 100644 (file)
  * SECTION:hildon-main
  * @Short_Description: Library initialization.
  *
+ * Before using Hildon, you need to initialize it; initialization connects
+ * to the window system display, and parses some standard command line
+ * arguments. See also gtk_init () to know more details on this topic.
+ *
+ * Hildon should be initialized by using hildon_gtk_init (). Notice this function
+ * also initialize gtk by calling gtk_init (). In case you need a customized
+ * initialization of GTK+ library you could use hildon_init () after the
+ * customized GTK+ initialization.
+ *
+ * <example>
+ * <title>Typical <function>main</function> function for a Hildon application</title>
+ *   <programlisting>
+ * int
+ * main (int argc, char **argv)
+ * {
+ *   /<!-- -->* Initialize i18n support *<!-- -->/
+ *   gtk_set_locale (<!-- -->);
+ * <!-- -->
+ *   /<!-- -->* Initialize the widget set *<!-- -->/
+ *   hildon_gtk_init (&amp;argc, &amp;argv);
+ * <!-- -->
+ *   /<!-- -->* Create the main window *<!-- -->/
+ *   mainwin = hildon_stackable_window_new();
+ * <!-- -->
+ *   /<!-- -->* Set up our GUI elements *<!-- -->/
+ *  ...
+ * <!-- -->
+ *   /<!-- -->* Show the application window *<!-- -->/
+ *   gtk_widget_show_all (mainwin);
+ * <!-- -->
+ *   /<!-- -->* Enter the main event loop, and wait for user interaction *<!-- -->/
+ *   gtk_main (<!-- -->);
+ * <!-- -->
+ *   /<!-- -->* The user lost interest *<!-- -->/
+ *   return 0;
+ *}
+ *  </programlisting>
+ * </example>
  */
 
 
 
 /**
  * hildon_init:
- * @argc: Address of the <parameter>argc</parameter>
- * parameter of your main() function. Changed if any arguments were
- * handled.
- * @argv: Address of the <parameter>argv</parameter>
- * parameter of main().  Any parameters understood by hildon_init()
- * are stripped before return.
  *
  * Initializes the hildon library. Call this function after calling gtk_init()
  * and before using any hildon or GTK+ functions in your program.
 void
 hildon_init (void)
 {
+  static gboolean initialized = FALSE;
+
+  if (initialized) {
+    g_critical ("Tried to initialized Hildon more than once.");
+    return;
+  } else {
+    initialized = TRUE;
+  }
+
   /* Register icon sizes */
   gtk_icon_size_register ("hildon-xsmall", 16, 16);
   gtk_icon_size_register ("hildon-small", 24, 24);