Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 86379 | Differences between
and this patch

Collapse All | Expand All

(-)stardict-cur-accepted/configure.in (-31 / +33 lines)
Lines 34-72 Link Here
34
ALL_LINGUAS="cs de hu mk ru sk uk vi zh_CN zh_TW"
34
ALL_LINGUAS="cs de hu mk ru sk uk vi zh_CN zh_TW"
35
AM_GLIB_GNU_GETTEXT
35
AM_GLIB_GNU_GETTEXT
36
36
37
dnl
37
AC_ARG_ENABLE(gnome-support, AC_HELP_STRING([--disable-gnome-support], [Disable gnome support]))
38
dnl Start of pkg-config checks
38
AM_CONDITIONAL(GNOME_SUPPORT, test "x${enable_gnome_support}" != "xno")
39
dnl
40
PKG_CHECK_MODULES(STARDICT, libgnomeui-2.0 >= 2.2.0)
41
STARDICT_CFLAGS="\
42
	-Wall \
43
	$STARDICT_CFLAGS"
44
39
40
if test "x${enable_gnome_support}" != "xno" ; then
41
	echo "enable gnome suppport";
45
dnl
42
dnl
46
dnl Start of zlib checks
43
dnl Start of pkg-config checks
47
dnl
44
dnl
48
AC_CHECK_LIB(z,zlibVersion,STARDICT_LIBS="$STARDICT_LIBS -lz",[AC_MSG_ERROR([zlib not found])])
45
	PKG_CHECK_MODULES(STARDICT, libgnomeui-2.0 >= 2.2.0)
49
46
	STARDICT_CFLAGS="-Wall $STARDICT_CFLAGS"
50
51
dnl *********************************************
47
dnl *********************************************
52
dnl for anything which calls gconftool-2 correctly
48
dnl for anything which calls gconftool-2 correctly
53
dnl *********************************************
49
dnl *********************************************
54
50
51
	AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
52
	if test x"$GCONFTOOL" = xno; then
53
        	AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
54
	fi
55
	AM_GCONF_SOURCE_2
55
56
56
dnl ******************************
57
	AM_CONDITIONAL(SCHEMAS_INSTALL, test x$schemas_install = xtrue)
58
dnl ==========================================================================
59
dnl stuff for the CORBA interface
57
60
58
dnl AC_ARG_ENABLE(schemas-install,AC_HELP_STRING([--disable-schemas-install], [Disable installation of the gconf schemas]))
61
	ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
62
	AC_SUBST(ORBIT_IDL)
59
63
60
dnl AM_CONDITIONAL(SCHEMAS_INSTALL, test x$enable_schemas_install != xno)
64
	LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
65
	AC_SUBST(LIBBONOBO_IDL)
61
66
62
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
67
	BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
63
if test x"$GCONFTOOL" = xno; then
68
	AC_SUBST(BONOBO_ACTIVATION_IDL)
64
        AC_MSG_ERROR([gconftool-2 executable not found in your path - should be
69
else
65
installed with GConf])
70
	echo "disable gnome support";
71
	AC_DEFINE([WITHOUT_GNOME],[], [Compile with gnome support])
72
	AM_CONDITIONAL(SCHEMAS_INSTALL, test "x${enable_gnome_support}" != "xno")
73
	AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x${enable_gnome_support}" != "xno")
74
	PKG_CHECK_MODULES(STARDICT, gtk+-2.0)
66
fi
75
fi
67
AM_GCONF_SOURCE_2
68
76
69
AM_CONDITIONAL(SCHEMAS_INSTALL, test x$schemas_install = xtrue)
77
78
70
79
71
dnl
80
dnl
72
dnl Check popt
81
dnl Check popt
Lines 76-93 Link Here
76
stardict. You can download the latest version from ftp://people.redhat.com/sopwith/popt/]))
85
stardict. You can download the latest version from ftp://people.redhat.com/sopwith/popt/]))
77
86
78
87
79
dnl ==========================================================================
80
81
dnl stuff for the CORBA interface
82
83
ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
84
AC_SUBST(ORBIT_IDL)
85
86
LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
87
AC_SUBST(LIBBONOBO_IDL)
88
88
89
BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
89
dnl
90
AC_SUBST(BONOBO_ACTIVATION_IDL)
90
dnl Start of zlib checks
91
dnl
92
AC_CHECK_LIB(z,zlibVersion,STARDICT_LIBS="$STARDICT_LIBS -lz",[AC_MSG_ERROR([zlib not found])])
91
93
92
dnl ==========================================================================
94
dnl ==========================================================================
93
95
(-)stardict-cur-accepted/data/Makefile.am (-1 / +7 lines)
Lines 3-8 Link Here
3
desktop_DATA 	 = $(desktop_in_files:.desktop.in=.desktop)
3
desktop_DATA 	 = $(desktop_in_files:.desktop.in=.desktop)
4
@INTLTOOL_DESKTOP_RULE@
4
@INTLTOOL_DESKTOP_RULE@
5
5
6
if GNOME_SUPPORT
6
schemasdir	 = $(sysconfdir)/gconf/schemas
7
schemasdir	 = $(sysconfdir)/gconf/schemas
7
schemas_in_files = stardict.schemas.in
8
schemas_in_files = stardict.schemas.in
8
schemas_DATA 	 = $(schemas_in_files:.schemas.in=.schemas)
9
schemas_DATA 	 = $(schemas_in_files:.schemas.in=.schemas)
Lines 12-25 Link Here
12
server_in_files = GNOME_Stardict.server.in
13
server_in_files = GNOME_Stardict.server.in
13
server_DATA = $(server_in_files:.server.in=.server)
14
server_DATA = $(server_in_files:.server.in=.server)
14
@INTLTOOL_SERVER_RULE@
15
@INTLTOOL_SERVER_RULE@
16
endif
15
17
16
man_MANS = stardict.1
18
man_MANS = stardict.1
17
19
18
20
if GNOME_SUPPORT
19
EXTRA_DIST = $(desktop_in_files)	\
21
EXTRA_DIST = $(desktop_in_files)	\
20
	$(server_in_files)		\
22
	$(server_in_files)		\
21
	$(schemas_in_files)		\
23
	$(schemas_in_files)		\
22
	$(man_MANS)
24
	$(man_MANS)
25
else
26
XTRA_DIST = $(desktop_in_files)        \
27
        $(man_MANS)
28
endif
23
29
24
CLEANFILES = \
30
CLEANFILES = \
25
	$(server_DATA) \
31
	$(server_DATA) \
(-)stardict-cur-accepted/help/Makefile.am (+2 lines)
Lines 1-3 Link Here
1
## Process this file with automake to produce Makefile.in.
1
## Process this file with automake to produce Makefile.in.
2
2
3
if GNOME_SUPPORT
3
SUBDIRS = C zh_CN zh_TW uk ru mk
4
SUBDIRS = C zh_CN zh_TW uk ru mk
5
endif
(-)stardict-cur-accepted/src/dictmanagedlg.cpp (+1 lines)
Lines 4-9 Link Here
4
4
5
#include <cstring>
5
#include <cstring>
6
#include <sys/stat.h>
6
#include <sys/stat.h>
7
#include <glib/gi18n.h>
7
8
8
#ifdef _WIN32
9
#ifdef _WIN32
9
#  include <gdk/gdkwin32.h>
10
#  include <gdk/gdkwin32.h>
(-)stardict-cur-accepted/src/docklet.cpp (+2 lines)
Lines 2-7 Link Here
2
#  include "config.h"
2
#  include "config.h"
3
#endif
3
#endif
4
4
5
#include <glib/gi18n.h>
6
5
#include "stardict.h"
7
#include "stardict.h"
6
#include "conf.h"
8
#include "conf.h"
7
9
(-)stardict-cur-accepted/src/floatwin.cpp (+1 lines)
Lines 4-9 Link Here
4
4
5
#include <cstring>
5
#include <cstring>
6
#include <string>
6
#include <string>
7
#include <glib/gi18n.h>
7
8
8
#ifdef _WIN32
9
#ifdef _WIN32
9
#  include <gdk/gdkwin32.h>
10
#  include <gdk/gdkwin32.h>
(-)stardict-cur-accepted/src/gnome-about.c (+888 lines)
Line 0 Link Here
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2
/* gnome-about.c - An about box widget for gnome.
3
4
   Copyright (C) 2001 CodeFactory AB
5
   Copyright (C) 2001, 2002 Anders Carlsson
6
7
   The Gnome Library is free software; you can redistribute it and/or
8
   modify it under the terms of the GNU Library General Public License as
9
   published by the Free Software Foundation; either version 2 of the
10
   License, or (at your option) any later version.
11
12
   The Gnome Library is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
   Library General Public License for more details.
16
17
   You should have received a copy of the GNU Library General Public
18
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
19
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
   Boston, MA 02111-1307, USA.
21
22
   Author: Anders Carlsson <andersca@gnu.org>
23
*/
24
25
//Changed by Hu Zheng <huzheng_001@163.com> to make it compile along. 2003.09.23
26
27
#include <glib/gi18n.h>
28
29
#include <gtk/gtkalignment.h>
30
#include <gtk/gtkbbox.h>
31
#include <gtk/gtkbutton.h>
32
#include <gtk/gtkdialog.h>
33
#include <gtk/gtkhbox.h>
34
#include <gtk/gtkimage.h>
35
#include <gtk/gtklabel.h>
36
#include <gtk/gtknotebook.h>
37
#include <gtk/gtkscrolledwindow.h>
38
#include <gtk/gtkstock.h>
39
#include <gtk/gtktextview.h>
40
#include <gtk/gtkvbox.h>
41
#include <gtk/gtkviewport.h>
42
43
44
#include <glib/gmacros.h>
45
46
#include "gnome-about.h"
47
48
G_BEGIN_DECLS
49
50
#define BONOBO_BOILERPLATE(type, type_as_function, corba_type,		\
51
			   parent_type, parent_type_macro,		\
52
			   register_type_macro)				\
53
static void type_as_function ## _class_init    (type ## Class *klass);	\
54
static void type_as_function ## _instance_init (type          *object);	\
55
static parent_type ## Class *parent_class = NULL;			\
56
static void								\
57
type_as_function ## _class_init_trampoline (gpointer klass,		\
58
					    gpointer data)		\
59
{									\
60
	parent_class = (parent_type ## Class *)g_type_class_ref (	\
61
		parent_type_macro);					\
62
	type_as_function ## _class_init ((type ## Class *)klass);	\
63
}									\
64
GType									\
65
type_as_function ## _get_type (void)					\
66
{									\
67
	static GType object_type = 0;					\
68
	if (object_type == 0) {						\
69
		static const GTypeInfo object_info = {			\
70
		    sizeof (type ## Class),				\
71
		    NULL,		/* base_init */			\
72
		    NULL,		/* base_finalize */		\
73
		    type_as_function ## _class_init_trampoline,		\
74
		    NULL,		/* class_finalize */		\
75
		    NULL,               /* class_data */		\
76
		    sizeof (type),					\
77
		    0,                  /* n_preallocs */		\
78
		    (GInstanceInitFunc) type_as_function ## _instance_init \
79
		};							\
80
		object_type = register_type_macro			\
81
			(type, type_as_function, corba_type,		\
82
			 parent_type, parent_type_macro);		\
83
	}								\
84
	return object_type;						\
85
}
86
87
#define BONOBO_CALL_PARENT(parent_class_cast, name, args)		\
88
	((parent_class_cast(parent_class)->name != NULL) ?		\
89
	 parent_class_cast(parent_class)->name args : (void)0)
90
91
G_END_DECLS
92
93
#define GNOME_CLASS_BOILERPLATE(type, type_as_function,			\
94
				parent_type, parent_type_macro)		\
95
	BONOBO_BOILERPLATE(type, type_as_function, type,		\
96
			  parent_type, parent_type_macro,		\
97
			  GNOME_REGISTER_TYPE)
98
99
#define GNOME_REGISTER_TYPE(type, type_as_function, corba_type,		\
100
			    parent_type, parent_type_macro)		\
101
	g_type_register_static (parent_type_macro, #type, &object_info, 0)
102
103
#define GNOME_CALL_PARENT(parent_class_cast, name, args)		\
104
	BONOBO_CALL_PARENT (parent_class_cast, name, args)
105
106
/* FIXME: More includes! */
107
108
struct _GnomeAboutPrivate {
109
	gchar *name;
110
	gchar *version;
111
	gchar *copyright;
112
	gchar *comments;
113
	gchar *translator_credits;
114
	
115
	GSList *authors;
116
	GSList *documenters;
117
	
118
	GtkWidget *logo_image;
119
	GtkWidget *name_label;
120
	GtkWidget *comments_label;
121
	GtkWidget *copyright_label;
122
123
	GtkWidget *credits_dialog;
124
};
125
126
enum {
127
	PROP_0,
128
	PROP_NAME,
129
	PROP_VERSION,
130
	PROP_COPYRIGHT,
131
	PROP_COMMENTS,
132
	PROP_AUTHORS,
133
	PROP_DOCUMENTERS,
134
	PROP_TRANSLATOR_CREDITS,
135
	PROP_LOGO,
136
};
137
138
#define GNOME_RESPONSE_CREDITS 1
139
140
static void gnome_about_finalize (GObject *object);
141
static void gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
142
static void gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
143
144
GNOME_CLASS_BOILERPLATE (GnomeAbout, gnome_about,
145
			 GtkDialog, GTK_TYPE_DIALOG)
146
147
static void
148
gnome_about_update_authors_label (GnomeAbout *about, GtkWidget *label)
149
{
150
	GString *string;
151
	GSList *list;
152
	gchar *tmp;
153
	
154
	if (about->_priv->authors == NULL) {
155
		gtk_widget_hide (label);
156
		return;
157
	}
158
	else {
159
		gtk_widget_show (label);
160
	}
161
162
	string = g_string_new (NULL);
163
164
	for (list = about->_priv->authors; list; list = list->next) {
165
		tmp = g_markup_escape_text (list->data, -1);
166
		g_string_append (string, tmp);
167
168
		if (list->next)
169
			g_string_append_c (string, '\n');
170
		g_free (tmp);
171
	}
172
	
173
	gtk_label_set_markup (GTK_LABEL (label), string->str);
174
	g_string_free (string, TRUE);
175
}
176
177
static void
178
gnome_about_update_documenters_label (GnomeAbout *about, GtkWidget *label)
179
{
180
	GString *string;
181
	GSList *list;
182
	gchar *tmp;
183
		
184
	if (about->_priv->documenters == NULL) {
185
		gtk_widget_hide (label);
186
		return;
187
	}
188
	else {
189
		gtk_widget_show (label);
190
	}
191
192
	string = g_string_new (NULL);
193
194
	for (list = about->_priv->documenters; list; list = list->next) {
195
		tmp = g_markup_escape_text (list->data, -1);
196
		g_string_append (string, tmp);
197
198
		if (list->next)
199
			g_string_append (string, "\n");
200
		g_free (tmp);
201
	}
202
	
203
	gtk_label_set_markup (GTK_LABEL (label), string->str);
204
	g_string_free (string, TRUE);
205
}
206
207
static void
208
gnome_about_update_translation_information_label (GnomeAbout *about, GtkWidget *label)
209
{
210
	GString *string;
211
	gchar *tmp;
212
	
213
	if (about->_priv->translator_credits == NULL) {
214
		gtk_widget_hide (label);
215
		return;
216
	}
217
	else {
218
		gtk_widget_show (label);
219
	}
220
221
	string = g_string_new (NULL);
222
223
	tmp = g_markup_escape_text (about->_priv->translator_credits, -1);
224
	g_string_append (string, tmp);
225
	g_free (tmp);
226
	
227
	gtk_label_set_markup (GTK_LABEL (label), string->str);
228
	g_string_free (string, TRUE);
229
}
230
231
static GtkWidget *
232
create_label (void)
233
{
234
	GtkWidget *label;
235
	
236
	label = gtk_label_new ("");
237
	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
238
	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
239
	gtk_misc_set_padding (GTK_MISC (label), 8, 8);
240
241
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
242
243
	return label;
244
}
245
246
static void
247
gnome_about_display_credits_dialog (GnomeAbout *about)
248
{
249
	GtkWidget *dialog, *label, *notebook, *sw;
250
251
	if (about->_priv->credits_dialog != NULL) {
252
		gtk_window_present (GTK_WINDOW (about->_priv->credits_dialog));
253
		return;
254
	}
255
	
256
	dialog = gtk_dialog_new_with_buttons (_("Credits"),
257
					      GTK_WINDOW (about),
258
					      GTK_DIALOG_DESTROY_WITH_PARENT,
259
					      GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
260
					      NULL);
261
	about->_priv->credits_dialog = dialog;
262
	gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
263
	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
264
	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
265
	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
266
	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
267
	g_signal_connect (dialog, "response",
268
			  G_CALLBACK (gtk_widget_destroy), dialog);
269
	g_signal_connect (dialog, "destroy",
270
			  G_CALLBACK (gtk_widget_destroyed),
271
			  &(about->_priv->credits_dialog));
272
273
	notebook = gtk_notebook_new ();
274
	gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
275
	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
276
277
	if (about->_priv->authors != NULL) {
278
		label = create_label ();
279
280
		sw = gtk_scrolled_window_new (NULL, NULL);
281
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
282
						GTK_POLICY_AUTOMATIC,
283
						GTK_POLICY_AUTOMATIC);
284
		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
285
		gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
286
		
287
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw,
288
					  gtk_label_new (_("Written by")));
289
		gnome_about_update_authors_label (about, label);
290
	}
291
292
	if (about->_priv->documenters != NULL) {
293
		label = create_label ();
294
		
295
		sw = gtk_scrolled_window_new (NULL, NULL);
296
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
297
						GTK_POLICY_AUTOMATIC,
298
						GTK_POLICY_AUTOMATIC);
299
		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
300
		gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
301
302
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw,
303
					  gtk_label_new (_("Documented by")));
304
		gnome_about_update_documenters_label (about, label);
305
	}
306
307
	if (about->_priv->translator_credits != NULL) {
308
		label = create_label ();
309
		
310
		sw = gtk_scrolled_window_new (NULL, NULL);
311
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
312
						GTK_POLICY_AUTOMATIC,
313
						GTK_POLICY_AUTOMATIC);
314
		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
315
		gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
316
317
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw,
318
					  gtk_label_new (_("Translated by")));
319
		gnome_about_update_translation_information_label (about, label);
320
	}
321
	
322
	gtk_widget_show_all (dialog);
323
}
324
325
static void
326
gnome_about_instance_init (GnomeAbout *about)
327
{
328
	GnomeAboutPrivate *priv;
329
	GtkWidget *vbox, *hbox, *image, *label, *alignment, *button;
330
331
	/* Data */
332
	
333
	priv = g_new0 (GnomeAboutPrivate, 1);
334
	about->_priv = priv;
335
336
	priv->name = NULL;
337
	priv->version = NULL;
338
	priv->copyright = NULL;
339
	priv->comments = NULL;
340
	priv->translator_credits = NULL;
341
	priv->authors = NULL;
342
	priv->documenters = NULL;
343
344
	gtk_dialog_set_has_separator (GTK_DIALOG (about), FALSE);
345
	gtk_container_set_border_width (GTK_CONTAINER (about), 5);
346
	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (about)->vbox), 5);
347
348
	/* Widgets */
349
	vbox = gtk_vbox_new (FALSE, 8);
350
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
351
352
	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0);
353
354
	priv->logo_image = gtk_image_new ();
355
	gtk_box_pack_start (GTK_BOX (vbox), priv->logo_image, FALSE, FALSE, 0);
356
	priv->name_label = gtk_label_new (NULL);
357
	gtk_label_set_selectable (GTK_LABEL (priv->name_label), TRUE);
358
	gtk_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER);
359
	gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0);
360
361
	priv->comments_label = gtk_label_new (NULL);
362
	gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE);
363
	gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER);
364
	gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
365
	gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0);
366
367
	priv->copyright_label = gtk_label_new (NULL);
368
	gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE);	
369
	gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER);
370
	gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0);
371
372
	gtk_widget_show_all (vbox);
373
	
374
	/* Add the close button */
375
	gtk_dialog_add_button (GTK_DIALOG (about), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
376
	gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CLOSE);
377
378
	/* Add the credits button */
379
	image = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON);
380
381
	label = gtk_label_new_with_mnemonic (_("C_redits"));
382
	
383
	hbox = gtk_hbox_new (FALSE, 2);
384
	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
385
	gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
386
387
	alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
388
	gtk_container_add (GTK_CONTAINER (alignment), hbox);
389
390
	button = gtk_button_new ();
391
	gtk_container_add (GTK_CONTAINER (button), alignment);
392
	gtk_widget_show_all (button);
393
394
	gtk_dialog_add_action_widget (GTK_DIALOG (about), button, GNOME_RESPONSE_CREDITS);
395
	gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (about)->action_area), button, TRUE);
396
	
397
	gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
398
399
	priv->credits_dialog = NULL;
400
}
401
402
static void
403
gnome_about_response (GtkDialog *dialog, gint response)
404
{
405
	switch (response) {
406
	case GNOME_RESPONSE_CREDITS:
407
		gnome_about_display_credits_dialog (GNOME_ABOUT (dialog));
408
		break;
409
	default:
410
		gtk_widget_destroy (GTK_WIDGET (dialog));
411
		break;
412
	}
413
}
414
415
static void
416
gnome_about_class_init (GnomeAboutClass *klass)
417
{
418
	GObjectClass *object_class;
419
	GtkWidgetClass *widget_class;
420
	GtkDialogClass *dialog_class;
421
	
422
	object_class = (GObjectClass *)klass;
423
	widget_class = (GtkWidgetClass *)klass;
424
	dialog_class = (GtkDialogClass *)klass;
425
	
426
	object_class->set_property = gnome_about_set_property;
427
	object_class->get_property = gnome_about_get_property;
428
429
	object_class->finalize = gnome_about_finalize;
430
431
	dialog_class->response = gnome_about_response;
432
	
433
	g_object_class_install_property (object_class,
434
					 PROP_NAME,
435
					 g_param_spec_string ("name",
436
							      _("Program name"),
437
							      _("The name of the program"),
438
							      NULL,
439
							      G_PARAM_READWRITE));
440
441
	g_object_class_install_property (object_class,
442
					 PROP_VERSION,
443
					 g_param_spec_string ("version",
444
							      _("Program version"),
445
							      _("The version of the program"),
446
							      NULL,
447
							      G_PARAM_READWRITE));
448
	g_object_class_install_property (object_class,
449
					 PROP_COPYRIGHT,
450
					 g_param_spec_string ("copyright",
451
							      _("Copyright string"),
452
							      _("Copyright information for the program"),
453
							      NULL,
454
							      G_PARAM_READWRITE));
455
	
456
	g_object_class_install_property (object_class,
457
					 PROP_COMMENTS,
458
					 g_param_spec_string ("comments",
459
							      _("Comments string"),
460
							      _("Comments about the program"),
461
							      NULL,
462
							      G_PARAM_READWRITE));
463
	g_object_class_install_property (object_class,
464
					 PROP_AUTHORS,
465
					 g_param_spec_value_array ("authors",
466
								   _("Authors"),
467
								   _("List of authors of the programs"),
468
								   g_param_spec_string ("author-entry",
469
											_("Author entry"),
470
											_("A single author entry"),
471
											NULL,
472
											G_PARAM_READWRITE),
473
								   G_PARAM_WRITABLE));
474
	g_object_class_install_property (object_class,
475
					 PROP_DOCUMENTERS,
476
					 g_param_spec_value_array ("documenters",
477
								   _("Documenters"),
478
								   _("List of people documenting the program"),
479
								   g_param_spec_string ("documenter-entry",
480
											_("Documenter entry"),
481
											_("A single documenter entry"),
482
											NULL,
483
											G_PARAM_READWRITE),
484
								   G_PARAM_WRITABLE));
485
486
	g_object_class_install_property (object_class,
487
					 PROP_TRANSLATOR_CREDITS,
488
					 g_param_spec_string ("translator_credits",
489
							      _("Translator credits"),
490
							      _("Credits to the translators. This string should be marked as translatable"),
491
							      NULL,
492
							      G_PARAM_READWRITE));
493
	
494
	g_object_class_install_property (object_class,
495
					 PROP_LOGO,
496
					 g_param_spec_object ("logo",
497
							      _("Logo"),
498
							      _("A logo for the about box"),
499
							      GDK_TYPE_PIXBUF,
500
							      G_PARAM_WRITABLE));
501
502
}
503
504
static void
505
gnome_about_set_comments (GnomeAbout *about, const gchar *comments)
506
{
507
	g_free (about->_priv->comments);
508
	about->_priv->comments = comments ? g_strdup (comments) : NULL;
509
510
	gtk_label_set_text (GTK_LABEL (about->_priv->comments_label), about->_priv->comments);
511
}
512
513
static void
514
gnome_about_set_translator_credits (GnomeAbout *about, const gchar *translator_credits)
515
{
516
	g_free (about->_priv->translator_credits);
517
518
	about->_priv->translator_credits = g_strdup (translator_credits);
519
}
520
521
static void
522
gnome_about_set_copyright (GnomeAbout *about, const gchar *copyright)
523
{
524
	char *copyright_string, *tmp;
525
	
526
	g_free (about->_priv->copyright);
527
	about->_priv->copyright = copyright ? g_strdup (copyright) : NULL;
528
529
	if (about->_priv->copyright != NULL) {
530
		tmp = g_markup_escape_text (about->_priv->copyright, -1);
531
		copyright_string = g_strdup_printf ("<span size=\"small\">%s</span>", tmp);
532
		g_free (tmp);
533
	}
534
	else {
535
		copyright_string = NULL;
536
	}
537
538
	gtk_label_set_markup (GTK_LABEL (about->_priv->copyright_label), copyright_string);
539
540
	g_free (copyright_string);
541
}
542
543
static void
544
gnome_about_set_version (GnomeAbout *about, const gchar *version)
545
{
546
	gchar *name_string, *tmp_name, *tmp_version;
547
	
548
	g_free (about->_priv->version);
549
	about->_priv->version = version ? g_strdup (version) : NULL;
550
551
	tmp_name = g_markup_escape_text (about->_priv->name, -1);
552
	
553
	if (about->_priv->version != NULL) {
554
		tmp_version = g_markup_escape_text (about->_priv->version, -1);
555
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s %s</span>", tmp_name, tmp_version);
556
		g_free (tmp_version);
557
	}
558
	else {
559
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s</span>", tmp_name);
560
	}
561
562
	gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string);
563
	g_free (name_string);
564
	g_free (tmp_name);
565
}
566
567
static void
568
gnome_about_set_name (GnomeAbout *about, const gchar *name)
569
{
570
	gchar *title_string;
571
	gchar *name_string;
572
	gchar *tmp_name, *tmp_version;
573
	
574
	g_free (about->_priv->name);
575
	about->_priv->name = g_strdup (name ? name : "");
576
577
	title_string = g_strdup_printf (_("About %s"), name);
578
	gtk_window_set_title (GTK_WINDOW (about), title_string);
579
	g_free (title_string);
580
581
	tmp_name = g_markup_escape_text (about->_priv->name, -1);
582
583
	if (about->_priv->version != NULL) {
584
		tmp_version = g_markup_escape_text (about->_priv->version, -1);
585
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s %s</span>", tmp_name, tmp_version);
586
		g_free (tmp_version);
587
	}
588
	else {
589
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s</span>", tmp_name);
590
	}
591
592
	gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string);
593
	g_free (name_string);
594
	g_free (tmp_name);
595
}
596
597
static void
598
gnome_about_free_person_list (GSList *list)
599
{
600
	if (list == NULL)
601
		return;
602
	
603
	g_slist_foreach (list, (GFunc) g_free, NULL);
604
	g_slist_free (list);
605
}
606
607
static void
608
gnome_about_finalize (GObject *object)
609
{
610
	GnomeAbout *about = GNOME_ABOUT (object);
611
612
	g_free (about->_priv->name);
613
	g_free (about->_priv->version);
614
	g_free (about->_priv->copyright);
615
	g_free (about->_priv->comments);
616
617
	gnome_about_free_person_list (about->_priv->authors);
618
	gnome_about_free_person_list (about->_priv->documenters);
619
620
	g_free (about->_priv->translator_credits);
621
622
	g_free (about->_priv);
623
	about->_priv = NULL;
624
625
	GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
626
}
627
628
static void
629
gnome_about_set_persons (GnomeAbout *about, guint prop_id, const GValue *persons)
630
{
631
		GValueArray *value_array;
632
	gint i;
633
	GSList *list;
634
635
	/* Free the old list */
636
	switch (prop_id) {
637
	case PROP_AUTHORS:
638
		list = about->_priv->authors;
639
		break;
640
	case PROP_DOCUMENTERS:
641
		list = about->_priv->documenters;
642
		break;
643
	default:
644
		g_assert_not_reached ();
645
		list = NULL; /* silence warning */
646
	}
647
648
	gnome_about_free_person_list (list);
649
	list = NULL;
650
	
651
	value_array = g_value_get_boxed (persons);
652
653
	if (value_array == NULL) {
654
		return;
655
	}
656
	
657
	for (i = 0; i < value_array->n_values; i++) {
658
		list = g_slist_prepend (list, g_value_dup_string (&value_array->values[i]));
659
	}
660
661
	list = g_slist_reverse (list);
662
	
663
	switch (prop_id) {
664
	case PROP_AUTHORS:
665
		about->_priv->authors = list;
666
		break;
667
	case PROP_DOCUMENTERS:
668
		about->_priv->documenters = list;
669
		break;
670
	default:
671
		g_assert_not_reached ();
672
	}
673
}
674
675
static void
676
set_value_array_from_list (GValue *value, GSList *list)
677
{
678
	GValueArray *array;
679
	GValue tmp_value = { 0 };
680
	GSList *tmp;
681
	gint length;
682
683
	length = g_slist_length (list);
684
	array = g_value_array_new (length);
685
686
	for (tmp = list; tmp; tmp = tmp->next) {
687
		char *str = tmp->data;
688
		
689
		g_value_init (&tmp_value, G_TYPE_STRING);
690
		g_value_set_string (&tmp_value, str);
691
		g_value_array_append (array, &tmp_value);
692
	}
693
694
	g_value_set_boxed (value, array);
695
	g_value_array_free (array);
696
}
697
698
static void
699
gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
700
{
701
	switch (prop_id) {
702
	case PROP_NAME:
703
		gnome_about_set_name (GNOME_ABOUT (object), g_value_get_string (value));
704
		break;
705
	case PROP_VERSION:
706
		gnome_about_set_version (GNOME_ABOUT (object), g_value_get_string (value));
707
		break;
708
	case PROP_COMMENTS:
709
		gnome_about_set_comments (GNOME_ABOUT (object), g_value_get_string (value));
710
		break;
711
	case PROP_COPYRIGHT:
712
		gnome_about_set_copyright (GNOME_ABOUT (object), g_value_get_string (value));
713
		break;
714
	case PROP_LOGO:
715
		if (g_value_get_object (value) != NULL) {
716
			gtk_image_set_from_pixbuf (GTK_IMAGE (GNOME_ABOUT (object)->_priv->logo_image),
717
						   g_value_get_object (value));
718
		}
719
		else {
720
		}
721
		break;
722
	case PROP_AUTHORS:
723
	case PROP_DOCUMENTERS:
724
		gnome_about_set_persons (GNOME_ABOUT (object), prop_id, value);
725
		break;
726
	case PROP_TRANSLATOR_CREDITS:
727
		gnome_about_set_translator_credits (GNOME_ABOUT (object), g_value_get_string (value));
728
		break;
729
	default:
730
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
731
		break;
732
	}
733
}
734
735
static void
736
gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
737
{
738
	GnomeAbout *about;
739
740
	about = GNOME_ABOUT (object);
741
	
742
	switch (prop_id) {
743
	case PROP_NAME:
744
		g_value_set_string (value, about->_priv->name);
745
		break;
746
	case PROP_VERSION:
747
		g_value_set_string (value, about->_priv->version);
748
		break;
749
	case PROP_COPYRIGHT:
750
		g_value_set_string (value, about->_priv->copyright);
751
		break;
752
	case PROP_COMMENTS:
753
		g_value_set_string (value, about->_priv->comments);
754
		break;
755
	case PROP_TRANSLATOR_CREDITS:
756
		g_value_set_string (value, about->_priv->translator_credits);
757
		break;
758
	case PROP_AUTHORS:
759
		set_value_array_from_list (value, about->_priv->authors);
760
		break;
761
	case PROP_DOCUMENTERS:
762
		set_value_array_from_list (value, about->_priv->documenters);
763
		break;
764
	case PROP_LOGO:
765
		g_value_set_object (value, gtk_image_get_pixbuf (GTK_IMAGE (about->_priv->logo_image)));
766
		break;
767
	default:
768
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
769
		break;
770
	}
771
}
772
773
/**
774
 * gnome_about_new:
775
 * @name: The name of the application.
776
 * @version: The version string of the application.
777
 * @copyright: The application's copyright statement.
778
 * @comments: A short miscellaneous string.
779
 * @authors: An %NULL terminated array of the application authors.
780
 * @documenters: An array of the application documenters.
781
 * @translator_credits: The translator for the current locale.
782
 * @logo_pixbuf: The application's logo.
783
 *
784
 * Construct an application's credits box. The @authors array cannot be empty
785
 * and the @translator_credits should be marked as a translatable string (so
786
 * that only the translator for the currently active locale is displayed).
787
 *
788
 * Returns: A new "About" dialog.
789
 */
790
GtkWidget *
791
gnome_about_new (const gchar  *name,
792
		 const gchar  *version,
793
		 const gchar  *copyright,
794
		 const gchar  *comments,
795
		 const gchar **authors,
796
		 const gchar **documenters,
797
		 const gchar  *translator_credits,
798
		 GdkPixbuf    *logo_pixbuf)
799
{
800
	GnomeAbout *about;
801
	
802
	g_return_val_if_fail (authors != NULL, NULL);
803
	
804
	about = g_object_new (GNOME_TYPE_ABOUT, NULL);
805
        gnome_about_construct(about, 
806
			      name, version, copyright, 
807
			      comments, authors, documenters, 
808
			      translator_credits, logo_pixbuf);
809
810
	return GTK_WIDGET(about);
811
}
812
813
/**
814
 * gnome_about_construct:
815
 * @about: An existing #GnomeAbout instance.
816
 * @name: The name of the application.
817
 * @version: The version string of the application.
818
 * @copyright: The application's copyright statement.
819
 * @comments: A short miscellaneous string.
820
 * @authors: An %NULL terminated array of the application authors.
821
 * @documenters: An array of the application documenters.
822
 * @translator_credits: The translator for the current locale.
823
 * @logo_pixbuf: The application's logo.
824
 *
825
 * Similar to gnome_about_new() except that the pre-existing @about widget is
826
 * used. Note that in this version of the function, @authors is not checked to
827
 * be non-%NULL, so callers must be careful, since bad things will happen if
828
 * this condition is not met.
829
 */
830
void
831
gnome_about_construct (GnomeAbout *about,
832
		       const gchar  *name,
833
		       const gchar  *version,
834
		       const gchar  *copyright,
835
		       const gchar  *comments,
836
		       const gchar **authors,
837
		       const gchar **documenters,
838
		       const gchar  *translator_credits,
839
		       GdkPixbuf    *logo_pixbuf)
840
{
841
	GValueArray *authors_array;
842
	GValueArray *documenters_array;
843
	gint i;
844
845
	authors_array = g_value_array_new (0);
846
	
847
	for (i = 0; authors[i] != NULL; i++) {
848
		GValue value = {0, };
849
		
850
		g_value_init (&value, G_TYPE_STRING);
851
			g_value_set_static_string (&value, authors[i]);
852
			authors_array = g_value_array_append (authors_array, &value);
853
	}
854
855
	if (documenters != NULL) {
856
		documenters_array = g_value_array_new (0);
857
858
		for (i = 0; documenters[i] != NULL; i++) {
859
			GValue value = {0, };
860
			
861
			g_value_init (&value, G_TYPE_STRING);
862
			g_value_set_static_string (&value, documenters[i]);
863
			documenters_array = g_value_array_append (documenters_array, &value);
864
		}
865
866
	}
867
	else {
868
		documenters_array = NULL;
869
	}
870
871
	g_object_set (G_OBJECT (about),
872
		      "name", name,
873
		      "version", version,
874
		      "copyright", copyright,
875
		      "comments", comments,
876
		      "authors", authors_array,
877
		      "documenters", documenters_array,
878
		      "translator_credits", translator_credits,
879
		      "logo", logo_pixbuf,
880
		      NULL);
881
882
	if (authors_array != NULL) {
883
		g_value_array_free (authors_array);
884
	}
885
	if (documenters_array != NULL) {
886
		g_value_array_free (documenters_array);
887
	}
888
}
(-)stardict-cur-accepted/src/gnome-about.h (+83 lines)
Line 0 Link Here
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2
/* gnome-about.h - An about box widget for gnome.
3
4
   Copyright (C) 2001 CodeFactory AB
5
   Copyright (C) 2001 Anders Carlsson <andersca@codefactory.se>
6
7
   The Gnome Library is free software; you can redistribute it and/or
8
   modify it under the terms of the GNU Library General Public License as
9
   published by the Free Software Foundation; either version 2 of the
10
   License, or (at your option) any later version.
11
12
   The Gnome Library is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
   Library General Public License for more details.
16
17
   You should have received a copy of the GNU Library General Public
18
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
19
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
   Boston, MA 02111-1307, USA.
21
22
   Author: Anders Carlsson <andersca@codefactory.se>
23
*/
24
25
#ifndef __GNOME_ABOUT_H__
26
#define __GNOME_ABOUT_H__
27
28
#include <gtk/gtkdialog.h>
29
30
G_BEGIN_DECLS
31
32
#define GNOME_TYPE_ABOUT            (gnome_about_get_type ())
33
#define GNOME_ABOUT(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), GNOME_TYPE_ABOUT, GnomeAbout))
34
#define GNOME_ABOUT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_ABOUT, GnomeAboutClass))
35
#define GNOME_IS_ABOUT(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), GNOME_TYPE_ABOUT))
36
#define GNOME_IS_ABOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_ABOUT))
37
#define GNOME_ABOUT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_ABOUT, GnomeAboutClass))
38
39
typedef struct _GnomeAbout        GnomeAbout;
40
typedef struct _GnomeAboutClass   GnomeAboutClass;
41
typedef struct _GnomeAboutPrivate GnomeAboutPrivate;
42
43
struct _GnomeAbout {
44
	GtkDialog parent_instance;
45
46
	/*< private >*/
47
	GnomeAboutPrivate *_priv;
48
};
49
50
struct _GnomeAboutClass {
51
	GtkDialogClass parent_class;
52
53
	/* Padding for possible expansion */
54
	gpointer padding1;
55
	gpointer padding2;
56
};
57
58
GType gnome_about_get_type (void) G_GNUC_CONST;
59
60
GtkWidget *gnome_about_new (const gchar  *name,
61
			    const gchar  *version,
62
			    const gchar  *copyright,
63
			    const gchar  *comments,
64
			    const gchar **authors,
65
			    const gchar **documenters,
66
			    const gchar  *translator_credits,
67
			    GdkPixbuf    *logo_pixbuf);
68
69
/* Only for use by bindings to languages other than C; don't use
70
   in applications. */
71
void gnome_about_construct (GnomeAbout *about,
72
			    const gchar  *name,
73
			    const gchar  *version,
74
			    const gchar  *copyright,
75
			    const gchar  *comments,
76
			    const gchar **authors,
77
			    const gchar **documenters,
78
			    const gchar  *translator_credits,
79
			    GdkPixbuf    *logo_pixbuf);
80
81
G_END_DECLS
82
83
#endif /* __GNOME_ABOUT_H__ */
(-)stardict-cur-accepted/src/lib.cpp (-6 / +8 lines)
Lines 470-491 Link Here
470
{
470
{
471
	wordlist = (gchar **)g_malloc((wordcount+1) * sizeof(gchar *));	
471
	wordlist = (gchar **)g_malloc((wordcount+1) * sizeof(gchar *));	
472
	gchar *p1 = idxdatabuffer;
472
	gchar *p1 = idxdatabuffer;
473
	for (int i=0;i<wordcount;i++) {		
473
  for (guint32 i=0; i<wordcount; i++) {		
474
		wordlist[i] = p1;
474
		wordlist[i] = p1;
475
		p1 += strlen(p1) +1 + 2*sizeof(glong);
475
    p1 += strlen(p1) +1 + 2*sizeof(guint32);
476
	}
476
	}
477
	wordlist[wordcount] = p1;
477
	wordlist[wordcount] = p1;
478
}
478
}
479
479
480
void Lib::loadwordoffset()
480
void Lib::loadwordoffset()
481
{
481
{
482
	// we can save the offsets in a file too, then just read it into the wordoffset array, or mmap it, this will make the loading be very fast.
482
  // we can save the offsets in a file too, then just read it into 
483
	// If you want to develop a command line version of StarDict, you can try this technique.
483
  // the wordoffset array, or mmap it, this will make the loading 
484
	wordoffset = (glong *)g_malloc((wordcount+1) * sizeof(glong));	
484
  // be very fast. If you want to develop a command line 
485
  // version of StarDict, you can try this technique.
486
  wordoffset = (glong *)g_malloc((wordcount+1)*sizeof(glong));
485
	gchar *p1 = idxdatabuffer;
487
	gchar *p1 = idxdatabuffer;
486
	for (int i=0;i<wordcount;i++) {		
488
	for (int i=0;i<wordcount;i++) {		
487
		wordoffset[i] = p1 - idxdatabuffer;
489
		wordoffset[i] = p1 - idxdatabuffer;
488
		p1 += strlen(p1) +1 + 2*sizeof(glong);
490
    p1 += strlen(p1) +1 + 2*sizeof(guint32);
489
		// We can check the word len < 256 here.
491
		// We can check the word len < 256 here.
490
		// or we can save the max word length, then wordentry_buf=g_malloc(max_wordlen);
492
		// or we can save the max word length, then wordentry_buf=g_malloc(max_wordlen);
491
		// but wordentry_buf[256] should be enough for most case. Get the max length will slow down the loading a little.
493
		// but wordentry_buf[256] should be enough for most case. Get the max length will slow down the loading a little.
(-)stardict-cur-accepted/src/lib.h (-2 / +2 lines)
Lines 44-57 Link Here
44
//this structure contain all information about dictionary
44
//this structure contain all information about dictionary
45
struct DictInfo {
45
struct DictInfo {
46
  std::string ifo_file_name;
46
  std::string ifo_file_name;
47
  glong wordcount;
47
  guint32 wordcount;
48
  std::string bookname;
48
  std::string bookname;
49
  std::string author;
49
  std::string author;
50
  std::string email;
50
  std::string email;
51
  std::string website;
51
  std::string website;
52
  std::string date;
52
  std::string date;
53
  std::string description;
53
  std::string description;
54
  gulong index_file_size;
54
  guint32 index_file_size;
55
  std::string sametypesequence;
55
  std::string sametypesequence;
56
  bool load_from_ifo_file(const gchar *ifofilename, bool istreedict);
56
  bool load_from_ifo_file(const gchar *ifofilename, bool istreedict);
57
};
57
};
(-)stardict-cur-accepted/src/mainwin.cpp (-17 / +43 lines)
Lines 2-16 Link Here
2
#  include "config.h"
2
#  include "config.h"
3
#endif
3
#endif
4
4
5
#ifndef _WIN32
5
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
6
#  include <libgnome/libgnome.h>
6
#  include <libgnome/libgnome.h>
7
#  include <libgnomeui/libgnomeui.h>
7
#  include <libgnomeui/libgnomeui.h>
8
#else
9
#  include "gnome-about.h"
8
#endif
10
#endif
9
11
12
#include <glib/gi18n.h>
13
10
#ifdef _WIN32
14
#ifdef _WIN32
11
#define VERSION "2.4.4"
15
#define VERSION "2.4.4"
12
#  include "win32/intl.h"
16
#  include "win32/intl.h"
13
#  include "win32/gnome-about.h"
14
#  include <gdk/gdkwin32.h>
17
#  include <gdk/gdkwin32.h>
15
#endif
18
#endif
16
19
Lines 508-514 Link Here
508
		gtk_menu_shell_append(GTK_MENU_SHELL(MainMenu), menuitem);
511
		gtk_menu_shell_append(GTK_MENU_SHELL(MainMenu), menuitem);
509
512
510
		menuitem = gtk_image_menu_item_new_with_mnemonic(_("_About"));
513
		menuitem = gtk_image_menu_item_new_with_mnemonic(_("_About"));
511
#ifdef _WIN32
514
#if defined(_WIN32) || defined(WITHOUT_GNOME)
512
		image = gtk_image_new_from_pixbuf(gpAppFrame->oAppSkin.stardict.about_menu.p[0]);
515
		image = gtk_image_new_from_pixbuf(gpAppFrame->oAppSkin.stardict.about_menu.p[0]);
513
#else
516
#else
514
		image = gtk_image_new_from_stock (GNOME_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON);
517
		image = gtk_image_new_from_stock (GNOME_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON);
Lines 1224-1258 Link Here
1224
{		
1227
{		
1225
	textview = gtk_text_view_new();
1228
	textview = gtk_text_view_new();
1226
	gtk_widget_show(textview);
1229
	gtk_widget_show(textview);
1227
	gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),false);
1230
  gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
1228
	gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), false);
1231
  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), FALSE);
1229
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD_CHAR);
1232
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD_CHAR);
1230
	gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview),5);
1233
	gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview),5);
1231
	gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview),5);
1234
	gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview),5);
1232
1235
1233
	g_signal_connect (G_OBJECT (textview), "button_press_event", G_CALLBACK (on_button_press), this);
1236
  g_signal_connect(G_OBJECT(textview), "button_press_event", G_CALLBACK(on_button_press), this);
1234
	g_signal_connect (G_OBJECT (textview), "selection_received", G_CALLBACK (SelectionCallback), this);
1237
  g_signal_connect(G_OBJECT(textview), "selection_received", G_CALLBACK(SelectionCallback), this);
1235
1238
1236
1239
1237
	GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
1240
	GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
1238
		
1241
		
1239
	gtk_text_buffer_create_tag (buffer, "DictNameTag", "foreground", "blue", NULL);
1242
  gtk_text_buffer_create_tag(buffer, "DictNameTag", "foreground", "blue", NULL);
1240
	gtk_text_buffer_create_tag (buffer, "YinBiaoTag", "foreground", "red", NULL);
1243
  gtk_text_buffer_create_tag(buffer, "YinBiaoTag", "foreground", "red", NULL);
1241
	gtk_text_buffer_create_tag (buffer, "WordTag", "weight", PANGO_WEIGHT_BOLD, "scale", PANGO_SCALE_X_LARGE, NULL);
1244
  gtk_text_buffer_create_tag(buffer, "WordTag", "weight", PANGO_WEIGHT_BOLD, "scale", PANGO_SCALE_X_LARGE, NULL);
1242
	gtk_text_buffer_create_tag (buffer, "PhoneticTag", "scale", PANGO_SCALE_X_LARGE, NULL);
1245
  gtk_text_buffer_create_tag(buffer, "PhoneticTag", "scale", PANGO_SCALE_X_LARGE, NULL);
1243
	//gtk_text_buffer_create_tag(buffer, "WordLink", "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL);
1246
	//gtk_text_buffer_create_tag(buffer, "WordLink", "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL);
1244
	//g_signal_connect(G_OBJECT(texttag), "event", G_CALLBACK(tag_event), strdup(url));
1247
	//g_signal_connect(G_OBJECT(texttag), "event", G_CALLBACK(tag_event), strdup(url));
1245
1248
1246
1249
1247
	scrolled_window = gtk_scrolled_window_new(NULL,NULL);
1250
	scrolled_window = gtk_scrolled_window_new(NULL,NULL);
1248
	gtk_widget_show(scrolled_window);
1251
	gtk_widget_show(scrolled_window);
1249
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
1252
  gtk_scrolled_window_set_policy(
1250
	//altought textview's set_wrap_mode will cause this can be GTK_POLICY_NEVER,but...there are widgets that may make this broken.
1253
    GTK_SCROLLED_WINDOW(scrolled_window),
1254
    //altought textview's set_wrap_mode will cause 
1255
    //this can be GTK_POLICY_NEVER,but...
1256
    //there are widgets that may make this broken.
1251
					GTK_POLICY_AUTOMATIC,
1257
					GTK_POLICY_AUTOMATIC,
1252
					GTK_POLICY_AUTOMATIC);
1258
					GTK_POLICY_AUTOMATIC);
1253
	gtk_container_add(GTK_CONTAINER(scrolled_window),textview);
1259
	gtk_container_add(GTK_CONTAINER(scrolled_window),textview);
1254
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
1260
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
1255
	gtk_box_pack_start(GTK_BOX(vbox),scrolled_window,true,true,0);
1261
  gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
1256
}
1262
}
1257
1263
1258
void TextWin::ShowInitFailed()
1264
void TextWin::ShowInitFailed()
Lines 1353-1364 Link Here
1353
	switch (*p++) {
1359
	switch (*p++) {
1354
					case 'm':
1360
					case 'm':
1355
	case 'l'://need more work...
1361
	case 'l'://need more work...
1356
	case 'g':
1357
	  sec_size = strlen(p);
1362
	  sec_size = strlen(p);
1358
	  if (sec_size)
1363
	  if (sec_size)
1359
	    gtk_text_buffer_insert(buffer, &iter, p, sec_size);	  
1364
	    gtk_text_buffer_insert(buffer, &iter, p, sec_size);	  
1360
						sec_size++;
1365
						sec_size++;
1361
						break;
1366
						break;
1367
	case 'g':
1368
	  sec_size = strlen(p);
1369
	  if (sec_size) {
1370
	    gchar *text=NULL;
1371
	    if (pango_parse_markup(p, -1, 0, NULL, &text, 0, NULL)) {
1372
	      gtk_text_buffer_insert(buffer, &iter, text, strlen(text));
1373
	      g_free(text);
1374
	    }
1375
	  }
1376
	  sec_size++;
1377
	  break;
1362
					case 't':
1378
					case 't':
1363
	  sec_size = strlen(p);
1379
	  sec_size = strlen(p);
1364
						if (sec_size) {
1380
						if (sec_size) {
Lines 1422-1433 Link Here
1422
    switch (*p++) {
1438
    switch (*p++) {
1423
			case 'm':
1439
			case 'm':
1424
    case 'l'://need more work...
1440
    case 'l'://need more work...
1425
    case 'g':
1426
      sec_size = strlen(p);
1441
      sec_size = strlen(p);
1427
				if (sec_size)
1442
				if (sec_size)
1428
	gtk_text_buffer_insert(buffer, &iter, p, sec_size);
1443
	gtk_text_buffer_insert(buffer, &iter, p, sec_size);
1429
				sec_size++;
1444
				sec_size++;
1430
				break;
1445
				break;
1446
    case 'g':
1447
      sec_size=strlen(p);
1448
      if (sec_size) {
1449
	gchar *text=NULL;
1450
	if (pango_parse_markup(p, -1, 0, NULL, &text, 0, NULL)) {
1451
	  gtk_text_buffer_insert(buffer, &iter, text, strlen(text));
1452
	  g_free(text);
1453
	}
1454
      }
1455
      sec_size++;
1456
      break;
1431
			case 't':
1457
			case 't':
1432
      sec_size = strlen(p);
1458
      sec_size = strlen(p);
1433
				if (sec_size) {
1459
				if (sec_size) {
(-)stardict-cur-accepted/src/mainwin.h (+1 lines)
Lines 172-177 Link Here
172
	static void SelectionCallback(GtkWidget* widget,GtkSelectionData *selection_data, guint time, TextWin *oTextWin);
172
	static void SelectionCallback(GtkWidget* widget,GtkSelectionData *selection_data, guint time, TextWin *oTextWin);
173
173
174
	static gboolean on_button_press(GtkWidget * widget, GdkEventButton * event, TextWin *oTextWin);
174
	static gboolean on_button_press(GtkWidget * widget, GdkEventButton * event, TextWin *oTextWin);
175
	static bool find_first_tag(gchar *str, gchar * & beg, gchar * & end);
175
public:
176
public:
176
	std::string queryWord;
177
	std::string queryWord;
177
	std::string pronounceWord;
178
	std::string pronounceWord;
(-)stardict-cur-accepted/src/Makefile.am (-4 / +15 lines)
Lines 16-22 Link Here
16
stardict_LDADD = 				\
16
stardict_LDADD = 				\
17
	$(STARDICT_LIBS)			
17
	$(STARDICT_LIBS)			
18
18
19
19
if GNOME_SUPPORT
20
IDL_FILE = GNOME_Stardict.idl
20
IDL_FILE = GNOME_Stardict.idl
21
21
22
IDL_SOURCES = \
22
IDL_SOURCES = \
Lines 24-41 Link Here
24
	GNOME_Stardict-common.c			\
24
	GNOME_Stardict-common.c			\
25
	GNOME_Stardict-skels.c			\
25
	GNOME_Stardict-skels.c			\
26
	GNOME_Stardict.h		
26
	GNOME_Stardict.h		
27
endif
28
29
if !GNOME_SUPPORT
30
GNOME_ABOUT=gnome-about.c gnome-about.h
31
endif
32
if GNOME_SUPPORT
33
STARIDCT_APP_SERVER=stardict-application-server.cpp stardict-application-server.h
34
endif
27
35
28
stardict_SOURCES = 			\
36
stardict_SOURCES = 			\
29
	$(IDL_SOURCES)			\
37
	$(IDL_SOURCES)			\
38
	$(GNOME_ABOUT)                  \
39
	$(STARIDCT_APP_SERVER)          \
30
	stardict.cpp stardict.h			\
40
	stardict.cpp stardict.h			\
31
	mainwin.cpp mainwin.h	\
41
	mainwin.cpp mainwin.h	\
32
	stardict-application-server.cpp stardict-application-server.h	\
33
	eggtrayicon.c eggtrayicon.h	\
42
	eggtrayicon.c eggtrayicon.h	\
34
	docklet.cpp docklet.h	\
43
	docklet.cpp docklet.h	\
35
	conf.cpp conf.h	\
44
	conf.cpp conf.h	\
36
	skin.cpp skin.h	\
45
	skin.cpp skin.h	\
37
	prefsdlg.cpp prefsdlg.h	\
46
	prefsdlg.cpp prefsdlg.h	\
38
	dictmanagedlg.cpp dictmanagedlg.h	\
47
	dictmanagedlg.cpp               \
48
	dictmanagedlg.h	                \
39
	floatwin.cpp floatwin.h	\
49
	floatwin.cpp floatwin.h	\
40
	readword.cpp readword.h	\
50
	readword.cpp readword.h	\
41
	selection.cpp selection.h	\
51
	selection.cpp selection.h	\
Lines 45-51 Link Here
45
	lib.cpp lib.h                   \
55
	lib.cpp lib.h                   \
46
	utils.cpp utils.h
56
	utils.cpp utils.h
47
57
48
58
if GNOME_SUPPORT
49
$(IDL_SOURCES): $(IDL_FILE)
59
$(IDL_SOURCES): $(IDL_FILE)
50
	$(ORBIT_IDL) -I $(LIBBONOBO_IDL) -I $(BONOBO_ACTIVATION_IDL) $(IDL_FILE)
60
	$(ORBIT_IDL) -I $(LIBBONOBO_IDL) -I $(BONOBO_ACTIVATION_IDL) $(IDL_FILE)
51
61
Lines 56-58 Link Here
56
	$(IDL_FILE)
66
	$(IDL_FILE)
57
67
58
CLEANFILES = $(IDL_SOURCES)
68
CLEANFILES = $(IDL_SOURCES)
69
endif
(-)stardict-cur-accepted/src/prefsdlg.cpp (+2 lines)
Lines 2-7 Link Here
2
#  include "config.h"
2
#  include "config.h"
3
#endif
3
#endif
4
4
5
#include <glib/gi18n.h>
6
5
#ifdef _WIN32
7
#ifdef _WIN32
6
#  include <gdk/gdkwin32.h>
8
#  include <gdk/gdkwin32.h>
7
#  include "win32/intl.h"
9
#  include "win32/intl.h"
(-)stardict-cur-accepted/src/readword.cpp (-33 / +33 lines)
Lines 2-45 Link Here
2
#  include "config.h"
2
#  include "config.h"
3
#endif
3
#endif
4
4
5
#include "readword.h"
5
#include <cstring>
6
#include "string.h"
6
#include <string>
7
7
8
#ifdef _WIN32
8
#include "utils.h"
9
#  include "stardict.h"
9
10
#else
10
#include "readword.h"
11
#  include <libgnome/libgnome.h>
12
#endif
13
11
14
ReadWord::ReadWord()
12
ReadWord::ReadWord()
15
{	
13
{	
16
#ifdef _WIN32
14
#ifdef _WIN32
17
	gchar *filename = g_build_filename(stardict_data_dir, "WyabdcRealPeopleTTS", NULL);
15
	have_data_file = 
18
	have_data_file = g_file_test(filename, G_FILE_TEST_EXISTS);
16
	  g_file_test((gStarDictDataDir+G_DIR_SEPARATOR+"WyabdcRealPeopleTTS").c_str(), 
19
	g_free(filename);
17
		      G_FILE_TEST_EXISTS);
20
#else
18
#else
21
	have_data_file = g_file_test("/usr/share/WyabdcRealPeopleTTS", G_FILE_TEST_EXISTS);
19
	have_data_file = g_file_test("/usr/share/WyabdcRealPeopleTTS", G_FILE_TEST_EXISTS);
22
#endif
20
#endif
23
}
21
}
24
22
25
gboolean ReadWord::canRead(const gchar *word)
23
bool ReadWord::canRead(const gchar *word)
26
{	
24
{	
27
	gboolean return_val = false;
25
  bool return_val = false;
28
	if (have_data_file && word && g_ascii_isalpha(word[0])) {
26
	if (have_data_file && word && g_ascii_isalpha(word[0])) {
29
		int n=strlen(word);
27
    std::string lowerword;
30
		gchar *lowerword = (gchar *)g_malloc(n+1);
28
    lowerword.resize(strlen(word));
31
		for (int i=0;i<n;i++)
29
    for (std::string::size_type i=0; i<lowerword.length(); i++)
32
			lowerword[i]= g_ascii_tolower(word[i]);
30
      lowerword[i]=g_ascii_tolower(word[i]);
33
		lowerword[n] = '\0';
31
    
32
    std::string filename;
34
#ifdef _WIN32
33
#ifdef _WIN32
35
		gchar *filename = g_strdup_printf("%s/WyabdcRealPeopleTTS/%c/%s.wav", stardict_data_dir, lowerword[0],lowerword);
34
    filename = gStarDictDataDir+"/WyabdcRealPeopleTTS/"+
35
      lowerword[0]+"/"+lowerword+".wav";
36
#else
36
#else
37
		gchar *filename = g_strdup_printf("/usr/share/WyabdcRealPeopleTTS/%c/%s.wav", lowerword[0],lowerword);		
37
    filename = std::string("/usr/share/WyabdcRealPeopleTTS/")+lowerword[0]+"/"+
38
      lowerword+".wav";
38
#endif
39
#endif
39
		return_val = g_file_test(filename, G_FILE_TEST_EXISTS);
40
    return_val = g_file_test(filename.c_str(), G_FILE_TEST_EXISTS);
40
		g_free(filename);
41
		g_free(lowerword);
42
	}
41
	}
42
43
	return return_val;
43
	return return_val;
44
}
44
}
45
45
Lines 46-65 Link Here
46
void ReadWord::read(const gchar *word)
46
void ReadWord::read(const gchar *word)
47
{
47
{
48
	if (have_data_file && word && g_ascii_isalpha(word[0])) {
48
	if (have_data_file && word && g_ascii_isalpha(word[0])) {
49
		int n=strlen(word);
49
    std::string lowerword;
50
		gchar *lowerword = (gchar *)g_malloc(n+1);
50
    lowerword.resize(strlen(word));
51
		for (int i=0;i<n;i++)
51
52
    for (std::string::size_type i=0; i<lowerword.length(); i++)
52
			lowerword[i]= g_ascii_tolower(word[i]);
53
			lowerword[i]= g_ascii_tolower(word[i]);
53
		lowerword[n] = '\0';
54
54
		gchar *filename;
55
    std::string filename;
55
#ifdef _WIN32
56
#ifdef _WIN32
56
		filename = g_strdup_printf("%s/WyabdcRealPeopleTTS/%c/%s.wav", stardict_data_dir, lowerword[0],lowerword);
57
    filename = gStarDictDataDir+"/WyabdcRealPeopleTTS/"+
57
		PlaySound(filename, 0, SND_ASYNC | SND_FILENAME);
58
      lowerword[0]+"/"+lowerword+".wav";
58
#else
59
#else
59
		filename = g_strdup_printf("/usr/share/WyabdcRealPeopleTTS/%c/%s.wav", lowerword[0],lowerword);		
60
    filename = std::string("/usr/share/WyabdcRealPeopleTTS/")+
60
		gnome_sound_play(filename);
61
      lowerword[0]+"/"+lowerword+".wav";
61
#endif
62
#endif
62
		g_free(filename);
63
    play_wav_file(filename.c_str());
63
		g_free(lowerword);
64
	}
64
	}
65
}
65
}
(-)stardict-cur-accepted/src/readword.h (-5 / +4 lines)
Lines 1-16 Link Here
1
#ifndef __SD_READWORD_H__
1
#ifndef __SD_READWORD_H__
2
#define __SD_READWORD_H__
2
#define __SD_READWORD_H__
3
3
4
#include <gtk/gtk.h>
4
#include <glib.h>
5
5
6
class ReadWord
6
class ReadWord {
7
{
8
public:
7
public:
9
	ReadWord();
8
	ReadWord();
10
	gboolean canRead(const gchar *word);
9
  bool canRead(const gchar *word);
11
	void read(const gchar *word);
10
	void read(const gchar *word);
12
private:
11
private:
13
	gboolean have_data_file;
12
  bool have_data_file;
14
};
13
};
15
14
16
#endif
15
#endif
(-)stardict-cur-accepted/src/selection.cpp (+1 lines)
Lines 3-8 Link Here
3
#endif
3
#endif
4
4
5
#include <cstring>
5
#include <cstring>
6
#include <glib/gi18n.h>
6
7
7
#ifdef _WIN32
8
#ifdef _WIN32
8
#  include "win32/intl.h"
9
#  include "win32/intl.h"
(-)stardict-cur-accepted/src/skin.cpp (-2 / +4 lines)
Lines 46-56 Link Here
46
	stardict.watch_cursor.cursor= gdk_cursor_new(GDK_WATCH);
46
	stardict.watch_cursor.cursor= gdk_cursor_new(GDK_WATCH);
47
  std::string pixmaps_dir(gStarDictDataDir+G_DIR_SEPARATOR+"pixmaps"+G_DIR_SEPARATOR);
47
  std::string pixmaps_dir(gStarDictDataDir+G_DIR_SEPARATOR+"pixmaps"+G_DIR_SEPARATOR);
48
  std::string filename;
48
  std::string filename;
49
#if defined(_WIN32) || defined(WITHOUT_GNOME)
50
  filename=pixmaps_dir+"about_menu.png";
51
  stardict.about_menu.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL);
52
#endif
49
#ifdef _WIN32			
53
#ifdef _WIN32			
50
  filename=pixmaps_dir+"stardict.png";
54
  filename=pixmaps_dir+"stardict.png";
51
  stardict.icon.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL);
55
  stardict.icon.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL);
52
  filename=pixmaps_dir+"about_menu.png";
53
  stardict.about_menu.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL);
54
#else
56
#else
55
  stardict.icon.p[0] = gdk_pixbuf_new_from_file(GNOME_ICONDIR"/stardict.png", NULL);	
57
  stardict.icon.p[0] = gdk_pixbuf_new_from_file(GNOME_ICONDIR"/stardict.png", NULL);	
56
  filename=pixmaps_dir+"docklet_normal.png";
58
  filename=pixmaps_dir+"docklet_normal.png";
(-)stardict-cur-accepted/src/skin.h (-2 / +3 lines)
Lines 25-33 Link Here
25
	struct _Skin_cursor normal_cursor;
25
	struct _Skin_cursor normal_cursor;
26
	struct _Skin_cursor watch_cursor;
26
	struct _Skin_cursor watch_cursor;
27
	struct _Skin_pixbuf_1 icon;
27
	struct _Skin_pixbuf_1 icon;
28
#ifdef _WIN32
28
#if defined(_WIN32) || defined(WITHOUT_GNOME)
29
	struct _Skin_pixbuf_1 about_menu;
29
	struct _Skin_pixbuf_1 about_menu;
30
#else
30
#endif
31
#ifndef _WIN32
31
	struct _Skin_pixbuf_1 docklet_normal_icon;
32
	struct _Skin_pixbuf_1 docklet_normal_icon;
32
	struct _Skin_pixbuf_1 docklet_scan_icon;
33
	struct _Skin_pixbuf_1 docklet_scan_icon;
33
	struct _Skin_pixbuf_1 docklet_stop_icon;
34
	struct _Skin_pixbuf_1 docklet_stop_icon;
(-)stardict-cur-accepted/src/splash.cpp (-3 / +1 lines)
Lines 2-11 Link Here
2
#  include "config.h"
2
#  include "config.h"
3
#endif
3
#endif
4
4
5
#include <glib/gi18n.h>
5
#include <gtk/gtk.h>
6
#include <gtk/gtk.h>
6
#ifndef _WIN32
7
#  include <libgnome/libgnome.h>
8
#endif
9
7
10
#ifdef _WIN32
8
#ifdef _WIN32
11
#  include "win32/intl.h"
9
#  include "win32/intl.h"
(-)stardict-cur-accepted/src/stardict-application-server.cpp (-2 / +4 lines)
Lines 1-5 Link Here
1
#ifdef HAVE_CONFIG_H
1
#ifdef HAVE_CONFIG_H
2
#include <config.h>
2
# include "config.h"
3
#endif
3
#endif
4
4
5
#include <bonobo/bonobo-generic-factory.h>
5
#include <bonobo/bonobo-generic-factory.h>
Lines 7-16 Link Here
7
#include <bonobo/bonobo-context.h>
7
#include <bonobo/bonobo-context.h>
8
#include <bonobo-activation/bonobo-activation-register.h>
8
#include <bonobo-activation/bonobo-activation-register.h>
9
9
10
#include "stardict-application-server.h"
10
11
#include "GNOME_Stardict.h"
11
#include "GNOME_Stardict.h"
12
#include "stardict.h"
12
#include "stardict.h"
13
13
14
#include "stardict-application-server.h"
15
14
16
15
static void stardict_application_server_class_init (StardictApplicationServerClass *klass);
17
static void stardict_application_server_class_init (StardictApplicationServerClass *klass);
16
static void stardict_application_server_init (StardictApplicationServer *a);
18
static void stardict_application_server_init (StardictApplicationServer *a);
(-)stardict-cur-accepted/src/stardict.cpp (-42 / +51 lines)
Lines 29-56 Link Here
29
#  include "config.h"
29
#  include "config.h"
30
#endif
30
#endif
31
31
32
#include <string.h>
32
#include <cstring>
33
#include <stdlib.h>
33
#include <cstdlib>
34
#include <cerrno>
35
#include <sys/stat.h>
36
#include <sys/types.h>
37
#include <glib/gi18n.h>
38
#include <gdk/gdkkeysyms.h>
34
39
35
#ifndef _WIN32
40
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
41
#  include <libgnome/libgnome.h>
42
#  include <libgnomeui/libgnomeui.h>
43
#endif
44
45
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
36
#  include "stardict-application-server.h"
46
#  include "stardict-application-server.h"
37
#  include "GNOME_Stardict.h"
47
#  include "GNOME_Stardict.h"
38
#endif
48
#endif
39
#include "splash.h"
40
49
41
#ifndef _WIN32
42
#  include <libgnome/libgnome.h>
43
#  include <libgnomeui/libgnomeui.h>
44
#endif
45
50
46
#ifdef _WIN32
51
#ifdef _WIN32
47
	#include "win32/intl.h"
52
#  include <gdk/gdkwin32.h>
48
	#include <gdk/gdkwin32.h>
53
#  include <windows.h>
49
	#include <windows.h>
54
#  include "win32/intl.h"
50
	#include <gdk/gdkkeysyms.h>
55
51
	HINSTANCE stardictexe_hInstance;
56
HINSTANCE stardictexe_hInstance;
52
#endif
57
#endif
53
58
59
#include "splash.h"
54
#include "conf.h"
60
#include "conf.h"
55
#include "utils.h"
61
#include "utils.h"
56
62
Lines 60-66 Link Here
60
66
61
static gboolean hide_option = FALSE;
67
static gboolean hide_option = FALSE;
62
68
63
#ifndef _WIN32
69
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
64
static gint debug = 0;
70
static gint debug = 0;
65
static gboolean quit_option = FALSE;
71
static gboolean quit_option = FALSE;
66
72
Lines 932-945 Link Here
932
/***************************************************/
939
/***************************************************/
933
AppFrame::AppFrame():oAppCore(this)
940
AppFrame::AppFrame():oAppCore(this)
934
{
941
{
935
#ifndef _WIN32
942
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
936
    gnome_sound_init(NULL);
943
    gnome_sound_init(NULL);
937
#endif
944
#endif
938
}
945
}
939
946
940
AppFrame::~AppFrame()
947
AppFrame::~AppFrame()
941
{
948
{
942
#ifndef _WIN32
949
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
943
	gnome_sound_shutdown();
950
	gnome_sound_shutdown();
944
#endif
951
#endif
945
}
952
}
Lines 953-960 Link Here
953
		
960
		
954
	oAppCore.Create(queryword);
961
	oAppCore.Create(queryword);
955
962
956
#ifndef _WIN32	
963
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
957
	stardict_app_server = stardict_application_server_new (gdk_screen_get_default ());
964
  stardict_app_server = 
965
    stardict_application_server_new(gdk_screen_get_default());
958
#endif
966
#endif
959
	
967
	
960
	gtk_main();
968
	gtk_main();
Lines 983-989 Link Here
983
    
991
    
984
	oAppCore.End();
992
	oAppCore.End();
985
993
986
#ifndef _WIN32	
994
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
987
	bonobo_object_unref (stardict_app_server);
995
	bonobo_object_unref (stardict_app_server);
988
#endif
996
#endif
989
	
997
	
Lines 1043-1049 Link Here
1043
	return false;
1051
	return false;
1044
}
1052
}
1045
1053
1046
#ifndef _WIN32
1054
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
1047
static void
1055
static void
1048
stardict_handle_automation_cmdline (gchar *queryword)
1056
stardict_handle_automation_cmdline (gchar *queryword)
1049
{
1057
{
Lines 1130-1145 Link Here
1130
}
1138
}
1131
#endif
1139
#endif
1132
1140
1133
#ifdef _WIN32
1141
#if defined(_WIN32) || defined(WITHOUT_GNOME)
1134
static void stardict_dummy_print( const gchar* string ) {
1142
static void stardict_dummy_print(const gchar*) 
1135
	return;
1143
{       
1136
}
1144
}
1137
1145
1138
static void stardict_dummy_log_handler (const gchar    *domain,
1146
static void stardict_dummy_log_handler(const gchar *,
1139
				    GLogLevelFlags  flags,
1147
				       GLogLevelFlags,
1140
				    const gchar    *msg,
1148
				       const gchar *,
1141
				    gpointer        user_data) {
1149
				       gpointer) 
1142
	return;
1150
{
1143
}
1151
}
1144
#endif
1152
#endif
1145
1153
Lines 1181-1208 Link Here
1181
	if (ll_winhandle > 0) {
1189
	if (ll_winhandle > 0) {
1182
		SetForegroundWindow(ll_winhandle);
1190
		SetForegroundWindow(ll_winhandle);
1183
		//BringWindowToTop(ll_winhandle); //don't work :(
1191
		//BringWindowToTop(ll_winhandle); //don't work :(
1184
		//ShowWindow( ll_winhandle, SW_SHOW); //don't work fine, as gtk widgets may still be hiden.
1192
    //don't work fine, as gtk widgets may still be hiden.
1185
		return 0;
1193
    //ShowWindow( ll_winhandle, SW_SHOW); 
1194
    return EXIT_SUCCESS;
1186
	}
1195
	}
1196
#endif
1197
#if defined(_WIN32) || defined(WITHOUT_GNOME)
1198
  gtk_set_locale();
1199
  gtk_init(&argc, &argv);
1187
1200
1188
    gtk_set_locale ();
1201
  g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1189
    gtk_init (&argc, &argv);
1190
1191
  g_log_set_handler (NULL, (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1192
			   stardict_dummy_log_handler, NULL);	
1202
			   stardict_dummy_log_handler, NULL);	
1193
  g_log_set_handler ("Gdk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1203
  g_log_set_handler("Gdk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1194
			   stardict_dummy_log_handler, NULL);
1204
			   stardict_dummy_log_handler, NULL);
1195
  g_log_set_handler ("Gtk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1205
  g_log_set_handler("Gtk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1196
			   stardict_dummy_log_handler, NULL);
1206
			   stardict_dummy_log_handler, NULL);
1197
  g_log_set_handler ("GLib", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1207
  g_log_set_handler("GLib", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1198
			   stardict_dummy_log_handler, NULL);
1208
			   stardict_dummy_log_handler, NULL);
1199
  g_log_set_handler ("GModule", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1209
  g_log_set_handler("GModule", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1200
			   stardict_dummy_log_handler, NULL);
1210
			   stardict_dummy_log_handler, NULL);
1201
  g_log_set_handler ("GLib-GObject", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1211
  g_log_set_handler("GLib-GObject", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1202
			   stardict_dummy_log_handler, NULL);
1212
			   stardict_dummy_log_handler, NULL);
1203
  g_log_set_handler ("GThread", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1213
  g_log_set_handler("GThread", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
1204
			   stardict_dummy_log_handler, NULL);
1214
			   stardict_dummy_log_handler, NULL);
1205
	g_set_print_handler( stardict_dummy_print );
1215
  g_set_print_handler(stardict_dummy_print);
1206
1216
1207
	gchar *queryword = NULL;
1217
	gchar *queryword = NULL;
1208
	for (int i = 1; i < argc; i++) {
1218
	for (int i = 1; i < argc; i++) {
Lines 1267-1273 Link Here
1267
		 */
1277
		 */
1268
                stardict_handle_automation_cmdline (queryword);				
1278
                stardict_handle_automation_cmdline (queryword);				
1269
                /* and we're done */
1279
                /* and we're done */
1270
    exit(EXIT_SUCCESS);
1280
    return EXIT_SUCCESS;
1271
	}
1281
	}
1272
	
1282
	
1273
	GnomeClient *client;
1283
	GnomeClient *client;
(-)stardict-cur-accepted/src/stardict.h (-6 / +3 lines)
Lines 3-9 Link Here
3
3
4
#include <gtk/gtk.h>
4
#include <gtk/gtk.h>
5
5
6
#if !defined(_WIN32)
6
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
7
# include <bonobo/bonobo-object.h>
7
# include <bonobo/bonobo-object.h>
8
# include <libgnome/libgnome.h>
8
# include <libgnome/libgnome.h>
9
#endif
9
#endif
Lines 95-111 Link Here
95
	void PopupDictManageDlg();
95
	void PopupDictManageDlg();
96
};
96
};
97
97
98
class AppFrame
98
class AppFrame {
99
{
100
private:
101
102
public:
99
public:
103
	AppCore oAppCore;
100
	AppCore oAppCore;
104
	AppSkin oAppSkin;
101
	AppSkin oAppSkin;
105
	ReadWord oReadWord;
102
	ReadWord oReadWord;
106
103
107
104
108
#ifndef _WIN32	
105
#if !defined(_WIN32) && !defined(WITHOUT_GNOME)
109
	BonoboObject *stardict_app_server;
106
	BonoboObject *stardict_app_server;
110
#endif
107
#endif
111
108
(-)stardict-cur-accepted/src/utils.h (+2 lines)
Lines 1-6 Link Here
1
#ifndef UTILS_H
1
#ifndef UTILS_H
2
#define UTILS_H
2
#define UTILS_H
3
3
4
#include <glib.h>
5
4
extern void play_wav_file(const gchar *filename);
6
extern void play_wav_file(const gchar *filename);
5
extern void show_help(const gchar *section);
7
extern void show_help(const gchar *section);
6
extern void show_url(const gchar *url);
8
extern void show_url(const gchar *url);
(-)stardict-cur-accepted/src/win32/gnome-about.c (-888 lines)
Lines 1-888 Link Here
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2
/* gnome-about.c - An about box widget for gnome.
3
4
   Copyright (C) 2001 CodeFactory AB
5
   Copyright (C) 2001, 2002 Anders Carlsson
6
7
   The Gnome Library is free software; you can redistribute it and/or
8
   modify it under the terms of the GNU Library General Public License as
9
   published by the Free Software Foundation; either version 2 of the
10
   License, or (at your option) any later version.
11
12
   The Gnome Library is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
   Library General Public License for more details.
16
17
   You should have received a copy of the GNU Library General Public
18
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
19
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
   Boston, MA 02111-1307, USA.
21
22
   Author: Anders Carlsson <andersca@gnu.org>
23
*/
24
25
//Changed by Hu Zheng <huzheng_001@163.com> to make it compile along. 2003.09.23
26
27
#include "intl.h"
28
29
#include "gnome-about.h"
30
31
#include <gtk/gtkalignment.h>
32
#include <gtk/gtkbbox.h>
33
#include <gtk/gtkbutton.h>
34
#include <gtk/gtkdialog.h>
35
#include <gtk/gtkhbox.h>
36
#include <gtk/gtkimage.h>
37
#include <gtk/gtklabel.h>
38
#include <gtk/gtknotebook.h>
39
#include <gtk/gtkscrolledwindow.h>
40
#include <gtk/gtkstock.h>
41
#include <gtk/gtktextview.h>
42
#include <gtk/gtkvbox.h>
43
#include <gtk/gtkviewport.h>
44
45
46
#include <glib/gmacros.h>
47
48
G_BEGIN_DECLS
49
50
#define BONOBO_BOILERPLATE(type, type_as_function, corba_type,		\
51
			   parent_type, parent_type_macro,		\
52
			   register_type_macro)				\
53
static void type_as_function ## _class_init    (type ## Class *klass);	\
54
static void type_as_function ## _instance_init (type          *object);	\
55
static parent_type ## Class *parent_class = NULL;			\
56
static void								\
57
type_as_function ## _class_init_trampoline (gpointer klass,		\
58
					    gpointer data)		\
59
{									\
60
	parent_class = (parent_type ## Class *)g_type_class_ref (	\
61
		parent_type_macro);					\
62
	type_as_function ## _class_init ((type ## Class *)klass);	\
63
}									\
64
GType									\
65
type_as_function ## _get_type (void)					\
66
{									\
67
	static GType object_type = 0;					\
68
	if (object_type == 0) {						\
69
		static const GTypeInfo object_info = {			\
70
		    sizeof (type ## Class),				\
71
		    NULL,		/* base_init */			\
72
		    NULL,		/* base_finalize */		\
73
		    type_as_function ## _class_init_trampoline,		\
74
		    NULL,		/* class_finalize */		\
75
		    NULL,               /* class_data */		\
76
		    sizeof (type),					\
77
		    0,                  /* n_preallocs */		\
78
		    (GInstanceInitFunc) type_as_function ## _instance_init \
79
		};							\
80
		object_type = register_type_macro			\
81
			(type, type_as_function, corba_type,		\
82
			 parent_type, parent_type_macro);		\
83
	}								\
84
	return object_type;						\
85
}
86
87
#define BONOBO_CALL_PARENT(parent_class_cast, name, args)		\
88
	((parent_class_cast(parent_class)->name != NULL) ?		\
89
	 parent_class_cast(parent_class)->name args : (void)0)
90
91
G_END_DECLS
92
93
#define GNOME_CLASS_BOILERPLATE(type, type_as_function,			\
94
				parent_type, parent_type_macro)		\
95
	BONOBO_BOILERPLATE(type, type_as_function, type,		\
96
			  parent_type, parent_type_macro,		\
97
			  GNOME_REGISTER_TYPE)
98
99
#define GNOME_REGISTER_TYPE(type, type_as_function, corba_type,		\
100
			    parent_type, parent_type_macro)		\
101
	g_type_register_static (parent_type_macro, #type, &object_info, 0)
102
103
#define GNOME_CALL_PARENT(parent_class_cast, name, args)		\
104
	BONOBO_CALL_PARENT (parent_class_cast, name, args)
105
106
/* FIXME: More includes! */
107
108
struct _GnomeAboutPrivate {
109
	gchar *name;
110
	gchar *version;
111
	gchar *copyright;
112
	gchar *comments;
113
	gchar *translator_credits;
114
	
115
	GSList *authors;
116
	GSList *documenters;
117
	
118
	GtkWidget *logo_image;
119
	GtkWidget *name_label;
120
	GtkWidget *comments_label;
121
	GtkWidget *copyright_label;
122
123
	GtkWidget *credits_dialog;
124
};
125
126
enum {
127
	PROP_0,
128
	PROP_NAME,
129
	PROP_VERSION,
130
	PROP_COPYRIGHT,
131
	PROP_COMMENTS,
132
	PROP_AUTHORS,
133
	PROP_DOCUMENTERS,
134
	PROP_TRANSLATOR_CREDITS,
135
	PROP_LOGO,
136
};
137
138
#define GNOME_RESPONSE_CREDITS 1
139
140
static void gnome_about_finalize (GObject *object);
141
static void gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
142
static void gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
143
144
GNOME_CLASS_BOILERPLATE (GnomeAbout, gnome_about,
145
			 GtkDialog, GTK_TYPE_DIALOG)
146
147
static void
148
gnome_about_update_authors_label (GnomeAbout *about, GtkWidget *label)
149
{
150
	GString *string;
151
	GSList *list;
152
	gchar *tmp;
153
	
154
	if (about->_priv->authors == NULL) {
155
		gtk_widget_hide (label);
156
		return;
157
	}
158
	else {
159
		gtk_widget_show (label);
160
	}
161
162
	string = g_string_new (NULL);
163
164
	for (list = about->_priv->authors; list; list = list->next) {
165
		tmp = g_markup_escape_text (list->data, -1);
166
		g_string_append (string, tmp);
167
168
		if (list->next)
169
			g_string_append_c (string, '\n');
170
		g_free (tmp);
171
	}
172
	
173
	gtk_label_set_markup (GTK_LABEL (label), string->str);
174
	g_string_free (string, TRUE);
175
}
176
177
static void
178
gnome_about_update_documenters_label (GnomeAbout *about, GtkWidget *label)
179
{
180
	GString *string;
181
	GSList *list;
182
	gchar *tmp;
183
		
184
	if (about->_priv->documenters == NULL) {
185
		gtk_widget_hide (label);
186
		return;
187
	}
188
	else {
189
		gtk_widget_show (label);
190
	}
191
192
	string = g_string_new (NULL);
193
194
	for (list = about->_priv->documenters; list; list = list->next) {
195
		tmp = g_markup_escape_text (list->data, -1);
196
		g_string_append (string, tmp);
197
198
		if (list->next)
199
			g_string_append (string, "\n");
200
		g_free (tmp);
201
	}
202
	
203
	gtk_label_set_markup (GTK_LABEL (label), string->str);
204
	g_string_free (string, TRUE);
205
}
206
207
static void
208
gnome_about_update_translation_information_label (GnomeAbout *about, GtkWidget *label)
209
{
210
	GString *string;
211
	gchar *tmp;
212
	
213
	if (about->_priv->translator_credits == NULL) {
214
		gtk_widget_hide (label);
215
		return;
216
	}
217
	else {
218
		gtk_widget_show (label);
219
	}
220
221
	string = g_string_new (NULL);
222
223
	tmp = g_markup_escape_text (about->_priv->translator_credits, -1);
224
	g_string_append (string, tmp);
225
	g_free (tmp);
226
	
227
	gtk_label_set_markup (GTK_LABEL (label), string->str);
228
	g_string_free (string, TRUE);
229
}
230
231
static GtkWidget *
232
create_label (void)
233
{
234
	GtkWidget *label;
235
	
236
	label = gtk_label_new ("");
237
	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
238
	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
239
	gtk_misc_set_padding (GTK_MISC (label), 8, 8);
240
241
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
242
243
	return label;
244
}
245
246
static void
247
gnome_about_display_credits_dialog (GnomeAbout *about)
248
{
249
	GtkWidget *dialog, *label, *notebook, *sw;
250
251
	if (about->_priv->credits_dialog != NULL) {
252
		gtk_window_present (GTK_WINDOW (about->_priv->credits_dialog));
253
		return;
254
	}
255
	
256
	dialog = gtk_dialog_new_with_buttons (_("Credits"),
257
					      GTK_WINDOW (about),
258
					      GTK_DIALOG_DESTROY_WITH_PARENT,
259
					      GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
260
					      NULL);
261
	about->_priv->credits_dialog = dialog;
262
	gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
263
	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
264
	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
265
	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
266
	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
267
	g_signal_connect (dialog, "response",
268
			  G_CALLBACK (gtk_widget_destroy), dialog);
269
	g_signal_connect (dialog, "destroy",
270
			  G_CALLBACK (gtk_widget_destroyed),
271
			  &(about->_priv->credits_dialog));
272
273
	notebook = gtk_notebook_new ();
274
	gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
275
	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
276
277
	if (about->_priv->authors != NULL) {
278
		label = create_label ();
279
280
		sw = gtk_scrolled_window_new (NULL, NULL);
281
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
282
						GTK_POLICY_AUTOMATIC,
283
						GTK_POLICY_AUTOMATIC);
284
		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
285
		gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
286
		
287
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw,
288
					  gtk_label_new (_("Written by")));
289
		gnome_about_update_authors_label (about, label);
290
	}
291
292
	if (about->_priv->documenters != NULL) {
293
		label = create_label ();
294
		
295
		sw = gtk_scrolled_window_new (NULL, NULL);
296
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
297
						GTK_POLICY_AUTOMATIC,
298
						GTK_POLICY_AUTOMATIC);
299
		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
300
		gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
301
302
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw,
303
					  gtk_label_new (_("Documented by")));
304
		gnome_about_update_documenters_label (about, label);
305
	}
306
307
	if (about->_priv->translator_credits != NULL) {
308
		label = create_label ();
309
		
310
		sw = gtk_scrolled_window_new (NULL, NULL);
311
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
312
						GTK_POLICY_AUTOMATIC,
313
						GTK_POLICY_AUTOMATIC);
314
		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
315
		gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
316
317
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw,
318
					  gtk_label_new (_("Translated by")));
319
		gnome_about_update_translation_information_label (about, label);
320
	}
321
	
322
	gtk_widget_show_all (dialog);
323
}
324
325
static void
326
gnome_about_instance_init (GnomeAbout *about)
327
{
328
	GnomeAboutPrivate *priv;
329
	GtkWidget *vbox, *hbox, *image, *label, *alignment, *button;
330
331
	/* Data */
332
	
333
	priv = g_new0 (GnomeAboutPrivate, 1);
334
	about->_priv = priv;
335
336
	priv->name = NULL;
337
	priv->version = NULL;
338
	priv->copyright = NULL;
339
	priv->comments = NULL;
340
	priv->translator_credits = NULL;
341
	priv->authors = NULL;
342
	priv->documenters = NULL;
343
344
	gtk_dialog_set_has_separator (GTK_DIALOG (about), FALSE);
345
	gtk_container_set_border_width (GTK_CONTAINER (about), 5);
346
	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (about)->vbox), 5);
347
348
	/* Widgets */
349
	vbox = gtk_vbox_new (FALSE, 8);
350
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
351
352
	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0);
353
354
	priv->logo_image = gtk_image_new ();
355
	gtk_box_pack_start (GTK_BOX (vbox), priv->logo_image, FALSE, FALSE, 0);
356
	priv->name_label = gtk_label_new (NULL);
357
	gtk_label_set_selectable (GTK_LABEL (priv->name_label), TRUE);
358
	gtk_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER);
359
	gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0);
360
361
	priv->comments_label = gtk_label_new (NULL);
362
	gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE);
363
	gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER);
364
	gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
365
	gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0);
366
367
	priv->copyright_label = gtk_label_new (NULL);
368
	gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE);	
369
	gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER);
370
	gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0);
371
372
	gtk_widget_show_all (vbox);
373
	
374
	/* Add the close button */
375
	gtk_dialog_add_button (GTK_DIALOG (about), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
376
	gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CLOSE);
377
378
	/* Add the credits button */
379
	image = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON);
380
381
	label = gtk_label_new_with_mnemonic (_("C_redits"));
382
	
383
	hbox = gtk_hbox_new (FALSE, 2);
384
	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
385
	gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
386
387
	alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
388
	gtk_container_add (GTK_CONTAINER (alignment), hbox);
389
390
	button = gtk_button_new ();
391
	gtk_container_add (GTK_CONTAINER (button), alignment);
392
	gtk_widget_show_all (button);
393
394
	gtk_dialog_add_action_widget (GTK_DIALOG (about), button, GNOME_RESPONSE_CREDITS);
395
	gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (about)->action_area), button, TRUE);
396
	
397
	gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
398
399
	priv->credits_dialog = NULL;
400
}
401
402
static void
403
gnome_about_response (GtkDialog *dialog, gint response)
404
{
405
	switch (response) {
406
	case GNOME_RESPONSE_CREDITS:
407
		gnome_about_display_credits_dialog (GNOME_ABOUT (dialog));
408
		break;
409
	default:
410
		gtk_widget_destroy (GTK_WIDGET (dialog));
411
		break;
412
	}
413
}
414
415
static void
416
gnome_about_class_init (GnomeAboutClass *klass)
417
{
418
	GObjectClass *object_class;
419
	GtkWidgetClass *widget_class;
420
	GtkDialogClass *dialog_class;
421
	
422
	object_class = (GObjectClass *)klass;
423
	widget_class = (GtkWidgetClass *)klass;
424
	dialog_class = (GtkDialogClass *)klass;
425
	
426
	object_class->set_property = gnome_about_set_property;
427
	object_class->get_property = gnome_about_get_property;
428
429
	object_class->finalize = gnome_about_finalize;
430
431
	dialog_class->response = gnome_about_response;
432
	
433
	g_object_class_install_property (object_class,
434
					 PROP_NAME,
435
					 g_param_spec_string ("name",
436
							      _("Program name"),
437
							      _("The name of the program"),
438
							      NULL,
439
							      G_PARAM_READWRITE));
440
441
	g_object_class_install_property (object_class,
442
					 PROP_VERSION,
443
					 g_param_spec_string ("version",
444
							      _("Program version"),
445
							      _("The version of the program"),
446
							      NULL,
447
							      G_PARAM_READWRITE));
448
	g_object_class_install_property (object_class,
449
					 PROP_COPYRIGHT,
450
					 g_param_spec_string ("copyright",
451
							      _("Copyright string"),
452
							      _("Copyright information for the program"),
453
							      NULL,
454
							      G_PARAM_READWRITE));
455
	
456
	g_object_class_install_property (object_class,
457
					 PROP_COMMENTS,
458
					 g_param_spec_string ("comments",
459
							      _("Comments string"),
460
							      _("Comments about the program"),
461
							      NULL,
462
							      G_PARAM_READWRITE));
463
	g_object_class_install_property (object_class,
464
					 PROP_AUTHORS,
465
					 g_param_spec_value_array ("authors",
466
								   _("Authors"),
467
								   _("List of authors of the programs"),
468
								   g_param_spec_string ("author-entry",
469
											_("Author entry"),
470
											_("A single author entry"),
471
											NULL,
472
											G_PARAM_READWRITE),
473
								   G_PARAM_WRITABLE));
474
	g_object_class_install_property (object_class,
475
					 PROP_DOCUMENTERS,
476
					 g_param_spec_value_array ("documenters",
477
								   _("Documenters"),
478
								   _("List of people documenting the program"),
479
								   g_param_spec_string ("documenter-entry",
480
											_("Documenter entry"),
481
											_("A single documenter entry"),
482
											NULL,
483
											G_PARAM_READWRITE),
484
								   G_PARAM_WRITABLE));
485
486
	g_object_class_install_property (object_class,
487
					 PROP_TRANSLATOR_CREDITS,
488
					 g_param_spec_string ("translator_credits",
489
							      _("Translator credits"),
490
							      _("Credits to the translators. This string should be marked as translatable"),
491
							      NULL,
492
							      G_PARAM_READWRITE));
493
	
494
	g_object_class_install_property (object_class,
495
					 PROP_LOGO,
496
					 g_param_spec_object ("logo",
497
							      _("Logo"),
498
							      _("A logo for the about box"),
499
							      GDK_TYPE_PIXBUF,
500
							      G_PARAM_WRITABLE));
501
502
}
503
504
static void
505
gnome_about_set_comments (GnomeAbout *about, const gchar *comments)
506
{
507
	g_free (about->_priv->comments);
508
	about->_priv->comments = comments ? g_strdup (comments) : NULL;
509
510
	gtk_label_set_text (GTK_LABEL (about->_priv->comments_label), about->_priv->comments);
511
}
512
513
static void
514
gnome_about_set_translator_credits (GnomeAbout *about, const gchar *translator_credits)
515
{
516
	g_free (about->_priv->translator_credits);
517
518
	about->_priv->translator_credits = g_strdup (translator_credits);
519
}
520
521
static void
522
gnome_about_set_copyright (GnomeAbout *about, const gchar *copyright)
523
{
524
	char *copyright_string, *tmp;
525
	
526
	g_free (about->_priv->copyright);
527
	about->_priv->copyright = copyright ? g_strdup (copyright) : NULL;
528
529
	if (about->_priv->copyright != NULL) {
530
		tmp = g_markup_escape_text (about->_priv->copyright, -1);
531
		copyright_string = g_strdup_printf ("<span size=\"small\">%s</span>", tmp);
532
		g_free (tmp);
533
	}
534
	else {
535
		copyright_string = NULL;
536
	}
537
538
	gtk_label_set_markup (GTK_LABEL (about->_priv->copyright_label), copyright_string);
539
540
	g_free (copyright_string);
541
}
542
543
static void
544
gnome_about_set_version (GnomeAbout *about, const gchar *version)
545
{
546
	gchar *name_string, *tmp_name, *tmp_version;
547
	
548
	g_free (about->_priv->version);
549
	about->_priv->version = version ? g_strdup (version) : NULL;
550
551
	tmp_name = g_markup_escape_text (about->_priv->name, -1);
552
	
553
	if (about->_priv->version != NULL) {
554
		tmp_version = g_markup_escape_text (about->_priv->version, -1);
555
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s %s</span>", tmp_name, tmp_version);
556
		g_free (tmp_version);
557
	}
558
	else {
559
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s</span>", tmp_name);
560
	}
561
562
	gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string);
563
	g_free (name_string);
564
	g_free (tmp_name);
565
}
566
567
static void
568
gnome_about_set_name (GnomeAbout *about, const gchar *name)
569
{
570
	gchar *title_string;
571
	gchar *name_string;
572
	gchar *tmp_name, *tmp_version;
573
	
574
	g_free (about->_priv->name);
575
	about->_priv->name = g_strdup (name ? name : "");
576
577
	title_string = g_strdup_printf (_("About %s"), name);
578
	gtk_window_set_title (GTK_WINDOW (about), title_string);
579
	g_free (title_string);
580
581
	tmp_name = g_markup_escape_text (about->_priv->name, -1);
582
583
	if (about->_priv->version != NULL) {
584
		tmp_version = g_markup_escape_text (about->_priv->version, -1);
585
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s %s</span>", tmp_name, tmp_version);
586
		g_free (tmp_version);
587
	}
588
	else {
589
		name_string = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">%s</span>", tmp_name);
590
	}
591
592
	gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string);
593
	g_free (name_string);
594
	g_free (tmp_name);
595
}
596
597
static void
598
gnome_about_free_person_list (GSList *list)
599
{
600
	if (list == NULL)
601
		return;
602
	
603
	g_slist_foreach (list, (GFunc) g_free, NULL);
604
	g_slist_free (list);
605
}
606
607
static void
608
gnome_about_finalize (GObject *object)
609
{
610
	GnomeAbout *about = GNOME_ABOUT (object);
611
612
	g_free (about->_priv->name);
613
	g_free (about->_priv->version);
614
	g_free (about->_priv->copyright);
615
	g_free (about->_priv->comments);
616
617
	gnome_about_free_person_list (about->_priv->authors);
618
	gnome_about_free_person_list (about->_priv->documenters);
619
620
	g_free (about->_priv->translator_credits);
621
622
	g_free (about->_priv);
623
	about->_priv = NULL;
624
625
	GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
626
}
627
628
static void
629
gnome_about_set_persons (GnomeAbout *about, guint prop_id, const GValue *persons)
630
{
631
		GValueArray *value_array;
632
	gint i;
633
	GSList *list;
634
635
	/* Free the old list */
636
	switch (prop_id) {
637
	case PROP_AUTHORS:
638
		list = about->_priv->authors;
639
		break;
640
	case PROP_DOCUMENTERS:
641
		list = about->_priv->documenters;
642
		break;
643
	default:
644
		g_assert_not_reached ();
645
		list = NULL; /* silence warning */
646
	}
647
648
	gnome_about_free_person_list (list);
649
	list = NULL;
650
	
651
	value_array = g_value_get_boxed (persons);
652
653
	if (value_array == NULL) {
654
		return;
655
	}
656
	
657
	for (i = 0; i < value_array->n_values; i++) {
658
		list = g_slist_prepend (list, g_value_dup_string (&value_array->values[i]));
659
	}
660
661
	list = g_slist_reverse (list);
662
	
663
	switch (prop_id) {
664
	case PROP_AUTHORS:
665
		about->_priv->authors = list;
666
		break;
667
	case PROP_DOCUMENTERS:
668
		about->_priv->documenters = list;
669
		break;
670
	default:
671
		g_assert_not_reached ();
672
	}
673
}
674
675
static void
676
set_value_array_from_list (GValue *value, GSList *list)
677
{
678
	GValueArray *array;
679
	GValue tmp_value = { 0 };
680
	GSList *tmp;
681
	gint length;
682
683
	length = g_slist_length (list);
684
	array = g_value_array_new (length);
685
686
	for (tmp = list; tmp; tmp = tmp->next) {
687
		char *str = tmp->data;
688
		
689
		g_value_init (&tmp_value, G_TYPE_STRING);
690
		g_value_set_string (&tmp_value, str);
691
		g_value_array_append (array, &tmp_value);
692
	}
693
694
	g_value_set_boxed (value, array);
695
	g_value_array_free (array);
696
}
697
698
static void
699
gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
700
{
701
	switch (prop_id) {
702
	case PROP_NAME:
703
		gnome_about_set_name (GNOME_ABOUT (object), g_value_get_string (value));
704
		break;
705
	case PROP_VERSION:
706
		gnome_about_set_version (GNOME_ABOUT (object), g_value_get_string (value));
707
		break;
708
	case PROP_COMMENTS:
709
		gnome_about_set_comments (GNOME_ABOUT (object), g_value_get_string (value));
710
		break;
711
	case PROP_COPYRIGHT:
712
		gnome_about_set_copyright (GNOME_ABOUT (object), g_value_get_string (value));
713
		break;
714
	case PROP_LOGO:
715
		if (g_value_get_object (value) != NULL) {
716
			gtk_image_set_from_pixbuf (GTK_IMAGE (GNOME_ABOUT (object)->_priv->logo_image),
717
						   g_value_get_object (value));
718
		}
719
		else {
720
		}
721
		break;
722
	case PROP_AUTHORS:
723
	case PROP_DOCUMENTERS:
724
		gnome_about_set_persons (GNOME_ABOUT (object), prop_id, value);
725
		break;
726
	case PROP_TRANSLATOR_CREDITS:
727
		gnome_about_set_translator_credits (GNOME_ABOUT (object), g_value_get_string (value));
728
		break;
729
	default:
730
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
731
		break;
732
	}
733
}
734
735
static void
736
gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
737
{
738
	GnomeAbout *about;
739
740
	about = GNOME_ABOUT (object);
741
	
742
	switch (prop_id) {
743
	case PROP_NAME:
744
		g_value_set_string (value, about->_priv->name);
745
		break;
746
	case PROP_VERSION:
747
		g_value_set_string (value, about->_priv->version);
748
		break;
749
	case PROP_COPYRIGHT:
750
		g_value_set_string (value, about->_priv->copyright);
751
		break;
752
	case PROP_COMMENTS:
753
		g_value_set_string (value, about->_priv->comments);
754
		break;
755
	case PROP_TRANSLATOR_CREDITS:
756
		g_value_set_string (value, about->_priv->translator_credits);
757
		break;
758
	case PROP_AUTHORS:
759
		set_value_array_from_list (value, about->_priv->authors);
760
		break;
761
	case PROP_DOCUMENTERS:
762
		set_value_array_from_list (value, about->_priv->documenters);
763
		break;
764
	case PROP_LOGO:
765
		g_value_set_object (value, gtk_image_get_pixbuf (GTK_IMAGE (about->_priv->logo_image)));
766
		break;
767
	default:
768
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
769
		break;
770
	}
771
}
772
773
/**
774
 * gnome_about_new:
775
 * @name: The name of the application.
776
 * @version: The version string of the application.
777
 * @copyright: The application's copyright statement.
778
 * @comments: A short miscellaneous string.
779
 * @authors: An %NULL terminated array of the application authors.
780
 * @documenters: An array of the application documenters.
781
 * @translator_credits: The translator for the current locale.
782
 * @logo_pixbuf: The application's logo.
783
 *
784
 * Construct an application's credits box. The @authors array cannot be empty
785
 * and the @translator_credits should be marked as a translatable string (so
786
 * that only the translator for the currently active locale is displayed).
787
 *
788
 * Returns: A new "About" dialog.
789
 */
790
GtkWidget *
791
gnome_about_new (const gchar  *name,
792
		 const gchar  *version,
793
		 const gchar  *copyright,
794
		 const gchar  *comments,
795
		 const gchar **authors,
796
		 const gchar **documenters,
797
		 const gchar  *translator_credits,
798
		 GdkPixbuf    *logo_pixbuf)
799
{
800
	GnomeAbout *about;
801
	
802
	g_return_val_if_fail (authors != NULL, NULL);
803
	
804
	about = g_object_new (GNOME_TYPE_ABOUT, NULL);
805
        gnome_about_construct(about, 
806
			      name, version, copyright, 
807
			      comments, authors, documenters, 
808
			      translator_credits, logo_pixbuf);
809
810
	return GTK_WIDGET(about);
811
}
812
813
/**
814
 * gnome_about_construct:
815
 * @about: An existing #GnomeAbout instance.
816
 * @name: The name of the application.
817
 * @version: The version string of the application.
818
 * @copyright: The application's copyright statement.
819
 * @comments: A short miscellaneous string.
820
 * @authors: An %NULL terminated array of the application authors.
821
 * @documenters: An array of the application documenters.
822
 * @translator_credits: The translator for the current locale.
823
 * @logo_pixbuf: The application's logo.
824
 *
825
 * Similar to gnome_about_new() except that the pre-existing @about widget is
826
 * used. Note that in this version of the function, @authors is not checked to
827
 * be non-%NULL, so callers must be careful, since bad things will happen if
828
 * this condition is not met.
829
 */
830
void
831
gnome_about_construct (GnomeAbout *about,
832
		       const gchar  *name,
833
		       const gchar  *version,
834
		       const gchar  *copyright,
835
		       const gchar  *comments,
836
		       const gchar **authors,
837
		       const gchar **documenters,
838
		       const gchar  *translator_credits,
839
		       GdkPixbuf    *logo_pixbuf)
840
{
841
	GValueArray *authors_array;
842
	GValueArray *documenters_array;
843
	gint i;
844
845
	authors_array = g_value_array_new (0);
846
	
847
	for (i = 0; authors[i] != NULL; i++) {
848
		GValue value = {0, };
849
		
850
		g_value_init (&value, G_TYPE_STRING);
851
			g_value_set_static_string (&value, authors[i]);
852
			authors_array = g_value_array_append (authors_array, &value);
853
	}
854
855
	if (documenters != NULL) {
856
		documenters_array = g_value_array_new (0);
857
858
		for (i = 0; documenters[i] != NULL; i++) {
859
			GValue value = {0, };
860
			
861
			g_value_init (&value, G_TYPE_STRING);
862
			g_value_set_static_string (&value, documenters[i]);
863
			documenters_array = g_value_array_append (documenters_array, &value);
864
		}
865
866
	}
867
	else {
868
		documenters_array = NULL;
869
	}
870
871
	g_object_set (G_OBJECT (about),
872
		      "name", name,
873
		      "version", version,
874
		      "copyright", copyright,
875
		      "comments", comments,
876
		      "authors", authors_array,
877
		      "documenters", documenters_array,
878
		      "translator_credits", translator_credits,
879
		      "logo", logo_pixbuf,
880
		      NULL);
881
882
	if (authors_array != NULL) {
883
		g_value_array_free (authors_array);
884
	}
885
	if (documenters_array != NULL) {
886
		g_value_array_free (documenters_array);
887
	}
888
}
(-)stardict-cur-accepted/src/win32/gnome-about.h (-83 lines)
Lines 1-83 Link Here
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2
/* gnome-about.h - An about box widget for gnome.
3
4
   Copyright (C) 2001 CodeFactory AB
5
   Copyright (C) 2001 Anders Carlsson <andersca@codefactory.se>
6
7
   The Gnome Library is free software; you can redistribute it and/or
8
   modify it under the terms of the GNU Library General Public License as
9
   published by the Free Software Foundation; either version 2 of the
10
   License, or (at your option) any later version.
11
12
   The Gnome Library is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
   Library General Public License for more details.
16
17
   You should have received a copy of the GNU Library General Public
18
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
19
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
   Boston, MA 02111-1307, USA.
21
22
   Author: Anders Carlsson <andersca@codefactory.se>
23
*/
24
25
#ifndef __GNOME_ABOUT_H__
26
#define __GNOME_ABOUT_H__
27
28
#include <gtk/gtkdialog.h>
29
30
G_BEGIN_DECLS
31
32
#define GNOME_TYPE_ABOUT            (gnome_about_get_type ())
33
#define GNOME_ABOUT(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), GNOME_TYPE_ABOUT, GnomeAbout))
34
#define GNOME_ABOUT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_ABOUT, GnomeAboutClass))
35
#define GNOME_IS_ABOUT(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), GNOME_TYPE_ABOUT))
36
#define GNOME_IS_ABOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_ABOUT))
37
#define GNOME_ABOUT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_ABOUT, GnomeAboutClass))
38
39
typedef struct _GnomeAbout        GnomeAbout;
40
typedef struct _GnomeAboutClass   GnomeAboutClass;
41
typedef struct _GnomeAboutPrivate GnomeAboutPrivate;
42
43
struct _GnomeAbout {
44
	GtkDialog parent_instance;
45
46
	/*< private >*/
47
	GnomeAboutPrivate *_priv;
48
};
49
50
struct _GnomeAboutClass {
51
	GtkDialogClass parent_class;
52
53
	/* Padding for possible expansion */
54
	gpointer padding1;
55
	gpointer padding2;
56
};
57
58
GType gnome_about_get_type (void) G_GNUC_CONST;
59
60
GtkWidget *gnome_about_new (const gchar  *name,
61
			    const gchar  *version,
62
			    const gchar  *copyright,
63
			    const gchar  *comments,
64
			    const gchar **authors,
65
			    const gchar **documenters,
66
			    const gchar  *translator_credits,
67
			    GdkPixbuf    *logo_pixbuf);
68
69
/* Only for use by bindings to languages other than C; don't use
70
   in applications. */
71
void gnome_about_construct (GnomeAbout *about,
72
			    const gchar  *name,
73
			    const gchar  *version,
74
			    const gchar  *copyright,
75
			    const gchar  *comments,
76
			    const gchar **authors,
77
			    const gchar **documenters,
78
			    const gchar  *translator_credits,
79
			    GdkPixbuf    *logo_pixbuf);
80
81
G_END_DECLS
82
83
#endif /* __GNOME_ABOUT_H__ */
(-)stardict-cur-accepted/src/win32/intl.h (-19 lines)
Lines 6-28 Link Here
6
#define PACKAGE "stardict"
6
#define PACKAGE "stardict"
7
#endif
7
#endif
8
8
9
#ifdef ENABLE_NLS
10
#  include <libintl.h>
11
#  define _(String) gettext(String)
12
#  ifdef gettext_noop
13
#    define N_(String) gettext_noop(String)
14
#  else
15
#    define N_(String) (String)
16
#  endif /* gettext_noop */
17
#else
18
#  define _(String) (String)
19
#  define N_(String) (String)
20
#  define textdomain(String) (String)
21
#  define gettext(String) (String)
22
#  define dgettext(Domain,String) (String)
23
#  define dcgettext(Domain,String,Type) (String)
24
#  define bindtextdomain(Domain,Directory) (Domain) 
25
#  define bind_textdomain_codeset(Domain,Codeset) (Domain) 
26
#endif /* ENABLE_NLS */
27
28
#endif /* __INTL_H__ */
9
#endif /* __INTL_H__ */

Return to bug 86379