summaryrefslogtreecommitdiff
path: root/src/procdialogs.cpp
diff options
context:
space:
mode:
authorraveit <[email protected]>2012-11-06 18:19:51 +0100
committerraveit <[email protected]>2012-11-06 18:19:51 +0100
commitf27253b155db8d3c06bf13801c63bdc282da4157 (patch)
treee8a449764975fe5066a67c9275ea73c56a88309b /src/procdialogs.cpp
parent7caef9a314fc9f1fea996d79601d4242286825b1 (diff)
downloadmate-system-monitor-f27253b155db8d3c06bf13801c63bdc282da4157.tar.bz2
mate-system-monitor-f27253b155db8d3c06bf13801c63bdc282da4157.tar.xz
Port to gesettings
Diffstat (limited to 'src/procdialogs.cpp')
-rw-r--r--src/procdialogs.cpp63
1 files changed, 27 insertions, 36 deletions
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index c9e9dae..148692a 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -31,7 +31,7 @@
#include "procactions.h"
#include "util.h"
#include "load-graph.h"
-#include "mateconf-keys.h"
+#include "settings-keys.h"
#include "procman_matesu.h"
#include "procman_gksu.h"
@@ -262,13 +262,13 @@ static void
show_kill_dialog_toggled (GtkToggleButton *button, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfClient *client = procdata->client;
+ GSettings *settings = procdata->settings;
gboolean toggled;
toggled = gtk_toggle_button_get_active (button);
- mateconf_client_set_bool (client, "/apps/procman/kill_dialog", toggled, NULL);
+ g_settings_set_boolean (settings, "kill-dialog", toggled);
}
@@ -278,10 +278,10 @@ static void
solaris_mode_toggled(GtkToggleButton *button, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfClient *client = procdata->client;
+ GSettings *settings = procdata->settings;
gboolean toggled;
toggled = gtk_toggle_button_get_active(button);
- mateconf_client_set_bool(client, procman::mateconf::solaris_mode.c_str(), toggled, NULL);
+ g_settings_set_boolean(settings, procman::settings::solaris_mode.c_str(), toggled);
}
@@ -289,10 +289,10 @@ static void
network_in_bits_toggled(GtkToggleButton *button, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfClient *client = procdata->client;
+ GSettings *settings = procdata->settings;
gboolean toggled;
toggled = gtk_toggle_button_get_active(button);
- mateconf_client_set_bool(client, procman::mateconf::network_in_bits.c_str(), toggled, NULL);
+ g_settings_set_boolean(settings, procman::settings::network_in_bits.c_str(), toggled);
}
@@ -301,13 +301,13 @@ static void
smooth_refresh_toggled(GtkToggleButton *button, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfClient *client = procdata->client;
+ GSettings *settings = procdata->settings;
gboolean toggled;
toggled = gtk_toggle_button_get_active(button);
- mateconf_client_set_bool(client, SmoothRefresh::KEY.c_str(), toggled, NULL);
+ g_settings_set_boolean(settings, SmoothRefresh::KEY.c_str(), toggled);
}
@@ -316,21 +316,21 @@ static void
show_all_fs_toggled (GtkToggleButton *button, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfClient *client = procdata->client;
+ GSettings *settings = procdata->settings;
gboolean toggled;
toggled = gtk_toggle_button_get_active (button);
- mateconf_client_set_bool (client, "/apps/procman/show_all_fs", toggled, NULL);
+ g_settings_set_boolean (settings, "show-all-fs", toggled);
}
class SpinButtonUpdater
{
public:
- SpinButtonUpdater(const string& mateconf_key)
- : mateconf_key(mateconf_key)
+ SpinButtonUpdater(const string& key)
+ : key(key)
{ }
static gboolean callback(GtkWidget *widget, GdkEventFocus *event, gpointer data)
@@ -345,20 +345,13 @@ private:
void update(GtkSpinButton* spin)
{
int new_value = int(1000 * gtk_spin_button_get_value(spin));
- GError* e = 0;
+ g_settings_set_int(ProcData::get_instance()->settings,
+ this->key.c_str(), new_value);
- if (not mateconf_client_set_int(ProcData::get_instance()->client,
- this->mateconf_key.c_str(), new_value,
- &e)) {
- g_warning("Failed to mateconf_client_set_int %s %d : %s\n",
- this->mateconf_key.c_str(), new_value, e->message);
- g_error_free(e);
- }
-
- procman_debug("set %s to %d", this->mateconf_key.c_str(), new_value);
+ procman_debug("set %s to %d", this->key.c_str(), new_value);
}
- const string mateconf_key;
+ const string key;
};
@@ -474,9 +467,9 @@ procdialog_create_preferences_dialog (ProcData *procdata)
typedef SpinButtonUpdater SBU;
- static SBU interval_updater("/apps/procman/update_interval");
- static SBU graph_interval_updater("/apps/procman/graph_update_interval");
- static SBU disks_interval_updater("/apps/procman/disks_interval");
+ static SBU interval_updater("update_interval");
+ static SBU graph_interval_updater("graph_update_interval");
+ static SBU disks_interval_updater("disks_interval");
GtkWidget *notebook;
GtkWidget *proc_box;
@@ -575,9 +568,8 @@ procdialog_create_preferences_dialog (ProcData *procdata)
smooth_button = gtk_check_button_new_with_mnemonic(_("Enable _smooth refresh"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(smooth_button),
- mateconf_client_get_bool(procdata->client,
- SmoothRefresh::KEY.c_str(),
- NULL));
+ g_settings_get_boolean(procdata->settings,
+ SmoothRefresh::KEY.c_str()));
g_signal_connect(G_OBJECT(smooth_button), "toggled",
G_CALLBACK(smooth_refresh_toggled), procdata);
gtk_box_pack_start(GTK_BOX(hbox2), smooth_button, TRUE, TRUE, 0);
@@ -603,9 +595,8 @@ procdialog_create_preferences_dialog (ProcData *procdata)
GtkWidget *solaris_button;
solaris_button = gtk_check_button_new_with_mnemonic(_("Solaris mode"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(solaris_button),
- mateconf_client_get_bool(procdata->client,
- procman::mateconf::solaris_mode.c_str(),
- NULL));
+ g_settings_get_boolean(procdata->settings,
+ procman::settings::solaris_mode.c_str()));
g_signal_connect(G_OBJECT(solaris_button), "toggled",
G_CALLBACK(solaris_mode_toggled), procdata);
gtk_box_pack_start(GTK_BOX(hbox2), solaris_button, TRUE, TRUE, 0);
@@ -685,9 +676,9 @@ procdialog_create_preferences_dialog (ProcData *procdata)
GtkWidget *bits_button;
bits_button = gtk_check_button_new_with_mnemonic(_("Show network speed in bits"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bits_button),
- mateconf_client_get_bool(procdata->client,
- procman::mateconf::network_in_bits.c_str(),
- NULL));
+ g_settings_get_boolean(procdata->settings,
+ procman::settings::network_in_bits.c_str()));
+
g_signal_connect(G_OBJECT(bits_button), "toggled",
G_CALLBACK(network_in_bits_toggled), procdata);
gtk_box_pack_start(GTK_BOX(vbox2), bits_button, TRUE, TRUE, 0);