summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-11-06 14:22:49 -0800
committerStefano Karapetsas <[email protected]>2012-11-06 14:22:49 -0800
commit684e6bb4c072f707a92ce72d85954b5790aaab53 (patch)
treee8a449764975fe5066a67c9275ea73c56a88309b
parent7caef9a314fc9f1fea996d79601d4242286825b1 (diff)
parentf27253b155db8d3c06bf13801c63bdc282da4157 (diff)
downloadmate-system-monitor-684e6bb4c072f707a92ce72d85954b5790aaab53.tar.bz2
mate-system-monitor-684e6bb4c072f707a92ce72d85954b5790aaab53.tar.xz
Merge pull request #10 from NiceandGently/master
port to gsettings
-rw-r--r--configure.in16
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/Makefile.am35
-rw-r--r--src/callbacks.cpp22
-rw-r--r--src/disks.cpp8
-rw-r--r--src/interface.cpp5
-rw-r--r--src/mate-system-monitor.schemas.in2
-rw-r--r--src/mateconf-keys.cpp14
-rw-r--r--src/memmaps.cpp154
-rw-r--r--src/openfiles.cpp13
-rw-r--r--src/org.mate.mate-system-monitor.gschema.xml.in282
-rw-r--r--src/procdialogs.cpp63
-rw-r--r--src/procman.cpp390
-rw-r--r--src/procman.h16
-rw-r--r--src/proctable.cpp6
-rw-r--r--src/settings-keys.cpp14
-rw-r--r--src/settings-keys.h (renamed from src/mateconf-keys.h)8
-rw-r--r--src/smooth_refresh.cpp47
-rw-r--r--src/smooth_refresh.h15
19 files changed, 600 insertions, 512 deletions
diff --git a/configure.in b/configure.in
index 083a542..77f831b 100644
--- a/configure.in
+++ b/configure.in
@@ -24,21 +24,20 @@ AM_PROG_CC_STDC
AC_HEADER_STDC
MATE_COMPILE_WARNINGS
-GLIB_REQUIRED=2.16.0
-MATECONF_REQUIRED=1.1.0
+GLIB_REQUIRED=2.28.0
LIBMATEWNCK_REQUIRED=1.3.0
LIBGTOP_REQUIRED=2.23.1
GTK_REQUIRED=2.20.0
MATE_ICON_THEME_REQUIRED=1.1.0
-GTKMM_REQUIRED=2.8
-GIOMM_REQUIRED=2.16.0
-GLIBMM_REQUIRED=2.14
+GTKMM_REQUIRED=2.22
+GIOMM_REQUIRED=2.26.0
+GLIBMM_REQUIRED=2.22
LIBXML_REQUIRED=2.0
RSVG_REQUIRED=2.12
DBUS_REQUIRED=0.7
PKG_CHECK_MODULES(GMODULE,gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""])
-PKG_CHECK_MODULES(PROCMAN,$GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED mateconf-2.0 >= $MATECONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libmatewnck >= $LIBMATEWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mate-icon-theme >= $MATE_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_REQUIRED)
+PKG_CHECK_MODULES(PROCMAN,$GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libmatewnck >= $LIBMATEWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mate-icon-theme >= $MATE_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED dbus-glib-1 >= $DBUS_REQUIRED)
AC_ARG_ENABLE(more-warnings,
@@ -65,10 +64,7 @@ fi
dnl CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden $CXXFLAGS"
dnl CXXFLAGS="-fvisibility-inlines-hidden $CXXFLAGS"
-AC_PATH_PROG(MATECONFTOOL, mateconftool-2)
-
-AM_MATECONF_SOURCE_2
-
+GLIB_GSETTINGS
GETTEXT_PACKAGE=mate-system-monitor
AC_SUBST(GETTEXT_PACKAGE)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9a77a92..65e425e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,13 +8,13 @@ src/callbacks.cpp
src/defaulttable.h
src/disks.cpp
src/e_date.c
-src/mate-system-monitor.schemas.in
src/gsm_color_button.c
src/interface.cpp
src/load-graph.cpp
src/lsof.cpp
src/memmaps.cpp
src/openfiles.cpp
+src/org.mate.mate-system-monitor.xml.in
src/procactions.cpp
src/procdialogs.cpp
src/procman.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index fb22e4b..6d982b0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,10 +30,10 @@ mate_system_monitor_SOURCES = \
sysinfo.cpp sysinfo.h \
lsof.cpp lsof.h \
selection.cpp selection.h \
- mateconf-keys.cpp mateconf-keys.h \
+ settings-keys.cpp settings-keys.h \
iconthemewrapper.cpp iconthemewrapper.h \
e_date.c e_date.h \
- gsm_color_button.c gsm_color_button.h
+ gsm_color_button.c gsm_color_button.h
mate_system_monitor_LDADD = @PROCMAN_LIBS@ libbacon.la
@@ -47,25 +47,20 @@ libbacon_la_SOURCES = \
specdir = $(datadir)/procman
-schemadir = $(MATECONF_SCHEMA_FILE_DIR)
-schema_ins = mate-system-monitor.schemas.in
-schema_DATA = $(schema_ins:.schemas.in=.schemas)
-@INTLTOOL_SCHEMAS_RULE@
-EXTRA_DIST = \
- $(schema_ins)
+# GSettings schemas, enum files and conversion file
+gsettings_ENUM_NAMESPACE = org.mate.mate-system-monitor
+gsettings_ENUM_FILES = $(top_srcdir)/src/*.h
+gsettingsschemadir = $(datadir)/glib-2.0/schemas
+gsettings_in_file = org.mate.mate-system-monitor.gschema.xml.in
+gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
+@INTLTOOL_XML_NOMERGE_RULE@
+@GSETTINGS_RULES@
+
+dist_noinst_DATA = \
+ $(gsettings_in_file)
CLEANFILES = \
- $(schema_DATA)
+ $(gsettings_SCHEMAS)
-if MATECONF_SCHEMAS_INSTALL
-install-data-local:
- if test -z "$(DESTDIR)"; then \
- for p in $(schema_DATA); do \
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) \
- ${MATECONFTOOL} --makefile-install-rule $(top_builddir)/src/$$p; \
- done; \
- fi
-else
-install-data-local:
-endif
+MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
diff --git a/src/callbacks.cpp b/src/callbacks.cpp
index 36d5a81..192e939 100644
--- a/src/callbacks.cpp
+++ b/src/callbacks.cpp
@@ -218,7 +218,7 @@ cb_end_process_button_pressed (GtkButton *button, gpointer data)
}
-static void change_mateconf_color(MateConfClient *client, const char *key,
+static void change_settings_color(GSettings *settings, const char *key,
GSMColorButton *cp)
{
GdkColor c;
@@ -226,7 +226,7 @@ static void change_mateconf_color(MateConfClient *client, const char *key,
gsm_color_button_get_color(cp, &c);
g_snprintf(color, sizeof color, "#%04x%04x%04x", c.red, c.green, c.blue);
- mateconf_client_set_string (client, key, color, NULL);
+ g_settings_set_string (settings, key, color);
}
@@ -235,18 +235,18 @@ cb_cpu_color_changed (GSMColorButton *cp, gpointer data)
{
char key[80];
gint i = GPOINTER_TO_INT (data);
- MateConfClient *client = mateconf_client_get_default ();
+ GSettings *settings = g_settings_new (GSM_GSETTINGS_SCHEMA);
- g_snprintf(key, sizeof key, "/apps/procman/cpu_color%d", i);
+ g_snprintf(key, sizeof key, "cpu-color%d", i);
- change_mateconf_color(client, key, cp);
+ change_settings_color(settings, key, cp);
}
void
cb_mem_color_changed (GSMColorButton *cp, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- change_mateconf_color(procdata->client, "/apps/procman/mem_color", cp);
+ change_settings_color(procdata->settings, "mem-color", cp);
}
@@ -254,21 +254,21 @@ void
cb_swap_color_changed (GSMColorButton *cp, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- change_mateconf_color(procdata->client, "/apps/procman/swap_color", cp);
+ change_settings_color(procdata->settings, "swap-color", cp);
}
void
cb_net_in_color_changed (GSMColorButton *cp, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- change_mateconf_color(procdata->client, "/apps/procman/net_in_color", cp);
+ change_settings_color(procdata->settings, "net-in-color", cp);
}
void
cb_net_out_color_changed (GSMColorButton *cp, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- change_mateconf_color(procdata->client, "/apps/procman/net_out_color", cp);
+ change_settings_color(procdata->settings, "net-out-color", cp);
}
static void
@@ -432,6 +432,6 @@ cb_radio_processes(GtkAction *action, GtkRadioAction *current, gpointer data)
procdata->config.whose_process = gtk_radio_action_get_current_value(current);
- mateconf_client_set_int (procdata->client, "/apps/procman/view_as",
- procdata->config.whose_process, NULL);
+ g_settings_set_int (procdata->settings, "view_as",
+ procdata->config.whose_process);
}
diff --git a/src/disks.cpp b/src/disks.cpp
index c694c0a..97ac949 100644
--- a/src/disks.cpp
+++ b/src/disks.cpp
@@ -245,9 +245,9 @@ cb_disk_columns_changed(GtkTreeView *treeview, gpointer user_data)
{
ProcData * const procdata = static_cast<ProcData*>(user_data);
- procman_save_tree_state(procdata->client,
+ procman_save_tree_state(procdata->settings,
GTK_WIDGET(treeview),
- "/apps/procman/disktreenew");
+ "disktreenew");
}
@@ -411,8 +411,8 @@ create_disk_view(ProcData *procdata)
gtk_widget_show_all(disk_box);
- procman_get_tree_state(procdata->client, disk_tree,
- "/apps/procman/disktreenew");
+ procman_get_tree_state(procdata->settings, disk_tree,
+ "disktreenew");
g_signal_connect (G_OBJECT(disk_tree), "columns-changed",
G_CALLBACK(cb_disk_columns_changed), procdata);
diff --git a/src/interface.cpp b/src/interface.cpp
index 96a4c90..b12301b 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -797,12 +797,13 @@ static void
cb_toggle_tree (GtkAction *action, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfClient *client = procdata->client;
+ GSettings *settings = procdata->settings;
gboolean show;
show = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (show == procdata->config.show_tree)
return;
- mateconf_client_set_bool (client, "/apps/procman/show_tree", show, NULL);
+ g_settings_set_boolean (settings, "show-tree", show);
}
+
diff --git a/src/mate-system-monitor.schemas.in b/src/mate-system-monitor.schemas.in
index 34bb102..7c75751 100644
--- a/src/mate-system-monitor.schemas.in
+++ b/src/mate-system-monitor.schemas.in
@@ -260,6 +260,7 @@
<owner>procman</owner>
<type>list</type>
<list_type>int</list_type>
+ <default>[0]</default>
<locale name="C">
<short>Process view columns order</short>
<long></long>
@@ -734,6 +735,7 @@
<owner>procman</owner>
<type>list</type>
<list_type>int</list_type>
+ <default>[0]</default>
<locale name="C">
<short>Disk view columns order</short>
<long></long>
diff --git a/src/mateconf-keys.cpp b/src/mateconf-keys.cpp
deleted file mode 100644
index 8fbb379..0000000
--- a/src/mateconf-keys.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "mateconf-keys.h"
-
-
-namespace procman
-{
- namespace mateconf
- {
- const std::string root("/apps/procman");
- const std::string solaris_mode(root + "/solaris_mode");
- const std::string open_files_tree_prefix(root + "/openfilestree");
- const std::string network_in_bits(root + "/network_in_bits");
- }
-}
-
diff --git a/src/memmaps.cpp b/src/memmaps.cpp
index de32ce0..b1c0615 100644
--- a/src/memmaps.cpp
+++ b/src/memmaps.cpp
@@ -89,144 +89,6 @@ namespace
};
- void
- procman_save_tree_state2(MateConfClient *client, GtkWidget *tree, const gchar *cprefix)
- {
- const string prefix(cprefix);
-
- GtkTreeModel *model;
- gint sort_col;
- GtkSortType order;
-
- g_assert(tree);
- g_assert(prefix != "");
-
- model = gtk_tree_view_get_model(GTK_TREE_VIEW (tree));
-
- if (gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(model), &sort_col, &order)) {
- mateconf_client_set_int(client, (prefix + "/sort_col").c_str(), sort_col, 0);
- mateconf_client_set_int(client, (prefix + "/sort_order").c_str(), order, 0);
- }
-
- GList * const columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(tree));
-
- GSList *list = 0;
-
- for (GList *it = columns; it; it = it->next)
- {
- GtkTreeViewColumn *column;
- ColumnState cs;
-
- column = static_cast<GtkTreeViewColumn*>(it->data);
- cs.id = gtk_tree_view_column_get_sort_column_id(column);
- cs.visible = gtk_tree_view_column_get_visible(column);
- cs.width = gtk_tree_view_column_get_width(column);
-
- list = g_slist_append(list, GINT_TO_POINTER(cs.pack()));
- }
-
- g_list_free(columns);
-
- GError *error = 0;
-
- if (not mateconf_client_set_list(client, (prefix + "/columns").c_str(),
- MATECONF_VALUE_INT, list,
- &error)) {
- g_critical("Failed to save tree state %s : %s",
- prefix.c_str(),
- error->message);
- g_error_free(error);
- }
-
- g_slist_free(list);
- }
-
-
- gboolean procman_get_tree_state2(MateConfClient *client, GtkWidget *tree, const gchar *cprefix)
- {
- const string prefix(cprefix);
- GtkTreeModel *model;
-
- gint sort_col;
- GtkSortType order;
-
- g_assert(tree);
- g_assert(prefix != "");
-
- if (!mateconf_client_dir_exists(client, prefix.c_str(), 0))
- return FALSE;
-
- model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
-
- sort_col = mateconf_client_get_int(client, (prefix + "/sort_col").c_str(), 0);
- sort_order = mateconf_client_get_int(client, (prefix + "/sort_order").c_str(), 0);
-
- if (sort_col != -1)
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), sort_col, order);
-
- proctable_set_columns_order(GTK_TREE_VIEW(tree), order);
-
- GSlist *list = mateconf_client_get_list(client, (prefix + "/columns").c_str(),
- MATECONF_VALUE_INT, 0);
-
-
- for (GSList *it = list; it; it = it->next) {
- ColumnState cs;
- cs.unpack(GPOINTER_TO_INT(it->data));
-
- GtkTreeViewColumn *column;
- column = gtk_tree_view_get_column(GTK_TREE_VIEW(tree), cs.id);
-
- if (!column)
- continue;
-
- gtk_tree_view_column_set_visible(column, cs.visible);
- if (cs.visible)
- gtk_tree_view_column_set_fixed_width(column, MAX(10, cs.width));
- }
-
- g_slist_free(list);
-
-
- GList * const columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(tree));
-
- for (GList * it = columns; it; it = it->next)
- {
- GtkTreeViewColumn *column = static_cast<GtkTreeViewColumn*>(it->data);
- unsigned id = gtk_tree_view_column_get_sort_column_id(column);
-
- ColumnState &cs(states[id]);
-
-
-
- key = g_strdup_printf("%s/col_%d_width", prefix, id);
- value = mateconf_client_get (client, key, NULL);
- g_free (key);
-
- if (value != NULL) {
- width = mateconf_value_get_int(value);
- mateconf_value_free (value);
-
- key = g_strdup_printf ("%s/col_%d_visible", prefix, id);
- visible = mateconf_client_get_bool (client, key, NULL);
- g_free (key);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), id);
- if(!column) continue;
- gtk_tree_view_column_set_visible (column, visible);
- if (visible) {
- /* ensure column is really visible */
- width = MAX(width, 10);
- gtk_tree_view_column_set_fixed_width(column, width);
- }
- }
- }
-
- g_list_free(columns);
-
- return TRUE;
- }
-
#endif
@@ -294,23 +156,23 @@ namespace
public:
guint timer;
GtkWidget *tree;
- MateConfClient *client;
+ GSettings *settings;
ProcInfo *info;
OffsetFormater format;
mutable InodeDevices devices;
- const char * const key;
+ const char * const schema;
- MemMapsData(GtkWidget *a_tree, MateConfClient *a_client)
+ MemMapsData(GtkWidget *a_tree, GSettings *a_settings)
: tree(a_tree),
- client(a_client),
- key("/apps/procman/memmapstree2")
+ settings(a_settings),
+ schema("memmapstree")
{
- procman_get_tree_state(this->client, this->tree, this->key);
+ procman_get_tree_state(this->settings, this->tree, this->schema);
}
~MemMapsData()
{
- procman_save_tree_state(this->client, this->tree, this->key);
+ procman_save_tree_state(this->settings, this->tree, this->schema);
}
};
}
@@ -562,7 +424,7 @@ create_memmapsdata (ProcData *procdata)
}
}
- return new MemMapsData(tree, procdata->client);
+ return new MemMapsData(tree, procdata->settings);
}
diff --git a/src/openfiles.cpp b/src/openfiles.cpp
index de3e864..7bce479 100644
--- a/src/openfiles.cpp
+++ b/src/openfiles.cpp
@@ -13,7 +13,7 @@
#include "openfiles.h"
#include "proctable.h"
#include "util.h"
-#include "mateconf-keys.h"
+#include "settings-keys.h"
enum
{
@@ -215,11 +215,11 @@ static void
close_openfiles_dialog (GtkDialog *dialog, gint id, gpointer data)
{
GtkWidget *tree = static_cast<GtkWidget*>(data);
- MateConfClient *client;
+ GSettings *settings;
guint timer;
- client = static_cast<MateConfClient*>(g_object_get_data (G_OBJECT (tree), "client"));
- procman_save_tree_state (client, tree, procman::mateconf::open_files_tree_prefix.c_str());
+ settings = static_cast<GSettings*>(g_object_get_data (G_OBJECT (tree), "settings"));
+ procman_save_tree_state (settings, tree, procman::settings::open_files_tree_prefix.c_str());
timer = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (tree), "timer"));
g_source_remove (timer);
@@ -288,7 +288,8 @@ create_openfiles_tree (ProcData *procdata)
GTK_SORT_ASCENDING);*/
#endif
- procman_get_tree_state (procdata->client, tree, procman::mateconf::open_files_tree_prefix.c_str());
+ procman_get_tree_state (procdata->settings, tree, procman::settings::open_files_tree_prefix.c_str());
+
return tree;
@@ -368,7 +369,7 @@ create_single_openfiles_dialog (GtkTreeModel *model, GtkTreePath *path,
tree = create_openfiles_tree (procdata);
gtk_container_add (GTK_CONTAINER (scrolled), tree);
g_object_set_data (G_OBJECT (tree), "selected_info", info);
- g_object_set_data (G_OBJECT (tree), "client", procdata->client);
+ g_object_set_data (G_OBJECT (tree), "settings", procdata->settings);
gtk_box_pack_start (GTK_BOX (dialog_vbox), scrolled, TRUE, TRUE, 0);
gtk_widget_show_all (scrolled);
diff --git a/src/org.mate.mate-system-monitor.gschema.xml.in b/src/org.mate.mate-system-monitor.gschema.xml.in
new file mode 100644
index 0000000..5edbb85
--- /dev/null
+++ b/src/org.mate.mate-system-monitor.gschema.xml.in
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.mate-system-monitor" path="/org/mate/mate-system-monitor/">
+ <key name="width" type="i">
+ <default>440</default>
+ <summary>Main Window width</summary>
+ </key>
+ <key name="height" type="i">
+ <default>495</default>
+ <summary>Main Window height</summary>
+ </key>
+ <key name="show-tree" type="b">
+ <default>false</default>
+ <summary>Show process dependencies in tree form</summary>
+ </key>
+ <key name="solaris-mode" type="b">
+ <default>false</default>
+ <summary>Solaris mode for CPU percentage</summary>
+ <description>If TRUE, system-monitor operates in 'Solaris mode' where a task's cpu usage is divided by the total number of CPUs. Else it operates in 'Irix mode'.</description>
+ </key>
+ <key name="smooth-refresh" type="b">
+ <default>true</default>
+ <summary>Enable/Disable smooth refresh</summary>
+ </key>
+ <key name="kill-dialog" type="b">
+ <default>true</default>
+ <summary>Show warning dialog when killing processes</summary>
+ </key>
+ <key name="update-interval" type="i">
+ <default>3000</default>
+ <summary>Time in milliseconds between updates of the process view</summary>
+ </key>
+ <key name="graph-update-interval" type="i">
+ <default>1000</default>
+ <summary>Time in milliseconds between updates of the graphs</summary>
+ </key>
+ <key name="show-all-fs" type="b">
+ <default>false</default>
+ <summary>Whether information about all filesystems should be displayed</summary>
+ <description>Whether to display information about all filesystems (including types like 'autofs' and 'procfs'). Useful for getting a list of all currently mounted filesystems.</description>
+ </key>
+ <key name="disks-interval" type="i">
+ <default>5000</default>
+ <summary>Time in milliseconds between updates of the devices list</summary>
+ </key>
+ <key name="view-as" type="i">
+ <default>1</default>
+ <summary>Determines which processes to show by default. 0 is All, 1 is user, and 2 is active</summary>
+ </key>
+ <key name="current-tab" type="i">
+ <default>2</default>
+ <summary>Saves the currently viewed tab</summary>
+ <description>0 for the System Info, 1 for the processes list, 2 for the resources and 3 for the disks list</description>
+ </key>
+ <key name="cpu-color0" type="s">
+ <default>'#FF6E00'</default>
+ <summary>Default graph cpu color</summary>
+ </key>
+ <key name="cpu-color1" type="s">
+ <default>'#CB0C29'</default>
+ <summary>Default graph cpu color</summary>
+ </key>
+ <key name="cpu-color2" type="s">
+ <default>'#49A835'</default>
+ <summary>Default graph cpu color</summary>
+ </key>
+ <key name="cpu-color3" type="s">
+ <default>'#2D7DB3'</default>
+ <summary>Default graph cpu color</summary>
+ </key>
+ <key name="mem-color" type="s">
+ <default>'#AB1852'</default>
+ <summary>Default graph mem color</summary>
+ </key>
+ <key name="swap-color" type="s">
+ <default>'#49A835'</default>
+ <summary>Default graph swap color</summary>
+ </key>
+ <key name="net-in-color" type="s">
+ <default>'#2D7DB3'</default>
+ <summary>Default graph incoming network traffic color</summary>
+ </key>
+ <key name="net-out-color" type="s">
+ <default>'#844798'</default>
+ <summary>Default graph outgoing network traffic color</summary>
+ </key>
+ <key name="network-in-bits" type="b">
+ <default>false
+ </default>
+ <_summary>Show network traffic in bits
+ </_summary>
+ </key>
+ <child name="proctree" schema="org.mate.mate-system-monitor.proctree"/>
+ <child name="disktreenew" schema="org.mate.mate-system-monitor.disktreenew"/>
+ <child name="memmapstree" schema="org.mate.mate-system-monitor.memmapstree"/>
+ <child name="openfilestree" schema="org.mate.mate-system-monitor.openfilestree" />
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.mate-system-monitor.proctree" path="/org/mate/mate-system-monitor/proctree/">
+ <key name="sort-col" type="i">
+ <default>0</default>
+ <summary>Process view sort column</summary>
+ </key>
+ <key name="columns-order" type="ai">
+ <default>[ 0 ]</default>
+ <summary>Process view columns order</summary>
+ </key>
+ <key name="sort-order" type="i">
+ <default>0</default>
+ <summary>Process view sort order</summary>
+ </key>
+ <key name="col-0-width" type="i">
+ <default>198</default>
+ <summary>Width of process 'name' column</summary>
+ </key>
+ <key name="col-0-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'name' column on startup</summary>
+ </key>
+ <key name="col-1-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'owner' column</summary>
+ </key>
+ <key name="col-1-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'owner' column on startup</summary>
+ </key>
+ <key name="col-2-width" type="i">
+ <default>37</default>
+ <summary>Width of process 'status' column</summary>
+ </key>
+ <key name="col-2-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'status' column on startup</summary>
+ </key>
+ <key name="col-3-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'virtual memory' column</summary>
+ </key>
+ <key name="col-3-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'virtual memory' column on startup</summary>
+ </key>
+ <key name="col-4-width" type="i">
+ <default>53</default>
+ <summary>Width of process 'resident memory' column</summary>
+ </key>
+ <key name="col-4-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'resident memory' column on startup</summary>
+ </key>
+ <key name="col-5-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'writable memory' column</summary>
+ </key>
+ <key name="col-5-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'writable memory' column on startup</summary>
+ </key>
+ <key name="col-6-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'shared memory' column</summary>
+ </key>
+ <key name="col-6-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'shared memory' column on startup</summary>
+ </key>
+ <key name="col-7-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'X server memory' column</summary>
+ </key>
+ <key name="col-7-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'X server memory' column on startup</summary>
+ </key>
+ <key name="col-8-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'CPU %' column</summary>
+ </key>
+ <key name="col-8-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'CPU %' column on startup</summary>
+ </key>
+ <key name="col-9-width" type="i">
+ <default>50</default>
+ <summary>Width of process 'CPU time' column</summary>
+ </key>
+ <key name="col-9-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'CPU time' column on startup</summary>
+ </key>
+ <key name="col-10-width" type="i">
+ <default>0</default>
+ <summary>Width of process 'start time' column</summary>
+ </key>
+ <key name="col-10-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'start time' column on startup</summary>
+ </key>
+ <key name="col-11-width" type="i">
+ <default>48</default>
+ <summary>Width of process 'nice' column</summary>
+ </key>
+ <key name="col-11-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'nice' column on startup</summary>
+ </key>
+ <key name="col-12-width" type="i">
+ <default>48</default>
+ <summary>Width of process 'PID' column</summary>
+ </key>
+ <key name="col-12-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'PID' column on startup</summary>
+ </key>
+ <key name="col-13-width" type="i">
+ <default>48</default>
+ <summary>Width of process 'SELinux security context' column</summary>
+ </key>
+ <key name="col-13-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'SELinux security context' column on startup</summary>
+ </key>
+ <key name="col-14-width" type="i">
+ <default>48</default>
+ <summary>Width of process 'arguments' column</summary>
+ </key>
+ <key name="col-14-visible" type="b">
+ <default>false</default>
+ <summary>Show process 'arguments' column on startup</summary>
+ </key>
+ <key name="col-15-width" type="i">
+ <default>48</default>
+ <summary>Width of process 'estimated memory usage' column</summary>
+ </key>
+ <key name="col-15-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'estimated memory usage' column on startup</summary>
+ </key>
+ <key name="col-16-width" type="i">
+ <default>48</default>
+ <summary>Width of process 'Waiting Channel' column</summary>
+ </key>
+ <key name="col-16-visible" type="b">
+ <default>true</default>
+ <summary>Show process 'Waiting Channel' column on startup</summary>
+ </key>
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.mate-system-monitor.disktreenew" path="/org/mate/mate-system-monitor/disktreenew/">
+ <key name="sort-col" type="i">
+ <default>1</default>
+ <summary>Process view sort column</summary>
+ </key>
+ <key name="sort-order" type="i">
+ <default>0</default>
+ <summary>Process view sort order</summary>
+ </key>
+ <key name="columns-order" type="ai">
+ <default>[ 0 ]</default>
+ <summary>Disk view columns order</summary>
+ </key>
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.mate-system-monitor.memmapstree" path="/org/mate/mate-system-monitor/memmapstree/">
+ <key name="sort-col" type="i">
+ <default>0</default>
+ <summary>Process view sort column</summary>
+ </key>
+ <key name="sort-order" type="i">
+ <default>0</default>
+ <summary>Process view sort order</summary>
+ </key>
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.mate-system-monitor.openfilestree" path="/org/mate/mate-system-monitor/openfilestree/">
+ <key name="sort-col" type="i">
+ <default>0</default>
+ <_summary>Process view sort column</_summary>
+ </key>
+ <key name="sort-order" type="i">
+ <default>0</default>
+ <_summary>Process view sort order</_summary>
+ </key>
+ </schema>
+</schemalist>
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);
diff --git a/src/procman.cpp b/src/procman.cpp
index e5b0099..9c683ef 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -31,7 +31,6 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <bacon-message-connection.h>
-#include <mateconf/mateconf-client.h>
#include <glibtop.h>
#include <glibtop/close.h>
#include <glibtop/loadavg.h>
@@ -44,7 +43,7 @@
#include "callbacks.h"
#include "smooth_refresh.h"
#include "util.h"
-#include "mateconf-keys.h"
+#include "settings-keys.h"
#include "argv.h"
@@ -69,12 +68,10 @@ ProcData* ProcData::get_instance()
static void
-tree_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+tree_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfValue *value = mateconf_entry_get_value (entry);
-
- procdata->config.show_tree = mateconf_value_get_bool (value);
+ procdata->config.show_tree = g_settings_get_boolean(settings, key);
g_object_set(G_OBJECT(procdata->tree),
"show-expanders", procdata->config.show_tree,
@@ -86,36 +83,32 @@ tree_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointe
}
static void
-solaris_mode_changed_cb(MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+solaris_mode_changed_cb(GSettings *settings, const gchar *key, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfValue *value = mateconf_entry_get_value (entry);
- procdata->config.solaris_mode = mateconf_value_get_bool(value);
+ procdata->config.solaris_mode = g_settings_get_boolean(settings, key);
proctable_update_all (procdata);
}
static void
-network_in_bits_changed_cb(MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+network_in_bits_changed_cb(GSettings *settings, const gchar *key, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfValue *value = mateconf_entry_get_value (entry);
- procdata->config.network_in_bits = mateconf_value_get_bool(value);
- // force scale to be redrawn
+ procdata->config.network_in_bits = g_settings_get_boolean(settings, key);
procdata->net_graph->clear_background();
}
static void
-view_as_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+view_as_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- MateConfValue *value = mateconf_entry_get_value (entry);
- procdata->config.whose_process = mateconf_value_get_int (value);
+ procdata->config.whose_process = g_settings_get_int (settings, key);
procdata->config.whose_process = CLAMP (procdata->config.whose_process, 0, 2);
proctable_clear_tree (procdata);
proctable_update_all (procdata);
@@ -123,26 +116,20 @@ view_as_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpoi
}
static void
-warning_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+warning_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- const gchar *key = mateconf_entry_get_key (entry);
- MateConfValue *value = mateconf_entry_get_value (entry);
-
- if (g_str_equal (key, "/apps/procman/kill_dialog")) {
- procdata->config.show_kill_warning = mateconf_value_get_bool (value);
+ if (g_str_equal (key, "kill-dialog")) {
+ procdata->config.show_kill_warning = g_settings_get_boolean (settings, key);
}
}
static void
-timeouts_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+timeouts_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData *procdata = static_cast<ProcData*>(data);
- const gchar *key = mateconf_entry_get_key (entry);
- MateConfValue *value = mateconf_entry_get_value (entry);
-
- if (g_str_equal (key, "/apps/procman/update_interval")) {
- procdata->config.update_interval = mateconf_value_get_int (value);
+ if (g_str_equal (key, "update-interval")) {
+ procdata->config.update_interval = g_settings_get_int (settings, key);
procdata->config.update_interval =
MAX (procdata->config.update_interval, 1000);
@@ -155,8 +142,8 @@ timeouts_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpo
procdata);
}
}
- else if (g_str_equal (key, "/apps/procman/graph_update_interval")){
- procdata->config.graph_update_interval = mateconf_value_get_int (value);
+ else if (g_str_equal (key, "graph-update-interval")){
+ procdata->config.graph_update_interval = g_settings_get_int (settings, key);
procdata->config.graph_update_interval =
MAX (procdata->config.graph_update_interval,
250);
@@ -167,9 +154,9 @@ timeouts_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpo
load_graph_change_speed(procdata->net_graph,
procdata->config.graph_update_interval);
}
- else if (g_str_equal(key, "/apps/procman/disks_interval")) {
+ else if (g_str_equal(key, "disks-interval")) {
- procdata->config.disks_update_interval = mateconf_value_get_int (value);
+ procdata->config.disks_update_interval = g_settings_get_int (settings, key);
procdata->config.disks_update_interval =
MAX (procdata->config.disks_update_interval, 1000);
@@ -187,16 +174,14 @@ timeouts_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpo
}
static void
-color_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- const gchar *key = mateconf_entry_get_key (entry);
- MateConfValue *value = mateconf_entry_get_value (entry);
- const gchar *color = mateconf_value_get_string (value);
+ const gchar *color = g_settings_get_string (settings, key);
- if (g_str_has_prefix (key, "/apps/procman/cpu_color")) {
- for (int i = 0; i < GLIBTOP_NCPU; i++) {
- string cpu_key = make_string(g_strdup_printf("/apps/procman/cpu_color%d", i));
+ if (g_str_has_prefix (key, "cpu-color")) {
+ for (int i = 0; i < procdata->config.num_cpus; i++) {
+ string cpu_key = make_string(g_strdup_printf("cpu-color%d", i));
if (cpu_key == key) {
gdk_color_parse (color, &procdata->config.cpu_color[i]);
procdata->cpu_graph->colors.at(i) = procdata->config.cpu_color[i];
@@ -204,19 +189,19 @@ color_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpoint
}
}
}
- else if (g_str_equal (key, "/apps/procman/mem_color")) {
+ else if (g_str_equal (key, "mem-color")) {
gdk_color_parse (color, &procdata->config.mem_color);
procdata->mem_graph->colors.at(0) = procdata->config.mem_color;
}
- else if (g_str_equal (key, "/apps/procman/swap_color")) {
+ else if (g_str_equal (key, "swap-color")) {
gdk_color_parse (color, &procdata->config.swap_color);
procdata->mem_graph->colors.at(1) = procdata->config.swap_color;
}
- else if (g_str_equal (key, "/apps/procman/net_in_color")) {
+ else if (g_str_equal (key, "net-in-color")) {
gdk_color_parse (color, &procdata->config.net_in_color);
procdata->net_graph->colors.at(0) = procdata->config.net_in_color;
}
- else if (g_str_equal (key, "/apps/procman/net_out_color")) {
+ else if (g_str_equal (key, "net-out-color")) {
gdk_color_parse (color, &procdata->config.net_out_color);
procdata->net_graph->colors.at(1) = procdata->config.net_out_color;
}
@@ -228,19 +213,18 @@ color_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpoint
static void
-show_all_fs_changed_cb (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
+show_all_fs_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
ProcData * const procdata = static_cast<ProcData*>(data);
- MateConfValue *value = mateconf_entry_get_value (entry);
- procdata->config.show_all_fs = mateconf_value_get_bool (value);
+ procdata->config.show_all_fs = g_settings_get_boolean (settings, key);
cb_update_disks (data);
}
static ProcData *
-procman_data_new (MateConfClient *client)
+procman_data_new (GSettings *settings)
{
ProcData *pd;
@@ -251,96 +235,96 @@ procman_data_new (MateConfClient *client)
pd = ProcData::get_instance();
- pd->config.width = mateconf_client_get_int (client, "/apps/procman/width", NULL);
- pd->config.height = mateconf_client_get_int (client, "/apps/procman/height", NULL);
- pd->config.show_tree = mateconf_client_get_bool (client, "/apps/procman/show_tree", NULL);
- mateconf_client_notify_add (client, "/apps/procman/show_tree", tree_changed_cb,
- pd, NULL, NULL);
-
- pd->config.solaris_mode = mateconf_client_get_bool(client, procman::mateconf::solaris_mode.c_str(), NULL);
- mateconf_client_notify_add(client, procman::mateconf::solaris_mode.c_str(), solaris_mode_changed_cb, pd, NULL, NULL);
-
- pd->config.network_in_bits = mateconf_client_get_bool(client, procman::mateconf::network_in_bits.c_str(), NULL);
- mateconf_client_notify_add(client, procman::mateconf::network_in_bits.c_str(), network_in_bits_changed_cb, pd, NULL, NULL);
-
-
- pd->config.show_kill_warning = mateconf_client_get_bool (client, "/apps/procman/kill_dialog",
- NULL);
- mateconf_client_notify_add (client, "/apps/procman/kill_dialog", warning_changed_cb,
- pd, NULL, NULL);
- pd->config.update_interval = mateconf_client_get_int (client, "/apps/procman/update_interval",
- NULL);
- mateconf_client_notify_add (client, "/apps/procman/update_interval", timeouts_changed_cb,
- pd, NULL, NULL);
- pd->config.graph_update_interval = mateconf_client_get_int (client,
- "/apps/procman/graph_update_interval",
- NULL);
- mateconf_client_notify_add (client, "/apps/procman/graph_update_interval", timeouts_changed_cb,
- pd, NULL, NULL);
- pd->config.disks_update_interval = mateconf_client_get_int (client,
- "/apps/procman/disks_interval",
- NULL);
- mateconf_client_notify_add (client, "/apps/procman/disks_interval", timeouts_changed_cb,
- pd, NULL, NULL);
-
-
- /* /apps/procman/show_all_fs */
- pd->config.show_all_fs = mateconf_client_get_bool (
- client, "/apps/procman/show_all_fs",
- NULL);
- mateconf_client_notify_add
- (client, "/apps/procman/show_all_fs",
- show_all_fs_changed_cb, pd, NULL, NULL);
-
-
- pd->config.whose_process = mateconf_client_get_int (client, "/apps/procman/view_as", NULL);
- mateconf_client_notify_add (client, "/apps/procman/view_as", view_as_changed_cb,
- pd, NULL, NULL);
- pd->config.current_tab = mateconf_client_get_int (client, "/apps/procman/current_tab", NULL);
-
- for (int i = 0; i < GLIBTOP_NCPU; i++) {
+ pd->config.width = g_settings_get_int (settings, "width");
+ pd->config.height = g_settings_get_int (settings, "height");
+ pd->config.show_tree = g_settings_get_boolean (settings, "show-tree");
+ g_signal_connect (G_OBJECT(settings), "changed::show-tree", G_CALLBACK(tree_changed_cb), pd);
+
+ pd->config.solaris_mode = g_settings_get_boolean(settings, procman::settings::solaris_mode.c_str());
+ std::string detail_string("changed::" + procman::settings::solaris_mode);
+ g_signal_connect(G_OBJECT(settings), detail_string.c_str(), G_CALLBACK(solaris_mode_changed_cb), pd);
+
+ pd->config.network_in_bits = g_settings_get_boolean(settings, procman::settings::network_in_bits.c_str());
+ detail_string = "changed::" + procman::settings::network_in_bits;
+ g_signal_connect(G_OBJECT(settings), detail_string.c_str(), G_CALLBACK(network_in_bits_changed_cb), pd);
+
+ pd->config.show_kill_warning = g_settings_get_boolean (settings, "kill-dialog");
+ g_signal_connect (G_OBJECT(settings), "changed::kill-dialog", G_CALLBACK(warning_changed_cb), pd);
+ pd->config.update_interval = g_settings_get_int (settings, "update-interval");
+ g_signal_connect (G_OBJECT(settings), "changed::update-interval", G_CALLBACK(timeouts_changed_cb), pd);
+ pd->config.graph_update_interval = g_settings_get_int (settings,
+ "graph-update-interval");
+ g_signal_connect (G_OBJECT(settings), "changed::graph-update-interval",
+ G_CALLBACK(timeouts_changed_cb), pd);
+ pd->config.disks_update_interval = g_settings_get_int (settings, "disks-interval");
+ g_signal_connect (G_OBJECT(settings), "changed::disks-interval", G_CALLBACK(timeouts_changed_cb), pd);
+
+
+ /* show_all_fs */
+ pd->config.show_all_fs = g_settings_get_boolean (settings, "show-all-fs");
+ g_signal_connect (settings, "changed::show-all-fs", G_CALLBACK(show_all_fs_changed_cb), pd);
+
+
+ pd->config.whose_process = g_settings_get_int (settings, "view-as");
+ g_signal_connect (G_OBJECT(settings), "changed::view-as", G_CALLBACK(view_as_changed_cb),pd);
+ pd->config.current_tab = g_settings_get_int (settings, "current-tab");
+
+ /* Determinie number of cpus since libgtop doesn't really tell you*/
+ pd->config.num_cpus = 0;
+ glibtop_get_cpu (&cpu);
+ pd->frequency = cpu.frequency;
+ i=0;
+ while (i < GLIBTOP_NCPU && cpu.xcpu_total[i] != 0) {
+ pd->config.num_cpus ++;
+ i++;
+ }
+ if (pd->config.num_cpus == 0)
+ pd->config.num_cpus = 1;
+
+ for (int i = 0; i < pd->config.num_cpus; i++) {
gchar *key;
- key = g_strdup_printf ("/apps/procman/cpu_color%d", i);
+ key = g_strdup_printf ("cpu-color%d", i);
- color = mateconf_client_get_string (client, key, NULL);
+ color = g_settings_get_string (settings, key);
if (!color)
color = g_strdup ("#f25915e815e8");
- mateconf_client_notify_add (client, key,
- color_changed_cb, pd, NULL, NULL);
+ detail_string = std::string("changed::") + std::string(key);
+ g_signal_connect (G_OBJECT(settings), detail_string.c_str(),
+ G_CALLBACK(color_changed_cb), pd);
gdk_color_parse(color, &pd->config.cpu_color[i]);
g_free (color);
g_free (key);
}
- color = mateconf_client_get_string (client, "/apps/procman/mem_color", NULL);
+ color = g_settings_get_string (settings, "mem-color");
if (!color)
color = g_strdup ("#000000ff0082");
- mateconf_client_notify_add (client, "/apps/procman/mem_color",
- color_changed_cb, pd, NULL, NULL);
+ g_signal_connect (G_OBJECT(settings), "changed::mem-color",
+ G_CALLBACK(color_changed_cb), pd);
gdk_color_parse(color, &pd->config.mem_color);
g_free (color);
- color = mateconf_client_get_string (client, "/apps/procman/swap_color", NULL);
+ color = g_settings_get_string (settings, "swap-color");
if (!color)
color = g_strdup ("#00b6000000ff");
- mateconf_client_notify_add (client, "/apps/procman/swap_color",
- color_changed_cb, pd, NULL, NULL);
+ g_signal_connect (G_OBJECT(settings), "changed::swap-color",
+ G_CALLBACK(color_changed_cb), pd);
gdk_color_parse(color, &pd->config.swap_color);
g_free (color);
- color = mateconf_client_get_string (client, "/apps/procman/net_in_color", NULL);
+ color = g_settings_get_string (settings, "net-in-color");
if (!color)
color = g_strdup ("#000000f200f2");
- mateconf_client_notify_add (client, "/apps/procman/net_in_color",
- color_changed_cb, pd, NULL, NULL);
+ g_signal_connect (G_OBJECT(settings), "changed::net-in-color",
+ G_CALLBACK(color_changed_cb), pd);
gdk_color_parse(color, &pd->config.net_in_color);
g_free (color);
- color = mateconf_client_get_string (client, "/apps/procman/net_out_color", NULL);
+ color = g_settings_get_string (settings, "net-out-color");
if (!color)
color = g_strdup ("#00f2000000c1");
- mateconf_client_notify_add (client, "/apps/procman/net_out_color",
- color_changed_cb, pd, NULL, NULL);
+ g_signal_connect (G_OBJECT(settings), "changed::net-out-color",
+ G_CALLBACK(color_changed_cb), pd);
gdk_color_parse(color, &pd->config.net_out_color);
g_free (color);
@@ -357,21 +341,9 @@ procman_data_new (MateConfClient *client)
PROCMAN_TAB_SYSINFO,
PROCMAN_TAB_DISKS);
- /* Determinie number of cpus since libgtop doesn't really tell you*/
- pd->config.num_cpus = 0;
- glibtop_get_cpu (&cpu);
- pd->frequency = cpu.frequency;
- i=0;
- while (i < GLIBTOP_NCPU && cpu.xcpu_total[i] != 0) {
- pd->config.num_cpus ++;
- i++;
- }
- if (pd->config.num_cpus == 0)
- pd->config.num_cpus = 1;
-
// delayed initialization as SmoothRefresh() needs ProcData
// i.e. we can't call ProcData::get_instance
- pd->smooth_refresh = new SmoothRefresh();
+ pd->smooth_refresh = new SmoothRefresh(settings);
return pd;
@@ -387,30 +359,24 @@ procman_free_data (ProcData *procdata)
gboolean
-procman_get_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *prefix)
+procman_get_tree_state (GSettings *settings, GtkWidget *tree, const gchar *child_schema)
{
GtkTreeModel *model;
GList *columns, *it;
gint sort_col;
GtkSortType order;
- gchar *key;
g_assert(tree);
- g_assert(prefix);
+ g_assert(child_schema);
- if (!mateconf_client_dir_exists (client, prefix, NULL))
- return FALSE;
+ GSettings *pt_settings = g_settings_get_child (settings, child_schema);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));
- key = g_strdup_printf ("%s/sort_col", prefix);
- sort_col = mateconf_client_get_int (client, key, NULL);
- g_free (key);
+ sort_col = g_settings_get_int (pt_settings, "sort-col");
- key = g_strdup_printf ("%s/sort_order", prefix);
- order = static_cast<GtkSortType>(mateconf_client_get_int (client, key, NULL));
- g_free (key);
+ order = static_cast<GtkSortType>(g_settings_get_int (pt_settings, "sort-order"));
if (sort_col != -1)
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
@@ -419,60 +385,68 @@ procman_get_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *pr
columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (tree));
- for(it = columns; it; it = it->next)
- {
+ if(!g_strcmp0(child_schema, "proctree"))
+ {
+ for(it = columns; it; it = it->next)
+ {
GtkTreeViewColumn *column;
- MateConfValue *value = NULL;
gint width;
gboolean visible;
int id;
+ gchar *key;
column = static_cast<GtkTreeViewColumn*>(it->data);
id = gtk_tree_view_column_get_sort_column_id (column);
- key = g_strdup_printf ("%s/col_%d_width", prefix, id);
- value = mateconf_client_get (client, key, NULL);
+ key = g_strdup_printf ("col-%d-width", id);
+ g_settings_get (pt_settings, key, "i", &width);
g_free (key);
- if (value != NULL) {
- width = mateconf_value_get_int(value);
- mateconf_value_free (value);
-
- key = g_strdup_printf ("%s/col_%d_visible", prefix, id);
- visible = mateconf_client_get_bool (client, key, NULL);
- g_free (key);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), id);
- if(!column) continue;
- gtk_tree_view_column_set_visible (column, visible);
- if (visible) {
- /* ensure column is really visible */
- width = MAX(width, 10);
- gtk_tree_view_column_set_fixed_width(column, width);
- }
- }
- }
-
- if(g_str_has_suffix(prefix, "proctree") || g_str_has_suffix(prefix, "disktreenew"))
+ key = g_strdup_printf ("col-%d-visible", id);
+ visible = g_settings_get_boolean (pt_settings, key);
+ g_free (key);
+
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), id);
+ if(!column) continue;
+ gtk_tree_view_column_set_visible (column, visible);
+ if (visible) {
+ /* ensure column is really visible */
+ width = MAX(width, 10);
+ gtk_tree_view_column_set_fixed_width(column, width);
+ }
+ }
+ }
+
+ if(!g_strcmp0(child_schema, "proctree") ||
+ !g_strcmp0(child_schema, "disktreenew"))
{
- GSList *order;
- char *key;
+ GVariant *value;
+ GVariantIter iter;
+ int sortIndex;
+
+ GSList *order = NULL;
+
+ value = g_settings_get_value(pt_settings, "columns-order");
+ g_variant_iter_init(&iter, value);
+
+ while (g_variant_iter_loop (&iter, "i", &sortIndex))
+ order = g_slist_append(order, GINT_TO_POINTER(sortIndex));
- key = g_strdup_printf("%s/columns_order", prefix);
- order = mateconf_client_get_list(client, key, MATECONF_VALUE_INT, NULL);
proctable_set_columns_order(GTK_TREE_VIEW(tree), order);
g_slist_free(order);
- g_free(key);
}
+ g_object_unref(pt_settings);
+ pt_settings = NULL;
+
g_list_free(columns);
return TRUE;
}
void
-procman_save_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *prefix)
+procman_save_tree_state (GSettings *settings, GtkWidget *tree, const gchar *child_schema)
{
GtkTreeModel *model;
GList *it, *columns;
@@ -480,26 +454,24 @@ procman_save_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *p
GtkSortType order;
g_assert(tree);
- g_assert(prefix);
+ g_assert(child_schema);
+
+ GSettings *pt_settings = g_settings_get_child (settings, child_schema);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));
if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model), &sort_col,
&order)) {
- gchar *key;
-
- key = g_strdup_printf ("%s/sort_col", prefix);
- mateconf_client_set_int (client, key, sort_col, NULL);
- g_free (key);
-
- key = g_strdup_printf ("%s/sort_order", prefix);
- mateconf_client_set_int (client, key, order, NULL);
- g_free (key);
+ g_settings_set_int (pt_settings, "sort-col", sort_col);
+ g_settings_set_int (pt_settings, "sort-order", order);
}
columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (tree));
+ g_print("%i\n", g_list_length(columns));
- for(it = columns; it; it = it->next)
- {
+ if(!g_strcmp0(child_schema, "proctree"))
+ {
+ for(it = columns; it; it = it->next)
+ {
GtkTreeViewColumn *column;
gboolean visible;
gint width;
@@ -511,35 +483,36 @@ procman_save_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *p
visible = gtk_tree_view_column_get_visible (column);
width = gtk_tree_view_column_get_width (column);
- key = g_strdup_printf ("%s/col_%d_width", prefix, id);
- mateconf_client_set_int (client, key, width, NULL);
+ key = g_strdup_printf ("col-%d-width", id);
+ g_settings_set_int (pt_settings, key, width);
g_free (key);
- key = g_strdup_printf ("%s/col_%d_visible", prefix, id);
- mateconf_client_set_bool (client, key, visible, NULL);
+ key = g_strdup_printf ("col-%d-visible", id);
+ g_settings_set_boolean (pt_settings, key, visible);
g_free (key);
- }
+ }
+ }
- if(g_str_has_suffix(prefix, "proctree") || g_str_has_suffix(prefix, "disktreenew"))
+ if(!g_strcmp0(child_schema, "proctree") || !g_strcmp0(child_schema, "disktreenew"))
{
GSList *order;
- char *key;
- GError *error = NULL;
+ GSList *order_node;
+ GVariantBuilder *builder;
+ GVariant *order_variant;
- key = g_strdup_printf("%s/columns_order", prefix);
order = proctable_get_columns_order(GTK_TREE_VIEW(tree));
- if(!mateconf_client_set_list(client, key, MATECONF_VALUE_INT, order, &error))
- {
- g_critical("Could not save MateConf key '%s' : %s",
- key,
- error->message);
- g_error_free(error);
- }
+ builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+
+ for(order_node = order; order_node; order_node = order_node->next)
+ g_variant_builder_add(builder, "i", GPOINTER_TO_INT(order_node->data));
+
+ order_variant = g_variant_new("ai", builder);
+ g_settings_set_value(pt_settings, "columns-order", order_variant);
+
g_slist_free(order);
- g_free(key);
- }
+ }
g_list_free(columns);
}
@@ -547,13 +520,13 @@ procman_save_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *p
void
procman_save_config (ProcData *data)
{
- MateConfClient *client = data->client;
+ GSettings *settings = data->settings;
g_assert(data);
- procman_save_tree_state (data->client, data->tree, "/apps/procman/proctree");
- procman_save_tree_state (data->client, data->disk_list, "/apps/procman/disktreenew");
+ procman_save_tree_state (data->settings, data->tree, "proctree");
+ procman_save_tree_state (data->settings, data->disk_list, "disktreenew");
#if GTK_CHECK_VERSION(3, 0, 0)
data->config.width = gdk_window_get_width(gtk_widget_get_window(data->app));
@@ -567,11 +540,11 @@ procman_save_config (ProcData *data)
data->config.height = height;
#endif
- mateconf_client_set_int (client, "/apps/procman/width", data->config.width, NULL);
- mateconf_client_set_int (client, "/apps/procman/height", data->config.height, NULL);
- mateconf_client_set_int (client, "/apps/procman/current_tab", data->config.current_tab, NULL);
+ g_settings_set_int (settings, "width", data->config.width);
+ g_settings_set_int (settings, "height", data->config.height);
+ g_settings_set_int (settings, "current-tab", data->config.current_tab);
- mateconf_client_suggest_sync (client, NULL);
+ g_settings_sync ();
@@ -587,7 +560,7 @@ get_startup_timestamp ()
/* we don't unset the env, since startup-notification
* may still need it */
- startup_id_env = g_getenv ("DESKTOP_STARTUP_ID");
+ startup_id_env = g_getenv ("DESKTOP-STARTUP-ID");
if (startup_id_env == NULL)
goto out;
@@ -675,7 +648,7 @@ int
main (int argc, char *argv[])
{
guint32 startup_timestamp;
- MateConfClient *client;
+ GSettings *settings;
ProcData *procdata;
BaconMessageConnection *conn;
@@ -734,15 +707,14 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_name ("utilities-system-monitor");
g_set_application_name(_("System Monitor"));
- client = mateconf_client_get_default ();
- mateconf_client_add_dir(client, "/apps/procman", MATECONF_CLIENT_PRELOAD_NONE, NULL);
+ settings = g_settings_new (GSM_GSETTINGS_SCHEMA);
glibtop_init ();
procman_debug("end init");
- procdata = procman_data_new (client);
- procdata->client = client;
+ procdata = procman_data_new (settings);
+ procdata->settings = g_settings_new(GSM_GSETTINGS_SCHEMA);
procman_debug("begin create_main_window");
create_main_window (procdata);
diff --git a/src/procman.h b/src/procman.h
index cbf73eb..c44087a 100644
--- a/src/procman.h
+++ b/src/procman.h
@@ -23,8 +23,8 @@
#include <glibmm/refptr.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
#include <glibtop/cpu.h>
#include <time.h>
@@ -40,6 +40,8 @@ struct LoadGraph;
#include "smooth_refresh.h"
#include "prettytable.h"
+#define GSM_GSETTINGS_SCHEMA "org.mate.mate-system-monitor"
+
enum
{
ALL_PROCESSES,
@@ -72,8 +74,8 @@ struct ProcConfig
{
gint width;
gint height;
- gboolean show_kill_warning;
- gboolean show_tree;
+ gboolean show_kill_warning;
+ gboolean show_tree;
gboolean show_all_fs;
int update_interval;
int graph_update_interval;
@@ -206,8 +208,8 @@ struct ProcData
PrettyTable pretty_table;
- MateConfClient *client;
- GtkWidget *app;
+ GSettings *settings;
+ GtkWidget *app;
GtkUIManager *menu;
unsigned frequency;
@@ -224,8 +226,8 @@ private:
};
void procman_save_config (ProcData *data);
-void procman_save_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *prefix);
-gboolean procman_get_tree_state (MateConfClient *client, GtkWidget *tree, const gchar *prefix);
+void procman_save_tree_state (GSettings *settings, GtkWidget *tree, const gchar *prefix);
+gboolean procman_get_tree_state (GSettings *settings, GtkWidget *tree, const gchar *prefix);
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 71bf2d4..3a0a129 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -90,9 +90,9 @@ cb_columns_changed(GtkTreeView *treeview, gpointer user_data)
{
ProcData * const procdata = static_cast<ProcData*>(user_data);
- procman_save_tree_state(procdata->client,
+ procman_save_tree_state(procdata->settings,
GTK_WIDGET(treeview),
- "/apps/procman/proctree");
+ "proctree");
}
@@ -392,7 +392,7 @@ proctable_new (ProcData * const procdata)
set_proctree_reorderable(procdata);
- procman_get_tree_state (procdata->client, proctree, "/apps/procman/proctree");
+ procman_get_tree_state (procdata->settings, proctree, "proctree");
/* Override column settings by hiding this column if it's meaningless: */
if (!can_show_security_context_column ()) {
diff --git a/src/settings-keys.cpp b/src/settings-keys.cpp
new file mode 100644
index 0000000..7d8ef1a
--- /dev/null
+++ b/src/settings-keys.cpp
@@ -0,0 +1,14 @@
+#include "settings-keys.h"
+
+
+namespace procman
+{
+ namespace settings
+ {
+ const std::string root("/org/mate/mate-system-monitor");
+ const std::string solaris_mode("solaris-mode");
+ const std::string open_files_tree_prefix("openfilestree");
+ const std::string network_in_bits("network-in-bits");
+ }
+}
+
diff --git a/src/mateconf-keys.h b/src/settings-keys.h
index 400065c..0e5f8e1 100644
--- a/src/mateconf-keys.h
+++ b/src/settings-keys.h
@@ -1,12 +1,12 @@
-#ifndef H_PROCMAN_MATECONF_KEYS_1177430397
-#define H_PROCMAN_MATECONF_KEYS_1177430397
+#ifndef H_PROCMAN_SETTINGS_KEYS_1177430397
+#define H_PROCMAN_SETTINGS_KEYS_1177430397
#include <string>
namespace procman
{
- namespace mateconf
+ namespace settings
{
extern const std::string root;
extern const std::string solaris_mode;
@@ -16,4 +16,4 @@ namespace procman
}
-#endif // H_PROCMAN_MATECONF_KEYS_1177430397
+#endif // H_PROCMAN_SETTINGS_KEYS_1177430397
diff --git a/src/smooth_refresh.cpp b/src/smooth_refresh.cpp
index f21c023..484aa67 100644
--- a/src/smooth_refresh.cpp
+++ b/src/smooth_refresh.cpp
@@ -4,7 +4,6 @@
#include <unistd.h>
#include <glib.h>
-#include <mateconf/mateconf-client.h>
#include <glibtop.h>
#include <glibtop/proctime.h>
#include <glibtop/cpu.h>
@@ -16,9 +15,7 @@
#include "util.h"
-const string SmoothRefresh::KEY("/apps/procman/smooth_refresh");
-const bool SmoothRefresh::KEY_DEFAULT_VALUE(true);
-
+const string SmoothRefresh::KEY("smooth-refresh");
unsigned SmoothRefresh::get_own_cpu_usage()
@@ -46,43 +43,32 @@ unsigned SmoothRefresh::get_own_cpu_usage()
-void SmoothRefresh::status_changed(MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+void SmoothRefresh::status_changed(GSettings *settings,
+ const gchar *key,
+ gpointer user_data)
{
- static_cast<SmoothRefresh*>(user_data)->load_mateconf_value(mateconf_entry_get_value(entry));
+ static_cast<SmoothRefresh*>(user_data)->load_settings_value(key);
}
-void SmoothRefresh::load_mateconf_value(MateConfValue* value)
+void SmoothRefresh::load_settings_value(const gchar *key)
{
- bool own_value = false;
-
- if (not value) {
- value = mateconf_client_get(mateconf_client_get_default(), KEY.c_str(), NULL);
- }
-
- this->active = value ? mateconf_value_get_bool(value) : KEY_DEFAULT_VALUE;
+ this->active = g_settings_get_boolean(settings, key);
if (this->active)
procman_debug("smooth_refresh is enabled");
-
- if (own_value and value)
- mateconf_value_free(value);
}
-
-SmoothRefresh::SmoothRefresh()
+SmoothRefresh::SmoothRefresh(GSettings *a_settings)
+:
+ settings(a_settings)
{
- this->connection = mateconf_client_notify_add(mateconf_client_get_default(),
- KEY.c_str(),
- status_changed,
- this,
- NULL,
- NULL);
+ this->connection = g_signal_connect(G_OBJECT(settings),
+ "changed::smooth-refresh",
+ G_CALLBACK(status_changed),
+ this);
this->reset();
- this->load_mateconf_value();
+ this->load_settings_value(KEY.c_str());
}
@@ -106,8 +92,7 @@ void SmoothRefresh::reset()
SmoothRefresh::~SmoothRefresh()
{
if (this->connection)
- mateconf_client_notify_remove(mateconf_client_get_default(),
- this->connection);
+ g_signal_handler_disconnect(G_OBJECT(settings), this->connection);
}
diff --git a/src/smooth_refresh.h b/src/smooth_refresh.h
index 29a503f..eed5227 100644
--- a/src/smooth_refresh.h
+++ b/src/smooth_refresh.h
@@ -2,8 +2,7 @@
#define _PROCMAN_SMOOTH_REFRESH
#include <glib.h>
-#include <mateconf/mateconf-client.h>
-
+#include <gio/gio.h>
#include <string>
using std::string;
@@ -22,7 +21,7 @@ public:
@return : initialized SmoothRefresh
*/
- SmoothRefresh();
+ SmoothRefresh(GSettings *a_settings);
~SmoothRefresh();
@@ -54,12 +53,11 @@ private:
unsigned get_own_cpu_usage();
- static void status_changed(MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data);
+ static void status_changed(GSettings *settings,
+ const gchar *key,
+ gpointer user_data);
- void load_mateconf_value(MateConfValue* value = NULL);
+ void load_settings_value(const gchar *key);
/*
fuzzy logic:
@@ -92,6 +90,7 @@ private:
-last_cpu_time: Save last cpu and process times to compute CPU%
*/
+ GSettings *settings;
bool active;
guint connection;
guint interval;