Initial import from Charles Yates' v0.2 tarball.
[rugen] / src / main.c
1 /*
2 * main.c -- GTK+ 2 dv1394d client demo
3 * Copyright (C) 2002-2003 Charles Yates <charles.yates@pandora.be>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23
24 #include <gtk/gtk.h>
25 #include <unistd.h>
26 #include <string.h>
27
28 #include <stdio.h>
29 #include "interface.h"
30 #include "support.h"
31 #include "dv1394app.h"
32
33 int main( int argc, char *argv[] )
34 {
35 char path[ 512 ];
36 dv1394app app = NULL;
37 GtkWidget *gdv1394d;
38
39 #ifdef ENABLE_NLS
40 bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
41 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
42 textdomain (GETTEXT_PACKAGE);
43 #endif
44
45 g_thread_init(NULL);
46 gdk_threads_init( );
47 gtk_set_locale( );
48 gtk_init( &argc, &argv );
49
50 // Linux hack to determine path of the executable
51 readlink( "/proc/self/exe", path, 512 );
52 if ( strstr( path, "/bin/fireswamp" ) )
53 {
54 ( *strstr( path, "/bin/fireswamp" ) ) = '\0';
55 strcat( path, "/share/fireswamp/pixmaps" );
56 add_pixmap_directory( path );
57 }
58 else
59 {
60 add_pixmap_directory( PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps" );
61 }
62
63 gdv1394d = create_gdv1394d ();
64 gtk_widget_show (gdv1394d);
65
66 gdk_threads_enter();
67 app = dv1394app_init( gdv1394d, argv[ 1 ] );
68 gtk_main ();
69 gdk_threads_leave();
70
71 dv1394app_close( app );
72
73 return 0;
74 }
75