summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/gtk/IconGtk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/gtk/IconGtk.cpp')
-rw-r--r--WebCore/platform/graphics/gtk/IconGtk.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/gtk/IconGtk.cpp b/WebCore/platform/graphics/gtk/IconGtk.cpp
index c6e9a14..d8b38a0 100644
--- a/WebCore/platform/graphics/gtk/IconGtk.cpp
+++ b/WebCore/platform/graphics/gtk/IconGtk.cpp
@@ -43,12 +43,11 @@ namespace WebCore {
Icon::Icon()
: m_icon(0)
{
- notImplemented();
}
Icon::~Icon()
{
- if(m_icon)
+ if (m_icon)
g_object_unref(m_icon);
}
@@ -89,7 +88,7 @@ static String lookupIconName(String MIMEType)
return GTK_STOCK_FILE;
}
-PassRefPtr<Icon> Icon::newIconForFile(const String& filename)
+PassRefPtr<Icon> Icon::createIconForFile(const String& filename)
{
if (!g_path_skip_root(filename.utf8().data()))
return 0;
@@ -97,13 +96,24 @@ PassRefPtr<Icon> Icon::newIconForFile(const String& filename)
String MIMEType = MIMETypeRegistry::getMIMETypeForPath(filename);
String iconName = lookupIconName(MIMEType);
- Icon* icon = new Icon;
+ RefPtr<Icon> icon = adoptRef(new Icon);
icon->m_icon = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), iconName.utf8().data(), 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- return icon->m_icon ? icon : 0;
+ if (!icon->m_icon)
+ return 0;
+ return icon.release();
+}
+
+PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
+{
+ //FIXME: Implement this
+ return 0;
}
void Icon::paint(GraphicsContext* context, const IntRect& rect)
{
+ if (context->paintingDisabled())
+ return;
+
// TODO: Scale/clip the image if necessary.
cairo_t* cr = context->platformContext();
cairo_save(cr);