[arch-commits] Commit in gnome-activity-journal/repos (12 files)

Balló György bgyorgy at archlinux.org
Wed Dec 7 17:56:38 UTC 2016


    Date: Wednesday, December 7, 2016 @ 17:56:38
  Author: bgyorgy
Revision: 198324

archrelease: copy trunk to community-i686, community-x86_64

Added:
  gnome-activity-journal/repos/community-i686/
  gnome-activity-journal/repos/community-i686/PKGBUILD
    (from rev 198323, gnome-activity-journal/trunk/PKGBUILD)
  gnome-activity-journal/repos/community-i686/bluebird_histogram.patch
    (from rev 198323, gnome-activity-journal/trunk/bluebird_histogram.patch)
  gnome-activity-journal/repos/community-i686/disable-set-background.patch
    (from rev 198323, gnome-activity-journal/trunk/disable-set-background.patch)
  gnome-activity-journal/repos/community-i686/fix-indicator-icon.patch
    (from rev 198323, gnome-activity-journal/trunk/fix-indicator-icon.patch)
  gnome-activity-journal/repos/community-i686/make-libgnomeui-optional.patch
    (from rev 198323, gnome-activity-journal/trunk/make-libgnomeui-optional.patch)
  gnome-activity-journal/repos/community-x86_64/
  gnome-activity-journal/repos/community-x86_64/PKGBUILD
    (from rev 198323, gnome-activity-journal/trunk/PKGBUILD)
  gnome-activity-journal/repos/community-x86_64/bluebird_histogram.patch
    (from rev 198323, gnome-activity-journal/trunk/bluebird_histogram.patch)
  gnome-activity-journal/repos/community-x86_64/disable-set-background.patch
    (from rev 198323, gnome-activity-journal/trunk/disable-set-background.patch)
  gnome-activity-journal/repos/community-x86_64/fix-indicator-icon.patch
    (from rev 198323, gnome-activity-journal/trunk/fix-indicator-icon.patch)
  gnome-activity-journal/repos/community-x86_64/make-libgnomeui-optional.patch
    (from rev 198323, gnome-activity-journal/trunk/make-libgnomeui-optional.patch)

-------------------------------------------------+
 community-i686/PKGBUILD                         |   54 ++++++++++
 community-i686/bluebird_histogram.patch         |   15 ++
 community-i686/disable-set-background.patch     |   33 ++++++
 community-i686/fix-indicator-icon.patch         |   15 ++
 community-i686/make-libgnomeui-optional.patch   |  113 ++++++++++++++++++++++
 community-x86_64/PKGBUILD                       |   54 ++++++++++
 community-x86_64/bluebird_histogram.patch       |   15 ++
 community-x86_64/disable-set-background.patch   |   33 ++++++
 community-x86_64/fix-indicator-icon.patch       |   15 ++
 community-x86_64/make-libgnomeui-optional.patch |  113 ++++++++++++++++++++++
 10 files changed, 460 insertions(+)

Copied: gnome-activity-journal/repos/community-i686/PKGBUILD (from rev 198323, gnome-activity-journal/trunk/PKGBUILD)
===================================================================
--- community-i686/PKGBUILD	                        (rev 0)
+++ community-i686/PKGBUILD	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,54 @@
+# $Id$
+# Maintainer: Balló György <ballogyor+arch at gmail dot com>
+
+pkgname=gnome-activity-journal
+pkgver=0.8.0
+pkgrel=9
+pkgdesc="Tool for easily browsing and finding files on your computer using the Zeitgeist engine"
+arch=('any')
+url="https://launchpad.net/gnome-activity-journal"
+license=('GPL')
+depends=('python2-dbus' 'python2-gconf' 'python2-xdg' 'zeitgeist')
+makedepends=('python2-distutils-extra')
+optdepends=('python2-libgnome: get thumbnail of image and video files' 
+            'gstreamer0.10-python: add multimedia tooltip for audio and video files'
+            'python2-pygments: get thumbnail of text files')
+source=(https://launchpad.net/$pkgname/${pkgver%.*}/$pkgver/+download/$pkgname-$pkgver.tar.gz{,.asc}
+        disable-set-background.patch
+        bluebird_histogram.patch
+        fix-indicator-icon.patch
+        make-libgnomeui-optional.patch)
+validpgpkeys=('7C0FF088052C082B442454171CFC22F3363DEAE3') # Siegfried-Angel Gevatter Pujals
+md5sums=('46e493f090b41a49cfce422203791bc0'
+         'SKIP'
+         '23f0ead4fe6161e6aa71c8ad19ac5695'
+         '075953e6cc1f88d2fc588488957550ee'
+         'b757b0c8e5ff06eb50d30f5028c5691b'
+         'a158b002cf33efcfefb4fa06d7ef7da5')
+
+prepare() {
+  cd $pkgname-$pkgver
+  sed -i 's@^#!.*python$@#!/usr/bin/python2@' src/config.py gnome-activity-journal
+
+  # https://bugs.launchpad.net/gnome-activity-journal/+bug/882557
+  patch -Np1 -i "$srcdir/disable-set-background.patch"
+
+  # https://bugs.launchpad.net/gnome-activity-journal/+bug/924988
+  patch -Np1 -i "$srcdir/bluebird_histogram.patch"
+
+  # Use icon name instead of full path to fix indicator icon
+  patch -Np1 -i "$srcdir/fix-indicator-icon.patch"
+
+  # https://bugs.launchpad.net/gnome-activity-journal/+bug/871130
+  patch -Np1 -i "$srcdir/make-libgnomeui-optional.patch"
+}
+
+build() {
+  cd $pkgname-$pkgver
+  python2 setup.py build
+}
+
+package() {
+  cd $pkgname-$pkgver
+  python2 setup.py install --root=$pkgdir/ --optimize=1
+}

Copied: gnome-activity-journal/repos/community-i686/bluebird_histogram.patch (from rev 198323, gnome-activity-journal/trunk/bluebird_histogram.patch)
===================================================================
--- community-i686/bluebird_histogram.patch	                        (rev 0)
+++ community-i686/bluebird_histogram.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,15 @@
+--- a/src/external.py
++++ b/src/external.py
+@@ -41,7 +41,11 @@
+     _restarted = False
+ 
+     def __init__(self):
+-        self._extension = CLIENT._iface.get_extension("Log", "journal/activity")
++        if CLIENT.get_version() >= [0, 8, 99]:
++            self._extension = CLIENT._iface.get_extension("Histogram", "journal/activity")
++        else:
++            self._extension = CLIENT._iface.get_extension("Log", "journal/activity")
++
+ 
+     def _show_error(self):
+         dialog = gtk.MessageDialog(

Copied: gnome-activity-journal/repos/community-i686/disable-set-background.patch (from rev 198323, gnome-activity-journal/trunk/disable-set-background.patch)
===================================================================
--- community-i686/disable-set-background.patch	                        (rev 0)
+++ community-i686/disable-set-background.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,33 @@
+diff -Naur gnome-activity-journal-0.8.0.orig/src/activity_widgets.py gnome-activity-journal-0.8.0/src/activity_widgets.py
+--- gnome-activity-journal-0.8.0.orig/src/activity_widgets.py	2011-07-16 17:58:23.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/activity_widgets.py	2011-11-15 02:15:30.603371223 +0100
+@@ -1689,7 +1689,6 @@
+         context = widget.window.cairo_create()
+         layout = self.create_pango_layout("   ")
+         width = event.area.width
+-        widget.style.set_background(window, gtk.STATE_NORMAL)
+         context.set_source_rgba(*self.line_color)
+         context.set_line_width(2)
+         self.draw_lines(window, context, layout, width)
+diff -Naur gnome-activity-journal-0.8.0.orig/src/histogram.py gnome-activity-journal-0.8.0/src/histogram.py
+--- gnome-activity-journal-0.8.0.orig/src/histogram.py	2011-05-21 14:29:27.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/histogram.py	2011-11-15 02:15:37.776270364 +0100
+@@ -157,7 +157,6 @@
+         """
+         The major drawing method that the expose event calls directly
+         """
+-        widget.style.set_background(widget.window, gtk.STATE_NORMAL)
+         context = widget.window.cairo_create()
+         self.expose(widget, event, context)
+ 
+diff -Naur gnome-activity-journal-0.8.0.orig/src/supporting_widgets.py gnome-activity-journal-0.8.0/src/supporting_widgets.py
+--- gnome-activity-journal-0.8.0.orig/src/supporting_widgets.py	2011-05-21 14:29:27.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/supporting_widgets.py	2011-11-15 02:15:45.059162848 +0100
+@@ -94,7 +94,6 @@
+         self.context = context
+ 
+         self.font_name = self.style.font_desc.get_family()
+-        widget.style.set_background(widget.window, gtk.STATE_NORMAL)
+ 
+         # set a clip region for the expose event
+         context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)

Copied: gnome-activity-journal/repos/community-i686/fix-indicator-icon.patch (from rev 198323, gnome-activity-journal/trunk/fix-indicator-icon.patch)
===================================================================
--- community-i686/fix-indicator-icon.patch	                        (rev 0)
+++ community-i686/fix-indicator-icon.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,15 @@
+diff -Naur gnome-activity-journal-0.8.0.orig/src/Indicator.py gnome-activity-journal-0.8.0/src/Indicator.py
+--- gnome-activity-journal-0.8.0.orig/src/Indicator.py	2011-07-16 18:57:07.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/Indicator.py	2011-11-15 02:51:27.156163756 +0100
+@@ -37,9 +37,9 @@
+         A widget that implements the appindicator for ubuntu
+         """
+         def __init__(self, main_window):
+-            path = get_icon_path("hicolor/scalable/apps/gnome-activity-journal.svg")
++            icon = "gnome-activity-journal"
+             name = _("Activity Journal")
+-            appindicator.Indicator.__init__(self, name, path, \
++            appindicator.Indicator.__init__(self, name, icon, \
+                 appindicator.CATEGORY_APPLICATION_STATUS)
+ 
+             self.main_window = main_window

Copied: gnome-activity-journal/repos/community-i686/make-libgnomeui-optional.patch (from rev 198323, gnome-activity-journal/trunk/make-libgnomeui-optional.patch)
===================================================================
--- community-i686/make-libgnomeui-optional.patch	                        (rev 0)
+++ community-i686/make-libgnomeui-optional.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,113 @@
+diff -Naur gnome-activity-journal-0.8.0.orig/src/common.py gnome-activity-journal-0.8.0/src/common.py
+--- gnome-activity-journal-0.8.0.orig/src/common.py	2011-07-16 18:27:43.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/common.py	2011-10-09 07:04:07.011645989 +0200
+@@ -29,7 +29,6 @@
+ import gobject
+ import gettext
+ import gio
+-import gnome.ui
+ import glib
+ import gtk
+ import os
+@@ -44,6 +43,12 @@
+ import zipfile
+ 
+ try:
++    import gnome.ui
++    gnomeui = True
++except ImportError:
++    gnomeui = None
++
++try:
+     import pygments
+ except ImportError:
+     pygments = None
+@@ -72,10 +77,11 @@
+ SIZE_TEXT_TIMELINEVIEW = ["small", "medium", "large", "x-large"]
+ SIZE_TEXT_THUMBVIEW = ["x-small", "small", "large", "xx-large"]
+ 
+-THUMBNAIL_FACTORIES = {
+-    SIZE_NORMAL: gnome.ui.ThumbnailFactory("normal"),
+-    SIZE_LARGE: gnome.ui.ThumbnailFactory("large")
+-}
++if gnomeui:
++    THUMBNAIL_FACTORIES = {
++        SIZE_NORMAL: gnome.ui.ThumbnailFactory("normal"),
++        SIZE_LARGE: gnome.ui.ThumbnailFactory("large")
++    }
+ ICON_THEME = gtk.icon_theme_get_default()
+ 
+ #FIXME i know it's ugly. Btw this is only a temp solution. It will be removed
+@@ -878,39 +884,41 @@
+         try:
+             thumb = THUMBS[size][self.uri]
+         except KeyError:
++            thumb = None
+-            factory = THUMBNAIL_FACTORIES[size]
+-            location = factory.lookup(self.uri, self.mtime)
+-            if location:
+-                thumb, mtime = THUMBS[size][self.uri] = \
+-                    (gtk.gdk.pixbuf_new_from_file(location), self.mtime)
+-            else:
+-                if factory.has_valid_failed_thumbnail(self.uri, self.mtime):
+-                    thumb = THUMBS[size][self.uri] = None
++            if gnomeui:
++                factory = THUMBNAIL_FACTORIES[size]
++                location = factory.lookup(self.uri, self.mtime)
++                if location:
++                    thumb, mtime = THUMBS[size][self.uri] = \
++                        (gtk.gdk.pixbuf_new_from_file(location), self.mtime)
+                 else:
+-                    thumb = factory.generate_thumbnail(self.uri, self.mime_type)
+-                    if thumb is None:
+-                        # maybe we are able to use a custom thumbnailer here
+-                        if filter(lambda name: "application-vnd.oasis.opendocument" in name, self.icon_names):
+-                            thumb = create_opendocument_thumb(self._file_object.get_path())
+-                        elif "text-x-generic" in self.icon_names or "text-x-script" in self.icon_names:
+-                            try:
+-                                thumb = create_text_thumb(self, size, 1)
+-                            except Exception:
+-                                thumb = None
+-                        elif "audio-x-generic" in self.icon_names:
+-                            pass
+-                            #FIXME
+-                            #thumb = self.get_audio_cover(size)
+-                    if thumb is None:
+-                        factory.create_failed_thumbnail(self.uri, self.mtime)
++                    if factory.has_valid_failed_thumbnail(self.uri, self.mtime):
++                        thumb = THUMBS[size][self.uri] = None
+                     else:
+-                        width, height = thumb.get_width(), thumb.get_height()
+-                        if width > size[0] or height > size[1]:
+-                            scale = min(float(size[0])/width, float(size[1])/height)
+-                            thumb = gnome.ui.thumbnail_scale_down_pixbuf(
+-                                thumb, int(scale*width), int(scale*height))
+-                        factory.save_thumbnail(thumb, self.uri, self.mtime)
+-                        THUMBS[size][self.uri] = (thumb, self.mtime)
++                        thumb = factory.generate_thumbnail(self.uri, self.mime_type)
++                        if thumb is None:
++                            # maybe we are able to use a custom thumbnailer here
++                            if filter(lambda name: "application-vnd.oasis.opendocument" in name, self.icon_names):
++                                thumb = create_opendocument_thumb(self._file_object.get_path())
++                            elif "text-x-generic" in self.icon_names or "text-x-script" in self.icon_names:
++                                try:
++                                    thumb = create_text_thumb(self, size, 1)
++                                except Exception:
++                                    thumb = None
++                            elif "audio-x-generic" in self.icon_names:
++                                pass
++                                #FIXME
++                                #thumb = self.get_audio_cover(size)
++                        if thumb is None:
++                            factory.create_failed_thumbnail(self.uri, self.mtime)
++                        else:
++                            width, height = thumb.get_width(), thumb.get_height()
++                            if width > size[0] or height > size[1]:
++                                scale = min(float(size[0])/width, float(size[1])/height)
++                                thumb = gnome.ui.thumbnail_scale_down_pixbuf(
++                                    thumb, int(scale*width), int(scale*height))
++                            factory.save_thumbnail(thumb, self.uri, self.mtime)
++                            THUMBS[size][self.uri] = (thumb, self.mtime)
+         else:
+             if thumb is not None:
+                 if thumb[1] != self.mtime:

Copied: gnome-activity-journal/repos/community-x86_64/PKGBUILD (from rev 198323, gnome-activity-journal/trunk/PKGBUILD)
===================================================================
--- community-x86_64/PKGBUILD	                        (rev 0)
+++ community-x86_64/PKGBUILD	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,54 @@
+# $Id$
+# Maintainer: Balló György <ballogyor+arch at gmail dot com>
+
+pkgname=gnome-activity-journal
+pkgver=0.8.0
+pkgrel=9
+pkgdesc="Tool for easily browsing and finding files on your computer using the Zeitgeist engine"
+arch=('any')
+url="https://launchpad.net/gnome-activity-journal"
+license=('GPL')
+depends=('python2-dbus' 'python2-gconf' 'python2-xdg' 'zeitgeist')
+makedepends=('python2-distutils-extra')
+optdepends=('python2-libgnome: get thumbnail of image and video files' 
+            'gstreamer0.10-python: add multimedia tooltip for audio and video files'
+            'python2-pygments: get thumbnail of text files')
+source=(https://launchpad.net/$pkgname/${pkgver%.*}/$pkgver/+download/$pkgname-$pkgver.tar.gz{,.asc}
+        disable-set-background.patch
+        bluebird_histogram.patch
+        fix-indicator-icon.patch
+        make-libgnomeui-optional.patch)
+validpgpkeys=('7C0FF088052C082B442454171CFC22F3363DEAE3') # Siegfried-Angel Gevatter Pujals
+md5sums=('46e493f090b41a49cfce422203791bc0'
+         'SKIP'
+         '23f0ead4fe6161e6aa71c8ad19ac5695'
+         '075953e6cc1f88d2fc588488957550ee'
+         'b757b0c8e5ff06eb50d30f5028c5691b'
+         'a158b002cf33efcfefb4fa06d7ef7da5')
+
+prepare() {
+  cd $pkgname-$pkgver
+  sed -i 's@^#!.*python$@#!/usr/bin/python2@' src/config.py gnome-activity-journal
+
+  # https://bugs.launchpad.net/gnome-activity-journal/+bug/882557
+  patch -Np1 -i "$srcdir/disable-set-background.patch"
+
+  # https://bugs.launchpad.net/gnome-activity-journal/+bug/924988
+  patch -Np1 -i "$srcdir/bluebird_histogram.patch"
+
+  # Use icon name instead of full path to fix indicator icon
+  patch -Np1 -i "$srcdir/fix-indicator-icon.patch"
+
+  # https://bugs.launchpad.net/gnome-activity-journal/+bug/871130
+  patch -Np1 -i "$srcdir/make-libgnomeui-optional.patch"
+}
+
+build() {
+  cd $pkgname-$pkgver
+  python2 setup.py build
+}
+
+package() {
+  cd $pkgname-$pkgver
+  python2 setup.py install --root=$pkgdir/ --optimize=1
+}

Copied: gnome-activity-journal/repos/community-x86_64/bluebird_histogram.patch (from rev 198323, gnome-activity-journal/trunk/bluebird_histogram.patch)
===================================================================
--- community-x86_64/bluebird_histogram.patch	                        (rev 0)
+++ community-x86_64/bluebird_histogram.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,15 @@
+--- a/src/external.py
++++ b/src/external.py
+@@ -41,7 +41,11 @@
+     _restarted = False
+ 
+     def __init__(self):
+-        self._extension = CLIENT._iface.get_extension("Log", "journal/activity")
++        if CLIENT.get_version() >= [0, 8, 99]:
++            self._extension = CLIENT._iface.get_extension("Histogram", "journal/activity")
++        else:
++            self._extension = CLIENT._iface.get_extension("Log", "journal/activity")
++
+ 
+     def _show_error(self):
+         dialog = gtk.MessageDialog(

Copied: gnome-activity-journal/repos/community-x86_64/disable-set-background.patch (from rev 198323, gnome-activity-journal/trunk/disable-set-background.patch)
===================================================================
--- community-x86_64/disable-set-background.patch	                        (rev 0)
+++ community-x86_64/disable-set-background.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,33 @@
+diff -Naur gnome-activity-journal-0.8.0.orig/src/activity_widgets.py gnome-activity-journal-0.8.0/src/activity_widgets.py
+--- gnome-activity-journal-0.8.0.orig/src/activity_widgets.py	2011-07-16 17:58:23.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/activity_widgets.py	2011-11-15 02:15:30.603371223 +0100
+@@ -1689,7 +1689,6 @@
+         context = widget.window.cairo_create()
+         layout = self.create_pango_layout("   ")
+         width = event.area.width
+-        widget.style.set_background(window, gtk.STATE_NORMAL)
+         context.set_source_rgba(*self.line_color)
+         context.set_line_width(2)
+         self.draw_lines(window, context, layout, width)
+diff -Naur gnome-activity-journal-0.8.0.orig/src/histogram.py gnome-activity-journal-0.8.0/src/histogram.py
+--- gnome-activity-journal-0.8.0.orig/src/histogram.py	2011-05-21 14:29:27.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/histogram.py	2011-11-15 02:15:37.776270364 +0100
+@@ -157,7 +157,6 @@
+         """
+         The major drawing method that the expose event calls directly
+         """
+-        widget.style.set_background(widget.window, gtk.STATE_NORMAL)
+         context = widget.window.cairo_create()
+         self.expose(widget, event, context)
+ 
+diff -Naur gnome-activity-journal-0.8.0.orig/src/supporting_widgets.py gnome-activity-journal-0.8.0/src/supporting_widgets.py
+--- gnome-activity-journal-0.8.0.orig/src/supporting_widgets.py	2011-05-21 14:29:27.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/supporting_widgets.py	2011-11-15 02:15:45.059162848 +0100
+@@ -94,7 +94,6 @@
+         self.context = context
+ 
+         self.font_name = self.style.font_desc.get_family()
+-        widget.style.set_background(widget.window, gtk.STATE_NORMAL)
+ 
+         # set a clip region for the expose event
+         context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)

Copied: gnome-activity-journal/repos/community-x86_64/fix-indicator-icon.patch (from rev 198323, gnome-activity-journal/trunk/fix-indicator-icon.patch)
===================================================================
--- community-x86_64/fix-indicator-icon.patch	                        (rev 0)
+++ community-x86_64/fix-indicator-icon.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,15 @@
+diff -Naur gnome-activity-journal-0.8.0.orig/src/Indicator.py gnome-activity-journal-0.8.0/src/Indicator.py
+--- gnome-activity-journal-0.8.0.orig/src/Indicator.py	2011-07-16 18:57:07.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/Indicator.py	2011-11-15 02:51:27.156163756 +0100
+@@ -37,9 +37,9 @@
+         A widget that implements the appindicator for ubuntu
+         """
+         def __init__(self, main_window):
+-            path = get_icon_path("hicolor/scalable/apps/gnome-activity-journal.svg")
++            icon = "gnome-activity-journal"
+             name = _("Activity Journal")
+-            appindicator.Indicator.__init__(self, name, path, \
++            appindicator.Indicator.__init__(self, name, icon, \
+                 appindicator.CATEGORY_APPLICATION_STATUS)
+ 
+             self.main_window = main_window

Copied: gnome-activity-journal/repos/community-x86_64/make-libgnomeui-optional.patch (from rev 198323, gnome-activity-journal/trunk/make-libgnomeui-optional.patch)
===================================================================
--- community-x86_64/make-libgnomeui-optional.patch	                        (rev 0)
+++ community-x86_64/make-libgnomeui-optional.patch	2016-12-07 17:56:38 UTC (rev 198324)
@@ -0,0 +1,113 @@
+diff -Naur gnome-activity-journal-0.8.0.orig/src/common.py gnome-activity-journal-0.8.0/src/common.py
+--- gnome-activity-journal-0.8.0.orig/src/common.py	2011-07-16 18:27:43.000000000 +0200
++++ gnome-activity-journal-0.8.0/src/common.py	2011-10-09 07:04:07.011645989 +0200
+@@ -29,7 +29,6 @@
+ import gobject
+ import gettext
+ import gio
+-import gnome.ui
+ import glib
+ import gtk
+ import os
+@@ -44,6 +43,12 @@
+ import zipfile
+ 
+ try:
++    import gnome.ui
++    gnomeui = True
++except ImportError:
++    gnomeui = None
++
++try:
+     import pygments
+ except ImportError:
+     pygments = None
+@@ -72,10 +77,11 @@
+ SIZE_TEXT_TIMELINEVIEW = ["small", "medium", "large", "x-large"]
+ SIZE_TEXT_THUMBVIEW = ["x-small", "small", "large", "xx-large"]
+ 
+-THUMBNAIL_FACTORIES = {
+-    SIZE_NORMAL: gnome.ui.ThumbnailFactory("normal"),
+-    SIZE_LARGE: gnome.ui.ThumbnailFactory("large")
+-}
++if gnomeui:
++    THUMBNAIL_FACTORIES = {
++        SIZE_NORMAL: gnome.ui.ThumbnailFactory("normal"),
++        SIZE_LARGE: gnome.ui.ThumbnailFactory("large")
++    }
+ ICON_THEME = gtk.icon_theme_get_default()
+ 
+ #FIXME i know it's ugly. Btw this is only a temp solution. It will be removed
+@@ -878,39 +884,41 @@
+         try:
+             thumb = THUMBS[size][self.uri]
+         except KeyError:
++            thumb = None
+-            factory = THUMBNAIL_FACTORIES[size]
+-            location = factory.lookup(self.uri, self.mtime)
+-            if location:
+-                thumb, mtime = THUMBS[size][self.uri] = \
+-                    (gtk.gdk.pixbuf_new_from_file(location), self.mtime)
+-            else:
+-                if factory.has_valid_failed_thumbnail(self.uri, self.mtime):
+-                    thumb = THUMBS[size][self.uri] = None
++            if gnomeui:
++                factory = THUMBNAIL_FACTORIES[size]
++                location = factory.lookup(self.uri, self.mtime)
++                if location:
++                    thumb, mtime = THUMBS[size][self.uri] = \
++                        (gtk.gdk.pixbuf_new_from_file(location), self.mtime)
+                 else:
+-                    thumb = factory.generate_thumbnail(self.uri, self.mime_type)
+-                    if thumb is None:
+-                        # maybe we are able to use a custom thumbnailer here
+-                        if filter(lambda name: "application-vnd.oasis.opendocument" in name, self.icon_names):
+-                            thumb = create_opendocument_thumb(self._file_object.get_path())
+-                        elif "text-x-generic" in self.icon_names or "text-x-script" in self.icon_names:
+-                            try:
+-                                thumb = create_text_thumb(self, size, 1)
+-                            except Exception:
+-                                thumb = None
+-                        elif "audio-x-generic" in self.icon_names:
+-                            pass
+-                            #FIXME
+-                            #thumb = self.get_audio_cover(size)
+-                    if thumb is None:
+-                        factory.create_failed_thumbnail(self.uri, self.mtime)
++                    if factory.has_valid_failed_thumbnail(self.uri, self.mtime):
++                        thumb = THUMBS[size][self.uri] = None
+                     else:
+-                        width, height = thumb.get_width(), thumb.get_height()
+-                        if width > size[0] or height > size[1]:
+-                            scale = min(float(size[0])/width, float(size[1])/height)
+-                            thumb = gnome.ui.thumbnail_scale_down_pixbuf(
+-                                thumb, int(scale*width), int(scale*height))
+-                        factory.save_thumbnail(thumb, self.uri, self.mtime)
+-                        THUMBS[size][self.uri] = (thumb, self.mtime)
++                        thumb = factory.generate_thumbnail(self.uri, self.mime_type)
++                        if thumb is None:
++                            # maybe we are able to use a custom thumbnailer here
++                            if filter(lambda name: "application-vnd.oasis.opendocument" in name, self.icon_names):
++                                thumb = create_opendocument_thumb(self._file_object.get_path())
++                            elif "text-x-generic" in self.icon_names or "text-x-script" in self.icon_names:
++                                try:
++                                    thumb = create_text_thumb(self, size, 1)
++                                except Exception:
++                                    thumb = None
++                            elif "audio-x-generic" in self.icon_names:
++                                pass
++                                #FIXME
++                                #thumb = self.get_audio_cover(size)
++                        if thumb is None:
++                            factory.create_failed_thumbnail(self.uri, self.mtime)
++                        else:
++                            width, height = thumb.get_width(), thumb.get_height()
++                            if width > size[0] or height > size[1]:
++                                scale = min(float(size[0])/width, float(size[1])/height)
++                                thumb = gnome.ui.thumbnail_scale_down_pixbuf(
++                                    thumb, int(scale*width), int(scale*height))
++                            factory.save_thumbnail(thumb, self.uri, self.mtime)
++                            THUMBS[size][self.uri] = (thumb, self.mtime)
+         else:
+             if thumb is not None:
+                 if thumb[1] != self.mtime:



More information about the arch-commits mailing list