1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 15:54:57 +00:00

(trunk gtk) #2900 "Indicator Application can only work with icon names, not rendered icons" -- patched for 1.90 in trunk. Thanks to qense for the patch.

This commit is contained in:
Charles Kerr 2010-02-14 14:26:45 +00:00
parent be80f3bbde
commit 6ddd5c4f12

View file

@ -19,6 +19,8 @@
#include "tr-icon.h"
#include "util.h"
#define MY_NAME "transmission"
#ifndef STATUS_ICON_SUPPORTED
gpointer
@ -122,17 +124,29 @@ tr_icon_refresh( gpointer vicon )
gpointer
tr_icon_new( TrCore * core)
{
const char * icon_name = TRAY_ICON;
AppIndicator * indicator = app_indicator_new ( "transmission",
icon_name,
APP_INDICATOR_CATEGORY_SYSTEM_SERVICES );
GtkWidget * w;
const char * icon_name;
AppIndicator * indicator;
GtkIconTheme * theme = gtk_icon_theme_get_default( );
GtkWidget * indicator_menu = action_get_widget( "/icon-popup" );
/* if the tray's icon is a 48x48 file, use it;
* otherwise, use the fallback builtin icon */
if( !gtk_icon_theme_has_icon( theme, TRAY_ICON ) )
icon_name = MY_NAME;
else {
GtkIconInfo * icon_info = gtk_icon_theme_lookup_icon( theme, TRAY_ICON, 48, GTK_ICON_LOOKUP_USE_BUILTIN );
const gboolean icon_is_builtin = gtk_icon_info_get_filename ( icon_info ) == NULL;
gtk_icon_info_free ( icon_info );
icon_name = icon_is_builtin ? MY_NAME : TRAY_ICON;
}
app_indicator_set_status ( indicator, APP_INDICATOR_STATUS_ACTIVE );
app_indicator_set_menu ( indicator, GTK_MENU (indicator_menu) );
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