00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00032 #include <ws_gui.h>
00033 #include <ws_gui_callbacks.h>
00034 #include <ws_gui_layout.h>
00035
00036
00037 int main(int argc, char *argv[])
00038 {
00039
00040
00041 gtk_init(&argc, &argv);
00042
00043
00044 setlocale(LC_ALL, "");
00045 bindtextdomain(PACKAGE, LOCALEDIR);
00046 bind_textdomain_codeset(PACKAGE, "UTF-8");
00047 textdomain(PACKAGE);
00048
00049 if (strcmp(_("ws_check"), "ws_check") == 0)
00050 {
00051 setlocale(LC_ALL, "en_GB");
00052 bindtextdomain(PACKAGE, LOCALEDIR);
00053 bind_textdomain_codeset(PACKAGE, "UTF-8");
00054 textdomain(PACKAGE);
00055 }
00056
00057
00058 WSGuiApp *ws_gui_app;
00059 ws_gui_app = (WSGuiApp*)g_malloc(sizeof(WSGuiApp));
00060
00061
00062 ws_gui_app->ws_gui_w_list =
00063 (struct WSGuiList*)g_malloc(sizeof(struct WSGuiList));
00064 ws_gui_app->ws_gui_menu =
00065 (struct WSGuiMenu*)g_malloc(sizeof(struct WSGuiMenu));
00066
00067
00068 ws_gui_app->client = gconf_client_get_default();
00069
00070 ws_gui_create_window(ws_gui_app);
00071 ws_gui_read_adjustment(ws_gui_app);
00072
00073
00074
00075 ws_gui_app->dbus_data = ws_dbus_create ("mdictionaryGui", "v1.0");
00076
00077
00078 ws_dbus_config (ws_gui_app->dbus_data,
00079 WS_DBUS_CONFIG_SERVICE,
00080 GUI_SERVICE);
00081 ws_dbus_config (ws_gui_app->dbus_data,
00082 WS_DBUS_CONFIG_OBJECT,
00083 GUI_OBJECT);
00084 ws_dbus_config (ws_gui_app->dbus_data,
00085 WS_DBUS_CONFIG_IFACE,
00086 GUI_IFACE);
00087 ws_dbus_config (ws_gui_app->dbus_data,
00088 WS_DBUS_CONFIG_REMOTE_SERVICE,
00089 MANAGER_SERVICE);
00090 ws_dbus_config (ws_gui_app->dbus_data,
00091 WS_DBUS_CONFIG_REMOTE_OBJECT,
00092 MANAGER_OBJECT);
00093 ws_dbus_config (ws_gui_app->dbus_data,
00094 WS_DBUS_CONFIG_REMOTE_IFACE,
00095 MANAGER_IFACE);
00096
00097
00098 ws_dbus_add_method (ws_gui_app->dbus_data,
00099 "return_words",
00100 WS_DBUS_TYPE_GARRAY,
00101 WS_DBUS_TYPE_INVALID);
00102
00103 ws_dbus_add_method (ws_gui_app->dbus_data,
00104 "return_translations",
00105 WS_DBUS_TYPE_STRING,
00106 WS_DBUS_TYPE_INVALID);
00107
00108 ws_dbus_add_method (ws_gui_app->dbus_data,
00109 "return_extracted_dict",
00110 WS_DBUS_TYPE_STRING,
00111 WS_DBUS_TYPE_INVALID);
00112
00113 ws_dbus_add_method (ws_gui_app->dbus_data,
00114 "update_progressbar",
00115 WS_DBUS_TYPE_DOUBLE,
00116 WS_DBUS_TYPE_INVALID);
00117
00118 ws_dbus_add_method (ws_gui_app->dbus_data,
00119 "signal",
00120 WS_DBUS_TYPE_SIGNAL,
00121 WS_DBUS_TYPE_INVALID);
00122
00123 ws_dbus_add_method (ws_gui_app->dbus_data,
00124 "search_home_applet",
00125 WS_DBUS_TYPE_STRING,
00126 WS_DBUS_TYPE_INVALID);
00127
00128
00129 ws_dbus_set_cb (ws_gui_app->dbus_data,
00130 "return_words",
00131 ws_gui_dbus_return_words,
00132 ws_gui_app);
00133
00134 ws_dbus_set_cb (ws_gui_app->dbus_data,
00135 "return_translations",
00136 ws_gui_dbus_return_translation,
00137 ws_gui_app);
00138 ws_dbus_set_cb (ws_gui_app->dbus_data,
00139 "return_extracted_dict",
00140 ws_dbus_server_return_extracted_bzip,
00141 ws_gui_app);
00142 ws_dbus_set_cb (ws_gui_app->dbus_data,
00143 "update_progressbar",
00144 ws_dbus_progress_bar,
00145 ws_gui_app);
00146 ws_dbus_set_cb (ws_gui_app->dbus_data,
00147 "signal",
00148 ws_gui_signal_hander,
00149 ws_gui_app);
00150
00151 ws_dbus_set_cb (ws_gui_app->dbus_data,
00152 "search_home_applet",
00153 ws_gui_search_home_handler,
00154 ws_gui_app);
00155
00156 ws_dbus_connect (ws_gui_app->dbus_data);
00157
00158
00159 ws_gui_app->ws_gui_clipboard =
00160 gtk_widget_get_clipboard (GTK_WIDGET(ws_gui_app->ws_gui_html),
00161 GDK_SELECTION_CLIPBOARD);
00162
00163
00164 g_signal_connect(G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_view),
00165 "cursor-changed",
00166 G_CALLBACK (ws_gui_view_cursor_changed),
00167 ws_gui_app);
00168
00169
00170 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
00171 "key-press-event",
00172 G_CALLBACK(hildon_key_press_listener),
00173 ws_gui_app);
00174 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
00175 "button-press-event",
00176 G_CALLBACK(ws_gui_button_press),
00177 ws_gui_app);
00178 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
00179 "button-release-event",
00180 G_CALLBACK(ws_gui_button_release),
00181 ws_gui_app);
00182
00183 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_list_eventbox),
00184 "button-press-event",
00185 G_CALLBACK(ws_gui_list_full_dialog),
00186 ws_gui_app);
00187 g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
00188 "delete-event",
00189 G_CALLBACK(ws_gui_on_exit),
00190 ws_gui_app);
00191
00192 ws_dbus_notify(ws_gui_app->dbus_data,
00193 WS_DBUS_ERROR_UNKNOWN);
00194
00195 gtk_main();
00196
00197 return 0;
00198 }
00199