The MinGW.org Installation Manager Tool
Revision | 9f098f7e24ee5466a30a23e0c45b08009c3705fa (tree) |
---|---|
Time | 2013-09-20 21:05:26 |
Author | Keith Marshall <keithmarshall@user...> |
Commiter | Keith Marshall |
Establish default preferences for GUI; (cf. MinGW-Feature #2036)
@@ -1,5 +1,23 @@ | ||
1 | 1 | 2013-09-20 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 2 | |
3 | + Establish default preferences for GUI; (cf. MinGW-Feature #2036) | |
4 | + | |
5 | + * src/pkgbase.h (pkgXmlDocument::EstablishPreferences): Adjust its | |
6 | + prototype; add argument identifying prospective client classification. | |
7 | + | |
8 | + * src/pkgopts.cpp (client_key): New XML property keyword; define it. | |
9 | + (pkgXmlDocument::EstablishPreferences): Implement filter, based on new | |
10 | + client classification argument, to restrict preference selection to a | |
11 | + matching client class specification. | |
12 | + | |
13 | + * src/climain.cpp (dbase.EstablishPreferences): Filter on class "cli". | |
14 | + * src/guiexec.cpp (pkgData->EstablishPreferences): Likewise, on "gui". | |
15 | + | |
16 | + * xml/profile.xml (preferences): Add client="cli" attribute for the | |
17 | + existing specification; add another for client="gui". | |
18 | + | |
19 | +2013-09-20 Keith Marshall <keithmarshall@users.sourceforge.net> | |
20 | + | |
3 | 21 | Force canonical comparison of shell links; (cf. MinGW-Bug #2054) |
4 | 22 | |
5 | 23 | * scripts/libexec/unlink.js [FileExists(filename) && (chklink != "")]: |
@@ -4,7 +4,7 @@ | ||
4 | 4 | * $Id$ |
5 | 5 | * |
6 | 6 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
7 | - * Copyright (C) 2009, 2010, 2011, 2012, MinGW Project | |
7 | + * Copyright (C) 2009-2013, MinGW.org Project | |
8 | 8 | * |
9 | 9 | * |
10 | 10 | * Implementation of the main program function, which is invoked by |
@@ -223,7 +223,7 @@ EXTERN_C int climain( int argc, char **argv ) | ||
223 | 223 | /* ...initialise any preferences which the user may |
224 | 224 | * have specified within profile.xml... |
225 | 225 | */ |
226 | - dbase.EstablishPreferences(); | |
226 | + dbase.EstablishPreferences( "cli" ); | |
227 | 227 | |
228 | 228 | /* ...and invoke the appropriate action handler. |
229 | 229 | */ |
@@ -175,9 +175,14 @@ void AppWindowMaker::LoadPackageData( bool force_update ) | ||
175 | 175 | throw WTK::runtime_error( "Cannot read package catalogue" ); |
176 | 176 | |
177 | 177 | /* Finally, load the installation records pertaining to |
178 | - * the active system map. | |
178 | + * the active system map... | |
179 | 179 | */ |
180 | 180 | pkgData->LoadSystemMap(); |
181 | + | |
182 | + /* ...and establish any preferences which the user may have | |
183 | + * specified within profile.xml | |
184 | + */ | |
185 | + pkgData->EstablishPreferences( "gui" ); | |
181 | 186 | } |
182 | 187 | |
183 | 188 | static void pkgInvokeInitDataLoad( void *window ) |
@@ -5,7 +5,7 @@ | ||
5 | 5 | * $Id$ |
6 | 6 | * |
7 | 7 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
8 | - * Copyright (C) 2009, 2010, 2011, 2012, 2013, MinGW.org Project | |
8 | + * Copyright (C) 2009-2013, MinGW.org Project | |
9 | 9 | * |
10 | 10 | * |
11 | 11 | * Public interface for the package directory management routines; |
@@ -409,7 +409,7 @@ class pkgXmlDocument : public TiXmlDocument | ||
409 | 409 | * options, which are specified within profile.xml rather than on |
410 | 410 | * the command line. |
411 | 411 | */ |
412 | - void EstablishPreferences(); | |
412 | + void EstablishPreferences( const char* = NULL ); | |
413 | 413 | |
414 | 414 | /* Method to synchronise the state of the local package manifest |
415 | 415 | * with the master copy held on the distribution server. |
@@ -4,7 +4,7 @@ | ||
4 | 4 | * $Id$ |
5 | 5 | * |
6 | 6 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
7 | - * Copyright (C) 2012, MinGW Project | |
7 | + * Copyright (C) 2012, 2013, MinGW.org Project | |
8 | 8 | * |
9 | 9 | * |
10 | 10 | * Implementation of XML interpreter for configuation of preferences. |
@@ -83,6 +83,7 @@ class pkgPreferenceEvaluator | ||
83 | 83 | /* XML tag/attribute key names, used exclusively within this module. |
84 | 84 | */ |
85 | 85 | static const char *prefs_key = "preferences"; |
86 | +static const char *client_key = "client"; | |
86 | 87 | static const char *option_key = "option"; |
87 | 88 | static const char *value_key = "value"; |
88 | 89 |
@@ -306,7 +307,7 @@ void pkgPreferenceEvaluator::SetScriptHook( const char *key, ... ) | ||
306 | 307 | } |
307 | 308 | } |
308 | 309 | |
309 | -void pkgXmlDocument::EstablishPreferences() | |
310 | +void pkgXmlDocument::EstablishPreferences( const char *client ) | |
310 | 311 | { |
311 | 312 | /* Method to interpret the content of any "preferences" sections |
312 | 313 | * appearing within the XML database. |
@@ -325,37 +326,44 @@ void pkgXmlDocument::EstablishPreferences() | ||
325 | 326 | pkgXmlNode *prefs = dbase_root->FindFirstAssociate( prefs_key ); |
326 | 327 | while( prefs != NULL ) |
327 | 328 | { |
328 | - /* ...and interpret any contained "enable" specifications. | |
329 | + /* ...then, for it and any of its siblings which apply within | |
330 | + * the active application profile classification... | |
329 | 331 | */ |
330 | - pkgPreferenceEvaluator opt( prefs->FindFirstAssociate( option_key )); | |
331 | - while( opt.Current() != NULL ) | |
332 | + if( (client == NULL) | |
333 | + || (strcasecmp( client, prefs->GetPropVal( client_key, client )) == 0) ) | |
332 | 334 | { |
333 | - const char *optname; | |
334 | - if( (optname = opt.SetName()) != NULL ) | |
335 | + /* ...interpret any contained "enable" specifications. | |
336 | + */ | |
337 | + pkgPreferenceEvaluator opt( prefs->FindFirstAssociate( option_key )); | |
338 | + while( opt.Current() != NULL ) | |
335 | 339 | { |
336 | - if( opt_strcmp( optname, desktop_option ) == 0 ) | |
337 | - /* | |
338 | - * Enable post-install hook for creation of desktop shortcuts; | |
339 | - * by default, these are defined for current user only, but may | |
340 | - * optionally be provided for all users. | |
341 | - */ | |
342 | - opt.SetScriptHook( PKG_DESKTOP_HOOK, NULL ); | |
340 | + const char *optname; | |
341 | + if( (optname = opt.SetName()) != NULL ) | |
342 | + { | |
343 | + if( opt_strcmp( optname, desktop_option ) == 0 ) | |
344 | + /* | |
345 | + * Enable post-install hook for creation of desktop shortcuts; | |
346 | + * by default, these are defined for current user only, but may | |
347 | + * optionally be provided for all users. | |
348 | + */ | |
349 | + opt.SetScriptHook( PKG_DESKTOP_HOOK, NULL ); | |
343 | 350 | |
344 | - else if( opt_strcmp( optname, start_menu_option ) == 0 ) | |
345 | - /* | |
346 | - * Similarly, enable hook for creation of start menu shortcuts. | |
347 | - */ | |
348 | - opt.SetScriptHook( PKG_START_MENU_HOOK, NULL ); | |
351 | + else if( opt_strcmp( optname, start_menu_option ) == 0 ) | |
352 | + /* | |
353 | + * Similarly, enable hook for creation of start menu shortcuts. | |
354 | + */ | |
355 | + opt.SetScriptHook( PKG_START_MENU_HOOK, NULL ); | |
349 | 356 | |
350 | - else | |
351 | - /* Any unrecognised option specification is simply ignored, | |
352 | - * after posting an appropriate diagnostic message. | |
353 | - */ | |
354 | - dmh_notify( DMH_WARNING, "unknown option '%s' ignored\n", optname ); | |
357 | + else | |
358 | + /* Any unrecognised option specification is simply ignored, | |
359 | + * after posting an appropriate diagnostic message. | |
360 | + */ | |
361 | + dmh_notify( DMH_WARNING, "unknown option '%s' ignored\n", optname ); | |
362 | + } | |
363 | + /* Repeat for any further "enable" specifations... | |
364 | + */ | |
365 | + opt.GetNext( option_key ); | |
355 | 366 | } |
356 | - /* Repeat for any further "enable" specifations... | |
357 | - */ | |
358 | - opt.GetNext( option_key ); | |
359 | 367 | } |
360 | 368 | /* ...and for any additional "preferences" sections. |
361 | 369 | */ |
@@ -4,7 +4,7 @@ | ||
4 | 4 | $Id$ |
5 | 5 | |
6 | 6 | Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
7 | - Copyright (C) 2009, 2010, 2012, MinGW Project | |
7 | + Copyright (C) 2009, 2010, 2012, 2013, MinGW.org Project | |
8 | 8 | |
9 | 9 | |
10 | 10 | Master configuration profile for mingw-get. |
@@ -31,7 +31,7 @@ | ||
31 | 31 | arising from the use of this software. |
32 | 32 | --> |
33 | 33 | |
34 | - <preferences> | |
34 | + <preferences client="cli"> | |
35 | 35 | <!-- |
36 | 36 | "preferences" specifications provide a mechanism for defining |
37 | 37 | user specified default attributes for command line options such |
@@ -52,6 +52,24 @@ | ||
52 | 52 | <!--option name="start-menu" value="all-users" /--> |
53 | 53 | </preferences> |
54 | 54 | |
55 | + <preferences client="gui"> | |
56 | + <!-- | |
57 | + The preceding "preferences" section applies exclusively to the | |
58 | + CLI client, (where command line options may be used); here, we | |
59 | + specify defaults for the GUI client, (which provides no support | |
60 | + for command line options), such that shortcuts will be created | |
61 | + on the desktop, and in the start menu, for the current user. | |
62 | + | |
63 | + Note that matching of the "client" attribute will be performed | |
64 | + case-insensitively, against a keyword defined by the respective | |
65 | + client; any "preferences" section with no "client" assignment | |
66 | + will be matched for ALL clients. | |
67 | + --> | |
68 | + | |
69 | + <option name="desktop" /> | |
70 | + <option name="start-menu" /> | |
71 | + </preferences> | |
72 | + | |
55 | 73 | <repository uri="http://prdownloads.sourceforge.net/mingw/%F.xml.lzma?download"> |
56 | 74 | <!-- |
57 | 75 | The "repository" specification identifies the URI where package |