[Goodies-commits] r5760 - xfce4-power-manager/trunk/src

Ali Abdallah aliov at xfce.org
Thu Oct 23 08:20:12 CEST 2008


Author: aliov
Date: 2008-10-23 06:20:12 +0000 (Thu, 23 Oct 2008)
New Revision: 5760

Modified:
   xfce4-power-manager/trunk/src/xfpm-settings.c
Log:
Don't show power save check box if HAL doesn't support it

Modified: xfce4-power-manager/trunk/src/xfpm-settings.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-settings.c	2008-10-22 21:30:56 UTC (rev 5759)
+++ xfce4-power-manager/trunk/src/xfpm-settings.c	2008-10-23 06:20:12 UTC (rev 5760)
@@ -472,41 +472,37 @@
     
     !ups_found ? gtk_table_attach(GTK_TABLE(table),action,1,2,1,2,GTK_SHRINK,GTK_SHRINK,0,0) : gtk_widget_hide(action);
 
-    // Power Save Profile
-    GtkWidget *power_save;        
-    label = gtk_label_new(ups_found ? _("Enable power save on ups power") : _("Enable power save on battery power"));
-    gtk_widget_show(label);
-    gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3);
-    power_save = gtk_check_button_new();
-    gtk_widget_show(power_save);
-    if ( !(power_management & SYSTEM_CAN_POWER_SAVE) )
-    {
-        gtk_widget_set_tooltip_text(power_save,_("No power save method found in the system"));
-        gtk_widget_set_sensitive(power_save,FALSE);
-    }
-    
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(power_save),
-                                 power_management & SYSTEM_CAN_POWER_SAVE ?
-                                 xfconf_channel_get_bool(channel,POWER_SAVE_CFG,FALSE)
-                                 : FALSE);
-                                  
-    g_signal_connect(power_save,"toggled",G_CALLBACK(set_power_save_cb),channel); 
-    gtk_table_attach(GTK_TABLE(table),power_save,1,2,2,3,GTK_SHRINK,GTK_SHRINK,0,0);   
-    
-
 #ifdef HAVE_LIBNOTIFY
     GtkWidget *notify_bt;        
     label = gtk_label_new(ups_found ? _("Enable ups charge notification") :_("Enable battery state notification"));
     gtk_widget_show(label);
-    gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,3,4);
+    gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3);
     notify_bt = gtk_check_button_new();
     gtk_widget_show(notify_bt);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(notify_bt),
                                  xfconf_channel_get_bool(channel,BATT_STATE_NOTIFICATION_CFG,TRUE)); 
     g_signal_connect(notify_bt,"toggled",G_CALLBACK(set_battery_state_notification_cb),channel); 
-    gtk_table_attach(GTK_TABLE(table),notify_bt,1,2,3,4,GTK_SHRINK,GTK_SHRINK,0,0);                             
+    gtk_table_attach(GTK_TABLE(table),notify_bt,1,2,2,3,GTK_SHRINK,GTK_SHRINK,0,0);                             
 #endif        
-    
+	if ( power_management & SYSTEM_CAN_POWER_SAVE )
+	{
+		// Power Save Profile
+		GtkWidget *power_save;        
+		label = gtk_label_new(ups_found ? _("Enable power save on ups power") : _("Enable power save on battery power"));
+		gtk_widget_show(label);
+		gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3);
+		power_save = gtk_check_button_new();
+		gtk_widget_show(power_save);
+		
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(power_save),
+									 power_management & SYSTEM_CAN_POWER_SAVE ?
+									 xfconf_channel_get_bool(channel,POWER_SAVE_CFG,FALSE)
+									 : FALSE);
+									  
+		g_signal_connect(power_save,"toggled",G_CALLBACK(set_power_save_cb),channel); 
+		gtk_table_attach(GTK_TABLE(table),power_save,1,2,2,3,GTK_SHRINK,GTK_SHRINK,0,0); 
+	}
+	
     gtk_container_add(GTK_CONTAINER(align),table);
     return frame;
     




More information about the Goodies-commits mailing list