diff --git a/gtk/actions.c b/gtk/actions.c index 452e9a83a..3343adb84 100644 --- a/gtk/actions.c +++ b/gtk/actions.c @@ -144,7 +144,9 @@ BuiltinIconInfo; static const BuiltinIconInfo my_fallback_icons[] = { - { tr_icon_logo, "transmission" }, + { tr_icon_logo, WINDOW_ICON }, + { tr_icon_logo, TRAY_ICON }, + { tr_icon_logo, NOTIFICATION_ICON }, { tr_icon_lock, "transmission-lock" }, { options_icon, "options" }, { blue_turtle, "alt-speed-on" }, diff --git a/gtk/actions.h b/gtk/actions.h index 8de96de56..3d41906f2 100644 --- a/gtk/actions.h +++ b/gtk/actions.h @@ -16,6 +16,11 @@ #include #include "tr-core.h" +#define WINDOW_ICON "transmission-main-window-icon" +#define TRAY_ICON "transmission-tray-icon" +#define NOTIFICATION_ICON "transmission-notification-icon" + + void actions_init( GtkUIManager * ui_manager, gpointer callback_user_data ); diff --git a/gtk/notify.c b/gtk/notify.c index fc644771c..caaacffba 100644 --- a/gtk/notify.c +++ b/gtk/notify.c @@ -21,6 +21,7 @@ #endif #include +#include "actions.h" /* NOTIFICATION_ICON */ #include "conf.h" #include "notify.h" #include "tr-prefs.h" @@ -89,6 +90,24 @@ can_support_actions( void ) return supported; } +static void +addIcon( NotifyNotification * notify ) +{ + int size = 32; + GtkIconTheme * theme; + GdkPixbuf * icon; + + gtk_icon_size_lookup( GTK_ICON_SIZE_DIALOG, &size, &size ); + theme = gtk_icon_theme_get_default( ); + icon = gtk_icon_theme_load_icon( theme, NOTIFICATION_ICON, size, 0, NULL ); + + if( icon != NULL ) + { + notify_notification_set_icon_from_pixbuf( notify, icon ); + g_object_unref( icon ); + } +} + void tr_notify_send( TrTorrent *tor ) { @@ -111,7 +130,8 @@ tr_notify_send( TrTorrent *tor ) n = notify_notification_new( _( "Torrent Complete" ), info->name, - "transmission", NULL ); + NULL, NULL ); + addIcon( n ); if( can_support_actions( ) ) { @@ -136,7 +156,8 @@ tr_notify_added( const char * name ) if( pref_flag_get( PREF_KEY_SHOW_DESKTOP_NOTIFICATION ) ) { NotifyNotification * n = notify_notification_new( - _( "Torrent Added" ), name, "transmission", NULL ); + _( "Torrent Added" ), name, NULL, NULL ); + addIcon( n ); notify_notification_set_timeout( n, NOTIFY_EXPIRES_DEFAULT ); notify_notification_show( n, NULL ); } diff --git a/gtk/tr-icon.c b/gtk/tr-icon.c index 2961f6c11..de37c7961 100644 --- a/gtk/tr-icon.c +++ b/gtk/tr-icon.c @@ -111,8 +111,8 @@ tr_icon_refresh( gpointer vicon ) gpointer tr_icon_new( TrCore * core ) { - GtkStatusIcon * icon = gtk_status_icon_new_from_icon_name( - "transmission" ); + const char * icon_name = TRAY_ICON; + GtkStatusIcon * icon = gtk_status_icon_new_from_icon_name( icon_name ); g_signal_connect( icon, "activate", G_CALLBACK( activated ), NULL ); g_signal_connect( icon, "popup-menu", G_CALLBACK( popup ), NULL );