# Gtk2 InfoBar class

**URL:** <https://www.ruby-forum.com/t/gtk2-infobar-class/217201>\
**Category:** Ruby-Gnome 2\
**Created:** [February 23, 2012, 10:11pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201 "2012-02-23T22:11:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 23, 2012, 10:11pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/1 "2012-02-23T22:11:19Z")

</div>

Hello

I have pushed an implementation for gtk infobar (cf: Gtk::InfoBar  
class).  
A sample code is given in gtk2/sample/misc/infobar.rb file.

Gtk::InfoBar#add\_buttons is not implemented as I was not sure how to  
write  
this method.  
But Gtk::InfoBar#add\_button can be called several times.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 24, 2012, 2:25pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/2 "2012-02-24T14:25:48Z")

</div>

cool - nice one!

- j

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 24, 2012, 5:11pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/3 "2012-02-24T17:11:23Z")

</div>

Great!

I love those examples - they are short and to the point of what a widget  
does. I learned a great deal about ruby-gtk that way. 🙂

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 24, 2012, 10:48pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/4 "2012-02-24T22:48:22Z")

</div>

Le 24 fvrier 2012 17:11, Marc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
a  
crit :

> Virtualization & Cloud Management Using Capacity Planning  
> Cloud computing makes use of virtualization - but cloud computing  
> also focuses on allowing computing to be delivered as a service.  
> [http://www.accelacomm.com/jaw/sfnl/114/51521223/](http://www.accelacomm.com/jaw/sfnl/114/51521223/)
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

Jake and Marc, you are most welcome.  
I am glad you like this piece of work.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 25, 2012, 2:15am UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/5 "2012-02-25T02:15:36Z")

</div>

On Sat, Feb 25, 2012 at 12:19 AM, grant schoep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’m on CentOS 5.7  
> gcc 4.1.2 20080704 (Red Hat 4.1.2-51)  
> Ruby 1.9.2p290

Note, that I am on a 64 bit machine, and I see it did compile all with  
-fPIC. I did a bit of google to trying to figure out what this message  
means. Saw some things that hinted at issues with global name space  
issues,  
but nothing helped. I can drop out the 3 changes from your commit and  
all  
builds fine.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 25, 2012, 7:21am UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/6 "2012-02-25T07:21:36Z")

</div>

Hi, Vincent.

Great work!

A few comments though:

- I think GTK\_TYPE\_MESSAGE\_TYPE should be defined as Gtk::MessageType.  
(similar to Gtk::PositionType and others)  
Just for your information, I’ve attached enum list.

- I think GTK\_TYPE\_RESPONSE\_TYPE should be defined as Gtk::ResponseType.

Sorry for too late reply.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 25, 2012, 1:20am UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/7 "2012-02-25T01:20:31Z")

</div>

I get a link problem now with this addition. Everything gets done  
compiling, then at the link step it bombs

/usr/bin/ld: init.o: relocation R\_X86\_64\_PC32 against `Init\_gtk\_infobar’  
can not be used when making a shared object; recompile with -fPIC  
/usr/bin/ld: final link failed: Bad value  
collect2: ld returned 1 exit status  
make[1]: \*\*\* [gtk2.so] Error 1

I’m on CentOS 5.7  
gcc 4.1.2 20080704 (Red Hat 4.1.2-51)  
Ruby 1.9.2p290

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 25, 2012, 3:20pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/8 "2012-02-25T15:20:16Z")

</div>

Le 25 fvrier 2012 01:19, grant schoep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) a crit :

> I’m on CentOS 5.7
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

Hi Grant

Thank for this report. I have no clue at the moment on how to fix this  
error.  
Futhermore I am on a 32 bits machine.  
Which kernel are you using ? (uname -a)  
Did you try to compile from a clean tree?  
(  
make realclean  
ruby1.9 extconf.rb gtk2  
make  
)

Can someone using a 64 bits machine confirm this bug ?

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 25, 2012, 3:36pm UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/9 "2012-02-25T15:36:23Z")

</div>

Le 25 fvrier 2012 07:20, Masaaki A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) a crit  
:

> - I think GTK\_TYPE\_RESPONSE\_TYPE should be defined as Gtk::ResponseType.  
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

Hi Masaaki

Thanks for your compliment.  
I agree that GTK\_TYPE\_MESSAGE\_TYPE should be defined as Gtk::MessageType  
but they are all ready defined as Gtk::MessageDialog::Type that is why I  
redefined it as Gtk::InfoBar::Type.  
I propose to define GTK\_TYPE\_MESSAGE\_TYPE as Gtk::MessageType,  
keep Gtk::MessageDialog::Type for compatibility sake and remove  
Gtk::InfoBar::Type as no one except me should have write code  
including this constant.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 26, 2012, 12:58am UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/10 "2012-02-26T00:58:07Z")

</div>

> I agree that GTK\_TYPE\_MESSAGE\_TYPE should be defined as Gtk::MessageType  
> but they are all ready defined as Gtk::MessageDialog::Type that is why I  
> redefined it as Gtk::InfoBar::Type.  
> I propose to define GTK\_TYPE\_MESSAGE\_TYPE as Gtk::MessageType,  
> keep Gtk::MessageDialog::Type for compatibility sake and remove  
> Gtk::InfoBar::Type as no one except me should have write code  
> including this constant.

I agree with you.

Thanks,

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 26, 2012, 3:24am UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/11 "2012-02-26T03:24:21Z")

</div>

Le 26 fvrier 2012 01:24, Masaaki A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) a crit  
:

> > > /usr/bin/ld: final link failed: Bad value
> > 
> > make  
> > @@ -117,10 +117,12 @@ rg\_response(VALUE self, VALUE response\_id)  
> > VALUE RG\_TARGET\_NAMESPACE = G\_DEF\_CLASS(GTK\_TYPE\_INFO\_BAR,  
> > +}
> 
> Thanks,
> 
> I have taken into your comment and upload changes (GTK\_CHECK\_VERSION patch  
> and constant definition).  
> Thanks for time.

Grant can you confirm your problem is fixed?

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [February 26, 2012, 1:24am UTC](https://www.ruby-forum.com/t/gtk2-infobar-class/217201/12 "2012-02-26T01:24:58Z")

</div>

Hi,

2012/2/25 Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > also focuses on allowing computing to be delivered as a service.  
> > error.  
> > Futhermore I am on a 32 bits machine.  
> > Which kernel are you using ? (uname -a)  
> > Did you try to compile from a clean tree?  
> > (  
> > make realclean  
> > ruby1.9 extconf.rb gtk2  
> > make  
> > )
> 
> Can someone using a 64 bits machine confirm this bug ?

I think need to be changed as follows:

diff --git a/gtk2/ext/gtk2/rbgtkinfobar.c b/gtk2/ext/gtk2/rbgtkinfobar.c  
index 30227a0..5d2e44e 100644  
— a/gtk2/ext/gtk2/rbgtkinfobar.c  
+++ b/gtk2/ext/gtk2/rbgtkinfobar.c  
@@ -117,10 +117,12 @@ rg\_response(VALUE self, VALUE response\_id)  
gtk\_info\_bar\_response(\_SELF(self), RVAL2GENUM(response\_id,  
GTK\_TYPE\_RESPONSE\_TYPE));  
return self;  
}  
+#endif

void  
Init\_gtk\_infobar(VALUE mGtk)  
{  
+#if GTK\_CHECK\_VERSION(2,18,0)  
VALUE RG\_TARGET\_NAMESPACE = G\_DEF\_CLASS(GTK\_TYPE\_INFO\_BAR,  
“InfoBar”, mGtk);

```
 RG_DEF_METHOD(initialize, -1);

```

@@ -148,5 +150,5 @@ Init\_gtk\_infobar(VALUE mGtk)  
/\* GtkResponseType. Allready defined in rbgtkdialog.c \*/  
G\_DEF\_CLASS(GTK\_TYPE\_RESPONSE\_TYPE, “ResponseType”,  
RG\_TARGET\_NAMESPACE);  
G\_DEF\_CONSTANTS(RG\_TARGET\_NAMESPACE, GTK\_TYPE\_RESPONSE\_TYPE,  
“GTK\_”);  
-}  
#endif  
+}

Thanks,
