#include <gtk/gtk.h>
Go to the source code of this file.
Functions | |
GtkWidget * | create_power_window (GtkWidget *parent) |
void | load_power_settings () |
void | save_power_settings () |
GtkWidget* create_power_window | ( | GtkWidget * | parent | ) |
Copyright (C) 2008 iRex Technologies B.V. All rights reserved.
Definition at line 138 of file power.c.
References create_auto_shutdown_widgets(), create_frame(), create_settingsview(), create_title(), g_power_settings_window, init_widgets_with_settings(), on_focus_in(), on_focus_out(), on_listview_navigate_cursor(), on_listview_row_activated(), and WINDOW_BORDER_PADDING.
Referenced by create_concrete_win().
00139 { 00140 // create top window 00141 GtkWidget* top_window = parent; 00142 gtk_window_maximize(GTK_WINDOW(top_window)); 00143 gtk_window_set_resizable(GTK_WINDOW(top_window), FALSE); 00144 gtk_container_set_border_width(GTK_CONTAINER(top_window),WINDOW_BORDER_PADDING ); 00145 gtk_window_set_modal(GTK_WINDOW(top_window), TRUE); 00146 00147 // top level vbox (vboxtop) 00148 GtkWidget* vboxtop = gtk_vbox_new(FALSE, 0); 00149 gtk_container_add(GTK_CONTAINER(top_window), vboxtop); 00150 00151 // add header container the title and subtitle of this settings page 00152 create_title(GTK_VBOX(vboxtop), _("Settings"), _("Power Management")); 00153 00154 // add the back/exit bar below the title 00155 GtkWidget* view = create_settingsview(); 00156 gtk_box_pack_start(GTK_BOX(vboxtop), view, FALSE, FALSE, 0); 00157 g_signal_connect(view, "row-activated", G_CALLBACK(on_listview_row_activated), NULL ) ; 00158 g_signal_connect(view, "navigate-cursor", G_CALLBACK(on_listview_navigate_cursor), NULL ) ; 00159 g_signal_connect(view, "focus-in-event", G_CALLBACK(on_focus_in), NULL ); 00160 g_signal_connect(view, "focus-out-event", G_CALLBACK(on_focus_out), NULL ); 00161 00162 GtkWidget* vbox = GTK_WIDGET( create_frame(GTK_VBOX(vboxtop)) ); 00163 create_auto_shutdown_widgets(GTK_BOX(vbox)); 00164 00165 00166 // Update widget with current settings. 00167 init_widgets_with_settings(); 00168 00169 g_power_settings_window = top_window; 00170 00171 gtk_widget_grab_focus(view); 00172 00173 gtk_widget_show_all(top_window); 00174 return top_window; 00175 }
void load_power_settings | ( | ) |
Definition at line 112 of file power.c.
References GCONF_MIN_STANDBY, GCONF_STANDBY_IF_PLUGGED, get_value_bool(), get_value_int(), LOGPRINTF, PowerSettings::minutes_standby, and PowerSettings::standby_if_plugged.
Referenced by create_concrete_win().
00113 { 00114 g_orig_power_settings.standby_if_plugged = get_value_bool(GCONF_STANDBY_IF_PLUGGED); 00115 g_orig_power_settings.minutes_standby = get_value_int (GCONF_MIN_STANDBY); 00116 00117 g_cur_power_settings = g_orig_power_settings; 00118 LOGPRINTF("Loading power settings, done."); 00119 }
void save_power_settings | ( | ) |
Definition at line 122 of file power.c.
References GCONF_MIN_STANDBY, GCONF_STANDBY_IF_PLUGGED, LOGPRINTF, PowerSettings::minutes_standby, set_value_bool(), set_value_int(), and PowerSettings::standby_if_plugged.
Referenced by on_listview_row_activated().
00123 { 00124 if (g_cur_power_settings.standby_if_plugged != g_orig_power_settings.standby_if_plugged) 00125 { 00126 set_value_bool(GCONF_STANDBY_IF_PLUGGED, g_cur_power_settings.standby_if_plugged); 00127 } 00128 00129 if (g_cur_power_settings.minutes_standby != g_orig_power_settings.minutes_standby) 00130 { 00131 set_value_int(GCONF_MIN_STANDBY, g_cur_power_settings.minutes_standby); 00132 } 00133 00134 LOGPRINTF("Saving power settings, done."); 00135 }