Forum: Ruby-Gnome 2 rbw and backticks on windows + StatusIcon tooltip update?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7988f36d0ee9050e8f1d646db55a9eb0?d=identicon&s=25 Gergely Kontra (Guest)
on 2007-05-02 16:51
(Received via mailing list)
Hi!

I've tried StatusIcon. It works fine, but during this test, I've
realized, that if I start the program with an rbw extension (no
command window), it flashes if I invoke external command with
backticks.

Is there any solution to that?

And is it possible to update the tooltip just in case I move the
cursor over the status icon?

thanks

Gergo

Code follows:

require 'gtk2'

class SubstIcon < Gtk::StatusIcon
    def initialize
        super
        update
        signal_connect("popup-menu"){|w, button, activate_time|
      menu = Gtk::Menu.new
            menuitem = Gtk::MenuItem.new("Quit")
            menuitem.signal_connect("activate"){
                set_visible(false)
                Gtk.main_quit
            }
            menu.append(menuitem)
            menu.show_all
            menu.popup(nil, nil, button, activate_time)
        }
        timeout_func
    end
    def timeout_func
        GLib::Timeout.add(1000) {
            update
            true
        }
    end
    def update
        set_icon_name(Gtk::Stock::DIALOG_INFO)
        subst = `subst`.split("\n").
            find_all {|l| l =~ /^S:\\:/}.
            map{|l| /=> .:\\(.*)/.match(l)[1]}[0] + "\n" +
            File.new('s:\varial\source\version.txt').readline
        set_tooltip subst
    end
end
SubstIcon.new

Gtk.main

--
+-[ Gergely Kontra <pihentagy@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
This topic is locked and can not be replied to.