From: Charles Kerr Date: Sun, 4 Jul 2010 18:27:03 +0000 (+0000) Subject: (trunk gtk) have the GtkStatusIcon code use the same icon fallback scheme as the... X-Git-Tag: 2.10~307 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d63b719e43c3e4effe4f9f96d09e5fe0181cbd3e;p=transmission (trunk gtk) have the GtkStatusIcon code use the same icon fallback scheme as the AppInd code --- diff --git a/gtk/tr-icon.c b/gtk/tr-icon.c index 819b0201e..5209494ca 100644 --- a/gtk/tr-icon.c +++ b/gtk/tr-icon.c @@ -124,13 +124,11 @@ tr_icon_refresh( gpointer vicon ) } #endif -#ifdef HAVE_LIBAPPINDICATOR -gpointer -tr_icon_new( TrCore * core) +static const char * +getIconName( void ) { - GtkWidget * w; const char * icon_name; - AppIndicator * indicator; + GtkIconTheme * theme = gtk_icon_theme_get_default( ); /* if the tray's icon is a 48x48 file, use it; @@ -144,22 +142,28 @@ tr_icon_new( TrCore * core) icon_name = icon_is_builtin ? MY_NAME : TRAY_ICON; } - indicator = app_indicator_new( MY_NAME, icon_name, APP_INDICATOR_CATEGORY_SYSTEM_SERVICES ); + return icon_name; +} + +#ifdef HAVE_LIBAPPINDICATOR +gpointer +tr_icon_new( TrCore * core) +{ + GtkWidget * w; + const char * icon_name = getIconName( ); + AppIndicator * indicator = app_indicator_new( MY_NAME, icon_name, APP_INDICATOR_CATEGORY_SYSTEM_SERVICES ); app_indicator_set_status( indicator, APP_INDICATOR_STATUS_ACTIVE ); w = action_get_widget( "/icon-popup" ); app_indicator_set_menu( indicator, GTK_MENU ( w ) ); - g_object_set_data( G_OBJECT( indicator ), "tr-core", core ); - return indicator; } #else gpointer tr_icon_new( TrCore * core ) { - const char * icon_name = TRAY_ICON; + const char * icon_name = getIconName( ); 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 ); g_object_set_data( G_OBJECT( icon ), "tr-core", core );