diff options
author | Balló György | 2017-02-15 18:41:19 +0100 |
---|---|---|
committer | Balló György | 2017-02-15 18:41:19 +0100 |
commit | 81d15e6611620d9fe314445c36b3c304970cf8c9 (patch) | |
tree | 36d1d833dda5783760182de0b9341a7c42ba79ab | |
download | aur-sugar-toolkit-gtk2.tar.gz |
Add sugar-toolkit-gtk2
Provides sugar-toolkit and sugar-base.
-rw-r--r-- | .SRCINFO | 29 | ||||
-rw-r--r-- | 0001-Don-t-assume-all-connection-managers-support-Sugar.patch | 38 | ||||
-rw-r--r-- | 0001-Use-profile.get_nickname-and-get_color-where-possibl.patch | 95 | ||||
-rw-r--r-- | PKGBUILD | 53 | ||||
-rw-r--r-- | drop-rsvg-dependency.patch | 134 |
5 files changed, 349 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..22d56085c70e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,29 @@ +pkgbase = sugar-toolkit-gtk2 + pkgdesc = GTK2 based toolkit for Sugar (deprecated) + pkgver = 0.110.0 + pkgrel = 1 + url = https://sugarlabs.org/ + arch = i686 + arch = x86_64 + license = LGPL + makedepends = intltool + depends = hippo-canvas + depends = python2-gconf + depends = sugar-toolkit-gtk3 + provides = sugar-toolkit + provides = sugar-base + conflicts = sugar-toolkit + conflicts = sugar-base + source = https://download.sugarlabs.org/sources/sucrose/glucose/sugar-toolkit/sugar-toolkit-0.110.0.tar.bz2 + source = https://download.sugarlabs.org/sources/sucrose/glucose/sugar-base/sugar-base-0.98.0.tar.bz2 + source = 0001-Use-profile.get_nickname-and-get_color-where-possibl.patch + source = 0001-Don-t-assume-all-connection-managers-support-Sugar.patch + source = drop-rsvg-dependency.patch + sha256sums = 14e76fac034f8801c2d63c9b562e6559817a31aac72b1853370bf0bc66779f25 + sha256sums = cab4489eaec13a17ca036082d49e933ecd6462954040b086597cf33772f9e1cc + sha256sums = 022d041c0491332c5fb65c9d46232d60bd360b545443bb52b52a66063e239628 + sha256sums = bb9405693fd3f6bb3303d97e839ae5ba466bbc0db93780949948dd4bb01568a6 + sha256sums = 80f28c29f43c1cb2ccb7107e05d5ce60b5f2160298262afeba3f98172e2fdb1a + +pkgname = sugar-toolkit-gtk2 + diff --git a/0001-Don-t-assume-all-connection-managers-support-Sugar.patch b/0001-Don-t-assume-all-connection-managers-support-Sugar.patch new file mode 100644 index 000000000000..71c73e936495 --- /dev/null +++ b/0001-Don-t-assume-all-connection-managers-support-Sugar.patch @@ -0,0 +1,38 @@ +From d93aa7626566eb3e4a5eb4dbdc29a31bfb611079 Mon Sep 17 00:00:00 2001 +From: Sam Parkinson <sam@sam.today> +Date: Sun, 5 Jun 2016 20:04:34 +1000 +Subject: [PATCH] Don't assume all connection managers support Sugar + +If the user has a "random" telepathy connection manager +installed and running on the system (eg. telepathy idle being +active if they are chatting on irc with GNOME's Polari), activities +will crash on startup. + +Steps to reproduce the crash: +1. Run Polari (eg. via the Terminal activity) +2. Join an irc channel in Polari (eg. #sugar on freenode) +3. Try to open an activity from the home view + - notice that opening any sugar3 activity will crash +--- + src/sugar/presence/presenceservice.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py +index b6c581ee..cf718e20 100644 +--- a/src/sugar/presence/presenceservice.py ++++ b/src/sugar/presence/presenceservice.py +@@ -92,6 +92,11 @@ class PresenceService(gobject.GObject): + if e.get_dbus_name() == name: + logging.debug("There's no shared activity with the id " + "%s", activity_id) ++ elif e.get_dbus_name() == \ ++ 'org.freedesktop.DBus.Error.UnknownMethod': ++ logging.warning( ++ 'Telepathy Account %r does not support ' ++ 'Sugar collaboration', account_path) + else: + raise + else: +-- +2.11.1 + diff --git a/0001-Use-profile.get_nickname-and-get_color-where-possibl.patch b/0001-Use-profile.get_nickname-and-get_color-where-possibl.patch new file mode 100644 index 000000000000..3665c396510a --- /dev/null +++ b/0001-Use-profile.get_nickname-and-get_color-where-possibl.patch @@ -0,0 +1,95 @@ +From 9f5a9228da8e0f8c378a665f7e1d9a3480617482 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ball=C3=83=C2=B3=20Gy=C3=83=C2=B6rgy?= <ballogyor@gmail.com> +Date: Wed, 15 Feb 2017 16:47:16 +0100 +Subject: [PATCH] Use profile.get_nickname and get_color where possible + +This is required to run activities when Sugar shell is not installed. + +Backported from: https://github.com/sugarlabs/sugar-toolkit-gtk3/commit/2f2b2d20d8ba8b6b94941dc0fed06a82c0f41a9f +--- + src/sugar/activity/activity.py | 3 ++- + src/sugar/datastore/datastore.py | 3 ++- + src/sugar/presence/buddy.py | 5 +++-- + src/sugar/profile.py | 4 ++-- + 4 files changed, 9 insertions(+), 6 deletions(-) + +diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py +index db589767..a13c3b0f 100644 +--- a/src/sugar/activity/activity.py ++++ b/src/sugar/activity/activity.py +@@ -71,6 +71,7 @@ from telepathy.constants import CONNECTION_HANDLE_TYPE_CONTACT + from telepathy.constants import CONNECTION_HANDLE_TYPE_ROOM + + from sugar import util ++from sugar.profile import get_color + from sugar.presence import presenceservice + from sugar.activity import i18n + from sugar.activity.activityservice import ActivityService +@@ -385,7 +386,7 @@ class Activity(Window, gtk.Container): + def _initialize_journal_object(self): + title = _('%s Activity') % get_bundle_name() + client = gconf.client_get_default() +- icon_color = client.get_string('/desktop/sugar/user/color') ++ icon_color = get_color().to_string() + + jobject = datastore.create() + jobject.metadata['title'] = title +diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py +index ed056347..9f496edc 100644 +--- a/src/sugar/datastore/datastore.py ++++ b/src/sugar/datastore/datastore.py +@@ -34,6 +34,7 @@ import dbus.glib + from sugar import env + from sugar import mime + from sugar import dispatch ++from sugar.profile import get_color + + DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' + DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' +@@ -234,7 +235,7 @@ class RawObject(object): + 'mime_type': gio.content_type_guess(filename=file_path), + 'activity': '', + 'activity_id': '', +- 'icon-color': client.get_string('/desktop/sugar/user/color'), ++ 'icon-color': get_color().to_string(), + 'description': file_path, + } + +diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py +index eaba3e33..d27bfb8c 100644 +--- a/src/sugar/presence/buddy.py ++++ b/src/sugar/presence/buddy.py +@@ -32,6 +32,7 @@ from telepathy.interfaces import CONNECTION, \ + from telepathy.constants import HANDLE_TYPE_CONTACT + + from sugar.presence.connectionmanager import get_connection_manager ++from sugar.profile import get_color, get_nick_name + + ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager' + CONN_INTERFACE_BUDDY_INFO = 'org.laptop.Telepathy.BuddyInfo' +@@ -244,5 +245,5 @@ class Owner(BaseBuddy): + BaseBuddy.__init__(self) + + client = gconf.client_get_default() +- self.props.nick = client.get_string('/desktop/sugar/user/nick') +- self.props.color = client.get_string('/desktop/sugar/user/color') ++ self.props.nick = get_nick_name() ++ self.props.color = get_color().to_string() +diff --git a/src/sugar/profile.py b/src/sugar/profile.py +index c1dffd79..0e1ed5ba 100644 +--- a/src/sugar/profile.py ++++ b/src/sugar/profile.py +@@ -69,8 +69,8 @@ class Profile(object): + + def is_valid(self): + client = gconf.client_get_default() +- nick = client.get_string('/desktop/sugar/user/nick') +- color = client.get_string('/desktop/sugar/user/color') ++ nick = get_nick_name() ++ color = get_color() + + return nick is not '' and \ + color is not '' and \ +-- +2.11.1 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..49d60ba15804 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,53 @@ +# Contributor: Balló György <ballogyor+arch at gmail dot com> + +pkgname=sugar-toolkit-gtk2 +_pkgname=sugar-toolkit +_base_pkgname=sugar-base +pkgver=0.110.0 +_base_pkgver=0.98.0 +pkgrel=1 +pkgdesc="GTK2 based toolkit for Sugar (deprecated)" +arch=('i686' 'x86_64') +url="https://sugarlabs.org/" +license=('LGPL') +depends=('hippo-canvas' 'python2-gconf' 'sugar-toolkit-gtk3') +makedepends=('intltool') +conflicts=($_pkgname $_base_pkgname) +provides=($_pkgname $_base_pkgname) +source=(https://download.sugarlabs.org/sources/sucrose/glucose/$_pkgname/$_pkgname-$pkgver.tar.bz2 + https://download.sugarlabs.org/sources/sucrose/glucose/$_base_pkgname/$_base_pkgname-$_base_pkgver.tar.bz2 + 0001-Use-profile.get_nickname-and-get_color-where-possibl.patch + 0001-Don-t-assume-all-connection-managers-support-Sugar.patch + drop-rsvg-dependency.patch) +sha256sums=('14e76fac034f8801c2d63c9b562e6559817a31aac72b1853370bf0bc66779f25' + 'cab4489eaec13a17ca036082d49e933ecd6462954040b086597cf33772f9e1cc' + '022d041c0491332c5fb65c9d46232d60bd360b545443bb52b52a66063e239628' + 'bb9405693fd3f6bb3303d97e839ae5ba466bbc0db93780949948dd4bb01568a6' + '80f28c29f43c1cb2ccb7107e05d5ce60b5f2160298262afeba3f98172e2fdb1a') + +prepare() { + cd $_pkgname-$pkgver + patch -Np1 -i ../0001-Use-profile.get_nickname-and-get_color-where-possibl.patch + patch -Np1 -i ../0001-Don-t-assume-all-connection-managers-support-Sugar.patch + patch -Np1 -i ../drop-rsvg-dependency.patch +} + +build() { + cd $_pkgname-$pkgver + ./configure --prefix=/usr + sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool + make + + cd ../$_base_pkgname-$_base_pkgver + ./configure --prefix=/usr + sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool + make +} + +package() { + cd $_pkgname-$pkgver + make DESTDIR="$pkgdir" install + + cd ../$_base_pkgname-$_base_pkgver + make DESTDIR="$pkgdir" install +} diff --git a/drop-rsvg-dependency.patch b/drop-rsvg-dependency.patch new file mode 100644 index 000000000000..a8cbd77ccc01 --- /dev/null +++ b/drop-rsvg-dependency.patch @@ -0,0 +1,134 @@ +diff -Naur sugar-toolkit-0.110.0.orig/src/sugar/graphics/icon.py sugar-toolkit-0.110.0/src/sugar/graphics/icon.py +--- sugar-toolkit-0.110.0.orig/src/sugar/graphics/icon.py 2015-10-04 08:49:53.000000000 +0200 ++++ sugar-toolkit-0.110.0/src/sugar/graphics/icon.py 2017-02-13 00:17:36.229025538 +0100 +@@ -37,35 +37,6 @@ + _BADGE_SIZE = 0.45 + + +-class _SVGLoader(object): +- +- def __init__(self): +- self._cache = LRU(50) +- +- def load(self, file_name, entities, cache): +- if file_name in self._cache: +- icon = self._cache[file_name] +- else: +- icon_file = open(file_name, 'r') +- icon = icon_file.read() +- icon_file.close() +- +- if cache: +- self._cache[file_name] = icon +- +- for entity, value in entities.items(): +- if isinstance(value, basestring): +- xml = '<!ENTITY %s "%s">' % (entity, value) +- icon = re.sub('<!ENTITY %s .*>' % entity, xml, icon) +- else: +- logging.error( +- 'Icon %s, entity %s is invalid.', file_name, entity) +- +- # XXX this is very slow! why? +- import rsvg +- return rsvg.Handle(data=icon) +- +- + class _IconInfo(object): + + def __init__(self): +@@ -86,7 +57,6 @@ + class _IconBuffer(object): + + _surface_cache = LRU(50) +- _loader = _SVGLoader() + + def __init__(self): + self.icon_name = None +@@ -111,15 +81,6 @@ + self.stroke_color, self.badge_name, self.width, self.height, + color, sensitive) + +- def _load_svg(self, file_name): +- entities = {} +- if self.fill_color: +- entities['fill_color'] = self.fill_color +- if self.stroke_color: +- entities['stroke_color'] = self.stroke_color +- +- return self._loader.load(file_name, entities, self.cache) +- + def _get_attach_points(self, info, size_request): + attach_points = info.get_attach_points() + +@@ -163,19 +124,10 @@ + badge_info = theme.lookup_icon(self.badge_name, int(size), 0) + if badge_info: + badge_file_name = badge_info.get_filename() +- if badge_file_name.endswith('.svg'): +- handle = self._loader.load(badge_file_name, {}, self.cache) +- +- dimensions = handle.get_dimension_data() +- icon_width = int(dimensions[0]) +- icon_height = int(dimensions[1]) ++ pixbuf = gtk.gdk.pixbuf_new_from_file(badge_file_name) + +- pixbuf = handle.get_pixbuf() +- else: +- pixbuf = gtk.gdk.pixbuf_new_from_file(badge_file_name) +- +- icon_width = pixbuf.get_width() +- icon_height = pixbuf.get_height() ++ icon_width = pixbuf.get_width() ++ icon_height = pixbuf.get_height() + + context.scale(float(size) / icon_width, + float(size) / icon_height) +@@ -256,17 +208,9 @@ + if icon_info.file_name is None: + return None + +- is_svg = icon_info.file_name.endswith('.svg') +- +- if is_svg: +- handle = self._load_svg(icon_info.file_name) +- dimensions = handle.get_dimension_data() +- icon_width = int(dimensions[0]) +- icon_height = int(dimensions[1]) +- else: +- pixbuf = gtk.gdk.pixbuf_new_from_file(icon_info.file_name) +- icon_width = pixbuf.get_width() +- icon_height = pixbuf.get_height() ++ pixbuf = gtk.gdk.pixbuf_new_from_file(icon_info.file_name) ++ icon_width = pixbuf.get_width() ++ icon_height = pixbuf.get_height() + + badge_info = self._get_badge_info(icon_info, icon_width, icon_height) + +@@ -290,21 +234,11 @@ + context.save() + + context.translate(padding, padding) +- if is_svg: +- if sensitive: +- handle.render_cairo(context) +- else: +- pixbuf = handle.get_pixbuf() +- pixbuf = self._get_insensitive_pixbuf(pixbuf, widget) +- gdkcontext = gtk.gdk.CairoContext(context) +- gdkcontext.set_source_pixbuf(pixbuf, 0, 0) +- gdkcontext.paint() +- else: +- if not sensitive: +- pixbuf = self._get_insensitive_pixbuf(pixbuf, widget) +- gdkcontext = gtk.gdk.CairoContext(context) +- gdkcontext.set_source_pixbuf(pixbuf, 0, 0) +- gdkcontext.paint() ++ if not sensitive: ++ pixbuf = self._get_insensitive_pixbuf(pixbuf, widget) ++ gdkcontext = gtk.gdk.CairoContext(context) ++ gdkcontext.set_source_pixbuf(pixbuf, 0, 0) ++ gdkcontext.paint() + + if self.badge_name: + context.restore() |