Libglade and stock icons
| From: | Andre Colomb | Date: | Tue, 30 Sep 2008 15:19:53 +0000 |
| Subject: | Libglade and stock icons | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-8301@lists.php.net to get a copy of this message | ||
Hi list!
I want to use my own icons in a libglade-loaded GUI. In Glade, I selected "Image Type: Icon Theme" and supplied my own stock ID under "Icon name". The icon is loaded in a GtkIconFactory which is installed via add_default().
Widgets from the glade file using the stock icon display show an image missing symbol, widgets created from PHP-Gtk directly work fine. Here is the sample code and glade definition to demonstrate:
----- icons.php ------
<?php
$iconfactory = new GtkIconFactory();
$iconfactory->add('myapp-test', GtkIconSet::new_from_pixbuf(GdkPixbuf::new_from_file('test.png')));
$iconfactory->add_default();
$glade = new GladeXML('icons.glade');
$window = $glade->get_widget('window1');
$vbox = $glade->get_widget('vbox1');
$vbox->add(GtkImage::new_from_stock('myapp-test', Gtk::ICON_SIZE_MENU));
$window->show_all();
Gtk::main();
?>
----- icons.glade -----
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.3 on Tue Sep 30 17:14:27 2008 -->
<glade-interface>
<widget class="GtkWindow" id="window1">
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<widget class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<child>
<widget class="GtkToolButton" id="toolbutton1">
<property name="visible">True</property>
<property name="icon_name">myapp-test</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="icon_name">myapp-test</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
I found a post about the topic concerning PyGTK (http://article.gmane.org/gmane.comp.gnome.gtk%2B.python/4951), so it might be a libglade issue. Just couldn't test it with libglade natively from within C so I report it here.
I'm using the PHP-Gtk2 beta since my application segfaults in very strange places with 2.0.0 and 2.0.1. Need to investigate more on that, so I'll describe it in another post.
Regards, Andre
--
Greetings...
From: Andre Colomb <acolomb@schickhardt.org>