1 /*******************************************************************************
2 This file is part of WhiteStork.
4 WhiteStork is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 WhiteStork is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with WhiteStork; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 Copyright 2006 ComArch S.A.
19 *******************************************************************************/
21 #include <ws_gui_callbacks.h>
22 #include <ws_gui_layout.h>
24 #include <pc-instances.h>
26 //int ws_gui_init(int argc, char *argv[])
27 int main(int argc, char *argv[])
29 if (is_already_running_this_application() > 1)
31 // if YES - do not start another one - terminate
32 g_debug("Another instance of application curently is running\n");
41 gtk_init(&argc, &argv);
44 setlocale(LC_ALL, "");
45 bindtextdomain("whitestork", "/usr/share/locale");
46 bind_textdomain_codeset("whitestork", "UTF-8");
47 textdomain("whitestork");
49 if (strcmp(_("ws_check"), "ws_check") == 0)
51 setlocale(LC_ALL, "en_GB");
52 bindtextdomain("whitestork", "/usr/share/locale");
53 bind_textdomain_codeset("whitestork", "UTF-8");
54 textdomain("whitestork");
59 ws_gui_app = (WSGuiApp*)g_malloc(sizeof(WSGuiApp));
62 ws_gui_app->ws_gui_w_list =
63 (struct WSGuiList*)g_malloc(sizeof(struct WSGuiList));
64 ws_gui_app->ws_gui_menu =
65 (struct WSGuiMenu*)g_malloc(sizeof(struct WSGuiMenu));
68 ws_gui_app->client = gconf_client_get_default();
70 ws_gui_create_window(ws_gui_app);
71 ws_gui_read_adjustment(ws_gui_app);
75 ws_gui_app->dbus_data = ws_dbus_create ("WhiteStorkGui", "v1.0");
77 ws_dbus_config (ws_gui_app->dbus_data,
78 WS_DBUS_CONFIG_SERVICE,
79 "org.maemo.WhiteStorkGui");
80 ws_dbus_config (ws_gui_app->dbus_data,
81 WS_DBUS_CONFIG_OBJECT,
82 "/org/maemo/WhiteStorkGui");
83 ws_dbus_config (ws_gui_app->dbus_data,
85 "org.maemo.WhiteStorkGui");
86 ws_dbus_config (ws_gui_app->dbus_data,
87 WS_DBUS_CONFIG_REMOTE_SERVICE,
88 "org.maemo.WhiteStorkManager");
89 ws_dbus_config (ws_gui_app->dbus_data,
90 WS_DBUS_CONFIG_REMOTE_OBJECT,
91 "/org/maemo/WhiteStorkManager");
92 ws_dbus_config (ws_gui_app->dbus_data,
93 WS_DBUS_CONFIG_REMOTE_IFACE,
94 "org.maemo.WhiteStorkManager");
96 ws_dbus_connect (ws_gui_app->dbus_data);
98 ws_dbus_set_cb (ws_gui_app->dbus_data,
100 ws_gui_dbus_return_words,
103 ws_dbus_set_cb (ws_gui_app->dbus_data,
104 "return_translations",
105 ws_gui_dbus_return_translation,
107 ws_dbus_set_cb (ws_gui_app->dbus_data,
108 "return_extracted_dict",
109 ws_dbus_server_return_extracted_dict2,
111 ws_dbus_set_cb (ws_gui_app->dbus_data,
112 "update_progressbar",
113 ws_dbus_progress_bar,
115 ws_dbus_set_cb (ws_gui_app->dbus_data,
117 ws_gui_signal_hander,
120 //setting the clipboard
121 ws_gui_app->ws_gui_clipboard =
122 gtk_widget_get_clipboard (GTK_WIDGET(ws_gui_app->ws_gui_html),
123 GDK_SELECTION_CLIPBOARD);
125 //connecting the signals
126 g_signal_connect(G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_selection),
128 G_CALLBACK (ws_gui_tree_selection_changed),
130 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
132 G_CALLBACK(hildon_key_press_listener),
134 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
135 "button-press-event",
136 G_CALLBACK(ws_gui_button_press),
138 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
139 "button-release-event",
140 G_CALLBACK(ws_gui_button_release),
142 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
144 G_CALLBACK(ws_gui_on_exit),
147 ws_dbus_notify(ws_gui_app->dbus_data,
148 WS_DBUS_ERROR_UNKNOWN);