shutdown-dialog 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in shutdown_dialog.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Arthur Andersen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,10 @@
1
+ # Shutdown Dialog
2
+
3
+ `shutdown-dialog` is a very simple dialog showing buttons to log out,
4
+ suspend, reboot or shutdown the computer. It´s using the ruby-gnome2
5
+ gem to display the menu.
6
+
7
+ ## Inpstallation
8
+
9
+ Just do a simple `sudo gem install shutdown-dialog` on your systems
10
+ ruby.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'shutdown-dialog'
4
+
5
+ ShutdownDialog.show_window
@@ -0,0 +1,85 @@
1
+ require "shutdown-dialog/version"
2
+
3
+ require 'gtk2'
4
+
5
+ module ShutdownDialog
6
+ def self.show_window
7
+ icon_size = Gtk::IconSize.register('48x48', 48, 48)
8
+
9
+ vbox = Gtk::VBox.new(false, 0)
10
+ hbox = Gtk::HBox.new(true, 0)
11
+ vbox1 = Gtk::VBox.new(false, 0)
12
+ vbox2 = Gtk::VBox.new(false, 0)
13
+
14
+ logout_button = Gtk::Button.new("Log Out")
15
+ logout_image = Gtk::Image.new('gnome-logout', icon_size)
16
+ logout_button.set_image(logout_image)
17
+ logout_button.signal_connect("clicked") do
18
+ Gtk.main_quit
19
+ system "echo \"awesome.quit()\" | awesome-client"
20
+ end
21
+
22
+ reboot_button = Gtk::Button.new("Reboot")
23
+ reboot_image = Gtk::Image.new('gnome-session-reboot', icon_size)
24
+ reboot_button.set_image(reboot_image)
25
+ reboot_button.signal_connect("clicked") do
26
+ Gtk.main_quit
27
+ system "sudo reboot"
28
+ end
29
+ vbox1.pack_end(reboot_button)
30
+
31
+ poweroff_button = Gtk::Button.new("Power Off")
32
+ poweroff_image = Gtk::Image.new('gnome-shutdown', icon_size)
33
+ poweroff_button.set_image(poweroff_image)
34
+ poweroff_button.signal_connect("clicked") do
35
+ Gtk.main_quit
36
+ system "sudo poweroff"
37
+ end
38
+ vbox2.pack_end(poweroff_button)
39
+
40
+ suspend_button = Gtk::Button.new("Suspend")
41
+ suspend_image = Gtk::Image.new('gnome-session-suspend', icon_size)
42
+ suspend_button.set_image(suspend_image)
43
+ suspend_button.signal_connect("clicked") do
44
+ Gtk.main_quit
45
+ system "sudo pm-suspend"
46
+ end
47
+ vbox1.pack_end(suspend_button)
48
+
49
+ hibernate_button = Gtk::Button.new("Hibernate")
50
+ hibernate_image = Gtk::Image.new('gnome-session-hibernate', icon_size)
51
+ hibernate_button.set_image(hibernate_image)
52
+ hibernate_button.signal_connect("clicked") do
53
+ Gtk.main_quit
54
+ system "sudo pm-hibernate"
55
+ end
56
+ vbox2.pack_end(hibernate_button)
57
+
58
+ hbox.pack_start(vbox1)
59
+ hbox.pack_start(vbox2)
60
+
61
+ vbox.pack_start(logout_button)
62
+ vbox.pack_start(hbox)
63
+
64
+ window = Gtk::Window.new
65
+ window.signal_connect("delete_event") { false }
66
+
67
+ window.window_position = Gtk::Window::POS_CENTER_ALWAYS
68
+
69
+ window.signal_connect("destroy") do
70
+ Gtk.main_quit
71
+ end
72
+
73
+ window.border_width = 10
74
+
75
+ window.add(vbox)
76
+
77
+ window.set_type_hint Gdk::Window::TYPE_HINT_DIALOG
78
+ window.set_default_size 500, 300
79
+ window.set_focus logout_button
80
+
81
+ window.show_all
82
+
83
+ Gtk.main
84
+ end
85
+ end
@@ -0,0 +1,5 @@
1
+ module Shutdown
2
+ module Dialog
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/shutdown-dialog/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Arthur Andersen"]
6
+ gem.email = ["leoc.git@gmail.com"]
7
+ gem.description = %q{A simple shutdown dialog}
8
+ gem.summary = %q{A simple shutdown dialog}
9
+ gem.homepage = "https://github.com/leoc/shutdown-dialog"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "shutdown-dialog"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Shutdown::Dialog::VERSION
17
+
18
+ gem.add_dependency "gtk2"
19
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shutdown-dialog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Arthur Andersen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-02-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: gtk2
16
+ requirement: &14357660 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *14357660
25
+ description: A simple shutdown dialog
26
+ email:
27
+ - leoc.git@gmail.com
28
+ executables:
29
+ - shutdown-dialog
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - bin/shutdown-dialog
39
+ - lib/shutdown-dialog.rb
40
+ - lib/shutdown-dialog/version.rb
41
+ - shutdown-dialog.gemspec
42
+ homepage: https://github.com/leoc/shutdown-dialog
43
+ licenses: []
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 1.8.11
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: A simple shutdown dialog
66
+ test_files: []