mirror of
https://github.com/transmission/transmission
synced 2024-12-23 16:24:02 +00:00
(trunk gtk) have the GtkStatusIcon code use the same icon fallback scheme as the AppInd code
This commit is contained in:
parent
6e5af03d78
commit
d63b719e43
1 changed files with 14 additions and 10 deletions
|
@ -124,13 +124,11 @@ tr_icon_refresh( gpointer vicon )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBAPPINDICATOR
|
static const char *
|
||||||
gpointer
|
getIconName( void )
|
||||||
tr_icon_new( TrCore * core)
|
|
||||||
{
|
{
|
||||||
GtkWidget * w;
|
|
||||||
const char * icon_name;
|
const char * icon_name;
|
||||||
AppIndicator * indicator;
|
|
||||||
GtkIconTheme * theme = gtk_icon_theme_get_default( );
|
GtkIconTheme * theme = gtk_icon_theme_get_default( );
|
||||||
|
|
||||||
/* if the tray's icon is a 48x48 file, use it;
|
/* 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;
|
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 );
|
app_indicator_set_status( indicator, APP_INDICATOR_STATUS_ACTIVE );
|
||||||
w = action_get_widget( "/icon-popup" );
|
w = action_get_widget( "/icon-popup" );
|
||||||
app_indicator_set_menu( indicator, GTK_MENU ( w ) );
|
app_indicator_set_menu( indicator, GTK_MENU ( w ) );
|
||||||
|
|
||||||
g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
|
g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
|
||||||
|
|
||||||
return indicator;
|
return indicator;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
gpointer
|
gpointer
|
||||||
tr_icon_new( TrCore * core )
|
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 );
|
GtkStatusIcon * icon = gtk_status_icon_new_from_icon_name( icon_name );
|
||||||
|
|
||||||
g_signal_connect( icon, "activate", G_CALLBACK( activated ), NULL );
|
g_signal_connect( icon, "activate", G_CALLBACK( activated ), NULL );
|
||||||
g_signal_connect( icon, "popup-menu", G_CALLBACK( popup ), NULL );
|
g_signal_connect( icon, "popup-menu", G_CALLBACK( popup ), NULL );
|
||||||
g_object_set_data( G_OBJECT( icon ), "tr-core", core );
|
g_object_set_data( G_OBJECT( icon ), "tr-core", core );
|
||||||
|
|
Loading…
Reference in a new issue