Updating branch refs/heads/ristretto-0.6 to 6b221241e563aa891cbbfd87f4eb01d92354dc4c (commit) from c4aac7df6346d322350c11bce41de0ce12bba749 (commit)
commit 6b221241e563aa891cbbfd87f4eb01d92354dc4c Author: Stephan Arts <step...@xfce.org> Date: Sat Aug 4 22:06:55 2012 +0200 Show current image as icon in taskbar (Bug #8837) src/main_window.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/src/main_window.c b/src/main_window.c index df4d8e4..2e9b1f3 100644 --- a/src/main_window.c +++ b/src/main_window.c @@ -38,6 +38,7 @@ #include "util.h" #include "file.h" #include "icon_bar.h" +#include "thumbnailer.h" #include "image_list.h" #include "image_viewer.h" #include "main_window.h" @@ -94,6 +95,7 @@ struct _RsttoMainWindowPriv GtkRecentManager *recent_manager; RsttoSettings *settings_manager; RsttoWallpaperManager *wallpaper_manager; + RsttoThumbnailer *thumbnailer; GtkWidget *menubar; GtkWidget *toolbar; @@ -161,6 +163,11 @@ static gint cb_compare_app_infos ( gconstpointer a, gconstpointer b); +static void +cb_rstto_thumbnailer_ready( + RsttoThumbnailer *thumbnailer, + RsttoFile *file, + gpointer user_data); static gboolean rstto_window_save_geometry_timer (gpointer user_data); @@ -764,6 +771,7 @@ rstto_main_window_init (RsttoMainWindow *window) window->priv->ui_manager = gtk_ui_manager_new (); window->priv->recent_manager = gtk_recent_manager_get_default(); window->priv->settings_manager = rstto_settings_new(); + window->priv->thumbnailer = rstto_thumbnailer_new(); /* Setup the image filter list for drag and drop */ window->priv->filter = gtk_file_filter_new (); @@ -1109,6 +1117,12 @@ rstto_main_window_init (RsttoMainWindow *window) G_CALLBACK (cb_rstto_desktop_type_changed), window); + g_signal_connect ( + G_OBJECT(window->priv->thumbnailer), + "ready", + G_CALLBACK (cb_rstto_thumbnailer_ready), + window); + } static void @@ -1247,6 +1261,7 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window) const gchar *id; GtkWidget *menu_item = NULL; GDesktopAppInfo *app_info = NULL; + const GdkPixbuf *pixbuf = NULL; GtkWidget *open_with_menu = gtk_menu_new(); GtkWidget *open_with_window_menu = gtk_menu_new(); @@ -1270,6 +1285,17 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window) -1.0, 0); + pixbuf = rstto_file_get_thumbnail (cur_file, THUMBNAIL_SIZE_VERY_SMALL); + if (pixbuf != NULL) + { + gtk_window_set_icon (GTK_WINDOW (window), gdk_pixbuf_copy (pixbuf)); + } + else + { + gtk_window_set_icon (GTK_WINDOW (window), NULL); + gtk_window_set_icon_name (GTK_WINDOW (window), "ristretto"); + } + app_list = g_app_info_get_all_for_type (content_type); editor = rstto_mime_db_lookup (window->priv->db, content_type); @@ -1358,6 +1384,9 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window) gtk_widget_show_all (open_with_window_menu); title = g_strdup (RISTRETTO_APP_TITLE); + + gtk_window_set_icon (GTK_WINDOW (window), NULL); + gtk_window_set_icon_name (GTK_WINDOW (window), "ristretto"); } rstto_main_window_update_buttons (window); @@ -4157,3 +4186,28 @@ cb_compare_app_infos ( { return g_app_info_equal (G_APP_INFO (a), G_APP_INFO (b)) ? 0 : 1; } + +static void +cb_rstto_thumbnailer_ready( + RsttoThumbnailer *thumbnailer, + RsttoFile *file, + gpointer user_data) +{ + RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data); + RsttoFile *cur_file = rstto_image_list_iter_get_file (window->priv->iter); + const GdkPixbuf *pixbuf = NULL; + + if (file == cur_file) + { + pixbuf = rstto_file_get_thumbnail (file, THUMBNAIL_SIZE_VERY_SMALL); + if (pixbuf != NULL) + { + gtk_window_set_icon (GTK_WINDOW (window), gdk_pixbuf_copy(pixbuf)); + } + else + { + gtk_window_set_icon (GTK_WINDOW (window), NULL); + gtk_window_set_icon_name (GTK_WINDOW (window), "ristretto"); + } + } +} _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits