Merge branch 'master' of git.sugarlabs.org:sugar-toolkit-gtk3/sugar-toolkit-gtk3
This commit is contained in:
commit
7c1451fbf3
@ -1,4 +1,4 @@
|
||||
AC_INIT([sugar-toolkit-gtk3],[0.95.4],[],[sugar-toolkit-gtk3])
|
||||
AC_INIT([sugar-toolkit-gtk3],[0.95.5],[],[sugar-toolkit-gtk3])
|
||||
|
||||
AC_PREREQ([2.59])
|
||||
|
||||
|
@ -48,8 +48,6 @@ libsugarext_la_SOURCES = \
|
||||
gsm-session.h \
|
||||
gsm-xsmp.c \
|
||||
gsm-xsmp.h \
|
||||
rsvg-wrapper.c \
|
||||
rsvg-wrapper.h \
|
||||
sugar-grid.c \
|
||||
sugar-grid.h \
|
||||
sugar-key-grabber.c \
|
||||
@ -133,9 +131,7 @@ SugarExt_1_0_gir_FILES = \
|
||||
sugar-grid.c \
|
||||
sugar-grid.h \
|
||||
gdk-wrapper.c \
|
||||
gdk-wrapper.h \
|
||||
rsvg-wrapper.c \
|
||||
rsvg-wrapper.h
|
||||
gdk-wrapper.h
|
||||
|
||||
SugarExt_1_0_gir_INCLUDES = Gtk-3.0 Gdk-3.0
|
||||
SugarExt_1_0_gir_PACKAGES = gtk+-3.0 gdk-3.0
|
||||
|
@ -56,6 +56,7 @@ from hashlib import sha1
|
||||
from functools import partial
|
||||
import StringIO
|
||||
import cairo
|
||||
import json
|
||||
|
||||
from gi.repository import GConf
|
||||
from gi.repository import Gtk
|
||||
@ -64,7 +65,6 @@ from gi.repository import GObject
|
||||
import dbus
|
||||
import dbus.service
|
||||
from dbus import PROPERTIES_IFACE
|
||||
import cjson
|
||||
from telepathy.server import DBusProperties
|
||||
from telepathy.interfaces import CHANNEL, \
|
||||
CHANNEL_TYPE_TEXT, \
|
||||
@ -724,8 +724,8 @@ class Activity(Window, Gtk.Container):
|
||||
|
||||
buddies_dict = self._get_buddies()
|
||||
if buddies_dict:
|
||||
self.metadata['buddies_id'] = cjson.encode(buddies_dict.keys())
|
||||
self.metadata['buddies'] = cjson.encode(self._get_buddies())
|
||||
self.metadata['buddies_id'] = json.dumps(buddies_dict.keys())
|
||||
self.metadata['buddies'] = json.dumps(self._get_buddies())
|
||||
|
||||
preview = self.get_preview()
|
||||
if preview is not None:
|
||||
|
@ -29,14 +29,13 @@ from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GdkPixbuf
|
||||
from gi.repository import Rsvg
|
||||
import cairo
|
||||
|
||||
from sugar3.graphics import style
|
||||
from sugar3.graphics.xocolor import XoColor
|
||||
from sugar3.util import LRU
|
||||
|
||||
from gi.repository import SugarExt
|
||||
|
||||
_BADGE_SIZE = 0.45
|
||||
|
||||
|
||||
@ -64,7 +63,7 @@ class _SVGLoader(object):
|
||||
logging.error(
|
||||
'Icon %s, entity %s is invalid.', file_name, entity)
|
||||
|
||||
return SugarExt.RsvgWrapper.new(icon)
|
||||
return Rsvg.Handle.new_from_data(icon)
|
||||
|
||||
|
||||
class _IconInfo(object):
|
||||
@ -260,8 +259,8 @@ class _IconBuffer(object):
|
||||
|
||||
if is_svg:
|
||||
handle = self._load_svg(icon_info.file_name)
|
||||
icon_width = handle.get_width()
|
||||
icon_height = handle.get_height()
|
||||
icon_width = handle.props.width
|
||||
icon_height = handle.props.height
|
||||
else:
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon_info.file_name)
|
||||
icon_width = pixbuf.get_width()
|
||||
|
@ -1,156 +0,0 @@
|
||||
/* rsvg-wrapper.c
|
||||
* Copyright (C) 2011 Raul Gutierrez Segales
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* Wrapper around rsvg while it gets introspection support.
|
||||
*
|
||||
* See: https://bugzilla.gnome.org/show_bug.cgi?id=663049
|
||||
*/
|
||||
|
||||
#include "rsvg-wrapper.h"
|
||||
#include <librsvg/rsvg.h>
|
||||
#include <librsvg/rsvg-cairo.h>
|
||||
|
||||
|
||||
G_DEFINE_TYPE (SugarRsvgWrapper, sugar_rsvg_wrapper, G_TYPE_OBJECT)
|
||||
|
||||
#define RSVG_WRAPPER_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), SUGAR_TYPE_RSVG_WRAPPER, SugarRsvgWrapperPrivate))
|
||||
|
||||
struct _SugarRsvgWrapperPrivate
|
||||
{
|
||||
RsvgHandle *handle;
|
||||
};
|
||||
|
||||
static void
|
||||
sugar_rsvg_wrapper_dispose (GObject *object)
|
||||
{
|
||||
SugarRsvgWrapper *self = SUGAR_RSVG_WRAPPER (object);
|
||||
SugarRsvgWrapperPrivate *priv = self->priv;
|
||||
|
||||
if (priv->handle)
|
||||
rsvg_handle_free (priv->handle);
|
||||
|
||||
G_OBJECT_CLASS (sugar_rsvg_wrapper_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
sugar_rsvg_wrapper_class_init (SugarRsvgWrapperClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (SugarRsvgWrapperPrivate));
|
||||
|
||||
object_class->dispose = sugar_rsvg_wrapper_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
sugar_rsvg_wrapper_init (SugarRsvgWrapper *wrapper)
|
||||
{
|
||||
SugarRsvgWrapperPrivate *priv;
|
||||
|
||||
priv = wrapper->priv = RSVG_WRAPPER_PRIVATE (wrapper);
|
||||
priv->handle = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sugar_rsvg_wrapper_new:
|
||||
* @data: (transfer none) (array length=len): the image data
|
||||
* @len: the length of @data
|
||||
*
|
||||
* Creates a new wrapper object
|
||||
*
|
||||
* Returns: (transfer full): new #SugarRsvgWrapper
|
||||
**/
|
||||
SugarRsvgWrapper*
|
||||
sugar_rsvg_wrapper_new (const guint8 *data,
|
||||
gsize len)
|
||||
{
|
||||
SugarRsvgWrapper* wrapper = g_object_new (SUGAR_TYPE_RSVG_WRAPPER, NULL);
|
||||
SugarRsvgWrapperPrivate *priv;
|
||||
GError *error;
|
||||
|
||||
priv = RSVG_WRAPPER_PRIVATE (wrapper);
|
||||
|
||||
/* My code never fails, hence I don't bother checking
|
||||
* the error after the call - rgs
|
||||
*/
|
||||
priv->handle = rsvg_handle_new_from_data (data, len, &error);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar_rsvg_wrapper_get_width:
|
||||
* @wrapper: an #SugarRsvgWrapper
|
||||
*
|
||||
* Gets the width of the associated RsvgHandle.
|
||||
*
|
||||
* Returns: The width of the wrapped RsvgHandle
|
||||
**/
|
||||
int sugar_rsvg_wrapper_get_width(SugarRsvgWrapper *wrapper)
|
||||
{
|
||||
SugarRsvgWrapperPrivate *priv = RSVG_WRAPPER_PRIVATE (wrapper);
|
||||
RsvgDimensionData dim;
|
||||
|
||||
rsvg_handle_get_dimensions (priv->handle, &dim);
|
||||
return dim.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar_rsvg_wrapper_get_height:
|
||||
* @wrapper: an #SugarRsvgWrapper
|
||||
*
|
||||
* Gets the height of the associated RsvgHandle.
|
||||
*
|
||||
* Returns: The height of the wrapped RsvgHandle
|
||||
**/
|
||||
int sugar_rsvg_wrapper_get_height(SugarRsvgWrapper *wrapper)
|
||||
{
|
||||
SugarRsvgWrapperPrivate *priv = RSVG_WRAPPER_PRIVATE (wrapper);
|
||||
RsvgDimensionData dim;
|
||||
|
||||
rsvg_handle_get_dimensions (priv->handle, &dim);
|
||||
return dim.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar_rsvg_wrapper_render_cairo:
|
||||
* @wrapper: an #SugarRsvgWrapper
|
||||
* @cr: the cairo region
|
||||
*
|
||||
**/
|
||||
void sugar_rsvg_wrapper_render_cairo(SugarRsvgWrapper *wrapper, cairo_t * cr)
|
||||
{
|
||||
SugarRsvgWrapperPrivate *priv = RSVG_WRAPPER_PRIVATE (wrapper);
|
||||
rsvg_handle_render_cairo (priv->handle, cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* sugar_rsvg_wrapper_get_pixbuf:
|
||||
* @wrapper: an #SugarRsvgWrapper
|
||||
*
|
||||
* Returns: (transfer full): the #GdkPixbuf
|
||||
**/
|
||||
GdkPixbuf *sugar_rsvg_wrapper_get_pixbuf(SugarRsvgWrapper *wrapper)
|
||||
{
|
||||
SugarRsvgWrapperPrivate *priv = RSVG_WRAPPER_PRIVATE (wrapper);
|
||||
return rsvg_handle_get_pixbuf (priv->handle);
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/* rsvg-wrapper.h
|
||||
* Copyright (C) 2011 Raul Gutierrez Segales
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RSVG_WRAPPER_H__
|
||||
#define __RSVG_WRAPPER_H__
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SUGAR_TYPE_RSVG_WRAPPER sugar_rsvg_wrapper_get_type ()
|
||||
|
||||
#define SUGAR_RSVG_WRAPPER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), SUGAR_TYPE_RSVG_WRAPPER, SugarRsvgWrapper))
|
||||
|
||||
#define SUGAR_RSVG_WRAPPER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), SUGAR_TYPE_RSVG_WRAPPER, SugarRsvgWrapperClass))
|
||||
|
||||
#define SUGAR_IS_RSVG_WRAPPER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUGAR_TYPE_RSVG_WRAPPER))
|
||||
|
||||
#define SUGAR_IS_RSVG_WRAPPER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), SUGAR_TYPE_RSVG_WRAPPER))
|
||||
|
||||
#define SUGAR_RSVG_WRAPPER_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), SUGAR_TYPE_RSVG_WRAPPER, SugarRsvgWrapperClass))
|
||||
|
||||
typedef struct _SugarRsvgWrapper SugarRsvgWrapper;
|
||||
typedef struct _SugarRsvgWrapperClass SugarRsvgWrapperClass;
|
||||
typedef struct _SugarRsvgWrapperPrivate SugarRsvgWrapperPrivate;
|
||||
|
||||
struct _SugarRsvgWrapper
|
||||
{
|
||||
GObject parent;
|
||||
SugarRsvgWrapperPrivate *priv;
|
||||
};
|
||||
|
||||
struct _SugarRsvgWrapperClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType sugar_rsvg_wrapper_get_type (void);
|
||||
|
||||
SugarRsvgWrapper* sugar_rsvg_wrapper_new (const guint8 *data, gsize len);
|
||||
int sugar_rsvg_wrapper_load(SugarRsvgWrapper *wrapper);
|
||||
int sugar_rsvg_wrapper_get_width(SugarRsvgWrapper *wrapper);
|
||||
int sugar_rsvg_wrapper_get_height(SugarRsvgWrapper *wrapper);
|
||||
void sugar_rsvg_wrapper_render_cairo(SugarRsvgWrapper *wrapper, cairo_t * cr);
|
||||
GdkPixbuf * sugar_rsvg_wrapper_get_pixbuf(SugarRsvgWrapper *wrapper);
|
||||
|
||||
#endif /* __RSVG_WRAPPER_H__ */
|
Loading…
Reference in New Issue
Block a user