mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
(trunk gtk) #2780 "for themability, T needs unique icon names for window, system tray, and popup icons" -- added to trunk for 1.81
This commit is contained in:
parent
e26a1783c6
commit
67b9c83df5
4 changed files with 33 additions and 5 deletions
|
@ -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" },
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
#include <gtk/gtk.h>
|
||||
#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 );
|
||||
|
||||
|
|
25
gtk/notify.c
25
gtk/notify.c
|
@ -21,6 +21,7 @@
|
|||
#endif
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue