[PATCH 4/7] Add device node name information to the storage spoke and disk cart (#902617).
Chris Lumens
clumens at redhat.com
Wed Jan 30 21:18:18 UTC 2013
---
pyanaconda/ui/gui/spokes/lib/cart.glade | 8 ++---
pyanaconda/ui/gui/spokes/lib/cart.py | 6 ++--
pyanaconda/ui/gui/spokes/source.py | 3 +-
pyanaconda/ui/gui/spokes/storage.py | 13 ++++----
widgets/python/AnacondaWidgets.py | 6 ++--
widgets/src/DiskOverview.c | 53 ++++++++++++++-------------------
6 files changed, 39 insertions(+), 50 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/cart.glade b/pyanaconda/ui/gui/spokes/lib/cart.glade
index 0743a9f..0e234a2 100644
--- a/pyanaconda/ui/gui/spokes/lib/cart.glade
+++ b/pyanaconda/ui/gui/spokes/lib/cart.glade
@@ -11,7 +11,7 @@
<column type="gchararray"/>
<!-- column-name free -->
<column type="gchararray"/>
- <!-- column-name id -->
+ <!-- column-name name -->
<column type="gchararray"/>
<!-- column-name unique -->
<column type="gint"/>
@@ -158,11 +158,11 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn" id="id_column">
+ <object class="GtkTreeViewColumn" id="name_column">
<property name="spacing">6</property>
- <property name="title" translatable="yes">Id</property>
+ <property name="title" translatable="yes">Name</property>
<child>
- <object class="GtkCellRendererText" id="id_renderer"/>
+ <object class="GtkCellRendererText" id="name_renderer"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
diff --git a/pyanaconda/ui/gui/spokes/lib/cart.py b/pyanaconda/ui/gui/spokes/lib/cart.py
index bdc4faf..0fe9869 100644
--- a/pyanaconda/ui/gui/spokes/lib/cart.py
+++ b/pyanaconda/ui/gui/spokes/lib/cart.py
@@ -36,7 +36,7 @@ IS_BOOT_COL = 0
DESCRIPTION_COL = 1
SIZE_COL = 2
FREE_SPACE_COL = 3
-SERIAL_COL = 4
+NAME_COL = 4
ID_COL = 5
def size_str(mb):
@@ -57,10 +57,10 @@ class SelectedDisksDialog(GUIObject):
for disk in disks:
self._store.append([False,
- disk.description,
+ "%s (%s)" % (disk.description, disk.serial),
size_str(disk.size),
size_str(free[disk.name][0]),
- disk.serial,
+ disk.name,
disk.id])
self.disks = disks[:]
self._update_summary()
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 84315a1..87ebb89 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -703,8 +703,7 @@ class SourceSpoke(NormalSpoke):
if cdrom:
@gtk_thread_wait
def gtk_action_1():
- selector = AnacondaWidgets.DiskOverview(cdrom.format.label or "", "drive-removable-media", "")
- selector.path = cdrom.path
+ selector = AnacondaWidgets.DiskOverview(cdrom.format.label or "", "drive-removable-media", "", cdrom.name)
selector.set_chosen(chosen)
self._autodetectMediaBox.pack_start(selector, False, False, 0)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 0155c83..69ed7fd 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -489,7 +489,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
# update the selections in the ui
overviews = self.local_disks_box.get_children()
for overview in overviews:
- name = overview.get_property("popup-info").partition("|")[0].strip()
+ name = overview.get_property("name")
overview.set_chosen(name in self.selected_disks)
self._update_summary()
@@ -531,13 +531,14 @@ class StorageSpoke(NormalSpoke, StorageChecker):
kind = "drive-harddisk"
size = size_str(disk.size)
- popup_info = "%s | %s" % (disk.name, disk.serial)
+ popup_info = "%s" % disk.serial
@gtk_thread_wait
def gtk_action():
overview = AnacondaWidgets.DiskOverview(disk.description,
kind,
size,
+ disk.name,
popup=popup_info)
self.local_disks_box.pack_start(overview, False, False, 0)
@@ -553,7 +554,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self._update_summary()
gtk_action()
-
+
self._ready = True
communication.send_ready(self.__class__.__name__)
@@ -593,9 +594,9 @@ class StorageSpoke(NormalSpoke, StorageChecker):
""" Update self.selected_disks based on the UI. """
overviews = self.local_disks_box.get_children()
for overview in overviews:
- name = overview.get_property("popup-info").partition("|")[0].strip()
-
selected = overview.get_chosen()
+ name = overview.get_property("name")
+
if selected and name not in self.selected_disks:
self.selected_disks.append(name)
@@ -618,7 +619,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
# update the UI to reflect changes to self.selected_disks
overviews = self.local_disks_box.get_children()
for overview in overviews:
- name = overview.get_property("popup-info").partition("|")[0].strip()
+ name = overview.get_property("name")
overview.set_chosen(name in self.selected_disks)
diff --git a/widgets/python/AnacondaWidgets.py b/widgets/python/AnacondaWidgets.py
index 4029b69..edb9f35 100644
--- a/widgets/python/AnacondaWidgets.py
+++ b/widgets/python/AnacondaWidgets.py
@@ -63,14 +63,12 @@ SpokeSelector = override(SpokeSelector)
__all__.append('SpokeSelector')
class DiskOverview(Anaconda.DiskOverview):
- def __init__(self, description, kind, capacity, os=None, popup=None):
+ def __init__(self, description, kind, capacity, name, popup=None):
Anaconda.DiskOverview.__init__(self)
self.set_property("description", description)
self.set_property("kind", kind)
self.set_property("capacity", capacity)
-
- if os:
- self.set_property("os", os)
+ self.set_property("name", name)
if popup:
self.set_property("popup-info", popup)
diff --git a/widgets/src/DiskOverview.c b/widgets/src/DiskOverview.c
index 6a4e9af..3aa2112 100644
--- a/widgets/src/DiskOverview.c
+++ b/widgets/src/DiskOverview.c
@@ -42,7 +42,7 @@ enum {
PROP_DESCRIPTION = 1,
PROP_KIND,
PROP_CAPACITY,
- PROP_OS,
+ PROP_NAME,
PROP_POPUP_INFO
};
@@ -50,7 +50,7 @@ enum {
#define DEFAULT_DESCRIPTION N_("New Device")
#define DEFAULT_KIND "drive-harddisk"
#define DEFAULT_CAPACITY N_("0 MB")
-#define DEFAULT_OS ""
+#define DEFAULT_NAME ""
#define DEFAULT_POPUP_INFO ""
#define ICON_SIZE 125
@@ -60,7 +60,7 @@ struct _AnacondaDiskOverviewPrivate {
GtkWidget *kind;
GtkWidget *description_label;
GtkWidget *capacity_label;
- GtkWidget *os_label;
+ GtkWidget *name_label;
GtkWidget *tooltip;
GdkCursor *cursor;
@@ -136,18 +136,20 @@ static void anaconda_disk_overview_class_init(AnacondaDiskOverviewClass *klass)
G_PARAM_READWRITE));
/**
- * AnacondaDiskOverview:os:
+ * AnacondaDiskOverview:name:
*
- * The :os string describes any operating system found on this device.
+ * The :name string provides this device's node name (like 'sda'). Note
+ * that these names aren't guaranteed to be consistent across reboots but
+ * their use is so ingrained that we need to continue displaying them.
*
* Since: 1.0
*/
g_object_class_install_property(object_class,
- PROP_OS,
- g_param_spec_string("os",
- P_("Operating System"),
- P_("Installed OS on this drive"),
- DEFAULT_OS,
+ PROP_NAME,
+ g_param_spec_string("name",
+ P_("Device node name"),
+ P_("Device node name"),
+ DEFAULT_NAME,
G_PARAM_READWRITE));
/**
@@ -226,17 +228,14 @@ static void anaconda_disk_overview_init(AnacondaDiskOverview *widget) {
gtk_label_set_markup(GTK_LABEL(widget->priv->description_label), markup);
g_free(markup);
- /* Create the OS label. By default there is no operating system, so just
- * create a new label here so we have a place for later, should an OS be
- * specified.
- */
- widget->priv->os_label = gtk_label_new(NULL);
+ /* Create the name label. */
+ widget->priv->name_label = gtk_label_new(NULL);
/* Add everything to the vbox, add the vbox to the widget. */
gtk_container_add(GTK_CONTAINER(widget->priv->vbox), widget->priv->capacity_label);
gtk_container_add(GTK_CONTAINER(widget->priv->vbox), widget->priv->kind);
gtk_container_add(GTK_CONTAINER(widget->priv->vbox), widget->priv->description_label);
- gtk_container_add(GTK_CONTAINER(widget->priv->vbox), widget->priv->os_label);
+ gtk_container_add(GTK_CONTAINER(widget->priv->vbox), widget->priv->name_label);
gtk_container_add(GTK_CONTAINER(widget), widget->priv->vbox);
@@ -297,8 +296,8 @@ static void anaconda_disk_overview_get_property(GObject *object, guint prop_id,
g_value_set_string (value, gtk_label_get_text(GTK_LABEL(priv->capacity_label)));
break;
- case PROP_OS:
- g_value_set_string (value, gtk_label_get_text(GTK_LABEL(priv->os_label)));
+ case PROP_NAME:
+ g_value_set_string (value, gtk_label_get_text(GTK_LABEL(priv->name_label)));
break;
case PROP_POPUP_INFO:
@@ -331,19 +330,11 @@ static void anaconda_disk_overview_set_property(GObject *object, guint prop_id,
break;
}
- case PROP_OS: {
- /* If no OS is given, set the label to blank. This will prevent
- * seeing a strange brown blob with no text in the middle of
- * nowhere.
- */
- if (!strcmp(g_value_get_string(value), ""))
- gtk_label_set_text(GTK_LABEL(priv->os_label), NULL);
- else {
- char *markup = g_markup_printf_escaped("<span foreground='white' background='brown'>%s</span>", g_value_get_string(value));
- gtk_label_set_markup(GTK_LABEL(priv->os_label), markup);
- g_free(markup);
- break;
- }
+ case PROP_NAME: {
+ char *markup = g_markup_printf_escaped("<span size='large'>%s</span>", g_value_get_string(value));
+ gtk_label_set_markup(GTK_LABEL(priv->name_label), markup);
+ g_free(markup);
+ break;
}
case PROP_POPUP_INFO: {
--
1.7.11.2
More information about the anaconda-patches
mailing list