Author: locilka
Date: Wed Sep 10 15:54:18 2008
New Revision: 50957
URL: http://svn.opensuse.org/viewcvs/yast?rev=50957&view=rev
Log:
- Desktop selection dialog definitions have been moved to control
file (bnc #424678).
Modified:
trunk/packager/package/yast2-packager.changes
trunk/packager/src/modules/DefaultDesktop.ycp
Modified: trunk/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=50957&r1=50956&r2=50957&view=diff
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Wed Sep 10 15:54:18 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Wed Sep 10 15:52:47 CEST 2008 - locilka@suse.cz
+
+- Desktop selection dialog definitions have been moved to control
+ file (bnc #424678).
+
+-------------------------------------------------------------------
Wed Sep 10 11:37:11 CEST 2008 - lslezak@suse.cz
- repositories.ycp: change table headers when switching to
Modified: trunk/packager/src/modules/DefaultDesktop.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/DefaultDesktop.ycp?rev=50957&r1=50956&r2=50957&view=diff
==============================================================================
--- trunk/packager/src/modules/DefaultDesktop.ycp (original)
+++ trunk/packager/src/modules/DefaultDesktop.ycp Wed Sep 10 15:54:18 2008
@@ -4,7 +4,7 @@
* Authors: Jiri Srain
* Lukas Ocilka
*
- * $Id: Packages.ycp 31512 2006-06-19 11:14:09Z jsrain $
+ * $Id:$
*/
{
@@ -14,87 +14,91 @@
textdomain "packager";
import "ProductFeatures";
+import "ProductControl";
import "Installation";
-// FIXME: Should be defined in control file
+// All desktop definitions are taken from control file
// @see GetAllDesktopsMap
-map all_desktops = $[
- "gnome" : $[
- "desktop" : "gnome",
- "logon" : "gdm",
- "cursor" : "DMZ",
- "packages" : ["gdm"],
- "order" : 1,
- // TRANSLATORS: Dialog label
- "label" : _("GNOME"),
- "patterns" : ["gnome", "x11", "base"],
- "icon" : "pattern-gnome",
- "description" : _("GNOME 2.22 is the latest desktop from the GNOME Project.
-It combines stability and maturity with incremental innovations."),
- ],
- "kde" : $[
- // bnc #381821
- "desktop" : "startkde4",
- "logon" : "kdm4",
- "cursor" : "DMZ",
- "packages" : ["kde4-kdm"],
- "order" : 1,
- // TRANSLATORS: Dialog label
- "label" : _("KDE 4.0"),
- "patterns" : ["kde", "x11", "base"],
- "icon" : "pattern-kde4",
- "description" : _("KDE 4.0 is the most recent evolution of KDE. It comes with many
-new KDE technologies, but it is less mature than the other desktops."),
- ],
- "kde3" : $[
- // bnc #381821
- "desktop" : "startkde3",
- "logon" : "kdm3",
- "cursor" : "DMZ",
- "packages" : ["kdebase3-kdm"],
- "order" : 1,
- // TRANSLATORS: Dialog label
- "label" : _("KDE 3.5"),
- "patterns" : ["kde3", "x11", "base"],
- "icon" : "pattern-kde",
- "description" : _("KDE 3.5 is the previous generation of the K Desktop Environment.
-It is mature and stable."),
- ],
- "xfce" : $[
- // bnc #298558
- "desktop" : "startxfce4",
- "logon" : "xdm",
- "cursor" : "DMZ",
- "packages" : ["xfce4-desktop"],
- "order" : 4,
- // TRANSLATORS: Dialog label
- "label" : _("XFCE Desktop"),
- "patterns" : ["xfce", "x11", "base"],
- "icon" : "pattern-xfce",
- ],
- "min_x" : $[
- "desktop" : "twm",
- "logon" : "xdm",
- "cursor" : "DMZ",
- "packages" : ["xorg-x11"],
- "order" : 6,
- // TRANSLATORS: Dialog label
- "label" : _("Minimal X Window"),
- "patterns" : ["x11", "base"],
- "icon" : "yast-x11",
- ],
- "textmode" : $[
- "desktop" : "twm",
- "logon" : "xdm",
- "cursor" : "DMZ",
- "packages" : ["xorg-x11"],
- "order" : 8,
- // TRANSLATORS: Dialog label
- "label" : _("Minimal Server Selection (Text Mode)"),
- "patterns" : ["enhanced_base"],
- "icon" : "yast-sshd",
- ],
-];
+map all_desktops = nil;
+
+/**
+ * Desktop which was selected in the desktop selection dialog
+ * "kde", "kde3", "gnome", "xfce", "min_x", "textmode", nil
+ */
+string desktop = nil;
+
+any MissingKey (map & desktop_def, string key) {
+ any ret = nil;
+
+ y2warning ("Wrong desktop def, missing '%1' key: %2", key, desktop_def);
+
+ switch (key) {
+ case "order":
+ ret = 99;
+ break;
+ case "desktop":
+ ret = "unknown";
+ break;
+ default:
+ ret = "";
+ break;
+ };
+
+ return ret;
+}
+
+/**
+ * Initialize default desktop from control file if specified there
+ */
+global void Init () {
+ string default_desktop = ProductFeatures::GetStringFeature
+ ("software", "default_desktop");
+ if (default_desktop == "")
+ default_desktop = nil;
+ desktop = default_desktop;
+
+ // See BNC #424678
+ if (all_desktops == nil) {
+ y2milestone ("Getting desktop dialogs from control file...");
+
+ list <map> desktops_from_cf = (list <map>) ProductFeatures::GetFeature ("software", "supported_desktops");
+
+ all_desktops = $[];
+ map one_desktop = $[];
+ string desktop_name = "";
+
+ foreach (map one_desktop_cf, desktops_from_cf, {
+ desktop_name = one_desktop_cf["name"]:"";
+ if (desktop_name == "") {
+ y2error ("Missing 'name' in %1", one_desktop_cf);
+ return;
+ }
+
+ // required keys
+ one_desktop = $[
+ "desktop" : one_desktop_cf["desktop"]:MissingKey (one_desktop_cf, "desktop"),
+ "logon" : one_desktop_cf["logon"]:MissingKey (one_desktop_cf, "logon"),
+ "cursor" : one_desktop_cf["cursor"]:MissingKey (one_desktop_cf, "logon"),
+ "packages" : splitstring (one_desktop_cf["packages"]:"", " \t\n"),
+ "patterns" : splitstring (one_desktop_cf["patterns"]:"", " \t\n"),
+ "order" : one_desktop_cf["order"]:MissingKey (one_desktop_cf, "order"),
+ "label" : ProductControl::GetTranslatedText ((string) one_desktop_cf["label_id"]:MissingKey (one_desktop_cf, "label_id")),
+ ];
+
+ // 'icon' in optional
+ if (haskey (one_desktop_cf, "icon")) {
+ one_desktop["icon"] = (string) one_desktop_cf["icon"]:"";
+ }
+
+ // 'description' is optional
+ if (haskey (one_desktop_cf, "description_id")) {
+ one_desktop["description"] = ProductControl::GetTranslatedText ((string) one_desktop_cf["description_id"]:"");
+ }
+
+ all_desktops[desktop_name] = one_desktop;
+ });
+ }
+}
/**
* Returns map of pre-defined default system tasks
@@ -113,6 +117,8 @@
* ]
*/
global map GetAllDesktopsMap () {
+ if (all_desktops == nil) Init();
+
return all_desktops;
}
@@ -158,14 +164,6 @@
}
/**
- * Desktop which was selected in the desktop selection dialog
- * "kde", "kde3", "gnome", "xfce", "min_x", "textmode", nil
- */
-string desktop = nil;
-
-
-
-/**
* Get the currently set default desktop, nil if none set
* @return string "kde", "kde3", "gnome", "xfce", "min_x", "textmode", nil
*/
@@ -235,16 +233,7 @@
return all_desktops[desktop, "label"]:"";
}
-/**
- * Initialize default desktop from control file if specified there
- */
-global void Init () {
- string default_desktop = ProductFeatures::GetStringFeature
- ("software", "default_desktop");
- if (default_desktop == "")
- default_desktop = nil;
- desktop = default_desktop;
-}
+
/* EOF */
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org