2009-08-11 Chris Toshok <toshok@ximian.com>
[moon.git] / examples / clock-hands / hands.cpp
blob978fe60db6a10dcefa34ef782950658230cffe06
1 /*
2 * Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
4 * Contact:
5 * Moonlight List (moonlight-list@lists.ximian.com)
6 *
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use,
11 * copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following
14 * conditions:
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
30 #include <string.h>
31 #include <stdlib.h>
32 #include <unistd.h>
33 #include <gtk/gtk.h>
34 #include <gdk/gdkkeysyms.h>
35 #include <signal.h>
36 #include <sys/syscall.h>
37 #include <sys/wait.h>
38 #include <dlfcn.h>
39 #include <gtkmozembed.h>
40 #include <nsXPCOMGlue.h>
42 static const GREVersionRange gre_version = {
43 "1.9", PR_TRUE,
44 "9.9", PR_TRUE
47 int
48 main(int argc, char **argv)
50 gtk_init (&argc, &argv);
52 GtkWindow *window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
54 char xpcom_lib_path [PATH_MAX];
55 char* xpcom_dir_path;
57 GRE_GetGREPathWithProperties (&gre_version, 1, nsnull, 0, xpcom_lib_path, sizeof (xpcom_lib_path));
58 xpcom_dir_path = g_path_get_dirname (xpcom_lib_path);
60 gtk_moz_embed_set_path (xpcom_dir_path);
61 g_free (xpcom_dir_path);
63 GtkWidget *moz_embed = gtk_moz_embed_new();
64 gtk_container_add (GTK_CONTAINER (window), moz_embed);
66 gtk_widget_set_usize (moz_embed, 416, 416);
68 char *current_directory = g_get_current_dir ();
69 char *html_path = g_strdup_printf ("file://%s/hands.html", current_directory);
70 gtk_moz_embed_load_url (GTK_MOZ_EMBED (moz_embed), html_path);
72 g_free (current_directory);
73 g_free (html_path);
75 gtk_widget_show_all (moz_embed);
76 gtk_widget_show_all (GTK_WIDGET (window));
77 gtk_main ();
79 return 0;