Forum: Ruby-Gnome 2 Gtk2 InfoBar class

Posted by Vincent Carmona (vinc-mai)
on 2012-02-23 22:11
(Received via mailing list)
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.
Posted by jake kaiden (lljk)
on 2012-02-24 14:25
cool - nice one!

  - j
Posted by Marc Heiler (shevegen)
on 2012-02-24 17:11
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. :)
Posted by Vincent Carmona (vinc-mai)
on 2012-02-24 22:48
(Received via mailing list)
Le 24 fvrier 2012 17:11, Marc Heiler <ruby-forum-incoming@andreas-s.net> 
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/
> _______________________________________________
> ruby-gnome2-devel-en mailing list
> ruby-gnome2-devel-en@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ruby-...
>


Jake and Marc, you are most welcome.
I am glad you like this piece of work.
Posted by Grant Schoep (matobinder)
on 2012-02-25 01:20
(Received via mailing list)
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
Posted by Grant Schoep (matobinder)
on 2012-02-25 02:15
(Received via mailing list)
On Sat, Feb 25, 2012 at 12:19 AM, grant schoep <matobinder@gmail.com> 
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.
Posted by Masaaki Aoyagi (Guest)
on 2012-02-25 07:21
Attachment: enum.txt (3,08 KB)
(Received via mailing list)
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.
Posted by Vincent Carmona (vinc-mai)
on 2012-02-25 15:20
(Received via mailing list)
Le 25 fvrier 2012 01:19, grant schoep <matobinder@gmail.com> a crit :

> I'm on CentOS 5.7
> _______________________________________________
> ruby-gnome2-devel-en mailing list
> ruby-gnome2-devel-en@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ruby-...
>
>
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 ?
Posted by Vincent Carmona (vinc-mai)
on 2012-02-25 15:36
(Received via mailing list)
Le 25 fvrier 2012 07:20, Masaaki Aoyagi <masaakiaoyagi@gmail.com> a crit 
:

> * I think GTK_TYPE_RESPONSE_TYPE should be defined as Gtk::ResponseType.
> ruby-gnome2-devel-en mailing list
> ruby-gnome2-devel-en@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ruby-...
>
>

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.
Posted by Masaaki Aoyagi (Guest)
on 2012-02-26 00:58
(Received via mailing list)
> 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,
Posted by Masaaki Aoyagi (Guest)
on 2012-02-26 01:24
(Received via mailing list)
Hi,

2012/2/25 Vincent Carmona <vinc4mai@gmail.com>:
>>
>> 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,
Posted by Vincent Carmona (vinc-mai)
on 2012-02-26 03:24
(Received via mailing list)
Le 26 fvrier 2012 01:24, Masaaki Aoyagi <masaakiaoyagi@gmail.com> 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?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.