sshfs-mapper qasim-gui: Split appart notification part.
git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1695 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
parent
cd3981db1a
commit
9f0d67eb81
1 changed files with 23 additions and 18 deletions
|
@ -11,8 +11,30 @@ end
|
|||
|
||||
module Qasim
|
||||
|
||||
NAME="Qasim"
|
||||
VERSION="0.1"
|
||||
|
||||
def dbus_notify title, body, icon
|
||||
bus = Qt::DBusConnection.sessionBus
|
||||
if !bus.connected?
|
||||
$stderr.puts("Cannot connect to the D-BUS session bus.\n" \
|
||||
"To start it, run:\n" \
|
||||
"\teval `dbus-launch --auto-syntax`\n")
|
||||
exit 1
|
||||
end
|
||||
msg = Qt::DBusMessage.create_method_call( 'org.freedesktop.Notifications',
|
||||
'/org/freedesktop/Notifications',
|
||||
'org.freedesktop.Notifications',
|
||||
'Notify' )
|
||||
msg.arguments = [ NAME, Qt::Variant.from_value( 0, "unsigned int" ),
|
||||
icon, title, body, [], {}, -1 ]
|
||||
rep = bus.call( msg )
|
||||
# if rep.type == Qt::DBusMessage
|
||||
|
||||
# si.showMessage("Qasim",
|
||||
# "Sorry dude", 2, 5000 )
|
||||
end
|
||||
|
||||
def build_app
|
||||
|
||||
app = Qt::Application.new(ARGV)
|
||||
|
@ -24,25 +46,8 @@ module Qasim
|
|||
|
||||
si.icon = std_icon
|
||||
si.show
|
||||
dbus_notify "Hello", "World", 'dialog-information'
|
||||
|
||||
bus = Qt::DBusConnection.sessionBus
|
||||
if !bus.connected?
|
||||
$stderr.puts("Cannot connect to the D-BUS session bus.\n" \
|
||||
"To start it, run:\n" \
|
||||
"\teval `dbus-launch --auto-syntax`\n")
|
||||
exit 1
|
||||
end
|
||||
msg = Qt::DBusMessage.create_method_call( 'org.freedesktop.Notifications',
|
||||
'/org/freedesktop/Notifications',
|
||||
'org.freedesktop.Notifications',
|
||||
'Notify' )
|
||||
msg.arguments = [ 'Coucou', Qt::Variant.from_value( 0, "unsigned int" ),
|
||||
'dialog-information', 'Title', 'blah', [], {}, -1 ]
|
||||
rep = bus.call( msg )
|
||||
# if rep.type == Qt::DBusMessage
|
||||
|
||||
# si.showMessage("Qasim",
|
||||
# "Sorry dude", 2, 5000 )
|
||||
|
||||
si.setToolTip("Qasim %s" % VERSION);
|
||||
|
||||
|
|
Loading…
Reference in a new issue