Changeset 10200
- Timestamp:
- Feb 14, 2010, 2:26:45 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/tr-icon.c
r10133 r10200 19 19 #include "tr-icon.h" 20 20 #include "util.h" 21 22 #define MY_NAME "transmission" 21 23 22 24 #ifndef STATUS_ICON_SUPPORTED … … 123 125 tr_icon_new( TrCore * core) 124 126 { 125 const char * icon_name = TRAY_ICON;126 AppIndicator * indicator = app_indicator_new ( "transmission", 127 icon_name, 128 APP_INDICATOR_CATEGORY_SYSTEM_SERVICES);127 GtkWidget * w; 128 const char * icon_name; 129 AppIndicator * indicator; 130 GtkIconTheme * theme = gtk_icon_theme_get_default( ); 129 131 130 GtkWidget * indicator_menu = action_get_widget( "/icon-popup" ); 132 /* if the tray's icon is a 48x48 file, use it; 133 * otherwise, use the fallback builtin icon */ 134 if( !gtk_icon_theme_has_icon( theme, TRAY_ICON ) ) 135 icon_name = MY_NAME; 136 else { 137 GtkIconInfo * icon_info = gtk_icon_theme_lookup_icon( theme, TRAY_ICON, 48, GTK_ICON_LOOKUP_USE_BUILTIN ); 138 const gboolean icon_is_builtin = gtk_icon_info_get_filename ( icon_info ) == NULL; 139 gtk_icon_info_free ( icon_info ); 140 icon_name = icon_is_builtin ? MY_NAME : TRAY_ICON; 141 } 142 143 indicator = app_indicator_new( MY_NAME, icon_name, APP_INDICATOR_CATEGORY_SYSTEM_SERVICES ); 144 app_indicator_set_status( indicator, APP_INDICATOR_STATUS_ACTIVE ); 145 w = action_get_widget( "/icon-popup" ); 146 app_indicator_set_menu( indicator, GTK_MENU ( w ) ); 131 147 132 app_indicator_set_status ( indicator, APP_INDICATOR_STATUS_ACTIVE ); 133 app_indicator_set_menu ( indicator, GTK_MENU (indicator_menu) ); 134 135 g_object_set_data( G_OBJECT( indicator ), "tr-core", core ); 136 return indicator; 148 g_object_set_data( G_OBJECT( indicator ), "tr-core", core ); 149 150 return indicator; 137 151 } 138 152 #else
Note: See TracChangeset
for help on using the changeset viewer.