1 /*******************************************************************************
2 This file is part of mdictionary.
4 mdictionary 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 mdictionary 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 mdictionary; 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 *******************************************************************************/
24 * \brief Main GUI file.
26 * GUI main loop and basic configuration of gui modules.
27 * \author Anna Gadomska \<anna.gadomska\@comarch.com\>
33 #include <ws_gui_callbacks.h>
34 #include <ws_gui_layout.h>
36 //int ws_gui_init(int argc, char *argv[])
37 int main(int argc, char *argv[])
41 gtk_init(&argc, &argv);
44 setlocale(LC_ALL, "");
45 bindtextdomain(PACKAGE, LOCALEDIR);
46 bind_textdomain_codeset(PACKAGE, "UTF-8");
49 if (strcmp(_("ws_check"), "ws_check") == 0)
51 setlocale(LC_ALL, "en_GB");
52 bindtextdomain(PACKAGE, LOCALEDIR);
53 bind_textdomain_codeset(PACKAGE, "UTF-8");
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 ("mdictionaryGui", "v1.0");
77 /*dbus wrapper configuration*/
78 ws_dbus_config (ws_gui_app->dbus_data,
79 WS_DBUS_CONFIG_SERVICE,
81 ws_dbus_config (ws_gui_app->dbus_data,
82 WS_DBUS_CONFIG_OBJECT,
84 ws_dbus_config (ws_gui_app->dbus_data,
87 ws_dbus_config (ws_gui_app->dbus_data,
88 WS_DBUS_CONFIG_REMOTE_SERVICE,
90 ws_dbus_config (ws_gui_app->dbus_data,
91 WS_DBUS_CONFIG_REMOTE_OBJECT,
93 ws_dbus_config (ws_gui_app->dbus_data,
94 WS_DBUS_CONFIG_REMOTE_IFACE,
97 //Add a list of remote methods available
98 ws_dbus_add_method (ws_gui_app->dbus_data,
101 WS_DBUS_TYPE_INVALID);
103 ws_dbus_add_method (ws_gui_app->dbus_data,
104 "return_translations",
106 WS_DBUS_TYPE_INVALID);
108 ws_dbus_add_method (ws_gui_app->dbus_data,
109 "return_extracted_dict",
111 WS_DBUS_TYPE_INVALID);
113 ws_dbus_add_method (ws_gui_app->dbus_data,
114 "update_progressbar",
116 WS_DBUS_TYPE_INVALID);
118 ws_dbus_add_method (ws_gui_app->dbus_data,
121 WS_DBUS_TYPE_INVALID);
123 ws_dbus_add_method (ws_gui_app->dbus_data,
124 "search_home_applet",
126 WS_DBUS_TYPE_INVALID);
128 //setting callbacks for local methods
129 ws_dbus_set_cb (ws_gui_app->dbus_data,
131 ws_gui_dbus_return_words,
134 ws_dbus_set_cb (ws_gui_app->dbus_data,
135 "return_translations",
136 ws_gui_dbus_return_translation,
138 ws_dbus_set_cb (ws_gui_app->dbus_data,
139 "return_extracted_dict",
140 ws_dbus_server_return_extracted_bzip,
142 ws_dbus_set_cb (ws_gui_app->dbus_data,
143 "update_progressbar",
144 ws_dbus_progress_bar,
146 ws_dbus_set_cb (ws_gui_app->dbus_data,
148 ws_gui_signal_hander,
151 ws_dbus_set_cb (ws_gui_app->dbus_data,
152 "search_home_applet",
153 ws_gui_search_home_handler,
156 ws_dbus_connect (ws_gui_app->dbus_data);
158 /*setting the clipboard*/
159 ws_gui_app->ws_gui_clipboard =
160 gtk_widget_get_clipboard (GTK_WIDGET(ws_gui_app->ws_gui_html),
161 GDK_SELECTION_CLIPBOARD);
163 /*connecting the signals*/
164 g_signal_connect(G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_view),
166 G_CALLBACK (ws_gui_view_cursor_changed),
170 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
172 G_CALLBACK(hildon_key_press_listener),
174 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
175 "button-press-event",
176 G_CALLBACK(ws_gui_button_press),
178 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
179 "button-release-event",
180 G_CALLBACK(ws_gui_button_release),
183 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_list_eventbox),
184 "button-press-event",
185 G_CALLBACK(ws_gui_list_full_dialog),
187 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
189 G_CALLBACK(ws_gui_on_exit),
192 ws_dbus_notify(ws_gui_app->dbus_data,
193 WS_DBUS_ERROR_UNKNOWN);