[gnome-disk-utility/udisks2-port] Add a Refresh button to the SMART dialog
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/udisks2-port] Add a Refresh button to the SMART dialog
- Date: Sun, 4 Sep 2011 15:28:38 +0000 (UTC)
commit edc1c3ae080e0782955f6bc6cfd1ba203e1deb62
Author: David Zeuthen <davidz redhat com>
Date: Sun Sep 4 11:28:32 2011 -0400
Add a Refresh button to the SMART dialog
Signed-off-by: David Zeuthen <davidz redhat com>
data/ui/smart-dialog.ui | 17 ++++++++++++++++
src/palimpsest/gduatasmartdialog.c | 37 ++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/smart-dialog.ui b/data/ui/smart-dialog.ui
index 88aa668..05531b1 100644
--- a/data/ui/smart-dialog.ui
+++ b/data/ui/smart-dialog.ui
@@ -63,6 +63,22 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="refresh-button">
+ <property name="label">gtk-refresh</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -335,6 +351,7 @@
<action-widget response="0">start-selftest-button</action-widget>
<action-widget response="1">stop-selftest-button</action-widget>
<action-widget response="-7">button1</action-widget>
+ <action-widget response="2">refresh-button</action-widget>
</action-widgets>
</object>
<object class="GtkMenu" id="selftest-menu">
diff --git a/src/palimpsest/gduatasmartdialog.c b/src/palimpsest/gduatasmartdialog.c
index 3b654e2..27f7c73 100644
--- a/src/palimpsest/gduatasmartdialog.c
+++ b/src/palimpsest/gduatasmartdialog.c
@@ -1296,6 +1296,39 @@ on_timeout (gpointer user_data)
return TRUE; /* keep timeout around */
}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+refresh_cb (UDisksDriveAta *ata,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GduWindow *window = GDU_WINDOW (user_data);
+ GError *error;
+
+ error = NULL;
+ if (!udisks_drive_ata_call_smart_update_finish (ata, res, &error))
+ {
+ gdu_window_show_error (window,
+ _("Error refreshing SMART data"),
+ error);
+ g_error_free (error);
+ }
+ g_object_unref (window);
+}
+
+
+static void
+refresh_do (DialogData *data)
+{
+ udisks_drive_ata_call_smart_update (data->ata,
+ g_variant_new ("a{sv}", NULL), /* options */
+ NULL, /* GCancellable */
+ (GAsyncReadyCallback) refresh_cb,
+ g_object_ref (data->window));
+}
+
/* ---------------------------------------------------------------------------------------------------- */
static void
@@ -1503,6 +1536,7 @@ gdu_ata_smart_dialog_show (GduWindow *window,
{
gint response;
response = gtk_dialog_run (GTK_DIALOG (data->dialog));
+ /* Keep in sync with .ui file */
switch (response)
{
case 0:
@@ -1511,6 +1545,9 @@ gdu_ata_smart_dialog_show (GduWindow *window,
case 1:
selftest_do (data, "abort");
break;
+ case 2:
+ refresh_do (data);
+ break;
}
if (response < 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]