Merge St.TextureCache and Shell.TextureCache
Brute force merge these two by essentially replacing St.TextureCache with a (renamed) Shell.TextureCache. One function was added for convenience, namely "st_texture_cache_load_file_simple". St.TextureCache had a function to load a texture from a filename, and it returned NULL on error but only half the callers actually checked this. This function is better. https://bugzilla.gnome.org/show_bug.cgi?id=607500
This commit is contained in:
parent
aa7de264e6
commit
22948b3d39
@ -59,10 +59,10 @@ AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
|
|||||||
PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 gtk+-2.0 dbus-glib-1 mutter-plugins >= 2.29.0
|
PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 gtk+-2.0 dbus-glib-1 mutter-plugins >= 2.29.0
|
||||||
gjs-gi-1.0 libgnome-menu $recorder_modules gconf-2.0
|
gjs-gi-1.0 libgnome-menu $recorder_modules gconf-2.0
|
||||||
gdk-x11-2.0 clutter-x11-1.0 clutter-glx-1.0
|
gdk-x11-2.0 clutter-x11-1.0 clutter-glx-1.0
|
||||||
gnome-desktop-2.0 >= 2.26 libstartup-notification-1.0
|
libstartup-notification-1.0
|
||||||
gobject-introspection-1.0 >= 0.6.5)
|
gobject-introspection-1.0 >= 0.6.5)
|
||||||
PKG_CHECK_MODULES(TIDY, clutter-1.0)
|
PKG_CHECK_MODULES(TIDY, clutter-1.0)
|
||||||
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-2.0 libcroco-0.6)
|
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-2.0 libcroco-0.6 gnome-desktop-2.0 >= 2.26)
|
||||||
PKG_CHECK_MODULES(BIG, clutter-1.0 gtk+-2.0 librsvg-2.0)
|
PKG_CHECK_MODULES(BIG, clutter-1.0 gtk+-2.0 librsvg-2.0)
|
||||||
PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-2.0)
|
PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-2.0)
|
||||||
PKG_CHECK_MODULES(TRAY, gtk+-2.0)
|
PKG_CHECK_MODULES(TRAY, gtk+-2.0)
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
const Shell = imports.gi.Shell;
|
|
||||||
|
|
||||||
|
const St = imports.gi.St;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const Search = imports.ui.search;
|
const Search = imports.ui.search;
|
||||||
@ -30,7 +31,7 @@ DocInfo.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
createIcon : function(size) {
|
createIcon : function(size) {
|
||||||
return Shell.TextureCache.get_default().load_recent_thumbnail(size, this.recentInfo);
|
return St.TextureCache.get_default().load_recent_thumbnail(size, this.recentInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
launch : function() {
|
launch : function() {
|
||||||
|
@ -694,7 +694,7 @@ AppIconMenu.prototype = {
|
|||||||
this._windowContainer.show();
|
this._windowContainer.show();
|
||||||
|
|
||||||
let iconsDiffer = false;
|
let iconsDiffer = false;
|
||||||
let texCache = Shell.TextureCache.get_default();
|
let texCache = St.TextureCache.get_default();
|
||||||
if (windows.length > 0) {
|
if (windows.length > 0) {
|
||||||
let firstIcon = windows[0].mini_icon;
|
let firstIcon = windows[0].mini_icon;
|
||||||
for (let i = 1; i < windows.length; i++) {
|
for (let i = 1; i < windows.length; i++) {
|
||||||
|
@ -268,11 +268,11 @@ SearchEntry.prototype = {
|
|||||||
box.append(this._iconBox, Big.BoxPackFlags.END);
|
box.append(this._iconBox, Big.BoxPackFlags.END);
|
||||||
|
|
||||||
let magnifierUri = "file://" + global.imagedir + "magnifier.svg";
|
let magnifierUri = "file://" + global.imagedir + "magnifier.svg";
|
||||||
this._magnifierIcon = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
|
this._magnifierIcon = St.TextureCache.get_default().load_uri_sync(St.TextureCachePolicy.FOREVER,
|
||||||
magnifierUri, 18, 18);
|
magnifierUri, 18, 18);
|
||||||
let closeUri = "file://" + global.imagedir + "close-black.svg";
|
let closeUri = "file://" + global.imagedir + "close-black.svg";
|
||||||
this._closeIcon = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
|
this._closeIcon = St.TextureCache.get_default().load_uri_sync(St.TextureCachePolicy.FOREVER,
|
||||||
closeUri, 18, 18);
|
closeUri, 18, 18);
|
||||||
this._closeIcon.reactive = true;
|
this._closeIcon.reactive = true;
|
||||||
this._closeIcon.connect('button-press-event', Lang.bind(this, function () {
|
this._closeIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||||
// Resetting this.entry.text will trigger notify::text signal which will
|
// Resetting this.entry.text will trigger notify::text signal which will
|
||||||
|
@ -85,8 +85,8 @@ DocDisplayItem.prototype = {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.NONE,
|
return St.TextureCache.get_default().load_uri_sync(St.TextureCachePolicy.NONE,
|
||||||
this._docInfo.uri, -1, -1);
|
this._docInfo.uri, -1, -1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// An exception will be raised when the image format isn't know
|
// An exception will be raised when the image format isn't know
|
||||||
/* FIXME: http://bugzilla.gnome.org/show_bug.cgi?id=591480: should
|
/* FIXME: http://bugzilla.gnome.org/show_bug.cgi?id=591480: should
|
||||||
|
@ -484,8 +484,8 @@ LookingGlass.prototype = {
|
|||||||
|
|
||||||
let toolbar = new St.BoxLayout({ name: "Toolbar" });
|
let toolbar = new St.BoxLayout({ name: "Toolbar" });
|
||||||
this.actor.add_actor(toolbar);
|
this.actor.add_actor(toolbar);
|
||||||
let inspectIcon = Shell.TextureCache.get_default().load_gicon(new Gio.ThemedIcon({ name: 'gtk-color-picker' }),
|
let inspectIcon = St.TextureCache.get_default().load_gicon(new Gio.ThemedIcon({ name: 'gtk-color-picker' }),
|
||||||
24);
|
24);
|
||||||
toolbar.add_actor(inspectIcon);
|
toolbar.add_actor(inspectIcon);
|
||||||
inspectIcon.reactive = true;
|
inspectIcon.reactive = true;
|
||||||
inspectIcon.connect('button-press-event', Lang.bind(this, function () {
|
inspectIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||||
|
@ -318,7 +318,7 @@ Source.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
createIcon: function(size) {
|
createIcon: function(size) {
|
||||||
let textureCache = Shell.TextureCache.get_default();
|
let textureCache = St.TextureCache.get_default();
|
||||||
|
|
||||||
if (this._icon) {
|
if (this._icon) {
|
||||||
if (this._icon.substr(0, 7) == 'file://')
|
if (this._icon.substr(0, 7) == 'file://')
|
||||||
|
@ -77,7 +77,7 @@ PlaceDeviceInfo.prototype = {
|
|||||||
|
|
||||||
iconFactory: function(size) {
|
iconFactory: function(size) {
|
||||||
let icon = this._mount.get_icon();
|
let icon = this._mount.get_icon();
|
||||||
return Shell.TextureCache.get_default().load_gicon(icon, size);
|
return St.TextureCache.get_default().load_gicon(icon, size);
|
||||||
},
|
},
|
||||||
|
|
||||||
launch: function() {
|
launch: function() {
|
||||||
@ -122,7 +122,7 @@ PlacesManager.prototype = {
|
|||||||
let homeIcon = Shell.util_get_icon_for_uri (homeUri);
|
let homeIcon = Shell.util_get_icon_for_uri (homeUri);
|
||||||
this._home = new PlaceInfo('special:home', homeLabel,
|
this._home = new PlaceInfo('special:home', homeLabel,
|
||||||
function(size) {
|
function(size) {
|
||||||
return Shell.TextureCache.get_default().load_gicon(homeIcon, size);
|
return St.TextureCache.get_default().load_gicon(homeIcon, size);
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
Gio.app_info_launch_default_for_uri(homeUri, global.create_app_launch_context());
|
Gio.app_info_launch_default_for_uri(homeUri, global.create_app_launch_context());
|
||||||
@ -135,7 +135,7 @@ PlacesManager.prototype = {
|
|||||||
let desktopIcon = Shell.util_get_icon_for_uri (desktopUri);
|
let desktopIcon = Shell.util_get_icon_for_uri (desktopUri);
|
||||||
this._desktopMenu = new PlaceInfo('special:desktop', desktopLabel,
|
this._desktopMenu = new PlaceInfo('special:desktop', desktopLabel,
|
||||||
function(size) {
|
function(size) {
|
||||||
return Shell.TextureCache.get_default().load_gicon(desktopIcon, size);
|
return St.TextureCache.get_default().load_gicon(desktopIcon, size);
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
Gio.app_info_launch_default_for_uri(desktopUri, global.create_app_launch_context());
|
Gio.app_info_launch_default_for_uri(desktopUri, global.create_app_launch_context());
|
||||||
@ -143,7 +143,7 @@ PlacesManager.prototype = {
|
|||||||
|
|
||||||
this._connect = new PlaceInfo('special:connect', _("Connect to..."),
|
this._connect = new PlaceInfo('special:connect', _("Connect to..."),
|
||||||
function (size) {
|
function (size) {
|
||||||
return Shell.TextureCache.get_default().load_icon_name("applications-internet", size);
|
return St.TextureCache.get_default().load_icon_name("applications-internet", size);
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
new Shell.Process({ args: ['nautilus-connect-server'] }).run();
|
new Shell.Process({ args: ['nautilus-connect-server'] }).run();
|
||||||
@ -310,7 +310,7 @@ PlacesManager.prototype = {
|
|||||||
|
|
||||||
let item = new PlaceInfo('bookmark:' + bookmark, label,
|
let item = new PlaceInfo('bookmark:' + bookmark, label,
|
||||||
function(size) {
|
function(size) {
|
||||||
return Shell.TextureCache.get_default().load_gicon(icon, size);
|
return St.TextureCache.get_default().load_gicon(icon, size);
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
Gio.app_info_launch_default_for_uri(bookmark, global.create_app_launch_context());
|
Gio.app_info_launch_default_for_uri(bookmark, global.create_app_launch_context());
|
||||||
@ -414,7 +414,7 @@ DashPlaceDisplayItem.prototype = {
|
|||||||
this.actor.append(text, Big.BoxPackFlags.EXPAND);
|
this.actor.append(text, Big.BoxPackFlags.EXPAND);
|
||||||
|
|
||||||
if (info.isRemovable()) {
|
if (info.isRemovable()) {
|
||||||
let removeIcon = Shell.TextureCache.get_default().load_icon_name ('media-eject', PLACES_ICON_SIZE);
|
let removeIcon = St.TextureCache.get_default().load_icon_name ('media-eject', PLACES_ICON_SIZE);
|
||||||
let removeIconBox = new St.Button({ child: removeIcon,
|
let removeIconBox = new St.Button({ child: removeIcon,
|
||||||
reactive: true });
|
reactive: true });
|
||||||
this.actor.append(removeIconBox, Big.BoxPackFlags.NONE);
|
this.actor.append(removeIconBox, Big.BoxPackFlags.NONE);
|
||||||
|
@ -7,9 +7,9 @@ const GLib = imports.gi.GLib;
|
|||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
|
const St = imports.gi.St;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
|
||||||
const Gettext = imports.gettext.domain('gnome-shell');
|
const Gettext = imports.gettext.domain('gnome-shell');
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ StatusMenu.prototype = {
|
|||||||
this._iconBox = new St.Bin();
|
this._iconBox = new St.Bin();
|
||||||
this.actor.add(this._iconBox, { y_align: St.Align.MIDDLE });
|
this.actor.add(this._iconBox, { y_align: St.Align.MIDDLE });
|
||||||
|
|
||||||
let textureCache = Shell.TextureCache.get_default();
|
let textureCache = St.TextureCache.get_default();
|
||||||
// FIXME: these icons are all wrong (likewise in createSubMenu)
|
// FIXME: these icons are all wrong (likewise in createSubMenu)
|
||||||
this._availableIcon = textureCache.load_icon_name('gtk-yes', 16);
|
this._availableIcon = textureCache.load_icon_name('gtk-yes', 16);
|
||||||
this._busyIcon = textureCache.load_icon_name('gtk-no', 16);
|
this._busyIcon = textureCache.load_icon_name('gtk-no', 16);
|
||||||
|
@ -90,8 +90,6 @@ libgnome_shell_la_SOURCES = \
|
|||||||
shell-stack.h \
|
shell-stack.h \
|
||||||
shell-tray-manager.c \
|
shell-tray-manager.c \
|
||||||
shell-tray-manager.h \
|
shell-tray-manager.h \
|
||||||
shell-texture-cache.c \
|
|
||||||
shell-texture-cache.h \
|
|
||||||
shell-uri-util.c \
|
shell-uri-util.c \
|
||||||
shell-uri-util.h \
|
shell-uri-util.h \
|
||||||
shell-window-tracker.c \
|
shell-window-tracker.c \
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "shell-app-private.h"
|
#include "shell-app-private.h"
|
||||||
#include "shell-global.h"
|
#include "shell-global.h"
|
||||||
#include "shell-texture-cache.h"
|
#include "st/st-texture-cache.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
#define GMENU_I_KNOW_THIS_IS_UNSTABLE
|
#define GMENU_I_KNOW_THIS_IS_UNSTABLE
|
||||||
@ -1100,9 +1100,9 @@ shell_app_info_create_icon_texture (ShellAppInfo *info, float size)
|
|||||||
|
|
||||||
if (info->type == SHELL_APP_INFO_TYPE_WINDOW)
|
if (info->type == SHELL_APP_INFO_TYPE_WINDOW)
|
||||||
{
|
{
|
||||||
return shell_texture_cache_bind_pixbuf_property (shell_texture_cache_get_default (),
|
return st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
|
||||||
G_OBJECT (info->window),
|
G_OBJECT (info->window),
|
||||||
"icon");
|
"icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
icon = shell_app_info_get_icon (info);
|
icon = shell_app_info_get_icon (info);
|
||||||
@ -1113,7 +1113,7 @@ shell_app_info_create_icon_texture (ShellAppInfo *info, float size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = shell_texture_cache_load_gicon (shell_texture_cache_get_default (), icon, (int)size);
|
ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), icon, (int)size);
|
||||||
g_object_unref (icon);
|
g_object_unref (icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "shell-doc-system.h"
|
#include "shell-doc-system.h"
|
||||||
|
|
||||||
#include "shell-global.h"
|
#include "shell-global.h"
|
||||||
#include "shell-texture-cache.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,100 +0,0 @@
|
|||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
||||||
#ifndef __SHELL_TEXTURE_CACHE_H__
|
|
||||||
#define __SHELL_TEXTURE_CACHE_H__
|
|
||||||
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
|
|
||||||
#define SHELL_TYPE_TEXTURE_CACHE (shell_texture_cache_get_type ())
|
|
||||||
#define SHELL_TEXTURE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_TEXTURE_CACHE, ShellTextureCache))
|
|
||||||
#define SHELL_TEXTURE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_TEXTURE_CACHE, ShellTextureCacheClass))
|
|
||||||
#define SHELL_IS_TEXTURE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_TEXTURE_CACHE))
|
|
||||||
#define SHELL_IS_TEXTURE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_TEXTURE_CACHE))
|
|
||||||
#define SHELL_TEXTURE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_TEXTURE_CACHE, ShellTextureCacheClass))
|
|
||||||
|
|
||||||
typedef struct _ShellTextureCache ShellTextureCache;
|
|
||||||
typedef struct _ShellTextureCacheClass ShellTextureCacheClass;
|
|
||||||
|
|
||||||
typedef struct _ShellTextureCachePrivate ShellTextureCachePrivate;
|
|
||||||
|
|
||||||
struct _ShellTextureCache
|
|
||||||
{
|
|
||||||
GObject parent;
|
|
||||||
|
|
||||||
ShellTextureCachePrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ShellTextureCacheClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SHELL_TEXTURE_CACHE_POLICY_NONE,
|
|
||||||
SHELL_TEXTURE_CACHE_POLICY_FOREVER
|
|
||||||
} ShellTextureCachePolicy;
|
|
||||||
|
|
||||||
GType shell_texture_cache_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
ShellTextureCache* shell_texture_cache_get_default (void);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_bind_pixbuf_property (ShellTextureCache *cache,
|
|
||||||
GObject *object,
|
|
||||||
const char *property_name);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_icon_name (ShellTextureCache *cache,
|
|
||||||
const char *name,
|
|
||||||
gint size);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_gicon (ShellTextureCache *cache,
|
|
||||||
GIcon *icon,
|
|
||||||
gint size);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_thumbnail (ShellTextureCache *cache,
|
|
||||||
int size,
|
|
||||||
const char *uri,
|
|
||||||
const char *mimetype);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_recent_thumbnail (ShellTextureCache *cache,
|
|
||||||
int size,
|
|
||||||
GtkRecentInfo *info);
|
|
||||||
|
|
||||||
void shell_texture_cache_evict_thumbnail (ShellTextureCache *cache,
|
|
||||||
const char *uri);
|
|
||||||
|
|
||||||
void shell_texture_cache_evict_recent_thumbnail (ShellTextureCache *cache,
|
|
||||||
GtkRecentInfo *info);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_uri_async (ShellTextureCache *cache,
|
|
||||||
const gchar *filename,
|
|
||||||
int available_width,
|
|
||||||
int available_height);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_uri_sync (ShellTextureCache *cache,
|
|
||||||
ShellTextureCachePolicy policy,
|
|
||||||
const gchar *filename,
|
|
||||||
int available_width,
|
|
||||||
int available_height,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
ClutterActor *shell_texture_cache_load_from_data (ShellTextureCache *cache,
|
|
||||||
const guchar *data,
|
|
||||||
gsize len,
|
|
||||||
int size,
|
|
||||||
GError **error);
|
|
||||||
ClutterActor *shell_texture_cache_load_from_raw (ShellTextureCache *cache,
|
|
||||||
const guchar *data,
|
|
||||||
gsize len,
|
|
||||||
gboolean has_alpha,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
int rowstride,
|
|
||||||
int size,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean shell_texture_cache_pixbuf_equal (ShellTextureCache *cache, GdkPixbuf *a, GdkPixbuf *b);
|
|
||||||
|
|
||||||
#endif /* __SHELL_TEXTURE_CACHE_H__ */
|
|
@ -16,7 +16,7 @@
|
|||||||
#include "shell-window-tracker.h"
|
#include "shell-window-tracker.h"
|
||||||
#include "shell-app-system.h"
|
#include "shell-app-system.h"
|
||||||
#include "shell-app-private.h"
|
#include "shell-app-private.h"
|
||||||
#include "shell-texture-cache.h"
|
#include "st/st-texture-cache.h"
|
||||||
#include "shell-global.h"
|
#include "shell-global.h"
|
||||||
#include "shell-marshal.h"
|
#include "shell-marshal.h"
|
||||||
|
|
||||||
@ -847,8 +847,8 @@ shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
themed = g_themed_icon_new (icon_name);
|
themed = g_themed_icon_new (icon_name);
|
||||||
texture = shell_texture_cache_load_gicon (shell_texture_cache_get_default (),
|
texture = st_texture_cache_load_gicon (st_texture_cache_get_default (),
|
||||||
themed, size);
|
themed, size);
|
||||||
g_object_unref (G_OBJECT (themed));
|
g_object_unref (G_OBJECT (themed));
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
@ -842,9 +842,7 @@ _st_entry_set_icon_from_file (StEntry *entry,
|
|||||||
|
|
||||||
cache = st_texture_cache_get_default ();
|
cache = st_texture_cache_get_default ();
|
||||||
|
|
||||||
|
*icon = (ClutterActor*) st_texture_cache_load_file_simple (cache, filename);
|
||||||
|
|
||||||
*icon = (ClutterActor*) st_texture_cache_get_texture (cache, filename);
|
|
||||||
|
|
||||||
clutter_actor_set_reactive (*icon, TRUE);
|
clutter_actor_set_reactive (*icon, TRUE);
|
||||||
clutter_actor_set_parent (*icon, CLUTTER_ACTOR (entry));
|
clutter_actor_set_parent (*icon, CLUTTER_ACTOR (entry));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,96 +1,103 @@
|
|||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||||
/*
|
#ifndef __ST_TEXTURE_CACHE_H__
|
||||||
* st-texture-cache.h: Cached textures object
|
#define __ST_TEXTURE_CACHE_H__
|
||||||
*
|
|
||||||
* Copyright 2007 OpenedHand
|
|
||||||
* Copyright 2009 Intel Corporation.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU Lesser General Public License,
|
|
||||||
* version 2.1, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope 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 Lesser General Public License
|
|
||||||
* along with this program; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
|
#include <gio/gio.h>
|
||||||
#error "Only <st/st.h> can be included directly.h"
|
#include <gtk/gtk.h>
|
||||||
#endif
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#ifndef _ST_TEXTURE_CACHE
|
|
||||||
#define _ST_TEXTURE_CACHE
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
#define ST_TYPE_TEXTURE_CACHE (st_texture_cache_get_type ())
|
||||||
|
#define ST_TEXTURE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ST_TYPE_TEXTURE_CACHE, StTextureCache))
|
||||||
|
#define ST_TEXTURE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ST_TYPE_TEXTURE_CACHE, StTextureCacheClass))
|
||||||
|
#define ST_IS_TEXTURE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ST_TYPE_TEXTURE_CACHE))
|
||||||
|
#define ST_IS_TEXTURE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ST_TYPE_TEXTURE_CACHE))
|
||||||
|
#define ST_TEXTURE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ST_TYPE_TEXTURE_CACHE, StTextureCacheClass))
|
||||||
|
|
||||||
#define ST_TYPE_TEXTURE_CACHE st_texture_cache_get_type()
|
typedef struct _StTextureCache StTextureCache;
|
||||||
|
typedef struct _StTextureCacheClass StTextureCacheClass;
|
||||||
|
|
||||||
#define ST_TEXTURE_CACHE(obj) \
|
typedef struct _StTextureCachePrivate StTextureCachePrivate;
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
|
||||||
ST_TYPE_TEXTURE_CACHE, StTextureCache))
|
|
||||||
|
|
||||||
#define ST_TEXTURE_CACHE_CLASS(klass) \
|
struct _StTextureCache
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
{
|
||||||
ST_TYPE_TEXTURE_CACHE, StTextureCacheClass))
|
GObject parent;
|
||||||
|
|
||||||
#define ST_IS_TEXTURE_CACHE(obj) \
|
StTextureCachePrivate *priv;
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
};
|
||||||
ST_TYPE_TEXTURE_CACHE))
|
|
||||||
|
|
||||||
#define ST_IS_TEXTURE_CACHE_CLASS(klass) \
|
struct _StTextureCacheClass
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
{
|
||||||
ST_TYPE_TEXTURE_CACHE))
|
|
||||||
|
|
||||||
#define ST_TEXTURE_CACHE_GET_CLASS(obj) \
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
|
||||||
ST_TYPE_TEXTURE_CACHE, StTextureCacheClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* StTextureCache:
|
|
||||||
*
|
|
||||||
* The contents of this structure are private and should only be accessed
|
|
||||||
* through the public API.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/*< private >*/
|
|
||||||
GObject parent;
|
|
||||||
} StTextureCache;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
void (* loaded) (StTextureCache *self,
|
};
|
||||||
const gchar *path,
|
|
||||||
ClutterTexture *texture);
|
|
||||||
|
|
||||||
void (* error_loading) (StTextureCache *self,
|
typedef enum {
|
||||||
GError *error);
|
ST_TEXTURE_CACHE_POLICY_NONE,
|
||||||
} StTextureCacheClass;
|
ST_TEXTURE_CACHE_POLICY_FOREVER
|
||||||
|
} StTextureCachePolicy;
|
||||||
|
|
||||||
GType st_texture_cache_get_type (void);
|
GType st_texture_cache_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
StTextureCache* st_texture_cache_get_default (void);
|
StTextureCache* st_texture_cache_get_default (void);
|
||||||
|
|
||||||
ClutterTexture* st_texture_cache_get_texture (StTextureCache *self,
|
ClutterActor *st_texture_cache_bind_pixbuf_property (StTextureCache *cache,
|
||||||
const gchar *path);
|
GObject *object,
|
||||||
ClutterActor* st_texture_cache_get_actor (StTextureCache *self,
|
const char *property_name);
|
||||||
const gchar *path);
|
|
||||||
|
|
||||||
gint st_texture_cache_get_size (StTextureCache *self);
|
ClutterActor *st_texture_cache_load_icon_name (StTextureCache *cache,
|
||||||
|
const char *name,
|
||||||
|
gint size);
|
||||||
|
|
||||||
void st_texture_cache_load_cache (StTextureCache *self,
|
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
|
||||||
const char *filename);
|
GIcon *icon,
|
||||||
|
gint size);
|
||||||
|
|
||||||
G_END_DECLS
|
ClutterActor *st_texture_cache_load_thumbnail (StTextureCache *cache,
|
||||||
|
int size,
|
||||||
|
const char *uri,
|
||||||
|
const char *mimetype);
|
||||||
|
|
||||||
#endif /* _ST_TEXTURE_CACHE */
|
ClutterActor *st_texture_cache_load_recent_thumbnail (StTextureCache *cache,
|
||||||
|
int size,
|
||||||
|
GtkRecentInfo *info);
|
||||||
|
|
||||||
|
void st_texture_cache_evict_thumbnail (StTextureCache *cache,
|
||||||
|
const char *uri);
|
||||||
|
|
||||||
|
void st_texture_cache_evict_recent_thumbnail (StTextureCache *cache,
|
||||||
|
GtkRecentInfo *info);
|
||||||
|
|
||||||
|
ClutterActor *st_texture_cache_load_uri_async (StTextureCache *cache,
|
||||||
|
const gchar *filename,
|
||||||
|
int available_width,
|
||||||
|
int available_height);
|
||||||
|
|
||||||
|
ClutterActor *st_texture_cache_load_uri_sync (StTextureCache *cache,
|
||||||
|
StTextureCachePolicy policy,
|
||||||
|
const gchar *filename,
|
||||||
|
int available_width,
|
||||||
|
int available_height,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
ClutterActor *st_texture_cache_load_file_simple (StTextureCache *cache,
|
||||||
|
const gchar *file_path);
|
||||||
|
|
||||||
|
ClutterActor *st_texture_cache_load_from_data (StTextureCache *cache,
|
||||||
|
const guchar *data,
|
||||||
|
gsize len,
|
||||||
|
int size,
|
||||||
|
GError **error);
|
||||||
|
ClutterActor *st_texture_cache_load_from_raw (StTextureCache *cache,
|
||||||
|
const guchar *data,
|
||||||
|
gsize len,
|
||||||
|
gboolean has_alpha,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int rowstride,
|
||||||
|
int size,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
gboolean st_texture_cache_pixbuf_equal (StTextureCache *cache, GdkPixbuf *a, GdkPixbuf *b);
|
||||||
|
|
||||||
|
#endif /* __ST_TEXTURE_CACHE_H__ */
|
||||||
|
@ -905,8 +905,8 @@ st_widget_real_style_changed (StWidget *self)
|
|||||||
/* `border-image' takes precedence over `background-image'.
|
/* `border-image' takes precedence over `background-image'.
|
||||||
* Firefox lets the background-image shine thru when border-image has
|
* Firefox lets the background-image shine thru when border-image has
|
||||||
* alpha an channel, maybe that would be an option for the future. */
|
* alpha an channel, maybe that would be an option for the future. */
|
||||||
texture = st_texture_cache_get_texture (texture_cache,
|
texture = (ClutterTexture*) st_texture_cache_load_file_simple (texture_cache,
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
clutter_texture_get_base_size (CLUTTER_TEXTURE (texture),
|
clutter_texture_get_base_size (CLUTTER_TEXTURE (texture),
|
||||||
&width, &height);
|
&width, &height);
|
||||||
@ -968,16 +968,8 @@ st_widget_real_style_changed (StWidget *self)
|
|||||||
bg_file = st_theme_node_get_background_image (theme_node);
|
bg_file = st_theme_node_get_background_image (theme_node);
|
||||||
if (bg_file != NULL)
|
if (bg_file != NULL)
|
||||||
{
|
{
|
||||||
texture = st_texture_cache_get_texture (texture_cache, bg_file);
|
priv->background_image = st_texture_cache_load_file_simple (texture_cache, bg_file);
|
||||||
priv->background_image = (ClutterActor*) texture;
|
clutter_actor_set_parent (priv->background_image, CLUTTER_ACTOR (self));
|
||||||
|
|
||||||
if (priv->background_image != NULL)
|
|
||||||
{
|
|
||||||
clutter_actor_set_parent (priv->background_image,
|
|
||||||
CLUTTER_ACTOR (self));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_warning ("Could not load %s", bg_file);
|
|
||||||
|
|
||||||
has_changed = TRUE;
|
has_changed = TRUE;
|
||||||
relayout_needed = TRUE;
|
relayout_needed = TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user