Accepting request 47538 from home:vuntz:branches:GNOME:Factory

ok

OBS-URL: https://build.opensuse.org/request/show/47538
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-desktop?expand=0&rev=83
This commit is contained in:
Vincent Untz 2010-09-09 19:16:45 +00:00 committed by Git OBS Bridge
parent 3d62fdce00
commit 49af375008
8 changed files with 130 additions and 401 deletions

View File

@ -1,35 +0,0 @@
Index: libgnome-desktop/gnome-desktop-item.c
================================================================================
--- libgnome-desktop/gnome-desktop-item.c
+++ libgnome-desktop/gnome-desktop-item.c
@@ -2085,8 +2085,16 @@
/* make a new copy and get rid of spaces */
- the_exec = g_alloca (strlen (exec) + 1);
- strcpy (the_exec, exec);
+
+ if (gnome_desktop_item_get_boolean (item, GNOME_DESKTOP_ITEM_SUBSTITUTEUID) ||
+ gnome_desktop_item_get_boolean (item, GNOME_DESKTOP_ITEM_ROOT_ONLY)) {
+ the_exec = g_alloca (strlen (exec) + sizeof ("gnomesu -- "));
+ strcpy (the_exec, "gnomesu -- ");
+ strcat (the_exec, exec);
+ } else {
+ the_exec = g_alloca (strlen (exec) + 1);
+ strcpy (the_exec, exec);
+ }
if ( ! strip_the_amp (the_exec)) {
g_set_error (error,
--- libgnome-desktop/libgnome/gnome-desktop-item.h
+++ libgnome-desktop/libgnome/gnome-desktop-item.h
@@ -96,7 +96,8 @@
#define GNOME_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */
#define GNOME_DESKTOP_ITEM_URL "URL" /* string */
#define GNOME_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */
-
+#define GNOME_DESKTOP_ITEM_SUBSTITUTEUID "X-KDE-SubstituteUID" /*boolean*/
+#define GNOME_DESKTOP_ITEM_ROOT_ONLY "X-KDE-RootOnly" /*boolean*/
/* The vfolder proposal */
#define GNOME_DESKTOP_ITEM_CATEGORIES "Categories" /* string */
#define GNOME_DESKTOP_ITEM_ONLY_SHOW_IN "OnlyShowIn" /* string */

View File

@ -1,4 +1,4 @@
gnome-desktop
libgnome-desktop-2-17
libgnome-desktop-3-0
obsoletes "gnome-desktop-<targettype> <= <version>"
provides "gnome-desktop-<targettype> = <version>"

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:986796cd7116c986db693531abc3aa7a9c00eeec96827717f5b3de99277aeda9
size 1679685

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3ef7e6b02ba4cea8d83592b4f140fb553d44280b372e5cbc21f9537a8a15827
size 892122

View File

@ -1,217 +0,0 @@
Index: libgnome-desktop/gnome-desktop-item.c
===================================================================
--- libgnome-desktop/gnome-desktop-item.c.orig
+++ libgnome-desktop/gnome-desktop-item.c
@@ -85,6 +85,7 @@ struct _GnomeDesktopItem {
GHashTable *main_hash;
char *location;
+ const char *gettext_domain;
time_t mtime;
@@ -140,6 +141,8 @@ static GnomeDesktopItem *gnome_desktop_i
static void update_recently_used_apps (const GnomeDesktopItem *item);
+static const char *lookup (const GnomeDesktopItem *item, const char *key);
+
static int
readbuf_getc (ReadBuf *rb)
{
@@ -387,6 +390,7 @@ gnome_desktop_item_new (void)
"1.0");
retval->launch_time = 0;
+ retval->gettext_domain = NULL;
return retval;
}
@@ -465,6 +469,10 @@ gnome_desktop_item_copy (const GnomeDesk
copy_string_hash,
retval->main_hash);
+ retval->gettext_domain = lookup (retval, GNOME_DESKTOP_ITEM_GETTEXT_DOMAIN);
+ if (!retval->gettext_domain)
+ retval->gettext_domain = "desktop_translations";
+
return retval;
}
@@ -916,6 +924,9 @@ gnome_desktop_item_unref (GnomeDesktopIt
g_free (item->location);
item->location = NULL;
+ /* no need to free it, it's a const key */
+ item->gettext_domain = NULL;
+
g_free (item);
}
@@ -1004,6 +1015,71 @@ lookup_locale (const GnomeDesktopItem *i
}
static const char *
+lookup_gettext (const GnomeDesktopItem *item, const char *key)
+{
+ const char *ret;
+ const char *msg_locale;
+ const char *value;
+
+ ret = NULL;
+
+ /* we're only interested in gettext translation if we don't have a
+ * translation in the .desktop file itself and if the key is one of the
+ * keys we know we want to translate: Name, GenericName, Comment.
+ * Blindly doing this for all keys can give strange result for the
+ * icons, since the Icon is a locale string in the spec, eg. */
+ if (!(item->gettext_domain &&
+ (strcmp (key, GNOME_DESKTOP_ITEM_NAME) == 0 ||
+ strcmp (key, GNOME_DESKTOP_ITEM_GENERIC_NAME) == 0 ||
+ strcmp (key, GNOME_DESKTOP_ITEM_COMMENT) == 0)))
+ return NULL;
+
+ msg_locale = setlocale (LC_MESSAGES, NULL);
+ if (!msg_locale)
+ return NULL;
+
+ value = lookup (item, key);
+ if (value == NULL || value[0] == '\0')
+ return NULL;
+
+ if (item->location) {
+ GFile *file;
+ char *basename;
+
+ file = g_file_new_for_uri (item->location);
+ basename = g_file_get_basename (file);
+ g_object_unref (file);
+
+ if (basename) {
+ char *context;
+ char *context_value;
+
+ context = g_strdup_printf ("%s(%s)", key,
+ basename);
+ context_value = g_strdup_printf ("%s%s%s",
+ context, ": ", value);
+ ret = g_dgettext (item->gettext_domain,
+ context_value);
+ if (ret == context_value)
+ ret = NULL;
+
+ g_free (context_value);
+ g_free (context);
+ g_free (basename);
+ }
+ }
+
+ if (!ret) {
+ ret = g_dgettext (item->gettext_domain, value);
+ /* don't accept no translation */
+ if (ret == value)
+ ret = NULL;
+ }
+
+ return ret;
+}
+
+static const char *
lookup_best_locale (const GnomeDesktopItem *item, const char *key)
{
const char * const *langs_pointer;
@@ -1013,6 +1089,14 @@ lookup_best_locale (const GnomeDesktopIt
for (i = 0; langs_pointer[i] != NULL; i++) {
const char *ret = NULL;
+ /* if we reach C, it means there were no inline translations so
+ * far, so let's try gettext first */
+ if (strcmp (langs_pointer[i], "C") == 0) {
+ ret = lookup_gettext (item, key);
+ if (ret != NULL)
+ return ret;
+ }
+
ret = lookup_locale (item, key, langs_pointer[i]);
if (ret != NULL)
return ret;
@@ -2720,11 +2804,21 @@ gnome_desktop_item_get_localestring_lang
const char *attr,
const char *language)
{
+ const char *msg_locale;
+ const char *ret;
+
g_return_val_if_fail (item != NULL, NULL);
g_return_val_if_fail (item->refcount > 0, NULL);
g_return_val_if_fail (attr != NULL, NULL);
- return lookup_locale (item, attr, language);
+ msg_locale = setlocale (LC_MESSAGES, NULL);
+
+ ret = lookup_locale (item, attr, language);
+ /* let's try gettext if the requested language is the current one */
+ if (!ret && language && strcmp (msg_locale, language))
+ ret = lookup_gettext (item, attr);
+
+ return ret;
}
/**
@@ -2752,6 +2846,14 @@ gnome_desktop_item_get_attr_locale (cons
for (i = 0; langs_pointer[i] != NULL; i++) {
const char *value = NULL;
+ /* if we reach C, it means there were no inline translations so
+ * far, so let's try gettext first */
+ if (strcmp (langs_pointer[i], "C") == 0) {
+ value = lookup_gettext (item, attr);
+ if (value)
+ return setlocale (LC_MESSAGES, NULL);
+ }
+
value = lookup_locale (item, attr, langs_pointer[i]);
if (value)
return langs_pointer[i];
@@ -2772,6 +2874,9 @@ gnome_desktop_item_get_languages (const
for (li = item->languages; li != NULL; li = li->next) {
char *language = li->data;
+ /* no gettext support here: this wouldn't give us a lot. Worst
+ * case, an desktop item editor won't see that there's a
+ * translation for the current locale. */
if (attr == NULL ||
lookup_locale (item, attr, language) != NULL) {
list = g_list_prepend (list, language);
@@ -3489,6 +3594,8 @@ try_english_key (GnomeDesktopItem *item,
str = NULL;
for (i = 0; locales[i] != NULL && str == NULL; i++) {
+ /* no gettext support here: this function is for broken
+ * .desktop files anyway */
str = g_strdup (lookup_locale (item, key, locales[i]));
}
if (str != NULL) {
@@ -3757,6 +3864,10 @@ ditem_load (ReadBuf *rb,
readbuf_close (rb);
+ item->gettext_domain = lookup (item, GNOME_DESKTOP_ITEM_GETTEXT_DOMAIN);
+ if (!item->gettext_domain)
+ item->gettext_domain = "desktop_translations";
+
return item;
}
Index: libgnome-desktop/libgnome/gnome-desktop-item.h
===================================================================
--- libgnome-desktop/libgnome/gnome-desktop-item.h.orig
+++ libgnome-desktop/libgnome/gnome-desktop-item.h
@@ -97,6 +97,7 @@ typedef struct _GnomeDesktopItem GnomeDe
#define GNOME_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */
#define GNOME_DESKTOP_ITEM_SUBSTITUTEUID "X-KDE-SubstituteUID" /*boolean*/
#define GNOME_DESKTOP_ITEM_ROOT_ONLY "X-KDE-RootOnly" /*boolean*/
+#define GNOME_DESKTOP_ITEM_GETTEXT_DOMAIN "X-SUSE-Gettext-Domain" /* string */
/* The vfolder proposal */
#define GNOME_DESKTOP_ITEM_CATEGORIES "Categories" /* string */
#define GNOME_DESKTOP_ITEM_ONLY_SHOW_IN "OnlyShowIn" /* string */

View File

@ -1,71 +0,0 @@
Index: gnome-desktop-2.28.1/libgnome-desktop/gnome-desktop-item.c
===================================================================
--- gnome-desktop-2.28.1.orig/libgnome-desktop/gnome-desktop-item.c
+++ gnome-desktop-2.28.1/libgnome-desktop/gnome-desktop-item.c
@@ -52,6 +52,8 @@
#include <gtk/gtk.h>
#endif
+#include <gtk/gtkrecentmanager.h>
+
#define sure_string(s) ((s)!=NULL?(s):"")
#define GNOME_DESKTOP_USE_UNSTABLE_API
@@ -136,6 +138,8 @@ static GnomeDesktopItem *gnome_desktop_i
GnomeDesktopItemLoadFlags flags,
GError **error);
+static void update_recently_used_apps (const GnomeDesktopItem *item);
+
static int
readbuf_getc (ReadBuf *rb)
{
@@ -2111,6 +2115,8 @@ gnome_desktop_item_launch_on_screen_with
(flags & GNOME_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD),
error);
+ update_recently_used_apps (item);
+
return ret;
}
@@ -3873,3 +3879,39 @@ gnome_desktop_item_error_quark (void)
return q;
}
+
+static void
+update_recently_used_apps (const GnomeDesktopItem *item)
+{
+ GtkRecentManager *manager;
+ GtkRecentData recent_data;
+
+ if (!item || !gnome_desktop_item_get_location (item))
+ return;
+
+ manager = gtk_recent_manager_get_default ();
+
+ if (!manager)
+ return;
+
+ recent_data.display_name = gnome_desktop_item_get_localestring (item, GNOME_DESKTOP_ITEM_NAME);
+ recent_data.description = gnome_desktop_item_get_localestring (item, GNOME_DESKTOP_ITEM_COMMENT);
+ recent_data.mime_type = "application/x-desktop";
+ recent_data.is_private = TRUE;
+
+ recent_data.app_name = g_get_application_name ();
+ if (!recent_data.app_name)
+ recent_data.app_name = "libgnomedesktop";
+
+ recent_data.app_exec = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_EXEC);
+ if (!recent_data.app_exec)
+ recent_data.app_exec = "gnome-open %u";
+
+ recent_data.groups = g_new0 (gchar *, 2);
+ recent_data.groups [0] = "recently-used-apps";
+ recent_data.groups [1] = NULL;
+
+ gtk_recent_manager_add_full (manager, gnome_desktop_item_get_location (item), &recent_data);
+
+ g_free (recent_data.groups);
+}

View File

@ -1,3 +1,48 @@
-------------------------------------------------------------------
Wed Sep 8 20:13:21 CEST 2010 - vuntz@opensuse.org
- Update gnome-desktop to the GNOME 3 version. The GNOME 2 version
will be kept as the gnome-desktop2 source package.
- There is a IS_DEFAULT_GNOME_DESKTOP default to make it easy to
choose which gnome-desktop version will be the default. This is
important since some files like gnome-about and the documentation
are conflicting between the two versions.
- Update to version 2.90.5. Changes from version 2.31.90:
+ libgnome-desktop:
- Port to GTK+ 3.0 and make it parallel installable with GTK+
2.0 version
- Drop GnomeDesktopItem API
+ Add --disable-desktop-docs configure flag
+ Remove old icons installed in /usr/share/pixmaps
+ Update gnome-about man page
+ Updated translations
- Change old-style BuildRequires to pkgconfig() style
BuildRequires:
+ old-style: gconf2-devel, gtk2-devel,
startup-notification-devel.
+ new-style: gconf-2.0, gdk-pixbuf-2.0, glib-2.0, gtk+-3.0,
libstartup-notification-1.0, x11, xrandr.
- Drop gnome-desktop-fate300461-desktop-gettext.patch,
gnome-desktop-recently-used-apps.patch, X-KDE-SubstituteUID.dif:
they were needed for the GnomeDesktopItem API, but it got
removed.
- Change Requires of lang subpackage to Recommends.
- Remove gnome-core Obsoletes: it's gone for a long time now.
- Create a gnome-about subpackage instead of the main gnome-desktop
package, since it only contains gnome-about.
- Rename libgnome-desktop-2-17 subpackage to libgnome-desktop-3-0,
following the library name change upstream.
- Rename devel subpackage to libgnome-desktop-3-devel, and make it
Provides/Obsoletes gnome-desktop-devel if
%IS_DEFAULT_GNOME_DESKTOP is set.
- Make libgnome-desktop-3-0 Provides/Obsoletes gnome-desktop if
%IS_DEFAULT_GNOME_DESKTOP is set.
- If %IS_DEFAULT_GNOME_DESKTOP is not set, pass
--disable-gnome-about and --disable-desktop-docs to configure, do
not look for the help files, and do not create a main package,
since it would be empty.
- Update description of packages.
-------------------------------------------------------------------
Wed Aug 18 18:41:35 CEST 2010 - dimstar@opensuse.org

View File

@ -1,5 +1,5 @@
#
# spec file for package gnome-desktop (Version 2.31.90)
# spec file for package gnome-desktop (Version 2.90.5)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -15,10 +15,10 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define IS_DEFAULT_GNOME_DESKTOP 0
Name: gnome-desktop
Version: 2.31.90
Version: 2.90.5
Release: 1
License: GFDLv1.1 ; GPLv2+ ; LGPLv2.1+
Summary: The GNOME Desktop API Library
@ -27,80 +27,88 @@ Group: System/GUI/GNOME
Source: %{name}-%{version}.tar.bz2
Source99: baselibs.conf
# PATCH-MISSING-TAG -- See http://en.opensuse.org/Packaging/Patches
Patch1: X-KDE-SubstituteUID.dif
# PATCH-MISSING-TAG -- See http://en.opensuse.org/Packaging/Patches
Patch2: gnome-desktop-desktop.patch
# PATCH-FEATURE-OPENSUSE gnome-desktop-recently-used-apps.patch -- Add launched .desktop files to recently used apps.
Patch3: gnome-desktop-recently-used-apps.patch
# PATCH-FEATURE-OPENSUSE gnome-desktop-fate300461-desktop-gettext.patch fate300461 vuntz@novell.com -- Look for translation of desktop entry strings via gettext
Patch5: gnome-desktop-fate300461-desktop-gettext.patch
BuildRequires: fdupes
BuildRequires: gconf2-devel
BuildRequires: gnome-doc-utils-devel
BuildRequires: gtk2-devel
BuildRequires: intltool
BuildRequires: startup-notification-devel
BuildRequires: translation-update-upstream
BuildRequires: update-desktop-files
Requires: %{name}-lang = %{version}
Obsoletes: gnome-core
BuildRequires: pkgconfig(gconf-2.0)
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(libstartup-notification-1.0)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xrandr)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
This package contains the libgnome-desktop library that contains APIs
that really belong in libgnome/libgnomeui but have not seen enough
testing or development to be considered stable. Use them at your own
risk.
This package contains the gnome-about program as well as some
desktop-wide documents.
Also contained here are documents installed as part of the core GNOME
distribution: the GPL, GNOME's .desktop files, the gnome-about program,
some man pages, and GNOME's core graphics files and icons.
%if %IS_DEFAULT_GNOME_DESKTOP
%package -n gnome-about
License: GPLv2+
Summary: Information dialog about GNOME
Group: System/GUI/GNOME
Recommends: %{name}-lang
%package -n libgnome-desktop-2-17
License: GFDLv1.1 ; GPLv2+ ; LGPLv2.1+
%description -n gnome-about
The gnome-about program helps find which version of GNOME is
installed.
%endif
%package -n libgnome-desktop-3-0
License: LGPLv2.1+
Summary: The GNOME Desktop API Library
Group: System/GUI/GNOME
Requires: %{name}-lang = %{version}
Recommends: %{name}-lang
%if %IS_DEFAULT_GNOME_DESKTOP
Provides: %{name} = %{version}
Obsoletes: %{name} < %{version}
%endif
%description -n libgnome-desktop-2-17
This package contains the libgnome-desktop library that contains APIs
that really belong in libgnome/libgnomeui but have not seen enough
testing or development to be considered stable. Use them at your own
risk.
%description -n libgnome-desktop-3-0
The libgnome-desktop library provides API shared by several applications
on the desktop, but that cannot live in the platform for various
reasons. There is no API or ABI guarantee, although we are doing our
best to provide stability. Documentation for the API is available with
gtk-doc.
Also contained here are documents installed as part of the core GNOME
distribution: the GPL, GNOME's .desktop files, the gnome-about program,
some man pages, and GNOME's core graphics files and icons.
%package devel
%package -n libgnome-desktop-3-devel
License: LGPLv2.1+
Summary: Include Files and Libraries mandatory for Development
Summary: The GNOME Desktop API Library -- Development Files
Group: Development/Libraries/GNOME
Requires: gconf2-devel
Requires: gtk2-devel
Requires: libgnome-desktop-2-17 = %{version}
Requires: startup-notification-devel
Obsoletes: gnome-desktop-doc <= 2.25.90
Provides: gnome-desktop-doc = 2.25.90
Requires: libgnome-desktop-3-0 = %{version}
%if %IS_DEFAULT_GNOME_DESKTOP
Provides: %{name}-devel = %{version}
Obsoletes: %{name}-devel < %{version}
Provides: %{name}-doc = %{version}
Obsoletes: %{name}-doc < %{version}
%endif
%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
%description -n libgnome-desktop-3-devel
The libgnome-desktop library provides API shared by several applications
on the desktop, but that cannot live in the platform for various
reasons. There is no API or ABI guarantee, although we are doing our
best to provide stability. Documentation for the API is available with
gtk-doc.
%lang_package
%prep
%setup -q
translation-update-upstream
%patch1
%patch2 -p0
%patch3 -p1
%patch5 -p0
%build
%configure --with-pic\
--disable-static\
--disable-scrollkeeper\
--with-gnome-distributor="SUSE"\
%if ! %IS_DEFAULT_GNOME_DESKTOP
--disable-gnome-about \
--disable-desktop-docs \
%endif
--disable-date-in-gnome-version
make %{?jobs:-j%jobs}
@ -112,47 +120,46 @@ make %{?jobs:-j%jobs}
%if 0%{?suse_version} <= 1120
%{__rm} %{buildroot}%{_datadir}/locale/en@shaw/LC_MESSAGES/*
%endif
%find_lang %{name}-2.0
%find_lang fdl %{name}-2.0.lang
%find_lang gpl %{name}-2.0.lang
%find_lang lgpl %{name}-2.0.lang
%find_lang %{name}-3.0
%if %IS_DEFAULT_GNOME_DESKTOP
%find_lang fdl %{name}-3.0.lang
%find_lang gpl %{name}-3.0.lang
%find_lang lgpl %{name}-3.0.lang
%suse_update_desktop_file gnome-about Documentation
%endif
%{__rm} -vf %{buildroot}%{_libdir}/*.la
%fdupes %{buildroot}
%clean
rm -rf %{buildroot}
%post -n libgnome-desktop-2-17 -p /sbin/ldconfig
%post -n libgnome-desktop-3-0 -p /sbin/ldconfig
%postun -n libgnome-desktop-2-17 -p /sbin/ldconfig
%postun -n libgnome-desktop-3-0 -p /sbin/ldconfig
%files
%if %IS_DEFAULT_GNOME_DESKTOP
%files -n gnome-about
%defattr (-, root, root)
%doc AUTHORS COPYING COPYING-DOCS ChangeLog NEWS README
%{_bindir}/*
%doc COPYING
%{_bindir}/gnome-about
%{_datadir}/applications/gnome-about.desktop
%{_datadir}/gnome-about
%{_datadir}/pixmaps/*.png
%{_datadir}/pixmaps/*.xpm
%doc %{_mandir}/man?/*.*
%{_datadir}/gnome-about/
%doc %{_mandir}/man1/gnome-about.1*
%endif
%files -n libgnome-desktop-2-17
%files -n libgnome-desktop-3-0
%defattr(-, root, root)
%doc COPYING.LIB
%{_datadir}/libgnome-desktop
%{_libdir}/*.so.*
%doc AUTHORS COPYING.LIB NEWS README
%{_datadir}/libgnome-desktop-3.0/
%{_libdir}/libgnome-desktop-3.so.*
%files lang -f %{name}-2.0.lang
%files devel
%files -n libgnome-desktop-3-devel
%defattr (-, root, root)
%{_libdir}/pkgconfig/*.pc
%{_libdir}/*.so
%{_includedir}/gnome-desktop-2.0
# Own these repositories to not depend on gtk-doc while building:
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%{_datadir}/gtk-doc/html/gnome-desktop
%{_includedir}/gnome-desktop-3.0/
%{_libdir}/libgnome-desktop-3.so
%{_libdir}/pkgconfig/gnome-desktop-3.0.pc
%doc %{_datadir}/gtk-doc/html/gnome-desktop3/
%files lang -f %{name}-3.0.lang
%changelog