[Xfce4-commits] [xfce/xfce4-power-manager] 01/03: Remove disk spin down feature (1/3)
noreply at xfce.org
noreply at xfce.org
Mon Jul 14 16:30:16 CEST 2014
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.
commit 3ad75fad293fb66e6316aa5820ee064f264eafa4
Author: Harald Judt <h.judt at gmx.at>
Date: Sun Jul 13 21:22:05 2014 +0200
Remove disk spin down feature (1/3)
The spin down feature does not work and would need a rewrite
to work with udisks-2. What's more, it is probably functionality
best handled by other tools or scripts, so let's remove it from
the power manager.
As a first step, this commit removes all interfacing code between
GUI and low-level udisks functions.
---
settings/xfpm-settings-main.c | 6 +--
settings/xfpm-settings.c | 114 +++--------------------------------------
settings/xfpm-settings.h | 4 +-
src/xfpm-main.c | 10 ----
src/xfpm-manager.c | 11 ----
src/xfpm-xfconf.c | 38 --------------
6 files changed, 8 insertions(+), 175 deletions(-)
diff --git a/settings/xfpm-settings-main.c b/settings/xfpm-settings-main.c
index 8f807b9..345ca7d 100644
--- a/settings/xfpm-settings-main.c
+++ b/settings/xfpm-settings-main.c
@@ -66,8 +66,6 @@ int main (int argc, char **argv)
gboolean has_hibernate_button;
gboolean has_power_button;
gboolean has_lid;
- gboolean can_spin_down;
- gboolean devkit_disk;
gboolean start_xfpm_if_not_running;
GdkNativeWindow socket_id = 0;
@@ -179,15 +177,13 @@ int main (int argc, char **argv)
has_power_button = xfpm_string_to_bool (g_hash_table_lookup (config_hash, "power-button"));
has_hibernate_button = xfpm_string_to_bool (g_hash_table_lookup (config_hash, "hibernate-button"));
can_shutdown = xfpm_string_to_bool (g_hash_table_lookup (config_hash, "can-shutdown"));
- can_spin_down = xfpm_string_to_bool (g_hash_table_lookup (config_hash, "can-spin"));
- devkit_disk = xfpm_string_to_bool (g_hash_table_lookup (config_hash, "devkit-disk"));
g_hash_table_destroy (config_hash);
dialog = xfpm_settings_dialog_new (channel, auth_suspend, auth_hibernate,
can_suspend, can_hibernate, can_shutdown, has_battery, has_lcd_brightness,
has_lid, has_sleep_button, has_hibernate_button, has_power_button,
- devkit_disk, can_spin_down, socket_id, device_id);
+ socket_id, device_id);
g_signal_connect_swapped (unique, "ping-received",
G_CALLBACK (gtk_window_present), dialog);
diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index fb9f152..0878080 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -174,9 +174,6 @@ void critical_level_value_changed_cb (GtkSpinButton *w,
void lock_screen_toggled_cb (GtkWidget *w,
XfconfChannel *channel);
-void on_spindown_hdd_changed (GtkWidget *w,
- XfconfChannel *channel);
-
static void view_cursor_changed_cb (GtkTreeView *view,
gpointer *user_data);
@@ -726,35 +723,11 @@ lock_screen_toggled_cb (GtkWidget *w, XfconfChannel *channel)
}
}
-void on_spindown_hdd_changed (GtkWidget *w, XfconfChannel *channel)
-{
- GtkTreeModel *model;
- GtkTreeIter selected_row;
- gint value = 0;
-
- if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (w), &selected_row))
- return;
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX(w));
-
- gtk_tree_model_get(model,
- &selected_row,
- 1,
- &value,
- -1);
-
- if ( !xfconf_channel_set_uint (channel, PROPERTIES_PREFIX SPIN_DOWN_HDD, value) )
- {
- g_critical ("Unable to set value for property %s", SPIN_DOWN_HDD);
- }
-}
-
static void
xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_suspend,
gboolean auth_hibernate, gboolean can_suspend,
gboolean can_hibernate, gboolean can_shutdown,
- gboolean has_lcd_brightness, gboolean has_lid,
- gboolean devkit_disk, gboolean can_spin_down)
+ gboolean has_lcd_brightness, gboolean has_lid)
{
gboolean valid;
gint list_value;
@@ -769,7 +742,6 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_suspend,
GtkWidget *label;
GtkWidget *brg;
GtkWidget *brg_level;
- GtkWidget *spin_down_hdd;
battery_critical = GTK_WIDGET (gtk_builder_get_object (xml, "battery-critical-combox"));
@@ -905,57 +877,6 @@ xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_suspend,
}
/*
- * Hard drive energy saving
- */
- spin_down_hdd = GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-hdd"));
-
- if ( can_spin_down && devkit_disk )
- {
- list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
-
- gtk_combo_box_set_model (GTK_COMBO_BOX(spin_down_hdd), GTK_TREE_MODEL(list_store));
-
- gtk_list_store_append(list_store, &iter);
- gtk_list_store_set (list_store, &iter, 0, _("Never"), 1, SPIN_DOWN_HDD_NEVER, -1);
-
- gtk_list_store_append(list_store, &iter);
- gtk_list_store_set (list_store, &iter, 0, _("On battery"), 1, SPIN_DOWN_HDD_ON_BATTERY, -1);
-
- gtk_list_store_append(list_store, &iter);
- gtk_list_store_set (list_store, &iter, 0, _("Plugged in"), 1, SPIN_DOWN_HDD_PLUGGED_IN, -1);
-
- gtk_list_store_append(list_store, &iter);
- gtk_list_store_set (list_store, &iter, 0, _("Always"), 1, SPIN_DOWN_HDD_ALWAYS, -1);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (spin_down_hdd), 0);
-
- val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX SPIN_DOWN_HDD, SPIN_DOWN_HDD_NEVER);
-
- for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter);
- valid;
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter) )
- {
- gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter,
- 1, &list_value, -1);
- if ( val == list_value )
- {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (spin_down_hdd), &iter);
- break;
- }
- }
- }
- gtk_widget_set_sensitive (spin_down_hdd, can_spin_down);
-
- if ( !devkit_disk )
- {
- gtk_widget_hide (spin_down_hdd);
- }
- else if ( !can_spin_down )
- {
- gtk_widget_set_tooltip_text (spin_down_hdd, _("Spinning down hard disks permission denied"));
- }
-
- /*
* Brightness on battery
*/
if ( has_lcd_brightness )
@@ -980,13 +901,12 @@ static void
xfpm_settings_on_ac (XfconfChannel *channel, gboolean auth_suspend,
gboolean auth_hibernate, gboolean can_suspend,
gboolean can_hibernate, gboolean has_lcd_brightness,
- gboolean has_lid, gboolean devkit_disk, gboolean can_spin_down)
+ gboolean has_lid)
{
GtkWidget *inact;
GtkWidget *lid;
GtkWidget *brg;
GtkWidget *brg_level;
- GtkWidget *spin_down_hdd;
GtkListStore *list_store;
GtkTreeIter iter;
guint val;
@@ -1075,23 +995,6 @@ xfpm_settings_on_ac (XfconfChannel *channel, gboolean auth_suspend,
gtk_widget_hide (lid);
}
- spin_down_hdd = GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-hdd"));
- /*
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (spin_down),
- xfconf_channel_get_bool (channel, PROPERTIES_PREFIX SPIN_DOWN_ON_AC, FALSE)); */
-
- gtk_widget_set_sensitive (spin_down_hdd, can_spin_down);
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-hdd-label")), can_spin_down);
-
- if ( !devkit_disk )
- {
- gtk_widget_hide (spin_down_hdd);
- }
- else if ( !can_spin_down )
- {
- gtk_widget_set_tooltip_text (spin_down_hdd, _("Spinning down hard disks permission denied"));
- }
-
/*
* Brightness on AC power
*/
@@ -2022,7 +1925,6 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
gboolean has_battery, gboolean has_lcd_brightness,
gboolean has_lid, gboolean has_sleep_button,
gboolean has_hibernate_button, gboolean has_power_button,
- gboolean devkit_disk, gboolean can_spin_down,
GdkNativeWindow id, gchar *device_id)
{
GtkWidget *plug;
@@ -2039,13 +1941,13 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
XFPM_DEBUG ("auth_hibernate=%s auth_suspend=%s can_shutdown=%s can_suspend=%s can_hibernate=%s " \
"has_battery=%s has_lcd_brightness=%s has_lid=%s has_sleep_button=%s " \
- "has_hibernate_button=%s has_power_button=%s can_spin_down=%s",
+ "has_hibernate_button=%s has_power_button=%s",
xfpm_bool_to_string (has_battery), xfpm_bool_to_string (auth_hibernate),
xfpm_bool_to_string (can_shutdown), xfpm_bool_to_string (auth_suspend),
xfpm_bool_to_string (can_suspend), xfpm_bool_to_string (can_hibernate),
xfpm_bool_to_string (has_lcd_brightness), xfpm_bool_to_string (has_lid),
xfpm_bool_to_string (has_sleep_button), xfpm_bool_to_string (has_hibernate_button),
- xfpm_bool_to_string (has_power_button), xfpm_bool_to_string (can_spin_down) );
+ xfpm_bool_to_string (has_power_button));
xml = xfpm_builder_new_from_string (xfpm_settings_ui, &error);
@@ -2135,9 +2037,7 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
can_suspend,
can_hibernate,
has_lcd_brightness,
- has_lid,
- devkit_disk,
- can_spin_down);
+ has_lid);
if ( has_battery )
xfpm_settings_on_battery (channel,
@@ -2147,9 +2047,7 @@ xfpm_settings_dialog_new (XfconfChannel *channel, gboolean auth_suspend,
can_hibernate,
can_shutdown,
has_lcd_brightness,
- has_lid,
- devkit_disk,
- can_spin_down);
+ has_lid);
else
{
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (xml ,"display_onbattery")));
diff --git a/settings/xfpm-settings.h b/settings/xfpm-settings.h
index 739119d..b5a6cb4 100644
--- a/settings/xfpm-settings.h
+++ b/settings/xfpm-settings.h
@@ -34,9 +34,7 @@ GtkWidget *xfpm_settings_dialog_new (XfconfChannel *channel,
gboolean has_sleep_button,
gboolean has_hibernate_button,
gboolean has_power_button,
- gboolean devkit_disk,
- gboolean can_spin_down,
GdkNativeWindow id,
- gchar *device_id);
+ gchar *device_id);
#endif /* __XFPM_SETTINGS_H */
diff --git a/src/xfpm-main.c b/src/xfpm-main.c
index e73b97d..21c5533 100644
--- a/src/xfpm-main.c
+++ b/src/xfpm-main.c
@@ -94,8 +94,6 @@ xfpm_dump (GHashTable *hash)
gboolean has_hibernate_button;
gboolean has_power_button;
gboolean has_lid;
- gboolean can_spin_down;
- gboolean devkit_disk;
has_battery = xfpm_string_to_bool (g_hash_table_lookup (hash, "has-battery"));
has_lid = xfpm_string_to_bool (g_hash_table_lookup (hash, "has-lid"));
@@ -108,8 +106,6 @@ xfpm_dump (GHashTable *hash)
has_power_button = xfpm_string_to_bool (g_hash_table_lookup (hash, "power-button"));
has_hibernate_button = xfpm_string_to_bool (g_hash_table_lookup (hash, "hibernate-button"));
can_shutdown = xfpm_string_to_bool (g_hash_table_lookup (hash, "can-shutdown"));
- can_spin_down = xfpm_string_to_bool (g_hash_table_lookup (hash, "can-spin"));
- devkit_disk = xfpm_string_to_bool (g_hash_table_lookup (hash, "devkit-disk"));
g_print ("---------------------------------------------------\n");
g_print (" Xfce power manager version %s\n", VERSION);
@@ -139,23 +135,17 @@ xfpm_dump (GHashTable *hash)
"%s: %s\n"
"%s: %s\n"
"%s: %s\n"
- "%s: %s\n"
- "%s: %s\n"
"%s: %s\n",
_("Can suspend"),
xfpm_bool_to_local_string (can_suspend),
_("Can hibernate"),
xfpm_bool_to_local_string (can_hibernate),
- _("Can spin down hard disks"),
- xfpm_bool_to_local_string (devkit_disk),
_("Authorized to suspend"),
xfpm_bool_to_local_string (auth_suspend),
_("Authorized to hibernate"),
xfpm_bool_to_local_string (auth_hibernate),
_("Authorized to shutdown"),
xfpm_bool_to_local_string (can_shutdown),
- _("Authorized to spin down hard disks"),
- xfpm_bool_to_local_string (can_spin_down),
_("Has battery"),
xfpm_bool_to_local_string (has_battery),
_("Has brightness panel"),
diff --git a/src/xfpm-manager.c b/src/xfpm-manager.c
index e65fab4..f24777f 100644
--- a/src/xfpm-manager.c
+++ b/src/xfpm-manager.c
@@ -44,7 +44,6 @@
#include "xfpm-power.h"
#include "xfpm-dbus.h"
-#include "xfpm-disks.h"
#include "xfpm-dpms.h"
#include "xfpm-manager.h"
#include "xfpm-console-kit.h"
@@ -92,7 +91,6 @@ struct XfpmManagerPrivate
XfpmConsoleKit *console;
XfpmSystemd *systemd;
XfpmDBusMonitor *monitor;
- XfpmDisks *disks;
XfpmInhibit *inhibit;
EggIdletime *idle;
#ifdef HAVE_DPMS
@@ -151,7 +149,6 @@ xfpm_manager_finalize (GObject *object)
if ( manager->priv->console != NULL )
g_object_unref (manager->priv->console);
g_object_unref (manager->priv->monitor);
- g_object_unref (manager->priv->disks);
g_object_unref (manager->priv->inhibit);
g_object_unref (manager->priv->idle);
@@ -699,7 +696,6 @@ void xfpm_manager_start (XfpmManager *manager)
manager->priv->console = xfpm_console_kit_new ();
manager->priv->monitor = xfpm_dbus_monitor_new ();
- manager->priv->disks = xfpm_disks_new ();
manager->priv->inhibit = xfpm_inhibit_new ();
manager->priv->idle = egg_idletime_new ();
@@ -799,8 +795,6 @@ GHashTable *xfpm_manager_get_config (XfpmManager *manager)
gboolean has_lcd_brightness = TRUE;
gboolean can_shutdown = TRUE;
gboolean has_lid = FALSE;
- gboolean can_spin = FALSE;
- gboolean devkit_disk = FALSE;
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -825,9 +819,6 @@ GHashTable *xfpm_manager_get_config (XfpmManager *manager)
"has-lid", &has_lid,
NULL);
- can_spin = xfpm_disks_get_can_spin (manager->priv->disks);
- devkit_disk = xfpm_disks_kit_is_running (manager->priv->disks);
-
has_battery = xfpm_power_has_battery (manager->priv->power);
has_lcd_brightness = xfpm_backlight_has_hw (manager->priv->backlight);
@@ -851,8 +842,6 @@ GHashTable *xfpm_manager_get_config (XfpmManager *manager)
g_hash_table_insert (hash, g_strdup ("has-battery"), g_strdup (xfpm_bool_to_string (has_battery)));
g_hash_table_insert (hash, g_strdup ("has-lid"), g_strdup (xfpm_bool_to_string (has_lid)));
- g_hash_table_insert (hash, g_strdup ("can-spin"), g_strdup (xfpm_bool_to_string (can_spin)));
- g_hash_table_insert (hash, g_strdup ("devkit-disk"), g_strdup (xfpm_bool_to_string (devkit_disk)));
g_hash_table_insert (hash, g_strdup ("has-brightness"), g_strdup (xfpm_bool_to_string (has_lcd_brightness)));
diff --git a/src/xfpm-xfconf.c b/src/xfpm-xfconf.c
index 848b6a0..a869ef6 100644
--- a/src/xfpm-xfconf.c
+++ b/src/xfpm-xfconf.c
@@ -84,9 +84,6 @@ enum
PROP_IDLE_SLEEP_MODE,
PROP_DIM_ON_AC_TIMEOUT,
PROP_DIM_ON_BATTERY_TIMEOUT,
- PROP_SPIN_DOWN_DISK,
- PROP_SPIN_DOWN_DISK_ON_AC_TIMEOUT,
- PROP_SPIN_DOWN_DISK_ON_BATTERY_TIMEOUT,
#ifdef WITH_NETWORK_MANAGER
PROP_NETWORK_MANAGER_SLEEP,
#endif
@@ -533,41 +530,6 @@ xfpm_xfconf_class_init (XfpmXfconfClass *klass)
120,
G_PARAM_READWRITE));
- /**
- * XfpmXfconf::spin-down-hdd
- **/
- g_object_class_install_property (object_class,
- PROP_SPIN_DOWN_DISK,
- g_param_spec_uint (SPIN_DOWN_HDD,
- NULL, NULL,
- 0,
- G_MAXUINT16,
- 4,
- G_PARAM_READWRITE));
-
- /**
- * XfpmXfconf::spin-down-on-ac-timeout
- **/
- g_object_class_install_property (object_class,
- PROP_SPIN_DOWN_DISK_ON_AC_TIMEOUT,
- g_param_spec_uint (SPIN_DOWN_ON_AC_TIMEOUT,
- NULL, NULL,
- 800,
- G_MAXUINT,
- 800,
- G_PARAM_READWRITE));
-
- /**
- * XfpmXfconf::spin-down-on-battery-timeout
- **/
- g_object_class_install_property (object_class,
- PROP_SPIN_DOWN_DISK_ON_BATTERY_TIMEOUT,
- g_param_spec_uint (SPIN_DOWN_ON_BATTERY_TIMEOUT,
- NULL, NULL,
- 120,
- G_MAXUINT,
- 120,
- G_PARAM_READWRITE));
#ifdef WITH_NETWORK_MANAGER
/**
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list