summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2003-01-31 16:31:46 +0000
committerBastien Nocera <hadess@src.gnome.org>2003-01-31 16:31:46 +0000
commit73eaa7d2fcf2afaa2443cdce0773f741cd8d5496 (patch)
tree7abd94e810a080dfe3098b81e08e1dda8fc5e1f8 /src
parent96edeb2ee45f134b149f4bf39da0c633cff0ee27 (diff)
downloadtotem-73eaa7d2fcf2afaa2443cdce0773f741cd8d5496.tar.gz
update recent-files stuff from libegg, we can now unmount CDs that have
2003-01-31 Bastien Nocera <hadess@hadess.net> * src/egg-recent-model.c: (egg_recent_model_changed): * src/egg-recent-util.c: (load_icon_file): * src/egg-recent-view-gtk.c: (egg_recent_view_gtk_init): update recent-files stuff from libegg, we can now unmount CDs that have stuff in the recent-files
Diffstat (limited to 'src')
-rw-r--r--src/egg-recent-model.c5
-rw-r--r--src/egg-recent-util.c96
-rw-r--r--src/egg-recent-view-gtk.c1
3 files changed, 25 insertions, 77 deletions
diff --git a/src/egg-recent-model.c b/src/egg-recent-model.c
index fb42f87e1..34733bc61 100644
--- a/src/egg-recent-model.c
+++ b/src/egg-recent-model.c
@@ -585,6 +585,7 @@ egg_recent_model_filter (EggRecentModel *model,
+#if 0
static void
egg_recent_model_monitor_list_cb (GnomeVFSMonitorHandle *handle,
const gchar *monitor_uri,
@@ -636,7 +637,7 @@ egg_recent_model_monitor_list (EggRecentModel *model, GList *list)
g_free (uri);
}
}
-
+#endif
static gboolean
@@ -1634,7 +1635,7 @@ egg_recent_model_changed (EggRecentModel *model)
if (model->priv->limit > 0) {
list = egg_recent_model_get_list (model);
- egg_recent_model_monitor_list (model, list);
+ /* egg_recent_model_monitor_list (model, list); */
g_signal_emit (G_OBJECT (model), model_signals[CHANGED], 0,
list);
diff --git a/src/egg-recent-util.c b/src/egg-recent-util.c
index e983ba320..91c0c6868 100644
--- a/src/egg-recent-util.c
+++ b/src/egg-recent-util.c
@@ -9,9 +9,6 @@
#include <libgnomeui/gnome-icon-theme.h>
#include <libgnomeui/gnome-icon-lookup.h>
#endif
-#ifdef HAVE_RSVG
-#include <librsvg/rsvg.h>
-#endif
#include <math.h>
#include "egg-recent-util.h"
@@ -56,46 +53,6 @@ egg_recent_util_escape_underlines (const gchar* text)
return g_string_free (str, FALSE);
}
-static gboolean
-path_represents_svg_image (const char *path)
-{
- /* Synchronous mime sniffing is a really bad idea here
- * since it's only useful for people adding custom icons,
- * and if they're doing that, they can behave themselves
- * and use a .svg extension.
- */
- return path != NULL && strstr (path, ".svg") != NULL;
-}
-
-/* This loads an SVG image, scaling it to the appropriate size. */
-#ifdef HAVE_RSVG
-static GdkPixbuf *
-load_pixbuf_svg (const char *path,
- guint size_in_pixels,
- guint base_size)
-{
- double zoom;
- GdkPixbuf *pixbuf;
-
- if (base_size != 0) {
- zoom = (double)size_in_pixels / base_size;
-
- pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max (path, zoom, zoom, size_in_pixels, size_in_pixels, NULL);
- } else {
- pixbuf = rsvg_pixbuf_from_file_at_max_size (path,
- size_in_pixels,
- size_in_pixels,
- NULL);
- }
-
- if (pixbuf == NULL) {
- return NULL;
- }
-
- return pixbuf;
-}
-#endif
-
static GdkPixbuf *
scale_icon (GdkPixbuf *pixbuf,
double *scale)
@@ -120,41 +77,30 @@ load_icon_file (char *filename,
guint width, height, size;
double scale;
- if (path_represents_svg_image (filename)) {
-#ifdef HAVE_RSVG
- pixbuf = load_pixbuf_svg (filename,
- nominal_size,
- base_size);
-#else
- /* svg file, and no svg support... */
- return NULL;
-#endif
- } else {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- if (pixbuf == NULL) {
- return NULL;
- }
-
- if (base_size == 0) {
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- size = MAX (width, height);
- if (size > nominal_size) {
- base_size = size;
- } else {
- /* Don't scale up small icons */
- base_size = nominal_size;
- }
- }
-
- if (base_size != nominal_size) {
- scale = (double)nominal_size/base_size;
- scaled_pixbuf = scale_icon (pixbuf, &scale);
- g_object_unref (pixbuf);
- pixbuf = scaled_pixbuf;
+ if (pixbuf == NULL) {
+ return NULL;
+ }
+
+ if (base_size == 0) {
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ size = MAX (width, height);
+ if (size > nominal_size) {
+ base_size = size;
+ } else {
+ /* Don't scale up small icons */
+ base_size = nominal_size;
}
}
+
+ if (base_size != nominal_size) {
+ scale = (double)nominal_size/base_size;
+ scaled_pixbuf = scale_icon (pixbuf, &scale);
+ g_object_unref (pixbuf);
+ pixbuf = scaled_pixbuf;
+ }
return pixbuf;
}
diff --git a/src/egg-recent-view-gtk.c b/src/egg-recent-view-gtk.c
index 3b7e6d0e5..8fefd326d 100644
--- a/src/egg-recent-view-gtk.c
+++ b/src/egg-recent-view-gtk.c
@@ -605,6 +605,7 @@ egg_recent_view_gtk_init (EggRecentViewGtk * view)
view->uid = egg_recent_util_get_unique_id ();
#ifndef USE_STABLE_LIBGNOMEUI
view->theme = gnome_icon_theme_new ();
+ gnome_icon_theme_set_allow_svg (view->theme, TRUE);
g_signal_connect_object (view->theme, "changed",
G_CALLBACK (theme_changed_cb), view, 0);
#endif