~ubuntu-branches/ubuntu/precise/xfce4-power-manager/precise

« back to all changes in this revision

Viewing changes to settings/xfpm-settings.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2010-12-09 18:28:34 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20101209182834-tjz13qcewqlq19eu
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include <xfconf/xfconf.h>
33
33
 
34
34
#include <libxfce4util/libxfce4util.h>
35
 
#include <libxfcegui4/libxfcegui4.h>
 
35
#include <libxfce4ui/libxfce4ui.h>
36
36
 
37
 
#include "libxfpm/xfpm-common.h"
38
 
#include "libxfpm/xfpm-string.h"
39
 
#include "libxfpm/xfpm-icons.h"
 
37
#include "xfpm-common.h"
 
38
#include "xfpm-icons.h"
 
39
#include "xfpm-debug.h"
40
40
 
41
41
#include "interfaces/xfpm-settings_ui.h"
42
42
 
149
149
void        lock_screen_toggled_cb                 (GtkWidget *w, 
150
150
                                                    XfconfChannel *channel);
151
151
 
152
 
void        cpu_freq_control_changed_cb            (GtkWidget *w, 
 
152
void        on_battery_spin_changed                (GtkWidget *w,
 
153
                                                    XfconfChannel *channel);
 
154
 
 
155
void        on_ac_spin_changed                     (GtkWidget *w,
153
156
                                                    XfconfChannel *channel);
154
157
 
155
158
void        _cursor_changed_cb                     (GtkTreeView *view, 
702
705
    }
703
706
}
704
707
 
705
 
void
706
 
cpu_freq_control_changed_cb (GtkWidget *w, XfconfChannel *channel)
 
708
void on_battery_spin_changed (GtkWidget *w,  XfconfChannel *channel)
707
709
{
708
 
#ifdef SYSTEM_IS_LINUX
709
 
    gboolean val = (gint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w));
 
710
    gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w));
710
711
    
711
 
    if ( !xfconf_channel_set_bool (channel, PROPERTIES_PREFIX CPU_FREQ_CONTROL, val) )
 
712
    if ( !xfconf_channel_set_bool (channel, PROPERTIES_PREFIX SPIN_DOWN_ON_BATTERY, val) )
712
713
    {
713
 
        g_critical ("Unable to set value for property %s\n", CPU_FREQ_CONTROL);
 
714
        g_critical ("Unable to set value for property %s", SPIN_DOWN_ON_BATTERY);
714
715
    }
715
 
#endif
 
716
    
716
717
}
717
718
 
 
719
void on_ac_spin_changed (GtkWidget *w, XfconfChannel *channel)
 
720
{
 
721
    gboolean val = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w));
 
722
    
 
723
    if ( !xfconf_channel_set_bool (channel, PROPERTIES_PREFIX SPIN_DOWN_ON_AC, val) )
 
724
    {
 
725
        g_critical ("Unable to set value for property %s", SPIN_DOWN_ON_AC);
 
726
    }
 
727
}
718
728
 
719
729
static void
720
 
xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gboolean can_suspend, 
721
 
                         gboolean can_hibernate, gboolean has_lcd_brightness, gboolean has_lid)
 
730
xfpm_settings_on_battery (XfconfChannel *channel, gboolean auth_hibernate, 
 
731
                          gboolean auth_suspend, gboolean can_shutdown, 
 
732
                          gboolean can_suspend, gboolean can_hibernate, 
 
733
                          gboolean has_lcd_brightness, gboolean has_lid,
 
734
                          gboolean devkit_disk, gboolean can_spin_down)
722
735
{
723
736
    gboolean valid;
724
737
    gint list_value;
733
746
    GtkWidget *label;
734
747
    GtkWidget *brg;
735
748
    GtkWidget *frame;
 
749
    GtkWidget *spin_down;
736
750
#ifdef HAVE_DPMS
737
751
    GtkWidget *dpms_frame_on_battery;
738
752
#endif
744
758
    if ( !can_suspend && !can_hibernate )
745
759
    {
746
760
        gtk_widget_set_sensitive (inact, FALSE);
 
761
        gtk_widget_set_tooltip_text (inact, _("Hibernate and suspend operations not supported"));
 
762
    }
 
763
    else if ( !auth_suspend && !auth_hibernate )
 
764
    {
 
765
        gtk_widget_set_sensitive (inact, FALSE);
747
766
        gtk_widget_set_tooltip_text (inact, _("Hibernate and suspend operations not permitted"));
748
767
    }
749
768
    
751
770
    gtk_range_set_value (GTK_RANGE (inact), val);
752
771
    
753
772
    
754
 
    if (!user_privilege )
755
 
    {
756
 
        gtk_widget_set_sensitive (battery_critical, FALSE);
757
 
        gtk_widget_set_tooltip_text (battery_critical, _("Shutdown and hibernate operations not permitted"));
758
 
    }
759
 
    
760
773
    list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
761
774
    
762
775
    gtk_combo_box_set_model (GTK_COMBO_BOX(battery_critical), GTK_TREE_MODEL(list_store));
764
777
    gtk_list_store_append(list_store, &iter);
765
778
    gtk_list_store_set (list_store, &iter, 0, _("Nothing"), 1, XFPM_DO_NOTHING, -1);
766
779
    
767
 
    if ( can_suspend )
 
780
    if ( can_suspend && auth_suspend )
768
781
    {
769
782
        gtk_list_store_append(list_store, &iter);
770
783
        gtk_list_store_set (list_store, &iter, 0, _("Suspend"), 1, XFPM_DO_SUSPEND, -1);
771
784
    }
772
785
    
773
 
    if ( can_hibernate )
 
786
    if ( can_hibernate && auth_hibernate )
774
787
    {
775
788
        gtk_list_store_append(list_store, &iter);
776
789
        gtk_list_store_set (list_store, &iter, 0, _("Hibernate"), 1, XFPM_DO_HIBERNATE, -1);
777
790
    }
778
791
 
779
 
    gtk_list_store_append(list_store, &iter);
780
 
    gtk_list_store_set (list_store, &iter, 0, _("Shutdown"), 1, XFPM_DO_SHUTDOWN, -1);
 
792
    if ( can_shutdown )
 
793
    {
 
794
        gtk_list_store_append(list_store, &iter);
 
795
        gtk_list_store_set (list_store, &iter, 0, _("Shutdown"), 1, XFPM_DO_SHUTDOWN, -1);
 
796
    }
781
797
    
782
798
    gtk_list_store_append(list_store, &iter);
783
799
    gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1);
822
838
    lid = GTK_WIDGET (gtk_builder_get_object (xml, "on-battery-lid"));
823
839
    if ( has_lid )
824
840
    {
825
 
        if (!user_privilege )
826
 
        {
827
 
            gtk_widget_set_sensitive (lid, FALSE);
828
 
            gtk_widget_set_tooltip_text (lid, _("Shutdown and hibernate operations not permitted"));
829
 
        }
830
 
        
831
841
        list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
832
842
        
833
843
        gtk_combo_box_set_model (GTK_COMBO_BOX(lid), GTK_TREE_MODEL(list_store));
835
845
        gtk_list_store_append(list_store, &iter);
836
846
        gtk_list_store_set (list_store, &iter, 0, _("Nothing"), 1, LID_TRIGGER_NOTHING, -1);
837
847
        
838
 
        if ( can_suspend )
 
848
        if ( can_suspend && auth_suspend )
839
849
        {
840
850
            gtk_list_store_append(list_store, &iter);
841
851
            gtk_list_store_set (list_store, &iter, 0, _("Suspend"), 1, LID_TRIGGER_SUSPEND, -1);
842
852
        }
843
853
        
844
 
        if ( can_hibernate)
 
854
        if ( can_hibernate && auth_hibernate)
845
855
        {
846
856
            gtk_list_store_append(list_store, &iter);
847
857
            gtk_list_store_set (list_store, &iter, 0, _("Hibernate"), 1, LID_TRIGGER_HIBERNATE, -1);
895
905
        gtk_notebook_remove_page (GTK_NOTEBOOK (nt), 1);
896
906
    }
897
907
#endif
 
908
 
 
909
    spin_down = GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-on-battery"));
 
910
    gtk_widget_set_sensitive (spin_down, can_spin_down);
 
911
    
 
912
    if ( !devkit_disk )
 
913
    {
 
914
        gtk_widget_hide (spin_down);
 
915
    }
 
916
    else if ( !can_spin_down )
 
917
    {
 
918
        gtk_widget_set_tooltip_text (spin_down, _("Spinning down hard disks permission denied"));
 
919
    }
898
920
}
899
921
 
900
922
static void
901
 
xfpm_settings_on_ac (XfconfChannel *channel, gboolean user_privilege, gboolean can_suspend, 
902
 
                     gboolean can_hibernate, gboolean has_lcd_brightness, gboolean has_lid)
 
923
xfpm_settings_on_ac (XfconfChannel *channel, gboolean auth_suspend, 
 
924
                     gboolean auth_hibernate, gboolean can_suspend, 
 
925
                     gboolean can_hibernate, gboolean has_lcd_brightness, 
 
926
                     gboolean has_lid, gboolean devkit_disk, gboolean can_spin_down)
903
927
{
904
928
    GtkWidget *inact;
905
929
    GtkWidget *lid;
906
930
    GtkWidget *frame;
907
931
    GtkWidget *brg;
 
932
    GtkWidget *spin_down;
908
933
    GtkListStore *list_store;
909
934
    GtkTreeIter iter;
910
935
    guint val;
920
945
    if ( !can_suspend && !can_hibernate )
921
946
    {
922
947
        gtk_widget_set_sensitive (inact, FALSE);
 
948
        gtk_widget_set_tooltip_text (inact, _("Hibernate and suspend operations not supported"));
 
949
    }
 
950
    else  if ( !auth_suspend && !auth_hibernate )
 
951
    {
 
952
        gtk_widget_set_sensitive (inact, FALSE);
923
953
        gtk_widget_set_tooltip_text (inact, _("Hibernate and suspend operations not permitted"));
924
954
    }
925
955
    
948
978
    {
949
979
        list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
950
980
        
951
 
        if ( !user_privilege )
952
 
        {
953
 
            gtk_widget_set_sensitive (lid, FALSE);
954
 
            gtk_widget_set_tooltip_text (lid, _("Hibernate and suspend operations not permitted"));
955
 
            
956
 
        }
957
981
        gtk_combo_box_set_model (GTK_COMBO_BOX(lid), GTK_TREE_MODEL(list_store));
958
982
        
959
983
        gtk_list_store_append(list_store, &iter);
1019
1043
        gtk_notebook_remove_page (GTK_NOTEBOOK (GTK_WIDGET (gtk_builder_get_object (xml, "on-ac-notebook"))), 1);
1020
1044
    }
1021
1045
#endif
 
1046
 
 
1047
    spin_down = GTK_WIDGET (gtk_builder_get_object (xml, "spin-down-on-ac"));
 
1048
    gtk_widget_set_sensitive (spin_down, can_spin_down);
 
1049
    
 
1050
    if ( !devkit_disk )
 
1051
    {
 
1052
        gtk_widget_hide (spin_down);
 
1053
    }
 
1054
    else if ( !can_spin_down )
 
1055
    {
 
1056
        gtk_widget_set_tooltip_text (spin_down, _("Spinning down hard disks permission denied"));
 
1057
    }
 
1058
 
1022
1059
}
1023
1060
 
1024
1061
static void
1025
 
xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege,
 
1062
xfpm_settings_general (XfconfChannel *channel, gboolean auth_hibernate, 
 
1063
                       gboolean auth_suspend, gboolean can_shutdown,  
1026
1064
                       gboolean can_suspend, gboolean can_hibernate,
1027
1065
                       gboolean has_sleep_button, gboolean has_hibernate_button,
1028
1066
                       gboolean has_power_button)
1105
1143
    
1106
1144
    if ( has_power_button )
1107
1145
    {
1108
 
        if (!user_privilege )
1109
 
        {
1110
 
            gtk_widget_set_sensitive (power, FALSE);
1111
 
            gtk_widget_set_tooltip_text (power, _("Hibernate and suspend operations not permitted"));
1112
 
        }
1113
 
        
1114
1146
        gtk_combo_box_set_model (GTK_COMBO_BOX(power), GTK_TREE_MODEL(list_store));
1115
1147
 
1116
1148
        gtk_list_store_append (list_store, &iter);
1117
1149
        gtk_list_store_set (list_store, &iter, 0, _("Nothing"), 1, XFPM_DO_NOTHING, -1);
1118
1150
        
1119
 
        if ( can_suspend )
 
1151
        if ( can_suspend && auth_suspend)
1120
1152
        {
1121
1153
            gtk_list_store_append (list_store, &iter);
1122
1154
            gtk_list_store_set (list_store, &iter, 0, _("Suspend"), 1, XFPM_DO_SUSPEND, -1);
1123
1155
        }
1124
1156
        
1125
 
        if ( can_hibernate )
 
1157
        if ( can_hibernate && auth_hibernate )
1126
1158
        {
1127
1159
            gtk_list_store_append (list_store, &iter);
1128
1160
            gtk_list_store_set (list_store, &iter, 0, _("Hibernate"), 1, XFPM_DO_HIBERNATE, -1);
1129
1161
        }
1130
1162
        
1131
 
        gtk_list_store_append (list_store, &iter);
1132
 
        gtk_list_store_set (list_store, &iter, 0, _("Shutdown"), 1, XFPM_DO_SHUTDOWN, -1);
 
1163
        if ( can_shutdown )
 
1164
        {
 
1165
            gtk_list_store_append (list_store, &iter);
 
1166
            gtk_list_store_set (list_store, &iter, 0, _("Shutdown"), 1, XFPM_DO_SHUTDOWN, -1);
 
1167
        }
1133
1168
        
1134
1169
        gtk_list_store_append (list_store, &iter);
1135
1170
        gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1);
1163
1198
    
1164
1199
    if (has_hibernate_button )
1165
1200
    {
1166
 
        if (!user_privilege )
1167
 
        {
1168
 
            gtk_widget_set_sensitive (hibernate, FALSE);
1169
 
            gtk_widget_set_tooltip_text (hibernate, _("Hibernate and suspend operations not permitted"));
1170
 
        }
1171
 
        
1172
1201
        gtk_combo_box_set_model (GTK_COMBO_BOX(hibernate), GTK_TREE_MODEL(list_store));
1173
1202
 
1174
1203
        gtk_list_store_append (list_store, &iter);
1175
1204
        gtk_list_store_set (list_store, &iter, 0, _("Nothing"), 1, XFPM_DO_NOTHING, -1);
1176
1205
        
1177
 
        if ( can_suspend )
 
1206
        if ( can_suspend && auth_suspend)
1178
1207
        {
1179
1208
            gtk_list_store_append (list_store, &iter);
1180
1209
            gtk_list_store_set (list_store, &iter, 0, _("Suspend"), 1, XFPM_DO_SUSPEND, -1);
1181
1210
        }
1182
1211
        
1183
 
        if ( can_hibernate )
 
1212
        if ( can_hibernate && auth_hibernate )
1184
1213
        {
1185
1214
            gtk_list_store_append (list_store, &iter);
1186
1215
            gtk_list_store_set (list_store, &iter, 0, _("Hibernate"), 1, XFPM_DO_HIBERNATE, -1);
1190
1219
        gtk_list_store_set (list_store, &iter, 0, _("Ask"), 1, XFPM_ASK, -1);
1191
1220
        
1192
1221
        value = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX HIBERNATE_SWITCH_CFG, XFPM_DO_NOTHING);
 
1222
        
1193
1223
        for ( valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter);
1194
1224
              valid;
1195
1225
              valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter) )
1218
1248
    
1219
1249
    if ( has_sleep_button )
1220
1250
    {
1221
 
        if (!user_privilege )
1222
 
        {
1223
 
            gtk_widget_set_sensitive (sleep_w, FALSE);
1224
 
            gtk_widget_set_tooltip_text (sleep_w, _("Hibernate and suspend operations not permitted"));
1225
 
        }
1226
 
        
1227
1251
        gtk_combo_box_set_model (GTK_COMBO_BOX(sleep_w), GTK_TREE_MODEL(list_store));
1228
1252
 
1229
1253
        gtk_list_store_append (list_store, &iter);
1230
1254
        gtk_list_store_set (list_store, &iter, 0, _("Nothing"), 1, XFPM_DO_NOTHING, -1);
1231
1255
        
1232
 
        if ( can_suspend )
 
1256
        if ( can_suspend && auth_suspend )
1233
1257
        {
1234
1258
            gtk_list_store_append (list_store, &iter);
1235
1259
            gtk_list_store_set (list_store, &iter, 0, _("Suspend"), 1, XFPM_DO_SUSPEND, -1);
1236
1260
        }
1237
1261
        
1238
 
        if ( can_hibernate )
 
1262
        if ( can_hibernate && auth_hibernate)
1239
1263
        {
1240
1264
            gtk_list_store_append (list_store, &iter);
1241
1265
            gtk_list_store_set (list_store, &iter, 0, _("Hibernate"), 1, XFPM_DO_HIBERNATE, -1);
1271
1295
    val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX GENERAL_NOTIFICATION_CFG, TRUE);
1272
1296
    
1273
1297
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(notify), val);
1274
 
    
1275
1298
}
1276
1299
 
1277
1300
static void
1278
 
xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean user_privilege,
 
1301
xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, 
 
1302
                        gboolean auth_hibernate, gboolean auth_suspend,
1279
1303
                        gboolean can_suspend, gboolean can_hibernate)
1280
1304
{
1281
1305
    guint val;
1282
1306
    gchar *str;
1283
1307
    GtkWidget *critical_level;
1284
1308
    GtkWidget *lock;
1285
 
    GtkWidget *cpu;
1286
1309
    GtkWidget *label;
1287
1310
    GtkWidget *sleep_dpms_mode;
1288
1311
    GtkWidget *suspend_dpms_mode;
1292
1315
    
1293
1316
    if ( !can_suspend )
1294
1317
    {
 
1318
        gtk_widget_set_sensitive (inact_suspend, FALSE);
 
1319
        gtk_widget_set_tooltip_text (inact_suspend, _("Suspend operation not supported"));
 
1320
    }
 
1321
    else if ( !auth_suspend )
 
1322
    {
1295
1323
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (inact_hibernate), TRUE);
1296
1324
        gtk_widget_set_sensitive (inact_suspend, FALSE);
1297
1325
        gtk_widget_set_tooltip_text (inact_suspend, _("Suspend operation not permitted"));
1300
1328
    if ( !can_hibernate )
1301
1329
    {
1302
1330
        gtk_widget_set_sensitive (inact_hibernate, FALSE);
 
1331
        gtk_widget_set_tooltip_text (inact_hibernate, _("Hibernate operation not supported"));
 
1332
    }
 
1333
    else if ( !auth_hibernate)
 
1334
    {
 
1335
        gtk_widget_set_sensitive (inact_hibernate, FALSE);
1303
1336
        gtk_widget_set_tooltip_text (inact_hibernate, _("Hibernate operation not permitted"));
1304
1337
    }
1305
1338
   
1306
1339
    str = xfconf_channel_get_string (channel, PROPERTIES_PREFIX INACTIVITY_SLEEP_MODE, "Suspend");
1307
 
    if ( xfpm_strequal (str, "Suspend") )
 
1340
    if ( !g_strcmp0 (str, "Suspend") )
1308
1341
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (inact_suspend), TRUE);
1309
 
    else if ( xfpm_strequal (str, "Hibernate"))
 
1342
    else if ( !g_strcmp0 (str, "Hibernate"))
1310
1343
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (inact_hibernate), TRUE);
1311
1344
    else 
1312
1345
    {
1322
1355
#ifdef HAVE_DPMS
1323
1356
    str = xfconf_channel_get_string (channel, PROPERTIES_PREFIX DPMS_SLEEP_MODE, "standby");
1324
1357
    
1325
 
    if ( xfpm_strequal (str, "standby" ) )
 
1358
    if ( !g_strcmp0 (str, "standby" ) )
1326
1359
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sleep_dpms_mode), TRUE);
1327
 
    else if ( xfpm_strequal (str, "suspend") )
 
1360
    else if ( !g_strcmp0 (str, "suspend") )
1328
1361
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suspend_dpms_mode), TRUE);
1329
1362
    else 
1330
1363
    {
1351
1384
    
1352
1385
        val = xfconf_channel_get_uint (channel, PROPERTIES_PREFIX CRITICAL_POWER_LEVEL, 10);
1353
1386
 
1354
 
        if ( G_UNLIKELY (val > 20) )
 
1387
        if ( val > 20 || val < 5)
1355
1388
        {
1356
1389
            g_critical ("Value %d if out of range for property %s\n", val, CRITICAL_POWER_LEVEL);
1357
1390
            gtk_spin_button_set_value (GTK_SPIN_BUTTON(critical_level), 10);
1371
1404
     */
1372
1405
    lock = GTK_WIDGET (gtk_builder_get_object (xml, "lock-screen"));
1373
1406
    
1374
 
    if ( !user_privilege )
 
1407
    if ( !can_suspend && !can_hibernate )
 
1408
    {
 
1409
        gtk_widget_set_sensitive (lock, FALSE);
 
1410
        gtk_widget_set_tooltip_text (lock, _("Hibernate and suspend operations not supported"));
 
1411
    }
 
1412
    else if ( !auth_hibernate && !auth_suspend)
1375
1413
    {
1376
1414
        gtk_widget_set_sensitive (lock, FALSE);
1377
1415
        gtk_widget_set_tooltip_text (lock, _("Hibernate and suspend operations not permitted"));
1379
1417
    
1380
1418
    val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX LOCK_SCREEN_ON_SLEEP, TRUE);
1381
1419
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(lock), val);
1382
 
 
1383
 
    cpu = GTK_WIDGET (gtk_builder_get_object (xml, "cpu-freq"));
1384
 
    
1385
 
#ifdef SYSTEM_IS_LINUX
1386
 
    if ( system_laptop )
1387
 
    {
1388
 
        val = xfconf_channel_get_bool (channel, PROPERTIES_PREFIX CPU_FREQ_CONTROL, TRUE);
1389
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cpu), val);
1390
 
    }
1391
 
    else
1392
 
        gtk_widget_hide (cpu);
1393
 
#else
1394
 
    gtk_widget_hide (cpu);
1395
 
#endif
1396
 
 
1397
1420
}
1398
1421
 
1399
1422
void
1454
1477
    gtk_tree_view_append_column(GTK_TREE_VIEW(view),col);
1455
1478
    
1456
1479
    /*General settings */
1457
 
    pix = xfce_themed_icon_load ("preferences-system", 48); 
 
1480
    pix = xfpm_icon_load ("preferences-system", 48); 
1458
1481
    
1459
1482
    gtk_list_store_append(list_store, &iter);
1460
1483
    
1470
1493
    i++;
1471
1494
    
1472
1495
    /* ON ac power */
1473
 
    pix = xfce_themed_icon_load (XFPM_AC_ADAPTER_ICON, 48); 
 
1496
    pix = xfpm_icon_load (XFPM_AC_ADAPTER_ICON, 48); 
1474
1497
    gtk_list_store_append(list_store, &iter);
1475
1498
    if ( pix )
1476
1499
    {
1485
1508
    
1486
1509
    if ( system_laptop )
1487
1510
    {
1488
 
        pix = xfce_themed_icon_load (XFPM_BATTERY_ICON, 48); 
 
1511
        pix = xfpm_icon_load (XFPM_BATTERY_ICON, 48); 
1489
1512
        gtk_list_store_append(list_store, &iter);
1490
1513
        if ( pix )
1491
1514
        {
1499
1522
    }
1500
1523
    i++;
1501
1524
    
1502
 
    pix = xfce_themed_icon_load ("applications-other", 48); 
 
1525
    pix = xfpm_icon_load ("applications-other", 48); 
1503
1526
    gtk_list_store_append(list_store, &iter);
1504
1527
    if ( pix )
1505
1528
    {
1548
1571
    settings_quit (plug, channel);
1549
1572
}
1550
1573
 
1551
 
void
 
1574
GtkWidget *
1552
1575
xfpm_settings_dialog_new (XfconfChannel *channel, gboolean system_laptop, 
1553
 
                          gboolean user_privilege, gboolean can_suspend, 
 
1576
                          gboolean auth_hibernate, gboolean auth_suspend, 
 
1577
                          gboolean can_shutdown, gboolean can_suspend, 
1554
1578
                          gboolean can_hibernate, gboolean has_lcd_brightness, 
1555
1579
                          gboolean has_lid, gboolean has_sleep_button, 
1556
1580
                          gboolean has_hibernate_button, gboolean has_power_button,
 
1581
                          gboolean devkit_disk, gboolean can_spin_down, 
1557
1582
                          GdkNativeWindow id)
1558
1583
{
1559
1584
    GtkWidget *plug;
1561
1586
    GtkWidget *allbox;
1562
1587
    GError *error = NULL;
1563
1588
 
1564
 
    TRACE("system_laptop=%s user_privilege=%s can_suspend=%s can_hibernate=%s has_lcd_brightness=%s has_lid=%s "\
1565
 
          "has_sleep_button=%s has_hibernate_button=%s has_power_button=%s",
1566
 
          xfpm_bool_to_string (system_laptop), xfpm_bool_to_string (user_privilege),
 
1589
    XFPM_DEBUG ("system_laptop=%s auth_hibernate=%s  auth_suspend=%s can_shutdown=%s can_suspend=%s can_hibernate=%s has_lcd_brightness=%s has_lid=%s "\
 
1590
           "has_sleep_button=%s has_hibernate_button=%s has_power_button=%s can_spin_down=%s",
 
1591
          xfpm_bool_to_string (system_laptop), xfpm_bool_to_string (auth_hibernate), 
 
1592
          xfpm_bool_to_string (can_shutdown), xfpm_bool_to_string (auth_suspend),
1567
1593
          xfpm_bool_to_string (can_suspend), xfpm_bool_to_string (can_hibernate),
1568
1594
          xfpm_bool_to_string (has_lcd_brightness), xfpm_bool_to_string (has_lid),
1569
1595
          xfpm_bool_to_string (has_sleep_button), xfpm_bool_to_string (has_hibernate_button),
1570
 
          xfpm_bool_to_string (has_power_button) );
 
1596
          xfpm_bool_to_string (has_power_button), xfpm_bool_to_string (can_spin_down) );
1571
1597
 
1572
1598
    xml = xfpm_builder_new_from_string (xfpm_settings_ui, &error);
1573
1599
    
1574
1600
    if ( G_UNLIKELY (error) )
1575
1601
    {
1576
 
        xfce_err ("%s : %s", error->message, _("Check your power manager installation"));
 
1602
        xfce_dialog_show_error (NULL, error, "%s", _("Check your power manager installation"));
1577
1603
        g_error ("%s", error->message);
1578
1604
    }
1579
1605
    
1589
1615
    dialog = GTK_WIDGET (gtk_builder_get_object (xml, "xfpm-settings-dialog"));
1590
1616
    nt = GTK_WIDGET (gtk_builder_get_object (xml, "main-notebook"));
1591
1617
    
1592
 
    xfpm_settings_on_ac (channel, user_privilege, can_suspend, can_hibernate, has_lcd_brightness, has_lid );
 
1618
    xfpm_settings_on_ac (channel, 
 
1619
                         auth_hibernate, 
 
1620
                         auth_suspend, 
 
1621
                         can_suspend, 
 
1622
                         can_hibernate, 
 
1623
                         has_lcd_brightness, 
 
1624
                         has_lid,
 
1625
                         devkit_disk,
 
1626
                         can_spin_down);
1593
1627
    
1594
1628
    if ( system_laptop )
1595
 
        xfpm_settings_on_battery (channel, user_privilege, can_suspend, can_hibernate, has_lcd_brightness, has_lid);
 
1629
        xfpm_settings_on_battery (channel, 
 
1630
                                  auth_hibernate, 
 
1631
                                  auth_suspend, 
 
1632
                                  can_shutdown, 
 
1633
                                  can_suspend, 
 
1634
                                  can_hibernate, 
 
1635
                                  has_lcd_brightness, 
 
1636
                                  has_lid,
 
1637
                                  devkit_disk,
 
1638
                                  can_spin_down);
1596
1639
        
1597
1640
    xfpm_settings_tree_view (channel, system_laptop);
1598
1641
    
1599
 
    xfpm_settings_general   (channel, user_privilege, can_suspend, can_hibernate,
 
1642
    xfpm_settings_general   (channel, auth_hibernate, auth_suspend, can_shutdown, can_suspend, can_hibernate,
1600
1643
                             has_sleep_button, has_hibernate_button, has_power_button );
1601
1644
                             
1602
 
    xfpm_settings_advanced  (channel, system_laptop, user_privilege, can_suspend, can_hibernate);
 
1645
    xfpm_settings_advanced  (channel, system_laptop, auth_hibernate, auth_suspend, can_suspend, can_hibernate);
1603
1646
    
1604
1647
    if ( id != 0 )
1605
1648
    {
1618
1661
    }
1619
1662
    
1620
1663
    gtk_builder_connect_signals (xml, channel);
 
1664
    
 
1665
    return dialog;
1621
1666
}