• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.org Installation Manager Tool


Commit MetaInfo

Revision9f098f7e24ee5466a30a23e0c45b08009c3705fa (tree)
Time2013-09-20 21:05:26
AuthorKeith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

Establish default preferences for GUI; (cf. MinGW-Feature #2036)

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
11 2013-09-20 Keith Marshall <keithmarshall@users.sourceforge.net>
22
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+
321 Force canonical comparison of shell links; (cf. MinGW-Bug #2054)
422
523 * scripts/libexec/unlink.js [FileExists(filename) && (chklink != "")]:
--- a/src/climain.cpp
+++ b/src/climain.cpp
@@ -4,7 +4,7 @@
44 * $Id$
55 *
66 * 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
88 *
99 *
1010 * Implementation of the main program function, which is invoked by
@@ -223,7 +223,7 @@ EXTERN_C int climain( int argc, char **argv )
223223 /* ...initialise any preferences which the user may
224224 * have specified within profile.xml...
225225 */
226- dbase.EstablishPreferences();
226+ dbase.EstablishPreferences( "cli" );
227227
228228 /* ...and invoke the appropriate action handler.
229229 */
--- a/src/guiexec.cpp
+++ b/src/guiexec.cpp
@@ -175,9 +175,14 @@ void AppWindowMaker::LoadPackageData( bool force_update )
175175 throw WTK::runtime_error( "Cannot read package catalogue" );
176176
177177 /* Finally, load the installation records pertaining to
178- * the active system map.
178+ * the active system map...
179179 */
180180 pkgData->LoadSystemMap();
181+
182+ /* ...and establish any preferences which the user may have
183+ * specified within profile.xml
184+ */
185+ pkgData->EstablishPreferences( "gui" );
181186 }
182187
183188 static void pkgInvokeInitDataLoad( void *window )
--- a/src/pkgbase.h
+++ b/src/pkgbase.h
@@ -5,7 +5,7 @@
55 * $Id$
66 *
77 * 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
99 *
1010 *
1111 * Public interface for the package directory management routines;
@@ -409,7 +409,7 @@ class pkgXmlDocument : public TiXmlDocument
409409 * options, which are specified within profile.xml rather than on
410410 * the command line.
411411 */
412- void EstablishPreferences();
412+ void EstablishPreferences( const char* = NULL );
413413
414414 /* Method to synchronise the state of the local package manifest
415415 * with the master copy held on the distribution server.
--- a/src/pkgopts.cpp
+++ b/src/pkgopts.cpp
@@ -4,7 +4,7 @@
44 * $Id$
55 *
66 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
7- * Copyright (C) 2012, MinGW Project
7+ * Copyright (C) 2012, 2013, MinGW.org Project
88 *
99 *
1010 * Implementation of XML interpreter for configuation of preferences.
@@ -83,6 +83,7 @@ class pkgPreferenceEvaluator
8383 /* XML tag/attribute key names, used exclusively within this module.
8484 */
8585 static const char *prefs_key = "preferences";
86+static const char *client_key = "client";
8687 static const char *option_key = "option";
8788 static const char *value_key = "value";
8889
@@ -306,7 +307,7 @@ void pkgPreferenceEvaluator::SetScriptHook( const char *key, ... )
306307 }
307308 }
308309
309-void pkgXmlDocument::EstablishPreferences()
310+void pkgXmlDocument::EstablishPreferences( const char *client )
310311 {
311312 /* Method to interpret the content of any "preferences" sections
312313 * appearing within the XML database.
@@ -325,37 +326,44 @@ void pkgXmlDocument::EstablishPreferences()
325326 pkgXmlNode *prefs = dbase_root->FindFirstAssociate( prefs_key );
326327 while( prefs != NULL )
327328 {
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...
329331 */
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) )
332334 {
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 )
335339 {
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 );
343350
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 );
349356
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 );
355366 }
356- /* Repeat for any further "enable" specifations...
357- */
358- opt.GetNext( option_key );
359367 }
360368 /* ...and for any additional "preferences" sections.
361369 */
--- a/xml/profile.xml
+++ b/xml/profile.xml
@@ -4,7 +4,7 @@
44 $Id$
55
66 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
88
99
1010 Master configuration profile for mingw-get.
@@ -31,7 +31,7 @@
3131 arising from the use of this software.
3232 -->
3333
34- <preferences>
34+ <preferences client="cli">
3535 <!--
3636 "preferences" specifications provide a mechanism for defining
3737 user specified default attributes for command line options such
@@ -52,6 +52,24 @@
5252 <!--option name="start-menu" value="all-users" /-->
5353 </preferences>
5454
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+
5573 <repository uri="http://prdownloads.sourceforge.net/mingw/%F.xml.lzma?download">
5674 <!--
5775 The "repository" specification identifies the URI where package