---
pyanaconda/ui/gui/spokes/lib/accordion.py | 31 ++++++-------------------------
widgets/src/MountpointSelector.c | 21 ++++++++++++---------
2 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/accordion.py b/pyanaconda/ui/gui/spokes/lib/accordion.py
index 5f7c21d..bf6debb 100644
--- a/pyanaconda/ui/gui/spokes/lib/accordion.py
+++ b/pyanaconda/ui/gui/spokes/lib/accordion.py
@@ -38,24 +38,6 @@ __all__ = ["DATA_DEVICE", "SYSTEM_DEVICE",
DATA_DEVICE = 0
SYSTEM_DEVICE = 1
-def mountpointName(mountpoint):
- # If there's a mount point, apply a kind of lame scheme to it to figure
- # out what the name should be. Basically, just look for the last directory
- # in the mount point's path and capitalize the first letter. So "/boot"
- # becomes "Boot", and "/usr/local" becomes "Local".
- if mountpoint == "/":
- return "Root"
- elif mountpoint != None:
- try:
- lastSlash = mountpoint.rindex("/")
- except ValueError:
- # No slash in the mount point? I suppose that's possible.
- return None
-
- return mountpoint[lastSlash+1:].capitalize()
- else:
- return None
-
def selectorFromDevice(device, selector=None, mountpoint=""):
"""Create a MountpointSelector from a Device object template. This
method should be used whenever constructing a new selector, or when
@@ -71,21 +53,20 @@ def selectorFromDevice(device, selector=None, mountpoint=""):
"""
if hasattr(device.format, "mountpoint") and device.format.mountpoint is not None:
mp = device.format.mountpoint
- else:
+ elif mountpoint:
mp = mountpoint
-
- if device.format.type == "swap":
- name = "Swap"
+ elif device.format.name:
+ mp = device.format.name
else:
- name = mountpointName(mp) or device.format.name
+ mp = _("Unknown")
size = Size(spec="%f MB" % device.size)
if not selector:
- selector = MountpointSelector(name, str(size).upper(), mp)
+ selector = MountpointSelector(device.name, str(size).upper(), mp)
selector._root = None
else:
- selector.props.name = name
+ selector.props.name = device.name
selector.props.size = str(size).upper()
selector.props.mountpoint = mp
diff --git a/widgets/src/MountpointSelector.c b/widgets/src/MountpointSelector.c
index 3b9a09f..3c6e3c9 100644
--- a/widgets/src/MountpointSelector.c
+++ b/widgets/src/MountpointSelector.c
@@ -45,7 +45,7 @@ enum {
PROP_MOUNTPOINT
};
-#define DEFAULT_NAME N_("Root")
+#define DEFAULT_NAME ""
#define DEFAULT_SIZE N_("0 GB")
#define DEFAULT_MOUNTPOINT ""
@@ -80,7 +80,9 @@ static void anaconda_mountpoint_selector_class_init(AnacondaMountpointSelectorCl
/**
* AnacondaMountpointSelector:name:
*
- * The :name string is the primary text displayed for a given mountpoint.
+ * The :name string is the secondary text displayed for this widget. It is
+ * commonly going to be the name of the device node containing this
+ * mountpoint.
*
* Since: 1.0
*/
@@ -111,7 +113,8 @@ static void anaconda_mountpoint_selector_class_init(AnacondaMountpointSelectorCl
/**
* AnacondaMountpointSelector:mountpoint:
*
- * The :mountpoint string is where on the filesystem this is mounted.
+ * The :mountpoint string is the primary text displayed for this widget.
+ * It shows where on the filesystem this device is mounted.
*
* Since: 1.0
*/
@@ -164,11 +167,11 @@ static gchar *find_pixmap(const gchar *file) {
return NULL;
}
-static void format_name_label(AnacondaMountpointSelector *widget, const char *value) {
+static void format_mountpoint_label(AnacondaMountpointSelector *widget, const char *value) {
char *markup;
markup = g_markup_printf_escaped("<span fgcolor='black' size='large' weight='bold'>%s</span>", value);
- gtk_label_set_markup(GTK_LABEL(widget->priv->name_label), markup);
+ gtk_label_set_markup(GTK_LABEL(widget->priv->mountpoint_label), markup);
g_free(markup);
}
@@ -180,11 +183,11 @@ static void format_size_label(AnacondaMountpointSelector *widget, const char *va
g_free(markup);
}
-static void format_mountpoint_label(AnacondaMountpointSelector *widget, const char *value) {
+static void format_name_label(AnacondaMountpointSelector *widget, const char *value) {
char *markup;
markup = g_markup_printf_escaped("<span fgcolor='grey' size='small'>%s</span>", value);
- gtk_label_set_markup(GTK_LABEL(widget->priv->mountpoint_label), markup);
+ gtk_label_set_markup(GTK_LABEL(widget->priv->name_label), markup);
g_free(markup);
}
@@ -242,10 +245,10 @@ static void anaconda_mountpoint_selector_init(AnacondaMountpointSelector *mountp
gtk_widget_set_hexpand(GTK_WIDGET(mountpoint->priv->mountpoint_label), TRUE);
/* Add everything to the grid, add the grid to the widget. */
- gtk_grid_attach(GTK_GRID(mountpoint->priv->grid), mountpoint->priv->name_label, 0, 0, 1, 1);
+ gtk_grid_attach(GTK_GRID(mountpoint->priv->grid), mountpoint->priv->mountpoint_label, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(mountpoint->priv->grid), mountpoint->priv->size_label, 1, 0, 1, 2);
gtk_grid_attach(GTK_GRID(mountpoint->priv->grid), mountpoint->priv->arrow, 2, 0, 1, 2);
- gtk_grid_attach(GTK_GRID(mountpoint->priv->grid), mountpoint->priv->mountpoint_label, 0, 1, 1, 2);
+ gtk_grid_attach(GTK_GRID(mountpoint->priv->grid), mountpoint->priv->name_label, 0, 1, 1, 2);
gtk_widget_set_margin_right(GTK_WIDGET(mountpoint->priv->grid), 12);
gtk_container_add(GTK_CONTAINER(mountpoint), mountpoint->priv->grid);
--
1.8.1.2