fix fallbacks not being used and remove the new ones

This commit is contained in:
Tom Beckmann 2014-06-15 20:36:39 +02:00
parent 0e77abb21f
commit 3aaa42dc90
2 changed files with 4 additions and 40 deletions

View File

@ -74,7 +74,7 @@ namespace Gala
/**
* returns a pixbuf for the application of this window or a default icon
**/
public static Gdk.Pixbuf? get_icon_for_window (Meta.Window window, int size)
public static Gdk.Pixbuf get_icon_for_window (Meta.Window window, int size)
{
Gdk.Pixbuf? result = null;
@ -85,9 +85,6 @@ namespace Gala
return result;
var app = Bamf.Matcher.get_default ().get_application_for_xid (xid);
if (app == null)
return null;
result = get_icon_for_application (app, size);
xid_pixbuf_cache.set (xid_key, result);

View File

@ -4,12 +4,6 @@ namespace Gala
{
class WindowIcon : Actor
{
static Gdk.Pixbuf? app_fallback_icon_64 = null;
static Gdk.Pixbuf? app_fallback_icon_22 = null;
static Gdk.Pixbuf? app_fallback_icon_16 = null;
static bool fallback_attempted_loading = false;
static const string FALLBACK_ICON = "application-default-icon";
public Meta.Window window { get; construct; }
int _icon_size;
@ -82,17 +76,6 @@ namespace Gala
set_pivot_point (0.5f, 0.5f);
set_easing_mode (AnimationMode.EASE_OUT_ELASTIC);
set_easing_duration (800);
if (!fallback_attempted_loading) {
fallback_attempted_loading = true;
try {
app_fallback_icon_64 = Gtk.IconTheme.get_default ().load_icon (FALLBACK_ICON, 64, 0);
app_fallback_icon_22 = Gtk.IconTheme.get_default ().load_icon (FALLBACK_ICON, 22, 0);
app_fallback_icon_16 = Gtk.IconTheme.get_default ().load_icon (FALLBACK_ICON, 16, 0);
} catch (Error e) {
warning (e.message);
}
}
}
public void place (float x, float y, int size)
@ -118,25 +101,9 @@ namespace Gala
new_icon.opacity = 0;
var pixbuf = Utils.get_icon_for_window (window, icon_size);
if (pixbuf == null) {
switch (icon_size) {
case 16:
pixbuf = app_fallback_icon_16;
break;
case 22:
pixbuf = app_fallback_icon_22;
break;
case 64:
pixbuf = app_fallback_icon_64;
break;
}
}
if (pixbuf != null) {
try {
new_icon.set_from_pixbuf (pixbuf);
} catch (Error e) {}
}
try {
new_icon.set_from_pixbuf (pixbuf);
} catch (Error e) {}
add_child (new_icon);