Thread: [Java-gnome-developer] How to change the icon of a ToolMenuButton ?
Brought to you by:
afcowie
From: Mehdi R. <meh...@gm...> - 2006-06-08 02:43:38
|
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. |
From: Mehdi R. <meh...@gm...> - 2006-06-07 20:05:32
|
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. |
From: Remy S. <rem...@gm...> - 2006-06-08 11:09:23
|
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 > > > |
From: Mehdi R. <meh...@gm...> - 2006-06-08 11:35:11
|
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 > > > |
From: Remy S. <rem...@gm...> - 2006-06-08 14:13:03
|
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 > > > > > > > |
From: Mehdi R. <meh...@gm...> - 2006-06-08 14:24:15
|
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 > > > > > > > > > > > > |
From: Andrew C. <an...@op...> - 2006-06-09 10:57:54
|
On Thu, 2006-06-08 at 16:24 +0200, Mehdi Rabah wrote: > Here is the versions I am using : > gtk.2.6.jar > glade2.10.jar That code is really ancient. It's over three GNOME generations old. In general, open source communities are happy to help people, but reality dictates that volunteers can only support the current release and even then it's sometimes hard to reproduce changes and/or backport fixes if the developers have moved on [incidentally, that's the rationale for the fork-late-if-at-all school of development]. It's considered helpful if you take the effort to install the most recently released code. That way if you've found a bug it's almost certain to still be extant. Otherwise, you may well be reporting problems that are long since solved. At time of writing, the current releases is glib-java 0.2.5, libgtk-java 2.8.5 and libglade-java 2.12.4 Cheers, AfC Sydney |
From: Mehdi R. <meh...@gm...> - 2006-06-08 14:29:45
|
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 > > > > > > > > > > > > > > > > > > |
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 > > > > > > > > > > > > > > > > > > > > > > > > > |
From: Andrew C. <an...@op...> - 2006-06-09 10:57:56
|
On Thu, 2006-06-08 at 15:31 +0000, Remy Suen wrote: > I think this is what Glade is doing in terms of adding a > MenuToolButton into a ToolBar. I've found in the past that GTK and Glade in particular does some unexpected things in order to achieve the results we take for granted. ToggleToolButtons, for example, are incredibly convoluted - partly so of what Glade creates, and partly because of how GTK maps them. If someone needs more details about them I can point you to the xseq code that manipulates them for buttons. A more mundane example is a "simple" stock button like OK. In actuality, GTK takes the stock button request and forms an Image plunks the OK pixbuf into it, then forms a Label, plunks "Ok" into it, and then makes an HBox, packs the Image and Label into the HBox, and then stuffs the HBox into the Button. Sometimes, after much hair-pulling, I've found myself rendering something, and then calling the Widget's getChildren() method, then walking the Widgets returned, and so on down until I learned what the heck was in there. Usually you can get some insight by reading the .glade file. Just pull it up in a nice syntax highlighting editor, and look at the families of widgets it has created. [Keep in mind that GTK could further complicate things at runtime] AfC Sydney |