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:
parent
be80f3bbde
commit
6ddd5c4f12
1 changed files with 24 additions and 10 deletions
|
@ -19,6 +19,8 @@
|
||||||
#include "tr-icon.h"
|
#include "tr-icon.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#define MY_NAME "transmission"
|
||||||
|
|
||||||
#ifndef STATUS_ICON_SUPPORTED
|
#ifndef STATUS_ICON_SUPPORTED
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
|
@ -122,18 +124,30 @@ tr_icon_refresh( gpointer vicon )
|
||||||
gpointer
|
gpointer
|
||||||
tr_icon_new( TrCore * core)
|
tr_icon_new( TrCore * core)
|
||||||
{
|
{
|
||||||
const char * icon_name = TRAY_ICON;
|
GtkWidget * w;
|
||||||
AppIndicator * indicator = app_indicator_new ( "transmission",
|
const char * icon_name;
|
||||||
icon_name,
|
AppIndicator * indicator;
|
||||||
APP_INDICATOR_CATEGORY_SYSTEM_SERVICES );
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ) );
|
||||||
|
|
||||||
app_indicator_set_status ( indicator, APP_INDICATOR_STATUS_ACTIVE );
|
g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
|
||||||
app_indicator_set_menu ( indicator, GTK_MENU (indicator_menu) );
|
|
||||||
|
return indicator;
|
||||||
g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
|
|
||||||
return indicator;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
gpointer
|
gpointer
|
||||||
|
|
Loading…
Reference in a new issue