Busy application and mouse cursor

Hi everyone.

I use a Gtk::Window for my application and I would like to change the
cursor during loading (the graphical interface is showed, the program is
running but resources are used to intialize the program). Usually in gtk
during initialization, the cursor is set to a rotating image instead of
an arrow to show that program is busy. How can I achieve this?

I take a look at Gdk::Cursor but I did not saw a simple method to do it.

Vincent C.

this is how i do it:
mainwindow.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))

I also wondered a long time before I found.

I got it when I realized a cursor is attached to a GDK::Window, not a
GTK.
And that GDK::Window is just a rectangular area on the screen.

So, the flow is :

  1. Get the area where you want to change the cursor (GTK::Widget#window)
  2. Change the cursor in this area (GDK::Window#cursor=)

Hope it helps.

Simon

Thanks for your replies. I was looking for a way to get the GDK::Window
and for the Gdk::Cursor::WATCH constant. I did not see this constant on
the hiki.
I will implement this feature on my apllication.

P.S. : I am currently writting an audio player based on ruby/gtk2 and
ruby/gst. I have just change the status to beta. Can I ask for
beta-tester on this list?

Simon A. wrote:

I also wondered a long time before I found.

I got it when I realized a cursor is attached to a GDK::Window, not a
GTK.
And that GDK::Window is just a rectangular area on the screen.

So, the flow is :

  1. Get the area where you want to change the cursor (GTK::Widget#window)
  2. Change the cursor in this area (GDK::Window#cursor=)

Hope it helps.

Simon

Dobai-Pataky Bálint wrote:

this is how i do it:
mainwindow.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))

i’ll give it a hit if you send us the download address.

ZiK is an audio player based on ruby/gtk2 and ruby/gst.
The official website can be found at http://zik.rubyforge.org/. The
project is hosted by rubyforge : http://rubyforge.org/projects/zik/.

Dobai-Pataky Bálint wrote:

i’ll give it a hit if you send us the download address.

hi
i like it.
just reported some stug on rubyforge.

thanks

Hi

2009/12/7 Vincent C. [email protected]

Thanks for your interesd on ZiK. I have answered to ypur reports on
rubyforge. Can you explain this two points :
scroll event handling on the trayicon,

I think he means :
Do something when I scroll the mouse wheel, while the mouse is over the
tray
icon.
Maybe next/prev song, or play faster/slower.

I tried very fast.
I crash when I try to access the preferences, but I think it’s because I
did
not install it. I just cloned and ruby main.rb. It seems you are loading
libs with a path configured somewhere, which is bad, imo.

Also, I don’t know why, but taglib is taglib2 if installed through gems.
Maybe contact the author to fix this.

Good work otherwise, even if I’m not looking for a new music player. I’m
happy to know there will be something to look at if I ever need GST in
ruby
:).

cheers

Simon

Thanks for your interesd on ZiK. I have answered to ypur reports on
rubyforge. Can you explain this two points :
scroll event handling on the trayicon,
padding of widgets in the preferences window/browser,playlist.

As I am not fluent in english I am nnot I understand wht you mean.

Dobai-Pataky Bálint wrote:

hi
i like it.
just reported some stug on rubyforge.

thanks

2009/12/8 Vincent C. [email protected]

(widget)’ failed
Gtk-CRITICAL **:gtk_container_add: assertion GTK_IS_WIDGET (widget)' failed Gtk-CRITICAL **:gtk_widget_thaw_child_notify: assertion GTK_IS_WIDGET
(widget)’ failed

I really don’t know how to do it :). I was just clarifying.

Latest gtk has a signal for that, dunno if it is in ruby-gnome2.
http://library.gnome.org/devel/gtk/stable/GtkStatusIcon.html

libs are loaded by :
require ‘lib’
but ZiK files (other than ZiK.rb/main.rb) are loaded by adding Data_dir
to $:.
In main.rb Data_dir is defined by File.dirname(FILE). Maybe there is
something to do here.
In installed ZiK, Data_dir was redefined by installation.
Is there a better way (a more rubysh one) of doing things?
I use ./main.rb (instead ofruby main.rb) and everything works smooth.

You might want to look at :

I do not use gems. I install all package from my distributions. I will
have to learn how to use gems before checking this and create a gem
release of ZiK.
The library used by ZiK can be found at
Ruby-taglib.

I know where to find it :).
I was just saying that it is shipped as ‘taglib’ on my distribution
(Debian
sid), et as ‘taglib2’ through gems. Both are the same lib, I don’t know
why
the gem is shipped as ‘taglib2’. The author has not been working on it
since
2006 it seems, so he may not be working on it anymore.

The crash with preferences dialog was a bug! Thanks for the report. It
should be fix in the last commit.

Simon A. wrote:

I really don’t know how to do it :). I was just clarifying.

Latest gtk has a signal for that, dunno if it is in ruby-gnome2.
http://library.gnome.org/devel/gtk/stable/GtkStatusIcon.html

Thanks for the clarification. This signal is not implemented ruby/gtk
0.17. I will try 0.19 later.

You might want to look at :
Ruby on Rails — Gem Packaging: Best Practices

Thanks for the link. I will try to change my practises.

I know where to find it :).
I was just saying that it is shipped as ‘taglib’ on my distribution
(Debian
sid), et as ‘taglib2’ through gems. Both are the same lib, I don’t know
why
the gem is shipped as ‘taglib2’. The author has not been working on it
since
2006 it seems, so he may not be working on it anymore.

I add the link just to be sure we were talking about the same lib. Can
you mail me the address of the gem packager? You can find mine in
main.rb.

Hi.

Simon A. wrote:

I think he means :
Do something when I scroll the mouse wheel, while the mouse is over the
tray
icon.
Maybe next/prev song, or play faster/slower.

Next/prev song on scroll event seems nice but I do not no how to deal
with events and Gtk::StatusIcon. It seems you cannot add a
Gtk::StatusIcon to a Gtk::EventBox.

require ‘gtk2’
si=Gtk::StatusIcon.new
eb=Gtk::EventBox.new
eb.add(si)
GLib-GObject-WARNING **:invalid cast from GtkStatusIcon' to GtkWidget’
Gtk-CRITICAL **:gtk_widget_freeze_child_notify: assertion GTK_IS_WIDGET (widget)' failed Gtk-CRITICAL **:gtk_container_add: assertion GTK_IS_WIDGET (widget)’
failed
Gtk-CRITICAL **:gtk_widget_thaw_child_notify: assertion `GTK_IS_WIDGET
(widget)’ failed

I tried very fast.
I crash when I try to access the preferences, but I think it’s because I
did
not install it. I just cloned and ruby main.rb. It seems you are loading
libs with a path configured somewhere, which is bad, imo.

libs are loaded by :
require ‘lib’
but ZiK files (other than ZiK.rb/main.rb) are loaded by adding Data_dir
to $:.
In main.rb Data_dir is defined by File.dirname(FILE). Maybe there is
something to do here.
In installed ZiK, Data_dir was redefined by installation.
Is there a better way (a more rubysh one) of doing things?
I use ./main.rb (instead ofruby main.rb) and everything works smooth.

Also, I don’t know why, but taglib is taglib2 if installed through gems.
Maybe contact the author to fix this.

I do not use gems. I install all package from my distributions. I will
have to learn how to use gems before checking this and create a gem
release of ZiK.
The library used by ZiK can be found at
Ruby-taglib.

Good work otherwise, even if I’m not looking for a new music player. I’m
happy to know there will be something to look at if I ever need GST in
ruby
:).

Thanks.

Dobai-Pataky Bálint wrote:

hi
i like it.
just reported some stug on rubyforge.

thanks

Hi.

The ZiK 0.12 was released. I think it closes features request you add on
rubyforge.
http://rubyforge.org/tracker/index.php?func=detail&aid=27519&group_id=5494&atid=21259
Can you give it a try and tell me if features you missed are
implemented?

Vincent.

thanks,
i will