Changeset 4969 for branches/1.0x/gtk/actions.c
- Timestamp:
- Feb 7, 2008, 8:27:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0x/gtk/actions.c
r4968 r4969 20 20 #include "tr_prefs.h" 21 21 #include "lock.h" 22 #include "logo.h" 22 23 23 24 #define UNUSED G_GNUC_UNUSED … … 171 172 BuiltinIconInfo; 172 173 173 const BuiltinIconInfo my_builtin_icons [] = 174 { 174 const BuiltinIconInfo my_fallback_icons [] = 175 { 176 { tr_icon_logo, "transmission" }, 175 177 { tr_icon_lock, "transmission-lock" } 176 178 }; … … 179 181 register_my_icons ( void ) 180 182 { 181 int i; 182 const int n = G_N_ELEMENTS( my_builtin_icons ); 183 GtkIconFactory * factory = gtk_icon_factory_new (); 184 gtk_icon_factory_add_default( factory ); 185 186 for( i=0; i<n; ++i ) 187 { 188 GdkPixbuf * p; 189 int width; 190 GtkIconSet * icon_set; 191 192 p = gdk_pixbuf_new_from_inline( -1, my_builtin_icons[i].raw, FALSE, 0 ); 193 width = gdk_pixbuf_get_width( p ); 194 gtk_icon_theme_add_builtin_icon (my_builtin_icons[i].name, width, p ); 195 196 icon_set = gtk_icon_set_new_from_pixbuf( p ); 197 gtk_icon_factory_add( factory, my_builtin_icons[i].name, icon_set ); 198 199 g_object_unref( p ); 200 gdk_pixbuf_unref( p ); 201 gtk_icon_set_unref (icon_set); 183 int i; 184 const int n = G_N_ELEMENTS( my_fallback_icons ); 185 GtkIconFactory * factory = gtk_icon_factory_new( ); 186 GtkIconTheme * theme = gtk_icon_theme_get_default( ); 187 gtk_icon_factory_add_default( factory ); 188 189 for( i=0; i<n; ++i ) 190 { 191 const char * name = my_fallback_icons[i].name; 192 193 if( !gtk_icon_theme_has_icon( theme, name ) ) 194 { 195 int width; 196 GdkPixbuf * p; 197 GtkIconSet * icon_set; 198 199 p = gdk_pixbuf_new_from_inline( -1, my_fallback_icons[i].raw, FALSE, 0 ); 200 width = gdk_pixbuf_get_width( p ); 201 icon_set = gtk_icon_set_new_from_pixbuf( p ); 202 gtk_icon_theme_add_builtin_icon( name, width, p ); 203 gtk_icon_factory_add( factory, name, icon_set ); 204 205 g_object_unref( p ); 206 gtk_icon_set_unref( icon_set ); 207 } 202 208 } 203 209
Note: See TracChangeset
for help on using the changeset viewer.