diff options
author | Brent Hull <[email protected]> | 2012-10-27 23:04:21 -0400 |
---|---|---|
committer | Brent Hull <[email protected]> | 2012-10-27 23:04:21 -0400 |
commit | e58350ab1a00d55e82f7ae97589562e10a77c485 (patch) | |
tree | a0a6596880e7305d8403de503653f89e19d313a3 /src/gpm-statistics.c | |
parent | aa88be1d4a4e545b4141b0065b094d49d3d3a81b (diff) | |
download | mate-power-manager-e58350ab1a00d55e82f7ae97589562e10a77c485.tar.bz2 mate-power-manager-e58350ab1a00d55e82f7ae97589562e10a77c485.tar.xz |
Port to Gsettings based on GNOME patch by Richard Hughes
Diffstat (limited to 'src/gpm-statistics.c')
-rw-r--r-- | src/gpm-statistics.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index 48ce69b..00a7d99 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -49,7 +49,7 @@ gchar *current_device = NULL; static const gchar *history_type; static const gchar *stats_type; static guint history_time; -static MateConfClient *mateconf_client; +static GSettings *settings; static gfloat sigma_smoothing = 0.0f; static UpWakeups *wakeups = NULL; static GtkWidget *graph_history = NULL; @@ -1107,8 +1107,8 @@ gpm_stats_notebook_changed_cb (GtkNotebook *notebook, gpointer page, gint page_n widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_stats")); gpm_stats_set_title (GTK_WINDOW (widget), page_num); - /* save page in mateconf */ - mateconf_client_set_int (mateconf_client, GPM_CONF_INFO_PAGE_NUMBER, page_num, NULL); + /* save page in gsettings */ + g_settings_set_int (settings, GPM_SETTINGS_INFO_PAGE_NUMBER, page_num); if (current_device == NULL) return; @@ -1151,8 +1151,8 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gboolean dat g_free (current_device); gtk_tree_model_get (model, &iter, GPM_DEVICES_COLUMN_ID, ¤t_device, -1); - /* save device in mateconf */ - mateconf_client_set_string (mateconf_client, GPM_CONF_INFO_LAST_DEVICE, current_device, NULL); + /* save device in gsettings */ + g_settings_set_string (settings, GPM_SETTINGS_INFO_LAST_DEVICE, current_device); /* show transaction_id */ egg_debug ("selected row is: %s", current_device); @@ -1326,8 +1326,8 @@ gpm_stats_history_type_combo_changed_cb (GtkWidget *widget, gpointer data) gpm_stats_button_update_ui (); - /* save to mateconf */ - mateconf_client_set_string (mateconf_client, GPM_CONF_INFO_HISTORY_TYPE, history_type, NULL); + /* save to gsettings */ + g_settings_set_string (settings, GPM_SETTINGS_INFO_HISTORY_TYPE, history_type); } /** @@ -1378,8 +1378,8 @@ gpm_stats_type_combo_changed_cb (GtkWidget *widget, gpointer data) gpm_stats_button_update_ui (); - /* save to mateconf */ - mateconf_client_set_string (mateconf_client, GPM_CONF_INFO_STATS_TYPE, stats_type, NULL); + /* save to gsettings */ + g_settings_set_string (settings, GPM_SETTINGS_INFO_STATS_TYPE, stats_type); } /** @@ -1405,8 +1405,8 @@ gpm_stats_range_combo_changed (GtkWidget *widget, gpointer data) else g_assert (FALSE); - /* save to mateconf */ - mateconf_client_set_int (mateconf_client, GPM_CONF_INFO_HISTORY_TIME, history_time, NULL); + /* save to gsettings */ + g_settings_set_int (settings, GPM_SETTINGS_INFO_HISTORY_TIME, history_time); gpm_stats_button_update_ui (); } @@ -1420,7 +1420,7 @@ gpm_stats_smooth_checkbox_history_cb (GtkWidget *widget, gpointer data) { gboolean checked; checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - mateconf_client_set_bool (mateconf_client, GPM_CONF_INFO_HISTORY_GRAPH_SMOOTH, checked, NULL); + g_settings_set_boolean (settings, GPM_SETTINGS_INFO_HISTORY_GRAPH_SMOOTH, checked); gpm_stats_button_update_ui (); } @@ -1433,7 +1433,7 @@ gpm_stats_smooth_checkbox_stats_cb (GtkWidget *widget, gpointer data) { gboolean checked; checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - mateconf_client_set_bool (mateconf_client, GPM_CONF_INFO_STATS_GRAPH_SMOOTH, checked, NULL); + g_settings_set_boolean (settings, GPM_SETTINGS_INFO_STATS_GRAPH_SMOOTH, checked); gpm_stats_button_update_ui (); } @@ -1446,7 +1446,7 @@ gpm_stats_points_checkbox_history_cb (GtkWidget *widget, gpointer data) { gboolean checked; checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - mateconf_client_set_bool (mateconf_client, GPM_CONF_INFO_HISTORY_GRAPH_POINTS, checked, NULL); + g_settings_set_boolean (settings, GPM_SETTINGS_INFO_HISTORY_GRAPH_POINTS, checked); gpm_stats_button_update_ui (); } @@ -1459,7 +1459,7 @@ gpm_stats_points_checkbox_stats_cb (GtkWidget *widget, gpointer data) { gboolean checked; checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - mateconf_client_set_bool (mateconf_client, GPM_CONF_INFO_STATS_GRAPH_POINTS, checked, NULL); + g_settings_set_boolean (settings, GPM_SETTINGS_INFO_STATS_GRAPH_POINTS, checked); gpm_stats_button_update_ui (); } @@ -1592,8 +1592,8 @@ main (int argc, char *argv[]) gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), GPM_DATA G_DIR_SEPARATOR_S "icons"); - /* get data from mateconf */ - mateconf_client = mateconf_client_get_default (); + /* get data from the settings */ + settings = g_settings_new (GPM_SETTINGS_SCHEMA); /* get UI */ builder = gtk_builder_new (); @@ -1639,31 +1639,31 @@ main (int argc, char *argv[]) G_CALLBACK (gpm_stats_button_help_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "checkbutton_smooth_history")); - checked = mateconf_client_get_bool (mateconf_client, GPM_CONF_INFO_HISTORY_GRAPH_SMOOTH, NULL); + checked = g_settings_get_boolean (settings, GPM_SETTINGS_INFO_HISTORY_GRAPH_SMOOTH); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked); g_signal_connect (widget, "clicked", G_CALLBACK (gpm_stats_smooth_checkbox_history_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "checkbutton_smooth_stats")); - checked = mateconf_client_get_bool (mateconf_client, GPM_CONF_INFO_STATS_GRAPH_SMOOTH, NULL); + checked = g_settings_get_boolean (settings, GPM_SETTINGS_INFO_STATS_GRAPH_SMOOTH); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked); g_signal_connect (widget, "clicked", G_CALLBACK (gpm_stats_smooth_checkbox_stats_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "checkbutton_points_history")); - checked = mateconf_client_get_bool (mateconf_client, GPM_CONF_INFO_HISTORY_GRAPH_POINTS, NULL); + checked = g_settings_get_boolean (settings, GPM_SETTINGS_INFO_HISTORY_GRAPH_POINTS); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked); g_signal_connect (widget, "clicked", G_CALLBACK (gpm_stats_points_checkbox_history_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "checkbutton_points_stats")); - checked = mateconf_client_get_bool (mateconf_client, GPM_CONF_INFO_STATS_GRAPH_POINTS, NULL); + checked = g_settings_get_boolean (settings, GPM_SETTINGS_INFO_STATS_GRAPH_POINTS); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked); g_signal_connect (widget, "clicked", G_CALLBACK (gpm_stats_points_checkbox_stats_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "notebook1")); - page = mateconf_client_get_int (mateconf_client, GPM_CONF_INFO_PAGE_NUMBER, NULL); + page = g_settings_get_int (settings, GPM_SETTINGS_INFO_PAGE_NUMBER); gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), page); g_signal_connect (widget, "switch-page", G_CALLBACK (gpm_stats_notebook_changed_cb), NULL); @@ -1705,14 +1705,14 @@ main (int argc, char *argv[]) gpm_stats_add_wakeups_columns (GTK_TREE_VIEW (widget)); gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget)); /* show */ - history_type = mateconf_client_get_string (mateconf_client, GPM_CONF_INFO_HISTORY_TYPE, NULL); - history_time = mateconf_client_get_int (mateconf_client, GPM_CONF_INFO_HISTORY_TIME, NULL); + history_type = g_settings_get_string (settings, GPM_SETTINGS_INFO_HISTORY_TYPE); + history_time = g_settings_get_int (settings, GPM_SETTINGS_INFO_HISTORY_TIME); if (history_type == NULL) history_type = GPM_HISTORY_CHARGE_VALUE; if (history_time == 0) history_time = GPM_HISTORY_HOUR_VALUE; - stats_type = mateconf_client_get_string (mateconf_client, GPM_CONF_INFO_STATS_TYPE, NULL); + stats_type = g_settings_get_string (settings, GPM_SETTINGS_INFO_STATS_TYPE); if (stats_type == NULL) stats_type = GPM_STATS_CHARGE_DATA_VALUE; @@ -1821,7 +1821,7 @@ main (int argc, char *argv[]) } if (last_device == NULL) - last_device = mateconf_client_get_string (mateconf_client, GPM_CONF_INFO_LAST_DEVICE, NULL); + last_device = g_settings_get_string (settings, GPM_SETTINGS_INFO_LAST_DEVICE); /* has capability to measure wakeups */ ret = up_wakeups_get_has_capability (wakeups); @@ -1853,7 +1853,7 @@ main (int argc, char *argv[]) gtk_main (); out: - g_object_unref (mateconf_client); + g_object_unref (settings); g_object_unref (client); g_object_unref (wakeups); g_object_unref (builder); |