quick_start 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Michał Łomnicki
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,38 @@
1
+ = QuickStart: Simple tool which runs chosen programs on startup
2
+
3
+ It's best to use QuickStart with GNOME as it's build with GTK. After GNOME startup QuickStart window is shown,
4
+ where one can choose set of applications started by one-click. Currently set of application is hardcoded as consists of
5
+ * firefox
6
+ * evolution
7
+ * skype
8
+ * gnome-terminal
9
+
10
+ All aplications are selected by default.
11
+
12
+ The set should be configured and this is job which will be done soon.
13
+
14
+ == Dependencies
15
+
16
+ * ruby
17
+ * libglade2-ruby
18
+
19
+ == Installation
20
+
21
+ sudo gem install mlomnicki-quick_start
22
+
23
+ At GNOME panel:
24
+ System -> Preferences -> Startup Applications, add new item and put /usr/bin/quick_start as command.
25
+
26
+ == About
27
+
28
+ Author:: Michał Łomnicki <michal@lomnicki.com.pl>
29
+ License:: Copyright 2009 by Michał Łomnicki
30
+ Released under a MIT license.
31
+
32
+ == Warranty
33
+
34
+ This software is provided "as is" and without any express or
35
+ implied warranties, including, without limitation, the implied
36
+ warranties of merchantibility and fitness for a particular
37
+ purpose.
38
+
data/bin/quick_start ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ LIBDIR = File.join( File.dirname(__FILE__), '..', 'lib' )
4
+ require File.join( LIBDIR, 'quick_start' )
5
+
6
+ PROG_PATH = File.join( LIBDIR, 'quick_start', 'quick_start.glade' )
7
+ PROG_NAME = "QuickStart"
8
+ qs = QuickStart::QuickStart2Glade.new(PROG_PATH, nil, PROG_NAME)
9
+ qs.show
10
+ Gtk.main
@@ -0,0 +1,29 @@
1
+ module QuickStart
2
+
3
+ class Program
4
+ @@map = {
5
+ :firefox => '/usr/bin/firefox',
6
+ :evolution => '/usr/bin/evolution',
7
+ :skype => '/usr/bin/skype',
8
+ :terminal => '/usr/bin/gnome-terminal'
9
+ }
10
+
11
+ class << self
12
+
13
+ def map
14
+ @@map
15
+ end
16
+
17
+ def run( name )
18
+ puts "running #{name} #{@@map[name.to_sym]}"
19
+ pid = Kernel.fork do
20
+ exec( @@map[name.to_sym] )
21
+ end
22
+ Process.detach(pid)
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,225 @@
1
+ <?xml version="1.0"?>
2
+ <glade-interface>
3
+ <!-- interface-requires gtk+ 2.16 -->
4
+ <!-- interface-naming-policy project-wide -->
5
+ <widget class="GtkWindow" id="main_window">
6
+ <property name="width_request">400</property>
7
+ <property name="height_request">200</property>
8
+ <property name="title" translatable="yes">QuickStart</property>
9
+ <property name="resizable">False</property>
10
+ <property name="window_position">center-always</property>
11
+ <property name="default_width">400</property>
12
+ <property name="default_height">250</property>
13
+ <child>
14
+ <widget class="GtkVBox" id="vbox1">
15
+ <property name="visible">True</property>
16
+ <property name="orientation">vertical</property>
17
+ <child>
18
+ <widget class="GtkHBox" id="box_programs">
19
+ <property name="visible">True</property>
20
+ <child>
21
+ <placeholder/>
22
+ </child>
23
+ </widget>
24
+ <packing>
25
+ <property name="position">0</property>
26
+ </packing>
27
+ </child>
28
+ <child>
29
+ <widget class="GtkHBox" id="hbox1">
30
+ <property name="visible">True</property>
31
+ <child>
32
+ <placeholder/>
33
+ </child>
34
+ <child>
35
+ <widget class="GtkButton" id="btn_run">
36
+ <property name="label" translatable="yes">Start</property>
37
+ <property name="visible">True</property>
38
+ <property name="can_focus">True</property>
39
+ <property name="receives_default">True</property>
40
+ <signal name="clicked" handler="on_btn_run_clicked"/>
41
+ </widget>
42
+ <packing>
43
+ <property name="position">1</property>
44
+ </packing>
45
+ </child>
46
+ <child>
47
+ <placeholder/>
48
+ </child>
49
+ </widget>
50
+ <packing>
51
+ <property name="position">1</property>
52
+ </packing>
53
+ </child>
54
+ <child>
55
+ <widget class="GtkStatusbar" id="status_bar">
56
+ <property name="visible">True</property>
57
+ <property name="spacing">2</property>
58
+ </widget>
59
+ <packing>
60
+ <property name="expand">False</property>
61
+ <property name="position">2</property>
62
+ </packing>
63
+ </child>
64
+ </widget>
65
+ </child>
66
+ </widget>
67
+ <widget class="GtkDialog" id="config_dialog">
68
+ <property name="border_width">5</property>
69
+ <property name="type_hint">normal</property>
70
+ <property name="has_separator">False</property>
71
+ <child internal-child="vbox">
72
+ <widget class="GtkVBox" id="dialog-vbox1">
73
+ <property name="visible">True</property>
74
+ <property name="orientation">vertical</property>
75
+ <property name="spacing">2</property>
76
+ <child>
77
+ <widget class="GtkHBox" id="box_config_programs">
78
+ <property name="visible">True</property>
79
+ <property name="border_width">10</property>
80
+ <child>
81
+ <widget class="GtkVButtonBox" id="box_config_programs_labels">
82
+ <property name="visible">True</property>
83
+ <child>
84
+ <placeholder/>
85
+ </child>
86
+ </widget>
87
+ <packing>
88
+ <property name="position">0</property>
89
+ </packing>
90
+ </child>
91
+ <child>
92
+ <widget class="GtkVButtonBox" id="box_config_programs_paths">
93
+ <property name="visible">True</property>
94
+ <child>
95
+ <placeholder/>
96
+ </child>
97
+ </widget>
98
+ <packing>
99
+ <property name="position">1</property>
100
+ </packing>
101
+ </child>
102
+ <child>
103
+ <widget class="GtkVButtonBox" id="box_config_programs_remove">
104
+ <property name="visible">True</property>
105
+ <child>
106
+ <placeholder/>
107
+ </child>
108
+ </widget>
109
+ <packing>
110
+ <property name="position">2</property>
111
+ </packing>
112
+ </child>
113
+ </widget>
114
+ <packing>
115
+ <property name="position">1</property>
116
+ </packing>
117
+ </child>
118
+ <child>
119
+ <widget class="GtkTable" id="dlg_config_table">
120
+ <property name="visible">True</property>
121
+ <property name="n_rows">3</property>
122
+ <property name="n_columns">2</property>
123
+ <child>
124
+ <widget class="GtkLabel" id="lbl_new_program_name">
125
+ <property name="visible">True</property>
126
+ <property name="label" translatable="yes">Name: </property>
127
+ </widget>
128
+ </child>
129
+ <child>
130
+ <widget class="GtkLabel" id="lbl_new_program_path">
131
+ <property name="visible">True</property>
132
+ <property name="label" translatable="yes">Path:</property>
133
+ </widget>
134
+ <packing>
135
+ <property name="top_attach">1</property>
136
+ <property name="bottom_attach">2</property>
137
+ </packing>
138
+ </child>
139
+ <child>
140
+ <widget class="GtkButton" id="btn_new_program_add">
141
+ <property name="label" translatable="yes">Add</property>
142
+ <property name="visible">True</property>
143
+ <property name="can_focus">True</property>
144
+ <property name="receives_default">True</property>
145
+ </widget>
146
+ <packing>
147
+ <property name="left_attach">1</property>
148
+ <property name="right_attach">2</property>
149
+ <property name="top_attach">2</property>
150
+ <property name="bottom_attach">3</property>
151
+ </packing>
152
+ </child>
153
+ <child>
154
+ <widget class="GtkEntry" id="txt_new_program_path">
155
+ <property name="visible">True</property>
156
+ <property name="can_focus">True</property>
157
+ <property name="invisible_char">&#x25CF;</property>
158
+ </widget>
159
+ <packing>
160
+ <property name="left_attach">1</property>
161
+ <property name="right_attach">2</property>
162
+ <property name="top_attach">1</property>
163
+ <property name="bottom_attach">2</property>
164
+ </packing>
165
+ </child>
166
+ <child>
167
+ <widget class="GtkEntry" id="txt_new_program_name">
168
+ <property name="visible">True</property>
169
+ <property name="can_focus">True</property>
170
+ <property name="invisible_char">&#x25CF;</property>
171
+ </widget>
172
+ <packing>
173
+ <property name="left_attach">1</property>
174
+ <property name="right_attach">2</property>
175
+ </packing>
176
+ </child>
177
+ <child>
178
+ <placeholder/>
179
+ </child>
180
+ </widget>
181
+ <packing>
182
+ <property name="position">2</property>
183
+ </packing>
184
+ </child>
185
+ <child internal-child="action_area">
186
+ <widget class="GtkHButtonBox" id="dlg_config">
187
+ <property name="visible">True</property>
188
+ <property name="layout_style">end</property>
189
+ <child>
190
+ <widget class="GtkButton" id="btn_config_cancel">
191
+ <property name="label" translatable="yes">Cancel</property>
192
+ <property name="visible">True</property>
193
+ <property name="can_focus">True</property>
194
+ <property name="receives_default">True</property>
195
+ </widget>
196
+ <packing>
197
+ <property name="expand">False</property>
198
+ <property name="fill">False</property>
199
+ <property name="position">0</property>
200
+ </packing>
201
+ </child>
202
+ <child>
203
+ <widget class="GtkButton" id="btn_config_save">
204
+ <property name="label" translatable="yes">Save</property>
205
+ <property name="visible">True</property>
206
+ <property name="can_focus">True</property>
207
+ <property name="receives_default">True</property>
208
+ </widget>
209
+ <packing>
210
+ <property name="expand">False</property>
211
+ <property name="fill">False</property>
212
+ <property name="position">1</property>
213
+ </packing>
214
+ </child>
215
+ </widget>
216
+ <packing>
217
+ <property name="expand">False</property>
218
+ <property name="pack_type">end</property>
219
+ <property name="position">0</property>
220
+ </packing>
221
+ </child>
222
+ </widget>
223
+ </child>
224
+ </widget>
225
+ </glade-interface>
@@ -0,0 +1,71 @@
1
+ require 'quick_start/program'
2
+
3
+ module QuickStart
4
+
5
+ class QuickStart2Glade
6
+ include GetText
7
+
8
+ attr :glade
9
+
10
+ def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)
11
+ bindtextdomain(domain, localedir, nil, "UTF-8")
12
+ @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}
13
+ @selected_map = {}
14
+ end
15
+
16
+ def show
17
+ @window = glade['main_window']
18
+
19
+ main_vbutton_box = Gtk::VButtonBox.new
20
+ Program.map.each_pair do |name, path|
21
+ main_vbutton_box.add( create_check_button( name.to_s ) )
22
+ glade['box_config_programs_labels'].add( Gtk::Label.new( name.to_s ) )
23
+ glade['box_config_programs_paths'].add( Gtk::Label.new( path ) )
24
+ glade['box_config_programs_remove'].add( Gtk::Button.new( "Remove" ) )
25
+ end
26
+ glade['box_programs'].add( main_vbutton_box )
27
+ @window.show_all
28
+ @window.signal_connect('destroy') { Gtk.main_quit }
29
+ end
30
+
31
+ def on_chb_application_toggled(widget)
32
+ if widget.active?
33
+ selected << widget.name
34
+ else
35
+ selected.delete( widget.name )
36
+ end
37
+ end
38
+
39
+ def on_btn_run_clicked(widget)
40
+ @selected_map.each_value do |program|
41
+
42
+ if program[:active]
43
+ show_status( "Running #{program[:name]}", program[:name] ) do
44
+ Program.run( program[:name] )
45
+ end
46
+ end
47
+ end
48
+ Gtk.main_quit
49
+ end
50
+
51
+ protected
52
+ def show_status( text, context, &block )
53
+ status_bar=glade['status_bar']
54
+ context = status_bar.get_context_id(context)
55
+ status_bar.push( context, text )
56
+ block.call
57
+ status_bar.pop( context )
58
+ end
59
+
60
+ def create_check_button( name )
61
+ button = Gtk::CheckButton.new( name.capitalize ).set_active( true ).set_name( "chb_#{name}" )
62
+ @selected_map[button.name] = { :name => name, :active => true }
63
+ button.signal_connect('toggled') do |widget|
64
+ @selected_map[widget.name][:active] = widget.active?
65
+ end
66
+ button
67
+ end
68
+
69
+ end
70
+
71
+ end
@@ -0,0 +1,5 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'libglade2'
4
+ require 'quick_start/quick_start_2_glade'
5
+
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quick_start
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
+ platform: ruby
6
+ authors:
7
+ - "Micha\xC5\x82 \xC5\x81omnicki"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-12 00:00:00 +02:00
13
+ default_executable: quick_start
14
+ dependencies: []
15
+
16
+ description:
17
+ email: michal@lomnicki.com.pl
18
+ executables:
19
+ - quick_start
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - MIT-LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - README.rdoc
27
+ - MIT-LICENSE
28
+ - bin/quick_start
29
+ - lib/quick_start/quick_start_2_glade.rb
30
+ - lib/quick_start/quick_start.glade
31
+ - lib/quick_start/program.rb
32
+ - lib/quick_start.rb
33
+ has_rdoc: true
34
+ homepage: http://github.com/mlomnicki/quick_start
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --charset=UTF-8
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.3.5
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: Simple tool which runs chosen programs on startup
61
+ test_files: []
62
+