Sha256: f69841b58d730515180e1936a7a285ee9ce7a91846b00821da142c56c311292b

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

#!/usr/bin/env ruby

=begin

attach_to_status_icon.rb

Luca Russo <vargolo@gmail.com>
Copyright (LGPL) 2006 - 2010

ruby-libnotify attach_to_status_icon example

=end

begin
  require 'RNotify'
rescue LoadError
  require 'rubygems'
  require 'RNotify'
end

Gtk.init
Notify.init("Test11")

win = Gtk::Window.new(Gtk::Window::TOPLEVEL)
win.signal_connect("destroy") { Gtk.main_quit }

bt = Gtk::Button.new("Click Me!")

win.add(bt)
win.show_all

icon = Gdk::Pixbuf.new(File.dirname(__FILE__) + "/icon.png")
st = Gtk::StatusIcon.new
st.pixbuf=icon

test = Notify::Notification.new("Attach_To", "Do you savvy? :P", nil, st)
test.timeout= Notify::Notification::EXPIRES_NEVER
test.pixbuf_icon=icon
test.add_action("Attach_To", "Click Me!") { Gtk.main_quit }

bt.signal_connect("clicked", test) { |wid,data| data.show }

Gtk.main

test.clear_actions
test.close
Notify.uninit

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-libnotify-0.4.1 examples/attach_to_status_icon.rb