Re: [Java-gnome-developer] How to change the icon of a ToolMenuButton ?
Brought to you by:
afcowie
From: Remy S. <rem...@gm...> - 2006-06-08 15:31:50
|
It looks like the problem is related to using ToolBars since this code doesn't work. Gtk.init(null); Window window = new Window(WindowType.TOPLEVEL); ToolBar toolbar = new ToolBar(); MenuToolButton mtb = new MenuToolButton(""); mtb.setIconWidget(new ToolButton("gtk-apply")); toolbar.add(mtb); window.add(toolbar); window.showAll(); Gtk.main(); I think this is what Glade is doing in terms of adding a MenuToolButton into a ToolBar. This might be gtk+ specific and is not actually our problem. Regards, Rem On 6/8/06, Mehdi Rabah <meh...@gm...> wrote: > > Hi again and sorry for the two mails in less than half an hour. > > It modified your simple code to test it with glade, and this didn't work : > > > public class Test { > Test(){} > > public static void main(String[] args) throws GladeXMLException, > FileNotFoundException, IOException{ > Gtk.init(null); > LibGlade gladefile = new LibGlade("C:/test/test.glade", new > Test()); > MenuToolButton mtb = (MenuToolButton) gladefile.getWidget > ("menutoolbutton1"); > > mtb.setIconWidget(new ToolButton("gtk-apply")); > Window w = new Window(WindowType.TOPLEVEL); > > w.add(mtb); > w.showAll(); > Gtk.main(); > } > } > > Should I submit a bug report ? > > > On 6/8/06, Mehdi Rabah <meh...@gm...> wrote: > > > > Here is the versions I am using : > > gtk.2.6.jar > > glade2.10.jar > > > > The code you send works fine for me too (except I had to call Window( > > WindowType.TOPLEVEL) instead of Window()), > > but it still didn't work when I call it from a button I loaded from a > > glade file. > > > > I'm going to do further tests. > > > > > > > > On 6/8/06, Remy Suen < rem...@gm...> wrote: > > > > > > The code below works fine for me though. I am of course using CVS > > > head, but I don't really think that that is relevant in this case unless you > > > are using an older version of libgtk-java. > > > > > > Gtk.init(null); > > > MenuToolButton mtb = new MenuToolButton(""); > > > mtb.setIconWidget(new ToolButton("gtk-apply")); > > > Window w = new Window(); > > > w.add(mtb); > > > w.showAll(); > > > Gtk.main(); > > > > > > Can you see if that works for you? Maybe your problem is > > > Glade-specific. > > > > > > Regards, > > > Rem > > > > > > > > > On 6/8/06, Mehdi Rabah < meh...@gm...> wrote: > > > > > > > > Hi Remy, > > > > > > > > I solved my problem by calling : > > > > - MenuToolButton.setStockId("gtk-cancel") > > > > - with MenuTooButton.setLabel("A different label from the > > > > standard"); > > > > > > > > Even if I didn't manage to reproduce the errors from the > > > > MenuToolButton.setIconWidget(new ToolButton("gtk-cancel")) method, > > > > it still didn't work to show an icon. > > > > If someone can explain me a little what it's for I can write it in > > > > the doc. > > > > > > > > Regards, > > > > Mehdi > > > > > > > > > > > > On 6/8/06, Remy Suen <rem...@gm... > wrote: > > > > > > > > > > Mehdi, could you file a bug about this if it is consistently > > > > > reproducible at bugzilla.gnome.org? Also, you are using a fairly > > > > > recent version of libgtk-java like 2.8.3, 2.8.4, or 2.8.5, right? > > > > > > > > > > Regards, > > > > > Rem > > > > > > > > > > On 6/6/06, Mehdi Rabah < meh...@gm...> wrote: > > > > > > > > > > > Hi again, > > > > > > > > > > I tried something like this : > > > > > > > > > > MenuToolButton menuButton = /* loaded from glade file */ > > > > > menuButton.setIconWidget(new ToolButton("gtk-apply")); > > > > > > > > > > to change the icon of a MenuToolButton, and it didn't work. > > > > > > > > > > (java-gnome:3524): GLib-GObject-CRITICAL **: g_object_get_data: > > > > > assertion `G_IS_OBJECT (object)' failed > > > > > (java-gnome:3524): GLib-GObject-CRITICAL **: > > > > > g_object_set_data_full: assertion `G_IS_OBJECT (object)' failed > > > > > > > > > > Someone can help ? I can say that I have read the doc since there > > > > > is no doc for this class :-) > > > > > I think the paramater of the constructor of ToolButton is not good > > > > > but I don't know what to use. > > > > > > > > > > > > > > > Thanks in advance, > > > > > -- > > > > > Mehdi R. > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > java-gnome-developer mailing list > > > > > > > > > > jav...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > java-gnome-developer mailing list > > > > > jav...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > > > > > > > > > > > > > > > > > > > > > > > |