Merge lp:~raof/docky/mono-options-transition into lp:docky

Proposed by Chris Halse Rogers
Status: Rejected
Rejected by: Rico Tzschichholz
Proposed branch: lp:~raof/docky/mono-options-transition
Merge into: lp:docky
Diff against target: 193 lines (+79/-54)
4 files modified
Docky/Docky/Docky.cs (+21/-18)
Docky/Docky/UserArgs.cs (+51/-36)
Docky/Makefile.am (+3/-0)
configure.ac (+4/-0)
To merge this branch: bzr merge lp:~raof/docky/mono-options-transition
Reviewer Review Type Date Requested Status
Rico Tzschichholz Disapprove
Chris Halse Rogers (community) Needs Fixing
Review via email: mp+16830@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Chris Halse Rogers (raof) wrote :

Transition from Mono.GetOptions to Mono.Options (bug #502650).

This (pretty much unavoidably) breaks building with MonoDevelop. If people really want to build using MD, I guess we'll have to copy the Options.cs source into our build tree.

Revision history for this message
Robert Dyer (psybers) wrote :

Hah, doesnt bother me! But Jason and Chris might not appreciate that... ;)

Revision history for this message
Chris Halse Rogers (raof) wrote :

Oh, bollocks. AssemblyInfo.cs also includes Mono.GetOptions references, and is what provides the Author attribute. Allow me to rework this and resubmit.

review: Needs Fixing
Revision history for this message
Rico Tzschichholz (ricotz) wrote :

cszikszoy has merged a solution with trunk 1542

review: Disapprove

Unmerged revisions

1028. By Chris Halse Rogers

Convert from Mono.GetOptions to Mono.Options

1027. By Chris Halse Rogers

Add Mono.Options source to Docky build sources

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Docky/Docky/Docky.cs'
2--- Docky/Docky/Docky.cs 2010-01-02 09:15:52 +0000
3+++ Docky/Docky/Docky.cs 2010-01-05 03:57:13 +0000
4@@ -79,25 +79,28 @@
5 // process the command line args
6 CommandLinePreferences = new UserArgs (args);
7
8- // set process name
9- DockServices.System.SetProcessName ("docky");
10-
11- // check compositing
12- CheckComposite ();
13- Gdk.Screen.Default.CompositedChanged += delegate {
14+ if (!CommandLinePreferences.HelpRequested) {
15+
16+ // set process name
17+ DockServices.System.SetProcessName ("docky");
18+
19+ // check compositing
20 CheckComposite ();
21- };
22-
23- DBusManager.Default.Initialize ();
24- PluginManager.Initialize ();
25- Controller.Initialize ();
26-
27- Gdk.Threads.Enter ();
28- Gtk.Application.Run ();
29- Gdk.Threads.Leave ();
30-
31- Controller.Dispose ();
32- PluginManager.Shutdown ();
33+ Gdk.Screen.Default.CompositedChanged += delegate {
34+ CheckComposite ();
35+ };
36+
37+ DBusManager.Default.Initialize ();
38+ PluginManager.Initialize ();
39+ Controller.Initialize ();
40+
41+ Gdk.Threads.Enter ();
42+ Gtk.Application.Run ();
43+ Gdk.Threads.Leave ();
44+
45+ Controller.Dispose ();
46+ PluginManager.Shutdown ();
47+ }
48 Gnome.Vfs.Vfs.Shutdown ();
49 }
50
51
52=== modified file 'Docky/Docky/UserArgs.cs'
53--- Docky/Docky/UserArgs.cs 2009-12-10 19:31:52 +0000
54+++ Docky/Docky/UserArgs.cs 2010-01-05 03:57:13 +0000
55@@ -19,51 +19,66 @@
56
57 using Docky.Services;
58
59-using Mono.GetOptions;
60-
61-// disable the warning message about Mono.GetOptions.Options being obsolete
62-#pragma warning disable 618
63+using Mono.Options;
64
65 namespace Docky
66 {
67- public class UserArgs : Options
68+ public class UserArgs
69 {
70- public LogLevel Logging { get; protected set; }
71-
72- [Option ("Disable cursor polling (for testing)", 'p', "disable-polling")]
73- public bool NoPollCursor;
74-
75- [Option ("Maximum window dimension (min 500)", 'm', "max-size")]
76- public int MaxSize;
77-
78- [Option ("Enable debug level logging", 'd', "debug")]
79- public bool Debug;
80-
81- [Option ("Netbook mode", 'n', "netbook")]
82- public bool NetbookMode;
83-
84- [Option ("Nvidia mode (for Nvidia cards that lag after awhile) [-b 10]", "nvidia")]
85- public bool NvidiaMode;
86-
87- [Option ("Maximum time (in minutes) to keep buffers", 'b', "buffer-time")]
88- public uint BufferTime;
89+ public LogLevel Logging { get; private set; }
90+ public bool NoPollCursor { get; private set; }
91+ public int MaxSize { get; private set; }
92+ public bool NetbookMode { get; private set; }
93+ public uint BufferTime { get; private set; }
94+ public bool HelpRequested { get; private set; }
95
96 public UserArgs (string[] args)
97 {
98- ParsingMode = OptionsParsingMode.GNU_DoubleDash;
99- ProcessArgs (args);
100+ var options = new OptionSet () {
101+ { "p|disable-polling", "Disable cursor polling (for testing)", v => NoPollCursor = (v != null)},
102+ { "m|max-size=", "Maximum window dimension (min 500)", (int v) => {
103+ if (v < 500) {
104+ throw new OptionException (String.Format ("Maximum window size must be > 500, {0} was specified", v), "max-size");
105+ }
106+ MaxSize = v;
107+ }
108+ },
109+ { "d|debug", "Enable debug level logging", v => {
110+ if (v != null) {
111+ Logging = LogLevel.Debug;
112+ }
113+ }
114+ },
115+ { "n|netbook", "Enable netbook mode", v => NetbookMode = (v != null)},
116+ { "nvidia", "nVidia mode (for nVidia cards that lag after some time)", v => {
117+ if (v != null) {
118+ BufferTime = 10;
119+ }
120+ }
121+ },
122+ { "b|buffer-time=", "Maximum time (in minutes) to keep buffers", (uint v) => BufferTime = v},
123+ { "h|help", "Show this help message", v => HelpRequested = (v != null)}
124+ };
125
126- // defaults
127- if (MaxSize == 0)
128- MaxSize = int.MaxValue;
129- MaxSize = Math.Max (MaxSize, 500);
130+ //Defaults
131 Logging = LogLevel.Warn;
132- if (NvidiaMode)
133- BufferTime = 10;
134- // if the debug option was passed, set it to debug
135- // otherwise leave it to the default, which is warn
136- if (Debug)
137- Log.DisplayLevel = LogLevel.Debug;
138+ MaxSize = int.MaxValue;
139+ BufferTime = 0;
140+ HelpRequested = false;
141+
142+ options.Parse (args);
143+
144+ if (HelpRequested) {
145+ ShowHelp (options);
146+ }
147+ }
148+
149+ static void ShowHelp (OptionSet opts)
150+ {
151+ Console.WriteLine ("Usage: docky [OPTIONS]");
152+ Console.WriteLine ();
153+ Console.WriteLine ("Options:");
154+ opts.WriteOptionDescriptions (Console.Out);
155 }
156 }
157 }
158
159=== modified file 'Docky/Makefile.am'
160--- Docky/Makefile.am 2009-12-20 04:17:12 +0000
161+++ Docky/Makefile.am 2010-01-05 03:57:13 +0000
162@@ -43,6 +43,9 @@
163 Docky/Menus/SeparatorWidget.cs \
164 Docky/Menus/DockItemMenu.cs
165
166+SOURCES_BUILD += $(MONO_OPTIONS_SOURCES)
167+
168+
169 RESOURCES = \
170 gtk-gui/gui.stetic \
171 Resources/about.svg \
172
173=== modified file 'configure.ac'
174--- configure.ac 2010-01-04 17:08:47 +0000
175+++ configure.ac 2010-01-05 03:57:13 +0000
176@@ -95,6 +95,7 @@
177 PKG_CHECK_MODULES([NDESK_DBUS_GLIB_10], [ndesk-dbus-glib-1.0])
178 PKG_CHECK_MODULES([NOTIFY_SHARP], [notify-sharp])
179 PKG_CHECK_MODULES([WNCK_SHARP_10], [wnck-sharp-1.0])
180+PKG_CHECK_MODULES([MONO_OPTIONS], [mono-options])
181
182 dnl check for native libraries (ones that are p/invoked)
183 GTK_REQUIRED_VERSION=2.14.3
184@@ -103,6 +104,9 @@
185 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION)
186 PKG_CHECK_MODULES(GLIB, gobject-2.0 >= $GLIB_REQUIRED_VERSION)
187
188+dnl Get Mono.Options source file
189+MONO_OPTIONS_SOURCES=$(pkg-config --variable=Sources mono-options)
190+AC_SUBST([MONO_OPTIONS_SOURCES])
191
192 AC_SUBST([GCONF_SHARP_20_LIBS])
193 AC_SUBST([GLADE_SHARP_20_LIBS])

Subscribers

People subscribed via source and target branches

to status/vote changes: