diff -bBurNd stardict-cur-accepted/configure.in stardict/configure.in --- stardict-cur-accepted/configure.in 2005-02-27 11:03:47.093507544 +0300 +++ stardict/configure.in 2005-02-25 16:01:02.000000000 +0300 @@ -34,39 +34,48 @@ ALL_LINGUAS="cs de hu mk ru sk uk vi zh_CN zh_TW" AM_GLIB_GNU_GETTEXT -dnl -dnl Start of pkg-config checks -dnl -PKG_CHECK_MODULES(STARDICT, libgnomeui-2.0 >= 2.2.0) -STARDICT_CFLAGS="\ - -Wall \ - $STARDICT_CFLAGS" +AC_ARG_ENABLE(gnome-support, AC_HELP_STRING([--disable-gnome-support], [Disable gnome support])) +AM_CONDITIONAL(GNOME_SUPPORT, test "x${enable_gnome_support}" != "xno") +if test "x${enable_gnome_support}" != "xno" ; then + echo "enable gnome suppport"; dnl -dnl Start of zlib checks +dnl Start of pkg-config checks dnl -AC_CHECK_LIB(z,zlibVersion,STARDICT_LIBS="$STARDICT_LIBS -lz",[AC_MSG_ERROR([zlib not found])]) - - + PKG_CHECK_MODULES(STARDICT, libgnomeui-2.0 >= 2.2.0) + STARDICT_CFLAGS="-Wall $STARDICT_CFLAGS" dnl ********************************************* dnl for anything which calls gconftool-2 correctly dnl ********************************************* + AC_PATH_PROG(GCONFTOOL, gconftool-2, no) + if test x"$GCONFTOOL" = xno; then + AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf]) + fi + AM_GCONF_SOURCE_2 -dnl ****************************** + AM_CONDITIONAL(SCHEMAS_INSTALL, test x$schemas_install = xtrue) +dnl ========================================================================== +dnl stuff for the CORBA interface -dnl AC_ARG_ENABLE(schemas-install,AC_HELP_STRING([--disable-schemas-install], [Disable installation of the gconf schemas])) + ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" + AC_SUBST(ORBIT_IDL) -dnl AM_CONDITIONAL(SCHEMAS_INSTALL, test x$enable_schemas_install != xno) + LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`" + AC_SUBST(LIBBONOBO_IDL) -AC_PATH_PROG(GCONFTOOL, gconftool-2, no) -if test x"$GCONFTOOL" = xno; then - AC_MSG_ERROR([gconftool-2 executable not found in your path - should be -installed with GConf]) + BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" + AC_SUBST(BONOBO_ACTIVATION_IDL) +else + echo "disable gnome support"; + AC_DEFINE([WITHOUT_GNOME],[], [Compile with gnome support]) + AM_CONDITIONAL(SCHEMAS_INSTALL, test "x${enable_gnome_support}" != "xno") + AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x${enable_gnome_support}" != "xno") + PKG_CHECK_MODULES(STARDICT, gtk+-2.0) fi -AM_GCONF_SOURCE_2 -AM_CONDITIONAL(SCHEMAS_INSTALL, test x$schemas_install = xtrue) + + dnl dnl Check popt @@ -76,18 +85,11 @@ stardict. You can download the latest version from ftp://people.redhat.com/sopwith/popt/])) -dnl ========================================================================== - -dnl stuff for the CORBA interface - -ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" -AC_SUBST(ORBIT_IDL) - -LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`" -AC_SUBST(LIBBONOBO_IDL) -BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" -AC_SUBST(BONOBO_ACTIVATION_IDL) +dnl +dnl Start of zlib checks +dnl +AC_CHECK_LIB(z,zlibVersion,STARDICT_LIBS="$STARDICT_LIBS -lz",[AC_MSG_ERROR([zlib not found])]) dnl ========================================================================== diff -bBurNd stardict-cur-accepted/data/Makefile.am stardict/data/Makefile.am --- stardict-cur-accepted/data/Makefile.am 2003-05-21 14:03:14.000000000 +0400 +++ stardict/data/Makefile.am 2005-02-25 17:04:13.000000000 +0300 @@ -3,6 +3,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ +if GNOME_SUPPORT schemasdir = $(sysconfdir)/gconf/schemas schemas_in_files = stardict.schemas.in schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) @@ -12,14 +13,19 @@ server_in_files = GNOME_Stardict.server.in server_DATA = $(server_in_files:.server.in=.server) @INTLTOOL_SERVER_RULE@ +endif man_MANS = stardict.1 - +if GNOME_SUPPORT EXTRA_DIST = $(desktop_in_files) \ $(server_in_files) \ $(schemas_in_files) \ $(man_MANS) +else +XTRA_DIST = $(desktop_in_files) \ + $(man_MANS) +endif CLEANFILES = \ $(server_DATA) \ diff -bBurNd stardict-cur-accepted/help/Makefile.am stardict/help/Makefile.am --- stardict-cur-accepted/help/Makefile.am 2004-10-19 07:04:05.000000000 +0400 +++ stardict/help/Makefile.am 2005-02-25 17:04:51.000000000 +0300 @@ -1,3 +1,5 @@ ## Process this file with automake to produce Makefile.in. +if GNOME_SUPPORT SUBDIRS = C zh_CN zh_TW uk ru mk +endif diff -bBurNd stardict-cur-accepted/src/dictmanagedlg.cpp stardict/src/dictmanagedlg.cpp --- stardict-cur-accepted/src/dictmanagedlg.cpp 2005-02-27 11:03:47.094507392 +0300 +++ stardict/src/dictmanagedlg.cpp 2005-02-25 16:40:53.000000000 +0300 @@ -4,6 +4,7 @@ #include #include +#include #ifdef _WIN32 # include diff -bBurNd stardict-cur-accepted/src/docklet.cpp stardict/src/docklet.cpp --- stardict-cur-accepted/src/docklet.cpp 2005-02-27 11:03:39.087724608 +0300 +++ stardict/src/docklet.cpp 2005-02-25 16:40:00.000000000 +0300 @@ -2,6 +2,8 @@ # include "config.h" #endif +#include + #include "stardict.h" #include "conf.h" diff -bBurNd stardict-cur-accepted/src/floatwin.cpp stardict/src/floatwin.cpp --- stardict-cur-accepted/src/floatwin.cpp 2005-02-27 11:03:47.096507088 +0300 +++ stardict/src/floatwin.cpp 2005-02-25 16:41:20.000000000 +0300 @@ -4,6 +4,7 @@ #include #include +#include #ifdef _WIN32 # include diff -bBurNd stardict-cur-accepted/src/gnome-about.c stardict/src/gnome-about.c --- stardict-cur-accepted/src/gnome-about.c 1970-01-01 03:00:00.000000000 +0300 +++ stardict/src/gnome-about.c 2005-02-25 16:27:29.000000000 +0300 @@ -0,0 +1,888 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* gnome-about.c - An about box widget for gnome. + + Copyright (C) 2001 CodeFactory AB + Copyright (C) 2001, 2002 Anders Carlsson + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Anders Carlsson +*/ + +//Changed by Hu Zheng to make it compile along. 2003.09.23 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +#include "gnome-about.h" + +G_BEGIN_DECLS + +#define BONOBO_BOILERPLATE(type, type_as_function, corba_type, \ + parent_type, parent_type_macro, \ + register_type_macro) \ +static void type_as_function ## _class_init (type ## Class *klass); \ +static void type_as_function ## _instance_init (type *object); \ +static parent_type ## Class *parent_class = NULL; \ +static void \ +type_as_function ## _class_init_trampoline (gpointer klass, \ + gpointer data) \ +{ \ + parent_class = (parent_type ## Class *)g_type_class_ref ( \ + parent_type_macro); \ + type_as_function ## _class_init ((type ## Class *)klass); \ +} \ +GType \ +type_as_function ## _get_type (void) \ +{ \ + static GType object_type = 0; \ + if (object_type == 0) { \ + static const GTypeInfo object_info = { \ + sizeof (type ## Class), \ + NULL, /* base_init */ \ + NULL, /* base_finalize */ \ + type_as_function ## _class_init_trampoline, \ + NULL, /* class_finalize */ \ + NULL, /* class_data */ \ + sizeof (type), \ + 0, /* n_preallocs */ \ + (GInstanceInitFunc) type_as_function ## _instance_init \ + }; \ + object_type = register_type_macro \ + (type, type_as_function, corba_type, \ + parent_type, parent_type_macro); \ + } \ + return object_type; \ +} + +#define BONOBO_CALL_PARENT(parent_class_cast, name, args) \ + ((parent_class_cast(parent_class)->name != NULL) ? \ + parent_class_cast(parent_class)->name args : (void)0) + +G_END_DECLS + +#define GNOME_CLASS_BOILERPLATE(type, type_as_function, \ + parent_type, parent_type_macro) \ + BONOBO_BOILERPLATE(type, type_as_function, type, \ + parent_type, parent_type_macro, \ + GNOME_REGISTER_TYPE) + +#define GNOME_REGISTER_TYPE(type, type_as_function, corba_type, \ + parent_type, parent_type_macro) \ + g_type_register_static (parent_type_macro, #type, &object_info, 0) + +#define GNOME_CALL_PARENT(parent_class_cast, name, args) \ + BONOBO_CALL_PARENT (parent_class_cast, name, args) + +/* FIXME: More includes! */ + +struct _GnomeAboutPrivate { + gchar *name; + gchar *version; + gchar *copyright; + gchar *comments; + gchar *translator_credits; + + GSList *authors; + GSList *documenters; + + GtkWidget *logo_image; + GtkWidget *name_label; + GtkWidget *comments_label; + GtkWidget *copyright_label; + + GtkWidget *credits_dialog; +}; + +enum { + PROP_0, + PROP_NAME, + PROP_VERSION, + PROP_COPYRIGHT, + PROP_COMMENTS, + PROP_AUTHORS, + PROP_DOCUMENTERS, + PROP_TRANSLATOR_CREDITS, + PROP_LOGO, +}; + +#define GNOME_RESPONSE_CREDITS 1 + +static void gnome_about_finalize (GObject *object); +static void gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); + +GNOME_CLASS_BOILERPLATE (GnomeAbout, gnome_about, + GtkDialog, GTK_TYPE_DIALOG) + +static void +gnome_about_update_authors_label (GnomeAbout *about, GtkWidget *label) +{ + GString *string; + GSList *list; + gchar *tmp; + + if (about->_priv->authors == NULL) { + gtk_widget_hide (label); + return; + } + else { + gtk_widget_show (label); + } + + string = g_string_new (NULL); + + for (list = about->_priv->authors; list; list = list->next) { + tmp = g_markup_escape_text (list->data, -1); + g_string_append (string, tmp); + + if (list->next) + g_string_append_c (string, '\n'); + g_free (tmp); + } + + gtk_label_set_markup (GTK_LABEL (label), string->str); + g_string_free (string, TRUE); +} + +static void +gnome_about_update_documenters_label (GnomeAbout *about, GtkWidget *label) +{ + GString *string; + GSList *list; + gchar *tmp; + + if (about->_priv->documenters == NULL) { + gtk_widget_hide (label); + return; + } + else { + gtk_widget_show (label); + } + + string = g_string_new (NULL); + + for (list = about->_priv->documenters; list; list = list->next) { + tmp = g_markup_escape_text (list->data, -1); + g_string_append (string, tmp); + + if (list->next) + g_string_append (string, "\n"); + g_free (tmp); + } + + gtk_label_set_markup (GTK_LABEL (label), string->str); + g_string_free (string, TRUE); +} + +static void +gnome_about_update_translation_information_label (GnomeAbout *about, GtkWidget *label) +{ + GString *string; + gchar *tmp; + + if (about->_priv->translator_credits == NULL) { + gtk_widget_hide (label); + return; + } + else { + gtk_widget_show (label); + } + + string = g_string_new (NULL); + + tmp = g_markup_escape_text (about->_priv->translator_credits, -1); + g_string_append (string, tmp); + g_free (tmp); + + gtk_label_set_markup (GTK_LABEL (label), string->str); + g_string_free (string, TRUE); +} + +static GtkWidget * +create_label (void) +{ + GtkWidget *label; + + label = gtk_label_new (""); + gtk_label_set_selectable (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); + gtk_misc_set_padding (GTK_MISC (label), 8, 8); + + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + + return label; +} + +static void +gnome_about_display_credits_dialog (GnomeAbout *about) +{ + GtkWidget *dialog, *label, *notebook, *sw; + + if (about->_priv->credits_dialog != NULL) { + gtk_window_present (GTK_WINDOW (about->_priv->credits_dialog)); + return; + } + + dialog = gtk_dialog_new_with_buttons (_("Credits"), + GTK_WINDOW (about), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); + about->_priv->credits_dialog = dialog; + gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); + gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), dialog); + g_signal_connect (dialog, "destroy", + G_CALLBACK (gtk_widget_destroyed), + &(about->_priv->credits_dialog)); + + notebook = gtk_notebook_new (); + gtk_container_set_border_width (GTK_CONTAINER (notebook), 5); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0); + + if (about->_priv->authors != NULL) { + label = create_label (); + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label); + gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, + gtk_label_new (_("Written by"))); + gnome_about_update_authors_label (about, label); + } + + if (about->_priv->documenters != NULL) { + label = create_label (); + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label); + gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, + gtk_label_new (_("Documented by"))); + gnome_about_update_documenters_label (about, label); + } + + if (about->_priv->translator_credits != NULL) { + label = create_label (); + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label); + gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, + gtk_label_new (_("Translated by"))); + gnome_about_update_translation_information_label (about, label); + } + + gtk_widget_show_all (dialog); +} + +static void +gnome_about_instance_init (GnomeAbout *about) +{ + GnomeAboutPrivate *priv; + GtkWidget *vbox, *hbox, *image, *label, *alignment, *button; + + /* Data */ + + priv = g_new0 (GnomeAboutPrivate, 1); + about->_priv = priv; + + priv->name = NULL; + priv->version = NULL; + priv->copyright = NULL; + priv->comments = NULL; + priv->translator_credits = NULL; + priv->authors = NULL; + priv->documenters = NULL; + + gtk_dialog_set_has_separator (GTK_DIALOG (about), FALSE); + gtk_container_set_border_width (GTK_CONTAINER (about), 5); + gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (about)->vbox), 5); + + /* Widgets */ + vbox = gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0); + + priv->logo_image = gtk_image_new (); + gtk_box_pack_start (GTK_BOX (vbox), priv->logo_image, FALSE, FALSE, 0); + priv->name_label = gtk_label_new (NULL); + gtk_label_set_selectable (GTK_LABEL (priv->name_label), TRUE); + gtk_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER); + gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0); + + priv->comments_label = gtk_label_new (NULL); + gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE); + gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER); + gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE); + gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0); + + priv->copyright_label = gtk_label_new (NULL); + gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE); + gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER); + gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0); + + gtk_widget_show_all (vbox); + + /* Add the close button */ + gtk_dialog_add_button (GTK_DIALOG (about), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CLOSE); + + /* Add the credits button */ + image = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON); + + label = gtk_label_new_with_mnemonic (_("C_redits")); + + hbox = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + gtk_container_add (GTK_CONTAINER (alignment), hbox); + + button = gtk_button_new (); + gtk_container_add (GTK_CONTAINER (button), alignment); + gtk_widget_show_all (button); + + gtk_dialog_add_action_widget (GTK_DIALOG (about), button, GNOME_RESPONSE_CREDITS); + gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (about)->action_area), button, TRUE); + + gtk_window_set_resizable (GTK_WINDOW (about), FALSE); + + priv->credits_dialog = NULL; +} + +static void +gnome_about_response (GtkDialog *dialog, gint response) +{ + switch (response) { + case GNOME_RESPONSE_CREDITS: + gnome_about_display_credits_dialog (GNOME_ABOUT (dialog)); + break; + default: + gtk_widget_destroy (GTK_WIDGET (dialog)); + break; + } +} + +static void +gnome_about_class_init (GnomeAboutClass *klass) +{ + GObjectClass *object_class; + GtkWidgetClass *widget_class; + GtkDialogClass *dialog_class; + + object_class = (GObjectClass *)klass; + widget_class = (GtkWidgetClass *)klass; + dialog_class = (GtkDialogClass *)klass; + + object_class->set_property = gnome_about_set_property; + object_class->get_property = gnome_about_get_property; + + object_class->finalize = gnome_about_finalize; + + dialog_class->response = gnome_about_response; + + g_object_class_install_property (object_class, + PROP_NAME, + g_param_spec_string ("name", + _("Program name"), + _("The name of the program"), + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_VERSION, + g_param_spec_string ("version", + _("Program version"), + _("The version of the program"), + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_COPYRIGHT, + g_param_spec_string ("copyright", + _("Copyright string"), + _("Copyright information for the program"), + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_COMMENTS, + g_param_spec_string ("comments", + _("Comments string"), + _("Comments about the program"), + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_AUTHORS, + g_param_spec_value_array ("authors", + _("Authors"), + _("List of authors of the programs"), + g_param_spec_string ("author-entry", + _("Author entry"), + _("A single author entry"), + NULL, + G_PARAM_READWRITE), + G_PARAM_WRITABLE)); + g_object_class_install_property (object_class, + PROP_DOCUMENTERS, + g_param_spec_value_array ("documenters", + _("Documenters"), + _("List of people documenting the program"), + g_param_spec_string ("documenter-entry", + _("Documenter entry"), + _("A single documenter entry"), + NULL, + G_PARAM_READWRITE), + G_PARAM_WRITABLE)); + + g_object_class_install_property (object_class, + PROP_TRANSLATOR_CREDITS, + g_param_spec_string ("translator_credits", + _("Translator credits"), + _("Credits to the translators. This string should be marked as translatable"), + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_LOGO, + g_param_spec_object ("logo", + _("Logo"), + _("A logo for the about box"), + GDK_TYPE_PIXBUF, + G_PARAM_WRITABLE)); + +} + +static void +gnome_about_set_comments (GnomeAbout *about, const gchar *comments) +{ + g_free (about->_priv->comments); + about->_priv->comments = comments ? g_strdup (comments) : NULL; + + gtk_label_set_text (GTK_LABEL (about->_priv->comments_label), about->_priv->comments); +} + +static void +gnome_about_set_translator_credits (GnomeAbout *about, const gchar *translator_credits) +{ + g_free (about->_priv->translator_credits); + + about->_priv->translator_credits = g_strdup (translator_credits); +} + +static void +gnome_about_set_copyright (GnomeAbout *about, const gchar *copyright) +{ + char *copyright_string, *tmp; + + g_free (about->_priv->copyright); + about->_priv->copyright = copyright ? g_strdup (copyright) : NULL; + + if (about->_priv->copyright != NULL) { + tmp = g_markup_escape_text (about->_priv->copyright, -1); + copyright_string = g_strdup_printf ("%s", tmp); + g_free (tmp); + } + else { + copyright_string = NULL; + } + + gtk_label_set_markup (GTK_LABEL (about->_priv->copyright_label), copyright_string); + + g_free (copyright_string); +} + +static void +gnome_about_set_version (GnomeAbout *about, const gchar *version) +{ + gchar *name_string, *tmp_name, *tmp_version; + + g_free (about->_priv->version); + about->_priv->version = version ? g_strdup (version) : NULL; + + tmp_name = g_markup_escape_text (about->_priv->name, -1); + + if (about->_priv->version != NULL) { + tmp_version = g_markup_escape_text (about->_priv->version, -1); + name_string = g_strdup_printf ("%s %s", tmp_name, tmp_version); + g_free (tmp_version); + } + else { + name_string = g_strdup_printf ("%s", tmp_name); + } + + gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string); + g_free (name_string); + g_free (tmp_name); +} + +static void +gnome_about_set_name (GnomeAbout *about, const gchar *name) +{ + gchar *title_string; + gchar *name_string; + gchar *tmp_name, *tmp_version; + + g_free (about->_priv->name); + about->_priv->name = g_strdup (name ? name : ""); + + title_string = g_strdup_printf (_("About %s"), name); + gtk_window_set_title (GTK_WINDOW (about), title_string); + g_free (title_string); + + tmp_name = g_markup_escape_text (about->_priv->name, -1); + + if (about->_priv->version != NULL) { + tmp_version = g_markup_escape_text (about->_priv->version, -1); + name_string = g_strdup_printf ("%s %s", tmp_name, tmp_version); + g_free (tmp_version); + } + else { + name_string = g_strdup_printf ("%s", tmp_name); + } + + gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string); + g_free (name_string); + g_free (tmp_name); +} + +static void +gnome_about_free_person_list (GSList *list) +{ + if (list == NULL) + return; + + g_slist_foreach (list, (GFunc) g_free, NULL); + g_slist_free (list); +} + +static void +gnome_about_finalize (GObject *object) +{ + GnomeAbout *about = GNOME_ABOUT (object); + + g_free (about->_priv->name); + g_free (about->_priv->version); + g_free (about->_priv->copyright); + g_free (about->_priv->comments); + + gnome_about_free_person_list (about->_priv->authors); + gnome_about_free_person_list (about->_priv->documenters); + + g_free (about->_priv->translator_credits); + + g_free (about->_priv); + about->_priv = NULL; + + GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); +} + +static void +gnome_about_set_persons (GnomeAbout *about, guint prop_id, const GValue *persons) +{ + GValueArray *value_array; + gint i; + GSList *list; + + /* Free the old list */ + switch (prop_id) { + case PROP_AUTHORS: + list = about->_priv->authors; + break; + case PROP_DOCUMENTERS: + list = about->_priv->documenters; + break; + default: + g_assert_not_reached (); + list = NULL; /* silence warning */ + } + + gnome_about_free_person_list (list); + list = NULL; + + value_array = g_value_get_boxed (persons); + + if (value_array == NULL) { + return; + } + + for (i = 0; i < value_array->n_values; i++) { + list = g_slist_prepend (list, g_value_dup_string (&value_array->values[i])); + } + + list = g_slist_reverse (list); + + switch (prop_id) { + case PROP_AUTHORS: + about->_priv->authors = list; + break; + case PROP_DOCUMENTERS: + about->_priv->documenters = list; + break; + default: + g_assert_not_reached (); + } +} + +static void +set_value_array_from_list (GValue *value, GSList *list) +{ + GValueArray *array; + GValue tmp_value = { 0 }; + GSList *tmp; + gint length; + + length = g_slist_length (list); + array = g_value_array_new (length); + + for (tmp = list; tmp; tmp = tmp->next) { + char *str = tmp->data; + + g_value_init (&tmp_value, G_TYPE_STRING); + g_value_set_string (&tmp_value, str); + g_value_array_append (array, &tmp_value); + } + + g_value_set_boxed (value, array); + g_value_array_free (array); +} + +static void +gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +{ + switch (prop_id) { + case PROP_NAME: + gnome_about_set_name (GNOME_ABOUT (object), g_value_get_string (value)); + break; + case PROP_VERSION: + gnome_about_set_version (GNOME_ABOUT (object), g_value_get_string (value)); + break; + case PROP_COMMENTS: + gnome_about_set_comments (GNOME_ABOUT (object), g_value_get_string (value)); + break; + case PROP_COPYRIGHT: + gnome_about_set_copyright (GNOME_ABOUT (object), g_value_get_string (value)); + break; + case PROP_LOGO: + if (g_value_get_object (value) != NULL) { + gtk_image_set_from_pixbuf (GTK_IMAGE (GNOME_ABOUT (object)->_priv->logo_image), + g_value_get_object (value)); + } + else { + } + break; + case PROP_AUTHORS: + case PROP_DOCUMENTERS: + gnome_about_set_persons (GNOME_ABOUT (object), prop_id, value); + break; + case PROP_TRANSLATOR_CREDITS: + gnome_about_set_translator_credits (GNOME_ABOUT (object), g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +{ + GnomeAbout *about; + + about = GNOME_ABOUT (object); + + switch (prop_id) { + case PROP_NAME: + g_value_set_string (value, about->_priv->name); + break; + case PROP_VERSION: + g_value_set_string (value, about->_priv->version); + break; + case PROP_COPYRIGHT: + g_value_set_string (value, about->_priv->copyright); + break; + case PROP_COMMENTS: + g_value_set_string (value, about->_priv->comments); + break; + case PROP_TRANSLATOR_CREDITS: + g_value_set_string (value, about->_priv->translator_credits); + break; + case PROP_AUTHORS: + set_value_array_from_list (value, about->_priv->authors); + break; + case PROP_DOCUMENTERS: + set_value_array_from_list (value, about->_priv->documenters); + break; + case PROP_LOGO: + g_value_set_object (value, gtk_image_get_pixbuf (GTK_IMAGE (about->_priv->logo_image))); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/** + * gnome_about_new: + * @name: The name of the application. + * @version: The version string of the application. + * @copyright: The application's copyright statement. + * @comments: A short miscellaneous string. + * @authors: An %NULL terminated array of the application authors. + * @documenters: An array of the application documenters. + * @translator_credits: The translator for the current locale. + * @logo_pixbuf: The application's logo. + * + * Construct an application's credits box. The @authors array cannot be empty + * and the @translator_credits should be marked as a translatable string (so + * that only the translator for the currently active locale is displayed). + * + * Returns: A new "About" dialog. + */ +GtkWidget * +gnome_about_new (const gchar *name, + const gchar *version, + const gchar *copyright, + const gchar *comments, + const gchar **authors, + const gchar **documenters, + const gchar *translator_credits, + GdkPixbuf *logo_pixbuf) +{ + GnomeAbout *about; + + g_return_val_if_fail (authors != NULL, NULL); + + about = g_object_new (GNOME_TYPE_ABOUT, NULL); + gnome_about_construct(about, + name, version, copyright, + comments, authors, documenters, + translator_credits, logo_pixbuf); + + return GTK_WIDGET(about); +} + +/** + * gnome_about_construct: + * @about: An existing #GnomeAbout instance. + * @name: The name of the application. + * @version: The version string of the application. + * @copyright: The application's copyright statement. + * @comments: A short miscellaneous string. + * @authors: An %NULL terminated array of the application authors. + * @documenters: An array of the application documenters. + * @translator_credits: The translator for the current locale. + * @logo_pixbuf: The application's logo. + * + * Similar to gnome_about_new() except that the pre-existing @about widget is + * used. Note that in this version of the function, @authors is not checked to + * be non-%NULL, so callers must be careful, since bad things will happen if + * this condition is not met. + */ +void +gnome_about_construct (GnomeAbout *about, + const gchar *name, + const gchar *version, + const gchar *copyright, + const gchar *comments, + const gchar **authors, + const gchar **documenters, + const gchar *translator_credits, + GdkPixbuf *logo_pixbuf) +{ + GValueArray *authors_array; + GValueArray *documenters_array; + gint i; + + authors_array = g_value_array_new (0); + + for (i = 0; authors[i] != NULL; i++) { + GValue value = {0, }; + + g_value_init (&value, G_TYPE_STRING); + g_value_set_static_string (&value, authors[i]); + authors_array = g_value_array_append (authors_array, &value); + } + + if (documenters != NULL) { + documenters_array = g_value_array_new (0); + + for (i = 0; documenters[i] != NULL; i++) { + GValue value = {0, }; + + g_value_init (&value, G_TYPE_STRING); + g_value_set_static_string (&value, documenters[i]); + documenters_array = g_value_array_append (documenters_array, &value); + } + + } + else { + documenters_array = NULL; + } + + g_object_set (G_OBJECT (about), + "name", name, + "version", version, + "copyright", copyright, + "comments", comments, + "authors", authors_array, + "documenters", documenters_array, + "translator_credits", translator_credits, + "logo", logo_pixbuf, + NULL); + + if (authors_array != NULL) { + g_value_array_free (authors_array); + } + if (documenters_array != NULL) { + g_value_array_free (documenters_array); + } +} diff -bBurNd stardict-cur-accepted/src/gnome-about.h stardict/src/gnome-about.h --- stardict-cur-accepted/src/gnome-about.h 1970-01-01 03:00:00.000000000 +0300 +++ stardict/src/gnome-about.h 2003-09-23 17:43:03.000000000 +0400 @@ -0,0 +1,83 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* gnome-about.h - An about box widget for gnome. + + Copyright (C) 2001 CodeFactory AB + Copyright (C) 2001 Anders Carlsson + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Anders Carlsson +*/ + +#ifndef __GNOME_ABOUT_H__ +#define __GNOME_ABOUT_H__ + +#include + +G_BEGIN_DECLS + +#define GNOME_TYPE_ABOUT (gnome_about_get_type ()) +#define GNOME_ABOUT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GNOME_TYPE_ABOUT, GnomeAbout)) +#define GNOME_ABOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_ABOUT, GnomeAboutClass)) +#define GNOME_IS_ABOUT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GNOME_TYPE_ABOUT)) +#define GNOME_IS_ABOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_ABOUT)) +#define GNOME_ABOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_ABOUT, GnomeAboutClass)) + +typedef struct _GnomeAbout GnomeAbout; +typedef struct _GnomeAboutClass GnomeAboutClass; +typedef struct _GnomeAboutPrivate GnomeAboutPrivate; + +struct _GnomeAbout { + GtkDialog parent_instance; + + /*< private >*/ + GnomeAboutPrivate *_priv; +}; + +struct _GnomeAboutClass { + GtkDialogClass parent_class; + + /* Padding for possible expansion */ + gpointer padding1; + gpointer padding2; +}; + +GType gnome_about_get_type (void) G_GNUC_CONST; + +GtkWidget *gnome_about_new (const gchar *name, + const gchar *version, + const gchar *copyright, + const gchar *comments, + const gchar **authors, + const gchar **documenters, + const gchar *translator_credits, + GdkPixbuf *logo_pixbuf); + +/* Only for use by bindings to languages other than C; don't use + in applications. */ +void gnome_about_construct (GnomeAbout *about, + const gchar *name, + const gchar *version, + const gchar *copyright, + const gchar *comments, + const gchar **authors, + const gchar **documenters, + const gchar *translator_credits, + GdkPixbuf *logo_pixbuf); + +G_END_DECLS + +#endif /* __GNOME_ABOUT_H__ */ diff -bBurNd stardict-cur-accepted/src/lib.cpp stardict/src/lib.cpp --- stardict-cur-accepted/src/lib.cpp 2005-02-27 11:03:47.098506784 +0300 +++ stardict/src/lib.cpp 2005-02-25 17:49:30.000000000 +0300 @@ -470,22 +470,24 @@ { wordlist = (gchar **)g_malloc((wordcount+1) * sizeof(gchar *)); gchar *p1 = idxdatabuffer; - for (int i=0;i # include +#else +# include "gnome-about.h" #endif +#include + #ifdef _WIN32 #define VERSION "2.4.4" # include "win32/intl.h" -# include "win32/gnome-about.h" # include #endif @@ -508,7 +511,7 @@ gtk_menu_shell_append(GTK_MENU_SHELL(MainMenu), menuitem); menuitem = gtk_image_menu_item_new_with_mnemonic(_("_About")); -#ifdef _WIN32 +#if defined(_WIN32) || defined(WITHOUT_GNOME) image = gtk_image_new_from_pixbuf(gpAppFrame->oAppSkin.stardict.about_menu.p[0]); #else image = gtk_image_new_from_stock (GNOME_STOCK_ABOUT, GTK_ICON_SIZE_BUTTON); @@ -1224,35 +1227,38 @@ { textview = gtk_text_view_new(); gtk_widget_show(textview); - gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),false); - gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), false); + gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE); + gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), FALSE); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD_CHAR); gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview),5); gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview),5); - g_signal_connect (G_OBJECT (textview), "button_press_event", G_CALLBACK (on_button_press), this); - g_signal_connect (G_OBJECT (textview), "selection_received", G_CALLBACK (SelectionCallback), this); + g_signal_connect(G_OBJECT(textview), "button_press_event", G_CALLBACK(on_button_press), this); + g_signal_connect(G_OBJECT(textview), "selection_received", G_CALLBACK(SelectionCallback), this); GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); - gtk_text_buffer_create_tag (buffer, "DictNameTag", "foreground", "blue", NULL); - gtk_text_buffer_create_tag (buffer, "YinBiaoTag", "foreground", "red", NULL); - gtk_text_buffer_create_tag (buffer, "WordTag", "weight", PANGO_WEIGHT_BOLD, "scale", PANGO_SCALE_X_LARGE, NULL); - gtk_text_buffer_create_tag (buffer, "PhoneticTag", "scale", PANGO_SCALE_X_LARGE, NULL); + gtk_text_buffer_create_tag(buffer, "DictNameTag", "foreground", "blue", NULL); + gtk_text_buffer_create_tag(buffer, "YinBiaoTag", "foreground", "red", NULL); + gtk_text_buffer_create_tag(buffer, "WordTag", "weight", PANGO_WEIGHT_BOLD, "scale", PANGO_SCALE_X_LARGE, NULL); + gtk_text_buffer_create_tag(buffer, "PhoneticTag", "scale", PANGO_SCALE_X_LARGE, NULL); //gtk_text_buffer_create_tag(buffer, "WordLink", "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL); //g_signal_connect(G_OBJECT(texttag), "event", G_CALLBACK(tag_event), strdup(url)); scrolled_window = gtk_scrolled_window_new(NULL,NULL); gtk_widget_show(scrolled_window); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - //altought textview's set_wrap_mode will cause this can be GTK_POLICY_NEVER,but...there are widgets that may make this broken. + gtk_scrolled_window_set_policy( + GTK_SCROLLED_WINDOW(scrolled_window), + //altought textview's set_wrap_mode will cause + //this can be GTK_POLICY_NEVER,but... + //there are widgets that may make this broken. GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolled_window),textview); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); - gtk_box_pack_start(GTK_BOX(vbox),scrolled_window,true,true,0); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); + gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); } void TextWin::ShowInitFailed() @@ -1353,12 +1359,22 @@ switch (*p++) { case 'm': case 'l'://need more work... - case 'g': sec_size = strlen(p); if (sec_size) gtk_text_buffer_insert(buffer, &iter, p, sec_size); sec_size++; break; + case 'g': + sec_size = strlen(p); + if (sec_size) { + gchar *text=NULL; + if (pango_parse_markup(p, -1, 0, NULL, &text, 0, NULL)) { + gtk_text_buffer_insert(buffer, &iter, text, strlen(text)); + g_free(text); + } + } + sec_size++; + break; case 't': sec_size = strlen(p); if (sec_size) { @@ -1422,12 +1438,22 @@ switch (*p++) { case 'm': case 'l'://need more work... - case 'g': sec_size = strlen(p); if (sec_size) gtk_text_buffer_insert(buffer, &iter, p, sec_size); sec_size++; break; + case 'g': + sec_size=strlen(p); + if (sec_size) { + gchar *text=NULL; + if (pango_parse_markup(p, -1, 0, NULL, &text, 0, NULL)) { + gtk_text_buffer_insert(buffer, &iter, text, strlen(text)); + g_free(text); + } + } + sec_size++; + break; case 't': sec_size = strlen(p); if (sec_size) { diff -bBurNd stardict-cur-accepted/src/mainwin.h stardict/src/mainwin.h --- stardict-cur-accepted/src/mainwin.h 2005-02-27 11:03:27.018559400 +0300 +++ stardict/src/mainwin.h 2005-02-26 12:45:23.000000000 +0300 @@ -172,6 +172,7 @@ static void SelectionCallback(GtkWidget* widget,GtkSelectionData *selection_data, guint time, TextWin *oTextWin); static gboolean on_button_press(GtkWidget * widget, GdkEventButton * event, TextWin *oTextWin); + static bool find_first_tag(gchar *str, gchar * & beg, gchar * & end); public: std::string queryWord; std::string pronounceWord; diff -bBurNd stardict-cur-accepted/src/Makefile.am stardict/src/Makefile.am --- stardict-cur-accepted/src/Makefile.am 2005-02-27 11:03:39.091724000 +0300 +++ stardict/src/Makefile.am 2005-02-25 16:36:46.000000000 +0300 @@ -16,7 +16,7 @@ stardict_LDADD = \ $(STARDICT_LIBS) - +if GNOME_SUPPORT IDL_FILE = GNOME_Stardict.idl IDL_SOURCES = \ @@ -24,18 +24,28 @@ GNOME_Stardict-common.c \ GNOME_Stardict-skels.c \ GNOME_Stardict.h +endif + +if !GNOME_SUPPORT +GNOME_ABOUT=gnome-about.c gnome-about.h +endif +if GNOME_SUPPORT +STARIDCT_APP_SERVER=stardict-application-server.cpp stardict-application-server.h +endif stardict_SOURCES = \ $(IDL_SOURCES) \ + $(GNOME_ABOUT) \ + $(STARIDCT_APP_SERVER) \ stardict.cpp stardict.h \ mainwin.cpp mainwin.h \ - stardict-application-server.cpp stardict-application-server.h \ eggtrayicon.c eggtrayicon.h \ docklet.cpp docklet.h \ conf.cpp conf.h \ skin.cpp skin.h \ prefsdlg.cpp prefsdlg.h \ - dictmanagedlg.cpp dictmanagedlg.h \ + dictmanagedlg.cpp \ + dictmanagedlg.h \ floatwin.cpp floatwin.h \ readword.cpp readword.h \ selection.cpp selection.h \ @@ -45,7 +55,7 @@ lib.cpp lib.h \ utils.cpp utils.h - +if GNOME_SUPPORT $(IDL_SOURCES): $(IDL_FILE) $(ORBIT_IDL) -I $(LIBBONOBO_IDL) -I $(BONOBO_ACTIVATION_IDL) $(IDL_FILE) @@ -56,3 +66,4 @@ $(IDL_FILE) CLEANFILES = $(IDL_SOURCES) +endif diff -bBurNd stardict-cur-accepted/src/prefsdlg.cpp stardict/src/prefsdlg.cpp --- stardict-cur-accepted/src/prefsdlg.cpp 2005-02-27 11:03:39.092723848 +0300 +++ stardict/src/prefsdlg.cpp 2005-02-25 16:40:22.000000000 +0300 @@ -2,6 +2,8 @@ # include "config.h" #endif +#include + #ifdef _WIN32 # include # include "win32/intl.h" diff -bBurNd stardict-cur-accepted/src/readword.cpp stardict/src/readword.cpp --- stardict-cur-accepted/src/readword.cpp 2003-09-23 14:19:48.000000000 +0400 +++ stardict/src/readword.cpp 2005-02-25 17:10:37.000000000 +0300 @@ -2,44 +2,44 @@ # include "config.h" #endif -#include "readword.h" -#include "string.h" +#include +#include -#ifdef _WIN32 -# include "stardict.h" -#else -# include -#endif +#include "utils.h" + +#include "readword.h" ReadWord::ReadWord() { #ifdef _WIN32 - gchar *filename = g_build_filename(stardict_data_dir, "WyabdcRealPeopleTTS", NULL); - have_data_file = g_file_test(filename, G_FILE_TEST_EXISTS); - g_free(filename); + have_data_file = + g_file_test((gStarDictDataDir+G_DIR_SEPARATOR+"WyabdcRealPeopleTTS").c_str(), + G_FILE_TEST_EXISTS); #else have_data_file = g_file_test("/usr/share/WyabdcRealPeopleTTS", G_FILE_TEST_EXISTS); #endif } -gboolean ReadWord::canRead(const gchar *word) +bool ReadWord::canRead(const gchar *word) { - gboolean return_val = false; + bool return_val = false; if (have_data_file && word && g_ascii_isalpha(word[0])) { - int n=strlen(word); - gchar *lowerword = (gchar *)g_malloc(n+1); - for (int i=0;i +#include -class ReadWord -{ +class ReadWord { public: ReadWord(); - gboolean canRead(const gchar *word); + bool canRead(const gchar *word); void read(const gchar *word); private: - gboolean have_data_file; + bool have_data_file; }; #endif diff -bBurNd stardict-cur-accepted/src/selection.cpp stardict/src/selection.cpp --- stardict-cur-accepted/src/selection.cpp 2005-02-27 11:03:27.020559096 +0300 +++ stardict/src/selection.cpp 2005-02-25 16:57:54.000000000 +0300 @@ -3,6 +3,7 @@ #endif #include +#include #ifdef _WIN32 # include "win32/intl.h" diff -bBurNd stardict-cur-accepted/src/skin.cpp stardict/src/skin.cpp --- stardict-cur-accepted/src/skin.cpp 2005-02-27 11:03:39.093723696 +0300 +++ stardict/src/skin.cpp 2005-02-25 16:31:44.000000000 +0300 @@ -46,11 +46,13 @@ stardict.watch_cursor.cursor= gdk_cursor_new(GDK_WATCH); std::string pixmaps_dir(gStarDictDataDir+G_DIR_SEPARATOR+"pixmaps"+G_DIR_SEPARATOR); std::string filename; +#if defined(_WIN32) || defined(WITHOUT_GNOME) + filename=pixmaps_dir+"about_menu.png"; + stardict.about_menu.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL); +#endif #ifdef _WIN32 filename=pixmaps_dir+"stardict.png"; stardict.icon.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL); - filename=pixmaps_dir+"about_menu.png"; - stardict.about_menu.p[0] = gdk_pixbuf_new_from_file(filename.c_str(), NULL); #else stardict.icon.p[0] = gdk_pixbuf_new_from_file(GNOME_ICONDIR"/stardict.png", NULL); filename=pixmaps_dir+"docklet_normal.png"; diff -bBurNd stardict-cur-accepted/src/skin.h stardict/src/skin.h --- stardict-cur-accepted/src/skin.h 2003-09-23 17:53:47.000000000 +0400 +++ stardict/src/skin.h 2005-02-25 16:39:36.000000000 +0300 @@ -25,9 +25,10 @@ struct _Skin_cursor normal_cursor; struct _Skin_cursor watch_cursor; struct _Skin_pixbuf_1 icon; -#ifdef _WIN32 +#if defined(_WIN32) || defined(WITHOUT_GNOME) struct _Skin_pixbuf_1 about_menu; -#else +#endif +#ifndef _WIN32 struct _Skin_pixbuf_1 docklet_normal_icon; struct _Skin_pixbuf_1 docklet_scan_icon; struct _Skin_pixbuf_1 docklet_stop_icon; diff -bBurNd stardict-cur-accepted/src/splash.cpp stardict/src/splash.cpp --- stardict-cur-accepted/src/splash.cpp 2005-02-27 11:03:39.093723696 +0300 +++ stardict/src/splash.cpp 2005-02-25 16:58:35.000000000 +0300 @@ -2,10 +2,8 @@ # include "config.h" #endif +#include #include -#ifndef _WIN32 -# include -#endif #ifdef _WIN32 # include "win32/intl.h" Файлы stardict-cur-accepted/src/stardict и stardict/src/stardict различаются diff -bBurNd stardict-cur-accepted/src/stardict-application-server.cpp stardict/src/stardict-application-server.cpp --- stardict-cur-accepted/src/stardict-application-server.cpp 2003-09-23 14:19:48.000000000 +0400 +++ stardict/src/stardict-application-server.cpp 2005-02-25 16:32:34.000000000 +0300 @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include @@ -7,10 +7,12 @@ #include #include -#include "stardict-application-server.h" + #include "GNOME_Stardict.h" #include "stardict.h" +#include "stardict-application-server.h" + static void stardict_application_server_class_init (StardictApplicationServerClass *klass); static void stardict_application_server_init (StardictApplicationServer *a); diff -bBurNd stardict-cur-accepted/src/stardict.cpp stardict/src/stardict.cpp --- stardict-cur-accepted/src/stardict.cpp 2005-02-27 11:03:47.103506024 +0300 +++ stardict/src/stardict.cpp 2005-02-25 16:22:37.000000000 +0300 @@ -29,28 +29,34 @@ # include "config.h" #endif -#include -#include +#include +#include +#include +#include +#include +#include +#include -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) +# include +# include +#endif + +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) # include "stardict-application-server.h" # include "GNOME_Stardict.h" #endif -#include "splash.h" -#ifndef _WIN32 -# include -# include -#endif #ifdef _WIN32 - #include "win32/intl.h" - #include - #include - #include - HINSTANCE stardictexe_hInstance; +# include +# include +# include "win32/intl.h" + +HINSTANCE stardictexe_hInstance; #endif +#include "splash.h" #include "conf.h" #include "utils.h" @@ -60,7 +66,7 @@ static gboolean hide_option = FALSE; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) static gint debug = 0; static gboolean quit_option = FALSE; @@ -932,14 +939,14 @@ /***************************************************/ AppFrame::AppFrame():oAppCore(this) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) gnome_sound_init(NULL); #endif } AppFrame::~AppFrame() { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) gnome_sound_shutdown(); #endif } @@ -953,8 +960,9 @@ oAppCore.Create(queryword); -#ifndef _WIN32 - stardict_app_server = stardict_application_server_new (gdk_screen_get_default ()); +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) + stardict_app_server = + stardict_application_server_new(gdk_screen_get_default()); #endif gtk_main(); @@ -983,7 +991,7 @@ oAppCore.End(); -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) bonobo_object_unref (stardict_app_server); #endif @@ -1043,7 +1051,7 @@ return false; } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) static void stardict_handle_automation_cmdline (gchar *queryword) { @@ -1130,16 +1138,16 @@ } #endif -#ifdef _WIN32 -static void stardict_dummy_print( const gchar* string ) { - return; +#if defined(_WIN32) || defined(WITHOUT_GNOME) +static void stardict_dummy_print(const gchar*) +{ } -static void stardict_dummy_log_handler (const gchar *domain, - GLogLevelFlags flags, - const gchar *msg, - gpointer user_data) { - return; +static void stardict_dummy_log_handler(const gchar *, + GLogLevelFlags, + const gchar *, + gpointer) +{ } #endif @@ -1181,28 +1189,30 @@ if (ll_winhandle > 0) { SetForegroundWindow(ll_winhandle); //BringWindowToTop(ll_winhandle); //don't work :( - //ShowWindow( ll_winhandle, SW_SHOW); //don't work fine, as gtk widgets may still be hiden. - return 0; + //don't work fine, as gtk widgets may still be hiden. + //ShowWindow( ll_winhandle, SW_SHOW); + return EXIT_SUCCESS; } +#endif +#if defined(_WIN32) || defined(WITHOUT_GNOME) + gtk_set_locale(); + gtk_init(&argc, &argv); - gtk_set_locale (); - gtk_init (&argc, &argv); - - g_log_set_handler (NULL, (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_log_set_handler ("Gdk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler("Gdk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_log_set_handler ("Gtk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler("Gtk", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_log_set_handler ("GLib", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler("GLib", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_log_set_handler ("GModule", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler("GModule", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_log_set_handler ("GLib-GObject", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler("GLib-GObject", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_log_set_handler ("GThread", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + g_log_set_handler("GThread", (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), stardict_dummy_log_handler, NULL); - g_set_print_handler( stardict_dummy_print ); + g_set_print_handler(stardict_dummy_print); gchar *queryword = NULL; for (int i = 1; i < argc; i++) { @@ -1267,7 +1277,7 @@ */ stardict_handle_automation_cmdline (queryword); /* and we're done */ - exit(EXIT_SUCCESS); + return EXIT_SUCCESS; } GnomeClient *client; diff -bBurNd stardict-cur-accepted/src/stardict.h stardict/src/stardict.h --- stardict-cur-accepted/src/stardict.h 2005-02-27 11:03:47.103506024 +0300 +++ stardict/src/stardict.h 2005-02-25 16:10:11.000000000 +0300 @@ -3,7 +3,7 @@ #include -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) # include # include #endif @@ -95,17 +95,14 @@ void PopupDictManageDlg(); }; -class AppFrame -{ -private: - +class AppFrame { public: AppCore oAppCore; AppSkin oAppSkin; ReadWord oReadWord; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(WITHOUT_GNOME) BonoboObject *stardict_app_server; #endif Файлы stardict-cur-accepted/src/tools/dictd2dic и stardict/src/tools/dictd2dic различаются diff -bBurNd stardict-cur-accepted/src/utils.h stardict/src/utils.h --- stardict-cur-accepted/src/utils.h 2005-02-27 11:03:47.104505872 +0300 +++ stardict/src/utils.h 2005-02-25 16:56:17.000000000 +0300 @@ -1,6 +1,8 @@ #ifndef UTILS_H #define UTILS_H +#include + extern void play_wav_file(const gchar *filename); extern void show_help(const gchar *section); extern void show_url(const gchar *url); diff -bBurNd stardict-cur-accepted/src/win32/gnome-about.c stardict/src/win32/gnome-about.c --- stardict-cur-accepted/src/win32/gnome-about.c 2003-09-24 04:30:41.000000000 +0400 +++ stardict/src/win32/gnome-about.c 1970-01-01 03:00:00.000000000 +0300 @@ -1,888 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* gnome-about.c - An about box widget for gnome. - - Copyright (C) 2001 CodeFactory AB - Copyright (C) 2001, 2002 Anders Carlsson - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Anders Carlsson -*/ - -//Changed by Hu Zheng to make it compile along. 2003.09.23 - -#include "intl.h" - -#include "gnome-about.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include - -G_BEGIN_DECLS - -#define BONOBO_BOILERPLATE(type, type_as_function, corba_type, \ - parent_type, parent_type_macro, \ - register_type_macro) \ -static void type_as_function ## _class_init (type ## Class *klass); \ -static void type_as_function ## _instance_init (type *object); \ -static parent_type ## Class *parent_class = NULL; \ -static void \ -type_as_function ## _class_init_trampoline (gpointer klass, \ - gpointer data) \ -{ \ - parent_class = (parent_type ## Class *)g_type_class_ref ( \ - parent_type_macro); \ - type_as_function ## _class_init ((type ## Class *)klass); \ -} \ -GType \ -type_as_function ## _get_type (void) \ -{ \ - static GType object_type = 0; \ - if (object_type == 0) { \ - static const GTypeInfo object_info = { \ - sizeof (type ## Class), \ - NULL, /* base_init */ \ - NULL, /* base_finalize */ \ - type_as_function ## _class_init_trampoline, \ - NULL, /* class_finalize */ \ - NULL, /* class_data */ \ - sizeof (type), \ - 0, /* n_preallocs */ \ - (GInstanceInitFunc) type_as_function ## _instance_init \ - }; \ - object_type = register_type_macro \ - (type, type_as_function, corba_type, \ - parent_type, parent_type_macro); \ - } \ - return object_type; \ -} - -#define BONOBO_CALL_PARENT(parent_class_cast, name, args) \ - ((parent_class_cast(parent_class)->name != NULL) ? \ - parent_class_cast(parent_class)->name args : (void)0) - -G_END_DECLS - -#define GNOME_CLASS_BOILERPLATE(type, type_as_function, \ - parent_type, parent_type_macro) \ - BONOBO_BOILERPLATE(type, type_as_function, type, \ - parent_type, parent_type_macro, \ - GNOME_REGISTER_TYPE) - -#define GNOME_REGISTER_TYPE(type, type_as_function, corba_type, \ - parent_type, parent_type_macro) \ - g_type_register_static (parent_type_macro, #type, &object_info, 0) - -#define GNOME_CALL_PARENT(parent_class_cast, name, args) \ - BONOBO_CALL_PARENT (parent_class_cast, name, args) - -/* FIXME: More includes! */ - -struct _GnomeAboutPrivate { - gchar *name; - gchar *version; - gchar *copyright; - gchar *comments; - gchar *translator_credits; - - GSList *authors; - GSList *documenters; - - GtkWidget *logo_image; - GtkWidget *name_label; - GtkWidget *comments_label; - GtkWidget *copyright_label; - - GtkWidget *credits_dialog; -}; - -enum { - PROP_0, - PROP_NAME, - PROP_VERSION, - PROP_COPYRIGHT, - PROP_COMMENTS, - PROP_AUTHORS, - PROP_DOCUMENTERS, - PROP_TRANSLATOR_CREDITS, - PROP_LOGO, -}; - -#define GNOME_RESPONSE_CREDITS 1 - -static void gnome_about_finalize (GObject *object); -static void gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); - -GNOME_CLASS_BOILERPLATE (GnomeAbout, gnome_about, - GtkDialog, GTK_TYPE_DIALOG) - -static void -gnome_about_update_authors_label (GnomeAbout *about, GtkWidget *label) -{ - GString *string; - GSList *list; - gchar *tmp; - - if (about->_priv->authors == NULL) { - gtk_widget_hide (label); - return; - } - else { - gtk_widget_show (label); - } - - string = g_string_new (NULL); - - for (list = about->_priv->authors; list; list = list->next) { - tmp = g_markup_escape_text (list->data, -1); - g_string_append (string, tmp); - - if (list->next) - g_string_append_c (string, '\n'); - g_free (tmp); - } - - gtk_label_set_markup (GTK_LABEL (label), string->str); - g_string_free (string, TRUE); -} - -static void -gnome_about_update_documenters_label (GnomeAbout *about, GtkWidget *label) -{ - GString *string; - GSList *list; - gchar *tmp; - - if (about->_priv->documenters == NULL) { - gtk_widget_hide (label); - return; - } - else { - gtk_widget_show (label); - } - - string = g_string_new (NULL); - - for (list = about->_priv->documenters; list; list = list->next) { - tmp = g_markup_escape_text (list->data, -1); - g_string_append (string, tmp); - - if (list->next) - g_string_append (string, "\n"); - g_free (tmp); - } - - gtk_label_set_markup (GTK_LABEL (label), string->str); - g_string_free (string, TRUE); -} - -static void -gnome_about_update_translation_information_label (GnomeAbout *about, GtkWidget *label) -{ - GString *string; - gchar *tmp; - - if (about->_priv->translator_credits == NULL) { - gtk_widget_hide (label); - return; - } - else { - gtk_widget_show (label); - } - - string = g_string_new (NULL); - - tmp = g_markup_escape_text (about->_priv->translator_credits, -1); - g_string_append (string, tmp); - g_free (tmp); - - gtk_label_set_markup (GTK_LABEL (label), string->str); - g_string_free (string, TRUE); -} - -static GtkWidget * -create_label (void) -{ - GtkWidget *label; - - label = gtk_label_new (""); - gtk_label_set_selectable (GTK_LABEL (label), TRUE); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); - gtk_misc_set_padding (GTK_MISC (label), 8, 8); - - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - - return label; -} - -static void -gnome_about_display_credits_dialog (GnomeAbout *about) -{ - GtkWidget *dialog, *label, *notebook, *sw; - - if (about->_priv->credits_dialog != NULL) { - gtk_window_present (GTK_WINDOW (about->_priv->credits_dialog)); - return; - } - - dialog = gtk_dialog_new_with_buttons (_("Credits"), - GTK_WINDOW (about), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL); - about->_priv->credits_dialog = dialog; - gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260); - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); - g_signal_connect (dialog, "destroy", - G_CALLBACK (gtk_widget_destroyed), - &(about->_priv->credits_dialog)); - - notebook = gtk_notebook_new (); - gtk_container_set_border_width (GTK_CONTAINER (notebook), 5); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0); - - if (about->_priv->authors != NULL) { - label = create_label (); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label); - gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE); - - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, - gtk_label_new (_("Written by"))); - gnome_about_update_authors_label (about, label); - } - - if (about->_priv->documenters != NULL) { - label = create_label (); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label); - gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE); - - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, - gtk_label_new (_("Documented by"))); - gnome_about_update_documenters_label (about, label); - } - - if (about->_priv->translator_credits != NULL) { - label = create_label (); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label); - gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE); - - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, - gtk_label_new (_("Translated by"))); - gnome_about_update_translation_information_label (about, label); - } - - gtk_widget_show_all (dialog); -} - -static void -gnome_about_instance_init (GnomeAbout *about) -{ - GnomeAboutPrivate *priv; - GtkWidget *vbox, *hbox, *image, *label, *alignment, *button; - - /* Data */ - - priv = g_new0 (GnomeAboutPrivate, 1); - about->_priv = priv; - - priv->name = NULL; - priv->version = NULL; - priv->copyright = NULL; - priv->comments = NULL; - priv->translator_credits = NULL; - priv->authors = NULL; - priv->documenters = NULL; - - gtk_dialog_set_has_separator (GTK_DIALOG (about), FALSE); - gtk_container_set_border_width (GTK_CONTAINER (about), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (about)->vbox), 5); - - /* Widgets */ - vbox = gtk_vbox_new (FALSE, 8); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0); - - priv->logo_image = gtk_image_new (); - gtk_box_pack_start (GTK_BOX (vbox), priv->logo_image, FALSE, FALSE, 0); - priv->name_label = gtk_label_new (NULL); - gtk_label_set_selectable (GTK_LABEL (priv->name_label), TRUE); - gtk_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER); - gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0); - - priv->comments_label = gtk_label_new (NULL); - gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE); - gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER); - gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE); - gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0); - - priv->copyright_label = gtk_label_new (NULL); - gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE); - gtk_label_set_justify (GTK_LABEL (priv->copyright_label), GTK_JUSTIFY_CENTER); - gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0); - - gtk_widget_show_all (vbox); - - /* Add the close button */ - gtk_dialog_add_button (GTK_DIALOG (about), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); - gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CLOSE); - - /* Add the credits button */ - image = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON); - - label = gtk_label_new_with_mnemonic (_("C_redits")); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (alignment), hbox); - - button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), alignment); - gtk_widget_show_all (button); - - gtk_dialog_add_action_widget (GTK_DIALOG (about), button, GNOME_RESPONSE_CREDITS); - gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (about)->action_area), button, TRUE); - - gtk_window_set_resizable (GTK_WINDOW (about), FALSE); - - priv->credits_dialog = NULL; -} - -static void -gnome_about_response (GtkDialog *dialog, gint response) -{ - switch (response) { - case GNOME_RESPONSE_CREDITS: - gnome_about_display_credits_dialog (GNOME_ABOUT (dialog)); - break; - default: - gtk_widget_destroy (GTK_WIDGET (dialog)); - break; - } -} - -static void -gnome_about_class_init (GnomeAboutClass *klass) -{ - GObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkDialogClass *dialog_class; - - object_class = (GObjectClass *)klass; - widget_class = (GtkWidgetClass *)klass; - dialog_class = (GtkDialogClass *)klass; - - object_class->set_property = gnome_about_set_property; - object_class->get_property = gnome_about_get_property; - - object_class->finalize = gnome_about_finalize; - - dialog_class->response = gnome_about_response; - - g_object_class_install_property (object_class, - PROP_NAME, - g_param_spec_string ("name", - _("Program name"), - _("The name of the program"), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_VERSION, - g_param_spec_string ("version", - _("Program version"), - _("The version of the program"), - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, - PROP_COPYRIGHT, - g_param_spec_string ("copyright", - _("Copyright string"), - _("Copyright information for the program"), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_COMMENTS, - g_param_spec_string ("comments", - _("Comments string"), - _("Comments about the program"), - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, - PROP_AUTHORS, - g_param_spec_value_array ("authors", - _("Authors"), - _("List of authors of the programs"), - g_param_spec_string ("author-entry", - _("Author entry"), - _("A single author entry"), - NULL, - G_PARAM_READWRITE), - G_PARAM_WRITABLE)); - g_object_class_install_property (object_class, - PROP_DOCUMENTERS, - g_param_spec_value_array ("documenters", - _("Documenters"), - _("List of people documenting the program"), - g_param_spec_string ("documenter-entry", - _("Documenter entry"), - _("A single documenter entry"), - NULL, - G_PARAM_READWRITE), - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, - PROP_TRANSLATOR_CREDITS, - g_param_spec_string ("translator_credits", - _("Translator credits"), - _("Credits to the translators. This string should be marked as translatable"), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_LOGO, - g_param_spec_object ("logo", - _("Logo"), - _("A logo for the about box"), - GDK_TYPE_PIXBUF, - G_PARAM_WRITABLE)); - -} - -static void -gnome_about_set_comments (GnomeAbout *about, const gchar *comments) -{ - g_free (about->_priv->comments); - about->_priv->comments = comments ? g_strdup (comments) : NULL; - - gtk_label_set_text (GTK_LABEL (about->_priv->comments_label), about->_priv->comments); -} - -static void -gnome_about_set_translator_credits (GnomeAbout *about, const gchar *translator_credits) -{ - g_free (about->_priv->translator_credits); - - about->_priv->translator_credits = g_strdup (translator_credits); -} - -static void -gnome_about_set_copyright (GnomeAbout *about, const gchar *copyright) -{ - char *copyright_string, *tmp; - - g_free (about->_priv->copyright); - about->_priv->copyright = copyright ? g_strdup (copyright) : NULL; - - if (about->_priv->copyright != NULL) { - tmp = g_markup_escape_text (about->_priv->copyright, -1); - copyright_string = g_strdup_printf ("%s", tmp); - g_free (tmp); - } - else { - copyright_string = NULL; - } - - gtk_label_set_markup (GTK_LABEL (about->_priv->copyright_label), copyright_string); - - g_free (copyright_string); -} - -static void -gnome_about_set_version (GnomeAbout *about, const gchar *version) -{ - gchar *name_string, *tmp_name, *tmp_version; - - g_free (about->_priv->version); - about->_priv->version = version ? g_strdup (version) : NULL; - - tmp_name = g_markup_escape_text (about->_priv->name, -1); - - if (about->_priv->version != NULL) { - tmp_version = g_markup_escape_text (about->_priv->version, -1); - name_string = g_strdup_printf ("%s %s", tmp_name, tmp_version); - g_free (tmp_version); - } - else { - name_string = g_strdup_printf ("%s", tmp_name); - } - - gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string); - g_free (name_string); - g_free (tmp_name); -} - -static void -gnome_about_set_name (GnomeAbout *about, const gchar *name) -{ - gchar *title_string; - gchar *name_string; - gchar *tmp_name, *tmp_version; - - g_free (about->_priv->name); - about->_priv->name = g_strdup (name ? name : ""); - - title_string = g_strdup_printf (_("About %s"), name); - gtk_window_set_title (GTK_WINDOW (about), title_string); - g_free (title_string); - - tmp_name = g_markup_escape_text (about->_priv->name, -1); - - if (about->_priv->version != NULL) { - tmp_version = g_markup_escape_text (about->_priv->version, -1); - name_string = g_strdup_printf ("%s %s", tmp_name, tmp_version); - g_free (tmp_version); - } - else { - name_string = g_strdup_printf ("%s", tmp_name); - } - - gtk_label_set_markup (GTK_LABEL (about->_priv->name_label), name_string); - g_free (name_string); - g_free (tmp_name); -} - -static void -gnome_about_free_person_list (GSList *list) -{ - if (list == NULL) - return; - - g_slist_foreach (list, (GFunc) g_free, NULL); - g_slist_free (list); -} - -static void -gnome_about_finalize (GObject *object) -{ - GnomeAbout *about = GNOME_ABOUT (object); - - g_free (about->_priv->name); - g_free (about->_priv->version); - g_free (about->_priv->copyright); - g_free (about->_priv->comments); - - gnome_about_free_person_list (about->_priv->authors); - gnome_about_free_person_list (about->_priv->documenters); - - g_free (about->_priv->translator_credits); - - g_free (about->_priv); - about->_priv = NULL; - - GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); -} - -static void -gnome_about_set_persons (GnomeAbout *about, guint prop_id, const GValue *persons) -{ - GValueArray *value_array; - gint i; - GSList *list; - - /* Free the old list */ - switch (prop_id) { - case PROP_AUTHORS: - list = about->_priv->authors; - break; - case PROP_DOCUMENTERS: - list = about->_priv->documenters; - break; - default: - g_assert_not_reached (); - list = NULL; /* silence warning */ - } - - gnome_about_free_person_list (list); - list = NULL; - - value_array = g_value_get_boxed (persons); - - if (value_array == NULL) { - return; - } - - for (i = 0; i < value_array->n_values; i++) { - list = g_slist_prepend (list, g_value_dup_string (&value_array->values[i])); - } - - list = g_slist_reverse (list); - - switch (prop_id) { - case PROP_AUTHORS: - about->_priv->authors = list; - break; - case PROP_DOCUMENTERS: - about->_priv->documenters = list; - break; - default: - g_assert_not_reached (); - } -} - -static void -set_value_array_from_list (GValue *value, GSList *list) -{ - GValueArray *array; - GValue tmp_value = { 0 }; - GSList *tmp; - gint length; - - length = g_slist_length (list); - array = g_value_array_new (length); - - for (tmp = list; tmp; tmp = tmp->next) { - char *str = tmp->data; - - g_value_init (&tmp_value, G_TYPE_STRING); - g_value_set_string (&tmp_value, str); - g_value_array_append (array, &tmp_value); - } - - g_value_set_boxed (value, array); - g_value_array_free (array); -} - -static void -gnome_about_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - switch (prop_id) { - case PROP_NAME: - gnome_about_set_name (GNOME_ABOUT (object), g_value_get_string (value)); - break; - case PROP_VERSION: - gnome_about_set_version (GNOME_ABOUT (object), g_value_get_string (value)); - break; - case PROP_COMMENTS: - gnome_about_set_comments (GNOME_ABOUT (object), g_value_get_string (value)); - break; - case PROP_COPYRIGHT: - gnome_about_set_copyright (GNOME_ABOUT (object), g_value_get_string (value)); - break; - case PROP_LOGO: - if (g_value_get_object (value) != NULL) { - gtk_image_set_from_pixbuf (GTK_IMAGE (GNOME_ABOUT (object)->_priv->logo_image), - g_value_get_object (value)); - } - else { - } - break; - case PROP_AUTHORS: - case PROP_DOCUMENTERS: - gnome_about_set_persons (GNOME_ABOUT (object), prop_id, value); - break; - case PROP_TRANSLATOR_CREDITS: - gnome_about_set_translator_credits (GNOME_ABOUT (object), g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gnome_about_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GnomeAbout *about; - - about = GNOME_ABOUT (object); - - switch (prop_id) { - case PROP_NAME: - g_value_set_string (value, about->_priv->name); - break; - case PROP_VERSION: - g_value_set_string (value, about->_priv->version); - break; - case PROP_COPYRIGHT: - g_value_set_string (value, about->_priv->copyright); - break; - case PROP_COMMENTS: - g_value_set_string (value, about->_priv->comments); - break; - case PROP_TRANSLATOR_CREDITS: - g_value_set_string (value, about->_priv->translator_credits); - break; - case PROP_AUTHORS: - set_value_array_from_list (value, about->_priv->authors); - break; - case PROP_DOCUMENTERS: - set_value_array_from_list (value, about->_priv->documenters); - break; - case PROP_LOGO: - g_value_set_object (value, gtk_image_get_pixbuf (GTK_IMAGE (about->_priv->logo_image))); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/** - * gnome_about_new: - * @name: The name of the application. - * @version: The version string of the application. - * @copyright: The application's copyright statement. - * @comments: A short miscellaneous string. - * @authors: An %NULL terminated array of the application authors. - * @documenters: An array of the application documenters. - * @translator_credits: The translator for the current locale. - * @logo_pixbuf: The application's logo. - * - * Construct an application's credits box. The @authors array cannot be empty - * and the @translator_credits should be marked as a translatable string (so - * that only the translator for the currently active locale is displayed). - * - * Returns: A new "About" dialog. - */ -GtkWidget * -gnome_about_new (const gchar *name, - const gchar *version, - const gchar *copyright, - const gchar *comments, - const gchar **authors, - const gchar **documenters, - const gchar *translator_credits, - GdkPixbuf *logo_pixbuf) -{ - GnomeAbout *about; - - g_return_val_if_fail (authors != NULL, NULL); - - about = g_object_new (GNOME_TYPE_ABOUT, NULL); - gnome_about_construct(about, - name, version, copyright, - comments, authors, documenters, - translator_credits, logo_pixbuf); - - return GTK_WIDGET(about); -} - -/** - * gnome_about_construct: - * @about: An existing #GnomeAbout instance. - * @name: The name of the application. - * @version: The version string of the application. - * @copyright: The application's copyright statement. - * @comments: A short miscellaneous string. - * @authors: An %NULL terminated array of the application authors. - * @documenters: An array of the application documenters. - * @translator_credits: The translator for the current locale. - * @logo_pixbuf: The application's logo. - * - * Similar to gnome_about_new() except that the pre-existing @about widget is - * used. Note that in this version of the function, @authors is not checked to - * be non-%NULL, so callers must be careful, since bad things will happen if - * this condition is not met. - */ -void -gnome_about_construct (GnomeAbout *about, - const gchar *name, - const gchar *version, - const gchar *copyright, - const gchar *comments, - const gchar **authors, - const gchar **documenters, - const gchar *translator_credits, - GdkPixbuf *logo_pixbuf) -{ - GValueArray *authors_array; - GValueArray *documenters_array; - gint i; - - authors_array = g_value_array_new (0); - - for (i = 0; authors[i] != NULL; i++) { - GValue value = {0, }; - - g_value_init (&value, G_TYPE_STRING); - g_value_set_static_string (&value, authors[i]); - authors_array = g_value_array_append (authors_array, &value); - } - - if (documenters != NULL) { - documenters_array = g_value_array_new (0); - - for (i = 0; documenters[i] != NULL; i++) { - GValue value = {0, }; - - g_value_init (&value, G_TYPE_STRING); - g_value_set_static_string (&value, documenters[i]); - documenters_array = g_value_array_append (documenters_array, &value); - } - - } - else { - documenters_array = NULL; - } - - g_object_set (G_OBJECT (about), - "name", name, - "version", version, - "copyright", copyright, - "comments", comments, - "authors", authors_array, - "documenters", documenters_array, - "translator_credits", translator_credits, - "logo", logo_pixbuf, - NULL); - - if (authors_array != NULL) { - g_value_array_free (authors_array); - } - if (documenters_array != NULL) { - g_value_array_free (documenters_array); - } -} diff -bBurNd stardict-cur-accepted/src/win32/gnome-about.h stardict/src/win32/gnome-about.h --- stardict-cur-accepted/src/win32/gnome-about.h 2003-09-23 17:43:03.000000000 +0400 +++ stardict/src/win32/gnome-about.h 1970-01-01 03:00:00.000000000 +0300 @@ -1,83 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* gnome-about.h - An about box widget for gnome. - - Copyright (C) 2001 CodeFactory AB - Copyright (C) 2001 Anders Carlsson - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Anders Carlsson -*/ - -#ifndef __GNOME_ABOUT_H__ -#define __GNOME_ABOUT_H__ - -#include - -G_BEGIN_DECLS - -#define GNOME_TYPE_ABOUT (gnome_about_get_type ()) -#define GNOME_ABOUT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GNOME_TYPE_ABOUT, GnomeAbout)) -#define GNOME_ABOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_ABOUT, GnomeAboutClass)) -#define GNOME_IS_ABOUT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GNOME_TYPE_ABOUT)) -#define GNOME_IS_ABOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_ABOUT)) -#define GNOME_ABOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_ABOUT, GnomeAboutClass)) - -typedef struct _GnomeAbout GnomeAbout; -typedef struct _GnomeAboutClass GnomeAboutClass; -typedef struct _GnomeAboutPrivate GnomeAboutPrivate; - -struct _GnomeAbout { - GtkDialog parent_instance; - - /*< private >*/ - GnomeAboutPrivate *_priv; -}; - -struct _GnomeAboutClass { - GtkDialogClass parent_class; - - /* Padding for possible expansion */ - gpointer padding1; - gpointer padding2; -}; - -GType gnome_about_get_type (void) G_GNUC_CONST; - -GtkWidget *gnome_about_new (const gchar *name, - const gchar *version, - const gchar *copyright, - const gchar *comments, - const gchar **authors, - const gchar **documenters, - const gchar *translator_credits, - GdkPixbuf *logo_pixbuf); - -/* Only for use by bindings to languages other than C; don't use - in applications. */ -void gnome_about_construct (GnomeAbout *about, - const gchar *name, - const gchar *version, - const gchar *copyright, - const gchar *comments, - const gchar **authors, - const gchar **documenters, - const gchar *translator_credits, - GdkPixbuf *logo_pixbuf); - -G_END_DECLS - -#endif /* __GNOME_ABOUT_H__ */ diff -bBurNd stardict-cur-accepted/src/win32/intl.h stardict/src/win32/intl.h --- stardict-cur-accepted/src/win32/intl.h 2003-09-23 14:09:53.000000000 +0400 +++ stardict/src/win32/intl.h 2005-02-25 16:25:57.000000000 +0300 @@ -6,23 +6,4 @@ #define PACKAGE "stardict" #endif -#ifdef ENABLE_NLS -# include -# define _(String) gettext(String) -# ifdef gettext_noop -# define N_(String) gettext_noop(String) -# else -# define N_(String) (String) -# endif /* gettext_noop */ -#else -# define _(String) (String) -# define N_(String) (String) -# define textdomain(String) (String) -# define gettext(String) (String) -# define dgettext(Domain,String) (String) -# define dcgettext(Domain,String,Type) (String) -# define bindtextdomain(Domain,Directory) (Domain) -# define bind_textdomain_codeset(Domain,Codeset) (Domain) -#endif /* ENABLE_NLS */ - #endif /* __INTL_H__ */