rpms/stardict/devel stardict-3.0.1-13.bz441209.patch, NONE, 1.1 .cvsignore, 1.8, 1.9 sources, 1.9, 1.10 stardict.spec, 1.59, 1.60

Caius Chance (cchance) fedora-extras-commits at redhat.com
Mon Aug 4 04:06:09 UTC 2008


Author: cchance

Update of /cvs/pkgs/rpms/stardict/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17306

Modified Files:
	.cvsignore sources stardict.spec 
Added Files:
	stardict-3.0.1-13.bz441209.patch 
Log Message:
* Mon Aug 04 2008 Caius Chance <cchance at redhat.com> - 3.0.1-13.fc10
- Resolves: rhbz#441209
  - Enable appropriate locale based dictionaries in user's first time usage.


stardict-3.0.1-13.bz441209.patch:

--- NEW FILE stardict-3.0.1-13.bz441209.patch ---
diff -up stardict-3.0.1/src/dictmanage.cpp.2-bz441209 stardict-3.0.1/src/dictmanage.cpp
--- stardict-3.0.1/src/dictmanage.cpp.2-bz441209	2007-09-04 18:20:04.000000000 +1000
+++ stardict-3.0.1/src/dictmanage.cpp	2008-08-04 13:42:47.000000000 +1000
@@ -4,6 +4,23 @@
 #include "conf.h"
 #include "stardict.h"
 
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+static std::string get_defaultdict_filename()
+{
+#ifndef _WIN32
+	// WIN32 default dictionary list has not been implemented yet.
+        std::string res;
+        gchar *tmp = g_build_filename("/etc/", "stardict", NULL);
+        res=tmp;
+        g_free(tmp);
+        res += G_DIR_SEPARATOR_S "defaultdict.cfg";
+#endif
+        return res;
+}
+
 class GetAllDictList {
 public:
 	GetAllDictList(std::list<std::string> &dict_all_list_) :
@@ -242,12 +259,42 @@ static void update_configxml(std::list<s
 		}
 		i = gpAppFrame->dictinfo.groups.begin();
 	}
+
+
+
+	// Loads config file for default dictionaries of current locale (LANG).
+        GKeyFile *keyfile = g_key_file_new ();
+        GKeyFileFlags flags = GKeyFileFlags(G_KEY_FILE_KEEP_COMMENTS 
+			| G_KEY_FILE_KEEP_TRANSLATIONS);
+
+        GError *error = NULL;
+        if (!g_key_file_load_from_file(keyfile, get_defaultdict_filename().c_str(), flags, &error))
+                g_error (error->message);
+
+	gchar **defaultdicts = g_key_file_get_locale_string_list(keyfile, "dict", "default", (char*)g_getenv("LANG"), NULL, NULL);
+
+	// All found dictionary files will be set disabled by default,
+	// except when specified for current locale in conf file.
+	// (On WIN32, all found dictionaries will be set enabled by default.)
 	gpAppFrame->dictinfo.active_group = i->name;
 	for (std::list<std::string>::iterator j = dict_new_install_list.begin(); j != dict_new_install_list.end(); ++j) {
 		DictManageItem item;
 		item.type = LOCAL_DICT;
-		item.enable = true;
 		item.file_or_id = *j;
+#ifndef _WIN32
+		item.enable = true;
+#else
+		item.enable = false;
+		const gchar* founddict = item.file_or_id.c_str();
+
+		for (guint cnt_i = 0; cnt_i < g_strv_length(defaultdicts); cnt_i++) {
+			if (g_pattern_match_simple(g_strconcat("*", (char*)defaultdicts[cnt_i], NULL), founddict)) {
+				item.enable = true;
+				break;
+			}
+		}
+#endif
+
 		i->querydict.push_back(item);
 		i->scandict.push_back(item);
 	}


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/stardict/devel/.cvsignore,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- .cvsignore	9 Nov 2007 01:30:06 -0000	1.8
+++ .cvsignore	4 Aug 2008 04:05:39 -0000	1.9
@@ -1 +1,2 @@
 stardict-3.0.1.tar.bz2
+defaultdict.cfg


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/stardict/devel/sources,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sources	9 Nov 2007 01:30:06 -0000	1.9
+++ sources	4 Aug 2008 04:05:39 -0000	1.10
@@ -1 +1,2 @@
 93bb2d7825bc9d52a4f9ba4c1c506d1d  stardict-3.0.1.tar.bz2
+2ff105238b1bdf8f9b79b6d380970fc0  defaultdict.cfg


Index: stardict.spec
===================================================================
RCS file: /cvs/pkgs/rpms/stardict/devel/stardict.spec,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- stardict.spec	17 Jul 2008 01:17:58 -0000	1.59
+++ stardict.spec	4 Aug 2008 04:05:39 -0000	1.60
@@ -4,14 +4,16 @@
 Name:		%{name}
 Summary: 	A powerful dictionary platform written in GTK+2
 Version:	%{version}
-Release:	12%{?dist}
+Release:	13%{?dist}
 Group: 		Applications/System
 License: 	GPLv3
 URL: 		http://stardict.sourceforge.net
 Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
+Source1:	defaultdict.cfg
 Patch0:		stardict-3.0.1.gcc43.patch
 Patch1:		transparent_trayicon.patch
 Patch2:		stardict-3.0.1-10.gucharmap.patch
+Patch3:		stardict-3.0.1-13.bz441209.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires: enchant, espeak, gucharmap >= 2.22.1, libbonobo >= 2.2.0, libgnome >= 2.2.0, libgnomeui >= 2.2.0, libsigc++20 >= 2.0.17
@@ -32,6 +34,7 @@
 %patch0 -p1 -b .1-gcc43
 %patch1 -p1 -b .2-trayicon
 %patch2 -p1 -b .3-gucharmap
+%patch3 -p1 -b .4-bz441209
 
 # Remove unneeded sigc++ header files to make it sure
 # that we are using system-wide libsigc++
@@ -39,6 +42,7 @@
 # 
 find src/sigc++* -name \*.h -or -name \*.cc | xargs rm -f
 
+
 %build
 %{__aclocal}
 %{__autoconf}
@@ -53,9 +57,14 @@
   --dir $RPM_BUILD_ROOT%{_datadir}/applications		\
   $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
 
+# copy config file of locale specific default dictionaries
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+cp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+
 /bin/rm -f `find $RPM_BUILD_ROOT%{_libdir}/stardict/plugins -name "*.la"`
 %find_lang %{name}
 
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -70,6 +79,7 @@
 %{_libdir}/bonobo/servers/*.server
 %{_datadir}/pixmaps/stardict.png
 %{_sysconfdir}/gconf/schemas/*.schemas
+%{_sysconfdir}/%{name}/defaultdict.cfg
 %{_datadir}/omf/*
 %{_mandir}/man1/*
 %doc %{_datadir}/gnome/help/stardict
@@ -84,6 +94,10 @@
 if which scrollkeeper-update>/dev/null 2>&1; then scrollkeeper-update; fi
 
 %changelog
+* Mon Aug 04 2008 Caius Chance <cchance at redhat.com> - 3.0.1-13.fc10
+- Resolves: rhbz#441209
+  - Enable appropriate locale based dictionaries in user's first time usage.
+
 * Thu Jul 17 2008 Caius Chance <cchance at redhat.com> - 3.0.1-12.fc10
 - Resolves: rhbz#455685 (Broken dependency of bonobo-activitation.)
 




More information about the scm-commits mailing list