summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--multiload/Makefile.am22
-rw-r--r--multiload/global.h3
-rw-r--r--multiload/load-graph.c9
-rw-r--r--multiload/main.c50
-rw-r--r--multiload/multiload.schemas.in284
-rw-r--r--multiload/org.mate.panel.applet.multiload.gschema.xml.in.in125
-rw-r--r--multiload/properties.c156
7 files changed, 233 insertions, 416 deletions
diff --git a/multiload/Makefile.am b/multiload/Makefile.am
index f3901510..fd75c8ff 100644
--- a/multiload/Makefile.am
+++ b/multiload/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = docs
INCLUDES = \
-I$(srcdir) \
-DMULTILOAD_MENU_UI_DIR=\""$(uidir)"\" \
- $(MATE_APPLETS3_CFLAGS) \
+ $(MATE_APPLETS4_CFLAGS) \
$(GTOP_APPLETS_CFLAGS) \
$(MATEDESKTOP_CFLAGS)
@@ -22,21 +22,22 @@ multiload_applet_2_SOURCES = \
autoscaler.h
multiload_applet_2_LDADD = \
- $(MATE_APPLETS3_LIBS) \
+ $(MATE_APPLETS4_LIBS) \
$(GTOP_APPLETS_LIBS) \
$(MATEDESKTOP_LIBS) \
-lm
-schemasdir = @MATECONF_SCHEMA_FILE_DIR@
-schemas_in_files = multiload.schemas.in
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+@INTLTOOL_XML_NOMERGE_RULE@
+gsettings_SCHEMAS = org.mate.panel.applet.multiload.gschema.xml
+@GSETTINGS_RULES@
-@INTLTOOL_SCHEMAS_RULE@
+%.gschema.xml.in: %.gschema.xml.in.in Makefile
+ $(AM_V_GEN) $(SED) -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
EXTRA_DIST = \
org.mate.applets.MultiLoadApplet.mate-panel-applet.in.in \
$(service_in_files) \
- $(schemas_in_files) \
+ $(gsettings_SCHEMAS_in_in) \
$(ui_DATA)
uidir = $(datadir)/mate-2.0/ui
@@ -63,11 +64,6 @@ org.mate.panel.applet.MultiLoadAppletFactory.service: $(service_in_files)
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA)
-
-if MATECONF_SCHEMAS_INSTALL
-install-data-local:
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(schemas_DATA) ;
-endif
+CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS_in) $(gsettings_SCHEMAS) *.gschema.valid
-include $(top_srcdir)/git.mk
diff --git a/multiload/global.h b/multiload/global.h
index 46840e08..613adb5d 100644
--- a/multiload/global.h
+++ b/multiload/global.h
@@ -5,6 +5,7 @@
#include <glib/gi18n.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <mate-panel-applet.h>
G_BEGIN_DECLS
@@ -60,6 +61,8 @@ struct _MultiloadApplet
{
MatePanelApplet *applet;
+ GSettings *settings;
+
LoadGraph *graphs[NGRAPHS];
GtkWidget *box;
diff --git a/multiload/load-graph.c b/multiload/load-graph.c
index 9b294f33..a17d604a 100644
--- a/multiload/load-graph.c
+++ b/multiload/load-graph.c
@@ -9,8 +9,9 @@
#include <glib.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <mate-panel-applet.h>
-#include <mate-panel-applet-mateconf.h>
+#include <mate-panel-applet-gsettings.h>
#include "global.h"
@@ -155,7 +156,7 @@ load_graph_unalloc (LoadGraph *g)
g->pos = NULL;
g->data = NULL;
- g->size = mate_panel_applet_mateconf_get_int(g->multiload->applet, "size", NULL);
+ g->size = g_settings_get_int(g->multiload->settings, "size");
g->size = MAX (g->size, 10);
if (g->pixmap) {
@@ -302,8 +303,8 @@ load_graph_load_config (LoadGraph *g)
for (i = 0; i < g->n; i++)
{
- g_snprintf(name, sizeof(name), "%s_color%u", g->name, i);
- temp = mate_panel_applet_mateconf_get_string(g->multiload->applet, name, NULL);
+ g_snprintf(name, sizeof(name), "%s-color%u", g->name, i);
+ temp = g_settings_get_string(g->multiload->settings, name);
if (!temp)
temp = g_strdup ("#000000");
gdk_color_parse(temp, &(g->colors[i]));
diff --git a/multiload/main.c b/multiload/main.c
index 9ac98624..0e7a64ce 100644
--- a/multiload/main.c
+++ b/multiload/main.c
@@ -22,10 +22,10 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <mateconf/mateconf-client.h>
-#include <libmate/mate-desktop-item.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
#include <mate-panel-applet.h>
-#include <mate-panel-applet-mateconf.h>
+#include <mate-panel-applet-gsettings.h>
#include "global.h"
@@ -90,24 +90,27 @@ static void
start_procman (MultiloadApplet *ma)
{
GError *error = NULL;
- MateDesktopItem *ditem;
+ GDesktopAppInfo *appinfo;
gchar *monitor;
g_return_if_fail (ma != NULL);
- monitor = mate_panel_applet_mateconf_get_string (ma->applet, "system_monitor", NULL);
+ monitor = g_settings_get_string (ma->settings, "system-monitor");
if (monitor == NULL)
monitor = g_strdup ("mate-system-monitor.desktop");
- if ((ditem = mate_desktop_item_new_from_basename (monitor, 0, NULL))) {
- mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
- mate_desktop_item_launch_on_screen (ditem, NULL,
- MATE_DESKTOP_ITEM_LAUNCH_ONLY_ONE,
- gtk_widget_get_screen (GTK_WIDGET (ma->applet)),
- -1, &error);
- mate_desktop_item_unref (ditem);
+ appinfo = g_desktop_app_info_new (monitor);
+ if (appinfo) {
+ GdkScreen *screen;
+ GdkAppLaunchContext *context;
+ screen = gtk_widget_get_screen (GTK_WIDGET (ma->applet));
+ context = gdk_app_launch_context_new ();
+ gdk_app_launch_context_set_screen (context, screen);
+ g_app_info_launch (G_APP_INFO (appinfo), NULL, G_APP_LAUNCH_CONTEXT (context), &error);
+ g_object_unref (context);
+ g_object_unref (appinfo);
}
- else {
+ else {
gdk_spawn_command_line_on_screen (
gtk_widget_get_screen (GTK_WIDGET (ma->applet)),
"mate-system-monitor", &error);
@@ -343,8 +346,8 @@ multiload_create_graphs(MultiloadApplet *ma)
gint speed, size;
gint i;
- speed = mate_panel_applet_mateconf_get_int (ma->applet, "speed", NULL);
- size = mate_panel_applet_mateconf_get_int (ma->applet, "size", NULL);
+ speed = g_settings_get_int (ma->settings, "speed");
+ size = g_settings_get_int (ma->settings, "size");
speed = MAX (speed, 50);
size = CLAMP (size, 10, 400);
@@ -357,11 +360,11 @@ multiload_create_graphs(MultiloadApplet *ma)
* older version of netload to a newer one in the
* 2.25.1 release. */
if (g_strcmp0 ("netload2", graph_types[i].name) == 0) {
- key = g_strdup ("view_netload");
+ key = g_strdup ("view-netload");
} else {
- key = g_strdup_printf ("view_%s", graph_types[i].name);
+ key = g_strdup_printf ("view-%s", graph_types[i].name);
}
- visible = mate_panel_applet_mateconf_get_bool (ma->applet, key, NULL);
+ visible = g_settings_get_boolean (ma->settings, key);
g_free (key);
ma->graphs[i] = load_graph_new (ma,
@@ -410,7 +413,7 @@ multiload_applet_refresh(MultiloadApplet *ma)
gtk_container_add(GTK_CONTAINER(ma->applet), ma->box);
- /* create the NGRAPHS graphs, passing in their user-configurable properties with mateconf. */
+ /* create the NGRAPHS graphs, passing in their user-configurable properties with gsettings. */
multiload_create_graphs (ma);
/* only start and display the graphs the user has turned on */
@@ -449,7 +452,7 @@ static gboolean
multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data)
{
MultiloadApplet *ma;
- MateConfClient *client;
+ GSettings *lockdown_settings;
GtkActionGroup *action_group;
gchar *ui_path;
@@ -466,7 +469,7 @@ multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data)
gtk_window_set_default_icon_name ("utilities-system-monitor");
mate_panel_applet_set_background_widget (applet, GTK_WIDGET(applet));
- mate_panel_applet_add_preferences (applet, "/schemas/apps/multiload/prefs", NULL);
+ ma->settings = mate_panel_applet_settings_new (applet, "org.mate.panel.applet.multiload");
mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
action_group = gtk_action_group_new ("Multiload Applet Actions");
@@ -487,8 +490,8 @@ multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data)
gtk_action_set_visible (action, FALSE);
}
- client = mateconf_client_get_default ();
- if (mateconf_client_get_bool (client, "/desktop/mate/lockdown/inhibit_command_line", NULL) ||
+ lockdown_settings = g_settings_new ("org.mate.lockdown");
+ if (g_settings_get_boolean (lockdown_settings, "disable-command-line") ||
mate_panel_applet_get_locked_down (applet)) {
GtkAction *action;
@@ -497,6 +500,7 @@ multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data)
action = gtk_action_group_get_action (action_group, "MultiLoadRunProcman");
gtk_action_set_visible (action, FALSE);
}
+ g_object_unref (lockdown_settings);
g_object_unref (action_group);
diff --git a/multiload/multiload.schemas.in b/multiload/multiload.schemas.in
deleted file mode 100644
index f1054dd4..00000000
--- a/multiload/multiload.schemas.in
+++ /dev/null
@@ -1,284 +0,0 @@
-<mateconfschemafile>
-<schemalist>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/view_cpuload</key>
- <owner>multiload-applet-2</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable CPU load graph</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/view_memload</key>
- <owner>multiload-applet-2</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable memory load graph</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/view_netload</key>
- <owner>multiload-applet-2</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable network load graph</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/view_swapload</key>
- <owner>multiload-applet-2</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable swap load graph</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/view_loadavg</key>
- <owner>multiload-applet-2</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable load average graph</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/view_diskload</key>
- <owner>multiload-applet-2</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable disk load graph</short>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/speed</key>
- <owner>multiload-applet-2</owner>
- <type>int</type>
- <default>500</default>
- <locale name="C">
- <short>Applet refresh rate in milliseconds</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/size</key>
- <owner>multiload-applet-2</owner>
- <type>int</type>
- <default>40</default>
- <locale name="C">
- <short>Graph size</short>
- <long>For horizontal panels, the width of the graphs in pixels. For vertical panels, this is the height of the graphs.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/cpuload_color0</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#0072b3</default>
- <locale name="C">
- <short>Graph color for user-related CPU activity</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/cpuload_color1</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#0092e6</default>
- <locale name="C">
- <short>Graph color for system-related CPU activity</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/cpuload_color2</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#00a3ff</default>
- <locale name="C">
- <short>Graph color for nice-related CPU activity</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/cpuload_color3</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#002f3d</default>
- <locale name="C">
- <short>Graph color for iowait related CPU activity</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/cpuload_color4</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>CPU graph background color</short>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/memload_color0</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#00b35b</default>
- <locale name="C">
- <short>Graph color for user-related memory usage</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/memload_color1</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#00e675</default>
- <locale name="C">
- <short>Graph color for shared memory</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/memload_color2</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#00ff82</default>
- <locale name="C">
- <short>Graph color for buffer memory</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/memload_color3</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#AAF5D0</default>
- <locale name="C">
- <short>Graph color for cached memory</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/memload_color4</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>Memory graph background color</short>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/netload2_color0</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#fce94f</default>
- <locale name="C">
- <short>Graph color for input network activity</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/netload2_color1</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#edd400</default>
- <locale name="C">
- <short>Graph color for output network activity</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/netload2_color2</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#c4a000</default>
- <locale name="C">
- <short>Graph color for loopback network usage</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/netload2_color3</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>Network graph background color</short>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/swapload_color0</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#8b00c3</default>
- <locale name="C">
- <short>Graph color for user-related swap usage</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/swapload_color1</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>Swap graph background color</short>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/loadavg_color0</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#d50000</default>
- <locale name="C">
- <short>Graph color for load average</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/loadavg_color1</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>Load graph background color</short>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/multiload/prefs/diskload_color0</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#C65000</default>
- <locale name="C">
- <short>Graph color for disk read</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/diskload_color1</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#FF6700</default>
- <locale name="C">
- <short>Graph color for disk write</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/diskload_color2</key>
- <owner>multiload-applet-2</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>Background color for disk load graph</short>
- </locale>
-</schema>
-<schema>
- <key>/schemas/apps/multiload/prefs/system_monitor</key>
- <owner>multiload_applet-2</owner>
- <type>string</type>
- <default>mate-system-monitor.desktop</default>
- <locale name="C">
- <short>The desktop description file to execute as the system monitor</short>
- </locale>
-</schema>
-
-</schemalist>
-</mateconfschemafile>
diff --git a/multiload/org.mate.panel.applet.multiload.gschema.xml.in.in b/multiload/org.mate.panel.applet.multiload.gschema.xml.in.in
new file mode 100644
index 00000000..7ea422ea
--- /dev/null
+++ b/multiload/org.mate.panel.applet.multiload.gschema.xml.in.in
@@ -0,0 +1,125 @@
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.mate.panel.applet.multiload">
+ <key name="view-cpuload" type="b">
+ <default>true</default>
+ <summary>Enable CPU load graph</summary>
+ </key>
+ <key name="view-memload" type="b">
+ <default>false</default>
+ <summary>Enable memory load graph</summary>
+ </key>
+ <key name="view-netload" type="b">
+ <default>false</default>
+ <summary>Enable network load graph</summary>
+ </key>
+ <key name="view-swapload" type="b">
+ <default>false</default>
+ <summary>Enable swap load graph</summary>
+ </key>
+ <key name="view-loadavg" type="b">
+ <default>false</default>
+ <summary>Enable load average graph</summary>
+ </key>
+ <key name="view-diskload" type="b">
+ <default>false</default>
+ <summary>Enable disk load graph</summary>
+ </key>
+ <key name="speed" type="i">
+ <default>500</default>
+ <summary>Applet refresh rate in milliseconds</summary>
+ </key>
+ <key name="size" type="i">
+ <default>40</default>
+ <summary>Graph size</summary>
+ <description>For horizontal panels, the width of the graphs in pixels. For vertical panels, this is the height of the graphs.</description>
+ </key>
+ <key name="cpuload-color0" type="s">
+ <default>'#0072b3'</default>
+ <summary>Graph color for user-related CPU activity</summary>
+ </key>
+ <key name="cpuload-color1" type="s">
+ <default>'#0092e6'</default>
+ <summary>Graph color for system-related CPU activity</summary>
+ </key>
+ <key name="cpuload-color2" type="s">
+ <default>'#00a3ff'</default>
+ <summary>Graph color for nice-related CPU activity</summary>
+ </key>
+ <key name="cpuload-color3" type="s">
+ <default>'#002f3d'</default>
+ <summary>Graph color for iowait related CPU activity</summary>
+ </key>
+ <key name="cpuload-color4" type="s">
+ <default>'#000000'</default>
+ <summary>CPU graph background color</summary>
+ </key>
+ <key name="memload-color0" type="s">
+ <default>'#00b35b'</default>
+ <summary>Graph color for user-related memory usage</summary>
+ </key>
+ <key name="memload-color1" type="s">
+ <default>'#00e675'</default>
+ <summary>Graph color for shared memory</summary>
+ </key>
+ <key name="memload-color2" type="s">
+ <default>'#00ff82'</default>
+ <summary>Graph color for buffer memory</summary>
+ </key>
+ <key name="memload-color3" type="s">
+ <default>'#AAF5D0'</default>
+ <summary>Graph color for cached memory</summary>
+ </key>
+ <key name="memload-color4" type="s">
+ <default>'#000000'</default>
+ <summary>Memory graph background color</summary>
+ </key>
+ <key name="netload2-color0" type="s">
+ <default>'#fce94f'</default>
+ <summary>Graph color for input network activity</summary>
+ </key>
+ <key name="netload2-color1" type="s">
+ <default>'#edd400'</default>
+ <summary>Graph color for output network activity</summary>
+ </key>
+ <key name="netload2-color2" type="s">
+ <default>'#c4a000'</default>
+ <summary>Graph color for loopback network usage</summary>
+ </key>
+ <key name="netload2-color3" type="s">
+ <default>'#000000'</default>
+ <summary>Network graph background color</summary>
+ </key>
+ <key name="swapload-color0" type="s">
+ <default>'#8b00c3'</default>
+ <summary>Graph color for user-related swap usage</summary>
+ </key>
+ <key name="swapload-color1" type="s">
+ <default>'#000000'</default>
+ <summary>Swap graph background color</summary>
+ </key>
+ <key name="loadavg-color0" type="s">
+ <default>'#d50000'</default>
+ <summary>Graph color for load average</summary>
+ </key>
+ <key name="loadavg-color1" type="s">
+ <default>'#000000'</default>
+ <summary>Load graph background color</summary>
+ </key>
+ <key name="diskload-color0" type="s">
+ <default>'#C65000'</default>
+ <summary>Graph color for disk read</summary>
+ </key>
+ <key name="diskload-color1" type="s">
+ <default>'#FF6700'</default>
+ <summary>Graph color for disk write</summary>
+ </key>
+ <key name="diskload-color2" type="s">
+ <default>'#000000'</default>
+ <summary>Background color for disk load graph</summary>
+ </key>
+ <key name="system-monitor" type="s">
+ <default>'mate-system-monitor.desktop'</default>
+ <summary>The desktop description file to execute as the system monitor</summary>
+ </key>
+ </schema>
+</schemalist>
diff --git a/multiload/properties.c b/multiload/properties.c
index 8f040939..6fb693d0 100644
--- a/multiload/properties.c
+++ b/multiload/properties.c
@@ -15,9 +15,9 @@
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <mate-panel-applet.h>
-#include <mate-panel-applet-mateconf.h>
+#include <mate-panel-applet-gsettings.h>
#include "global.h"
@@ -53,26 +53,6 @@ soft_set_sensitive (GtkWidget *w, gboolean sensitivity)
gtk_widget_set_sensitive (w, sensitivity);
}
-
-static gboolean
-key_writable (MatePanelApplet *applet, const char *key)
-{
- gboolean writable;
- char *fullkey;
- static MateConfClient *client = NULL;
- if (client == NULL)
- client = mateconf_client_get_default ();
-
- fullkey = mate_panel_applet_mateconf_get_full_key (applet, key);
-
- writable = mateconf_client_key_is_writable (client, fullkey, NULL);
-
- g_free (fullkey);
-
- return writable;
-}
-
-
static void
properties_set_insensitive(MultiloadApplet *ma)
{
@@ -133,11 +113,9 @@ property_toggled_cb(GtkWidget *widget, gpointer name)
prop_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "prop_type"));
/* FIXME: the first toggle button to be checked/dechecked does not work, but after that everything is cool. what gives? */
- mate_panel_applet_mateconf_set_bool(ma->applet, (gchar *)name,
- active, NULL);
-
- mate_panel_applet_mateconf_set_bool(ma->applet, (gchar *)name,
- active, NULL);
+ /* FIXME: check if this is still valid for gsettings */
+ g_settings_set_boolean (ma->settings, (gchar *)name, active);
+ g_settings_set_boolean (ma->settings, (gchar *)name, active);
if (active)
{
@@ -169,11 +147,8 @@ spin_button_changed_cb(GtkWidget *widget, gpointer name)
value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
/* FIXME: the first toggle button to be checked/dechecked does not work, but after that everything is cool. what gives? */
- mate_panel_applet_mateconf_set_int(ma->applet, (gchar *)name,
- value, NULL);
-
- mate_panel_applet_mateconf_set_int(ma->applet, (gchar *)name,
- value, NULL);
+ g_settings_set_int (ma->settings, (gchar *)name, value);
+ g_settings_set_int (ma->settings, (gchar *)name, value);
switch(prop_type)
{
@@ -232,32 +207,30 @@ add_page(GtkWidget *notebook, gchar *label)
return page;
}
-/* save the selected color to mateconf and apply it on the applet */
+/* save the selected color to gsettings and apply it on the applet */
static void
-color_picker_set_cb(GtkColorButton *color_picker, gpointer data)
+color_picker_set_cb(GtkColorButton *color_picker, gchar *key)
{
gchar color_string[8];
- const gchar *mateconf_path;
guint8 prop_type;
GdkColor color;
MultiloadApplet *ma;
- mateconf_path = data;
ma = g_object_get_data (G_OBJECT (color_picker), "MultiloadApplet");
prop_type = 0;
- if (strstr(mateconf_path, "cpuload"))
+ if (strstr(key, "cpuload"))
prop_type = PROP_CPU;
- else if (strstr(mateconf_path, "memload"))
+ else if (strstr(key, "memload"))
prop_type = PROP_MEM;
- else if (strstr(mateconf_path, "netload2"))
+ else if (strstr(key, "netload2"))
prop_type = PROP_NET;
- else if (strstr(mateconf_path, "swapload"))
+ else if (strstr(key, "swapload"))
prop_type = PROP_SWAP;
- else if (strstr(mateconf_path, "loadavg"))
+ else if (strstr(key, "loadavg"))
prop_type = PROP_AVG;
- else if (strstr(mateconf_path, "diskload"))
+ else if (strstr(key, "diskload"))
prop_type = PROP_DISK;
else
g_assert_not_reached();
@@ -266,10 +239,10 @@ color_picker_set_cb(GtkColorButton *color_picker, gpointer data)
snprintf(color_string, 8, "#%02X%02X%02X",
color.red / 256, color.green / 256, color.blue / 256);
- mate_panel_applet_mateconf_set_string(MATE_PANEL_APPLET(ma->applet), mateconf_path, color_string, NULL);
+ g_settings_set_string(ma->settings, key, color_string);
gdk_color_parse(color_string,
- &(ma->graphs[prop_type]->colors[g_ascii_digit_value(mateconf_path[strlen(mateconf_path) - 1]) ]) );
+ &(ma->graphs[prop_type]->colors[g_ascii_digit_value(key[strlen(key) - 1]) ]) );
ma->graphs[prop_type]->colors_allocated = FALSE;
@@ -278,7 +251,7 @@ color_picker_set_cb(GtkColorButton *color_picker, gpointer data)
/* create a color selector */
static void
-add_color_selector(GtkWidget *page, gchar *name, gchar *mateconf_path, MultiloadApplet *ma)
+add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma)
{
GtkWidget *vbox;
GtkWidget *label;
@@ -286,7 +259,7 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *mateconf_path, Multiload
GdkColor color;
gchar *color_string;
- color_string = mate_panel_applet_mateconf_get_string(ma->applet, mateconf_path, NULL);
+ color_string = g_settings_get_string (ma->settings, key);
if (!color_string)
color_string = g_strdup ("#000000");
color.red = (g_ascii_xdigit_value(color_string[1]) * 16
@@ -311,15 +284,15 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *mateconf_path, Multiload
gtk_color_button_set_color(GTK_COLOR_BUTTON(color_picker), &color);
- g_signal_connect(G_OBJECT(color_picker), "color_set", G_CALLBACK(color_picker_set_cb), mateconf_path);
+ g_signal_connect(G_OBJECT(color_picker), "color_set", G_CALLBACK(color_picker_set_cb), key);
- if ( ! key_writable (ma->applet, mateconf_path))
+ if ( ! g_settings_is_writable (ma->settings, key))
hard_set_sensitive (vbox, FALSE);
return;
}
-/* creates the properties dialog using up-to-the-minute info from mateconf */
+/* creates the properties dialog using up-to-the-minute info from gsettings */
static void
fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
{
@@ -382,78 +355,77 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
check_box = gtk_check_button_new_with_mnemonic(_("_Processor"));
ma->check_boxes[0] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
- mate_panel_applet_mateconf_get_bool(ma->applet, "view_cpuload", NULL));
+ g_settings_get_boolean (ma->settings, "view-cpuload"));
g_object_set_data(G_OBJECT(check_box), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(check_box), "prop_type", GINT_TO_POINTER(PROP_CPU));
g_signal_connect(G_OBJECT(check_box), "toggled",
- G_CALLBACK(property_toggled_cb), "view_cpuload");
+ G_CALLBACK(property_toggled_cb), "view-cpuload");
gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0);
- if ( ! key_writable (ma->applet, "view_cpuload"))
+ if ( ! g_settings_is_writable (ma->settings, "view-cpuload"))
hard_set_sensitive (check_box, FALSE);
check_box = gtk_check_button_new_with_mnemonic(_("_Memory"));
ma->check_boxes[1] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
- mate_panel_applet_mateconf_get_bool(ma->applet, "view_memload", NULL));
+ g_settings_get_boolean (ma->settings, "view-memload"));
g_object_set_data(G_OBJECT(check_box), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(check_box), "prop_type", GINT_TO_POINTER(PROP_MEM));
g_signal_connect(G_OBJECT(check_box), "toggled",
- G_CALLBACK(property_toggled_cb), "view_memload");
+ G_CALLBACK(property_toggled_cb), "view-memload");
gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0);
- if ( ! key_writable (ma->applet, "view_memload"))
+ if ( ! g_settings_is_writable (ma->settings, "view-memload"))
hard_set_sensitive (check_box, FALSE);
check_box = gtk_check_button_new_with_mnemonic(_("_Network"));
ma->check_boxes[2] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
- mate_panel_applet_mateconf_get_bool(ma->applet, "view_netload", NULL));
+ g_settings_get_boolean (ma->settings, "view-netload"));
g_object_set_data(G_OBJECT(check_box), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(check_box), "prop_type", GINT_TO_POINTER(PROP_NET));
g_signal_connect(G_OBJECT(check_box), "toggled",
- G_CALLBACK(property_toggled_cb), "view_netload");
+ G_CALLBACK(property_toggled_cb), "view-netload");
gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0);
- if ( ! key_writable (ma->applet, "view_netload"))
+ if ( ! g_settings_is_writable (ma->settings, "view-netload"))
hard_set_sensitive (check_box, FALSE);
check_box = gtk_check_button_new_with_mnemonic (_("S_wap Space"));
ma->check_boxes[3] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
- mate_panel_applet_mateconf_get_bool(ma->applet, "view_swapload", NULL));
+ g_settings_get_boolean (ma->settings, "view-swapload"));
g_object_set_data(G_OBJECT(check_box), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(check_box), "prop_type", GINT_TO_POINTER(PROP_SWAP));
g_signal_connect(G_OBJECT(check_box), "toggled",
- G_CALLBACK(property_toggled_cb), "view_swapload");
+ G_CALLBACK(property_toggled_cb), "view-swapload");
gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0);
- if ( ! key_writable (ma->applet, "view_swapload"))
+ if ( ! g_settings_is_writable (ma->settings, "view-swapload"))
hard_set_sensitive (check_box, FALSE);
check_box = gtk_check_button_new_with_mnemonic(_("_Load"));
ma->check_boxes[4] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
- mate_panel_applet_mateconf_get_bool(ma->applet, "view_loadavg", NULL));
+ g_settings_get_boolean (ma->settings, "view-loadavg"));
g_object_set_data(G_OBJECT(check_box), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(check_box), "prop_type", GINT_TO_POINTER(PROP_AVG));
g_signal_connect(G_OBJECT(check_box), "toggled",
- G_CALLBACK(property_toggled_cb), "view_loadavg");
+ G_CALLBACK(property_toggled_cb), "view-loadavg");
gtk_box_pack_start(GTK_BOX(control_hbox), check_box, FALSE, FALSE, 0);
- if ( ! key_writable (ma->applet, "view_loadavg"))
+ if ( ! g_settings_is_writable (ma->settings, "view-loadavg"))
hard_set_sensitive (check_box, FALSE);
check_box = gtk_check_button_new_with_mnemonic(_("_Harddisk"));
ma->check_boxes[5] = check_box;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_box),
- mate_panel_applet_mateconf_get_bool (ma->applet,
- "view_diskload", NULL));
+ g_settings_get_boolean (ma->settings, "view-diskload"));
g_object_set_data (G_OBJECT (check_box), "MultiloadApplet", ma);
g_object_set_data (G_OBJECT (check_box), "prop_type",
GINT_TO_POINTER (PROP_DISK));
g_signal_connect (G_OBJECT (check_box), "toggled",
- G_CALLBACK (property_toggled_cb), "view_diskload");
+ G_CALLBACK (property_toggled_cb), "view-diskload");
gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0);
category_vbox = gtk_vbox_new (FALSE, 6);
@@ -511,11 +483,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
g_object_set_data(G_OBJECT(spin_button), "prop_type",
GINT_TO_POINTER(PROP_SIZE));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button),
- (gdouble)mate_panel_applet_mateconf_get_int(ma->applet, "size", NULL));
+ (gdouble)g_settings_get_int(ma->settings, "size"));
g_signal_connect(G_OBJECT(spin_button), "value_changed",
G_CALLBACK(spin_button_changed_cb), "size");
- if ( ! key_writable (ma->applet, "size")) {
+ if ( ! g_settings_is_writable (ma->settings, "size")) {
hard_set_sensitive (label, FALSE);
hard_set_sensitive (hbox, FALSE);
}
@@ -546,13 +518,13 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
g_object_set_data(G_OBJECT(spin_button), "prop_type",
GINT_TO_POINTER(PROP_SPEED));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button),
- (gdouble)mate_panel_applet_mateconf_get_int(ma->applet, "speed", NULL));
+ (gdouble)g_settings_get_int (ma->settings, "speed"));
g_signal_connect(G_OBJECT(spin_button), "value_changed",
G_CALLBACK(spin_button_changed_cb), "speed");
gtk_size_group_add_widget (spin_size, spin_button);
gtk_box_pack_start (GTK_BOX (hbox), spin_button, FALSE, FALSE, 0);
- if ( ! key_writable (ma->applet, "speed")) {
+ if ( ! g_settings_is_writable (ma->settings, "speed")) {
hard_set_sensitive (label, FALSE);
hard_set_sensitive (hbox, FALSE);
}
@@ -595,42 +567,42 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
page = add_page(ma->notebook, _("Processor"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
- add_color_selector(page, _("_User"), "cpuload_color0", ma);
- add_color_selector(page, _("S_ystem"), "cpuload_color1", ma);
- add_color_selector(page, _("N_ice"), "cpuload_color2", ma);
- add_color_selector(page, _("I_OWait"), "cpuload_color3", ma);
- add_color_selector(page, _("I_dle"), "cpuload_color4", ma);
+ add_color_selector(page, _("_User"), "cpuload-color0", ma);
+ add_color_selector(page, _("S_ystem"), "cpuload-color1", ma);
+ add_color_selector(page, _("N_ice"), "cpuload-color2", ma);
+ add_color_selector(page, _("I_OWait"), "cpuload-color3", ma);
+ add_color_selector(page, _("I_dle"), "cpuload-color4", ma);
page = add_page(ma->notebook, _("Memory"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
- add_color_selector(page, _("_User"), "memload_color0", ma);
- add_color_selector(page, _("Sh_ared"), "memload_color1", ma);
- add_color_selector(page, _("_Buffers"), "memload_color2", ma);
- add_color_selector (page, _("Cach_ed"), "memload_color3", ma);
- add_color_selector(page, _("F_ree"), "memload_color4", ma);
+ add_color_selector(page, _("_User"), "memload-color0", ma);
+ add_color_selector(page, _("Sh_ared"), "memload-color1", ma);
+ add_color_selector(page, _("_Buffers"), "memload-color2", ma);
+ add_color_selector (page, _("Cach_ed"), "memload-color3", ma);
+ add_color_selector(page, _("F_ree"), "memload-color4", ma);
page = add_page(ma->notebook, _("Network"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
- add_color_selector (page, _("_In"), "netload2_color0", ma);
- add_color_selector(page, _("_Out"), "netload2_color1", ma);
- add_color_selector (page, _("_Local"), "netload2_color2", ma);
- add_color_selector(page, _("_Background"), "netload2_color3", ma);
+ add_color_selector (page, _("_In"), "netload2-color0", ma);
+ add_color_selector(page, _("_Out"), "netload2-color1", ma);
+ add_color_selector (page, _("_Local"), "netload2-color2", ma);
+ add_color_selector(page, _("_Background"), "netload2-color3", ma);
page = add_page(ma->notebook, _("Swap Space"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
- add_color_selector(page, _("_Used"), "swapload_color0", ma);
- add_color_selector(page, _("_Free"), "swapload_color1", ma);
+ add_color_selector(page, _("_Used"), "swapload-color0", ma);
+ add_color_selector(page, _("_Free"), "swapload-color1", ma);
page = add_page(ma->notebook, _("Load"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
- add_color_selector(page, _("_Average"), "loadavg_color0", ma);
- add_color_selector(page, _("_Background"), "loadavg_color1", ma);
+ add_color_selector(page, _("_Average"), "loadavg-color0", ma);
+ add_color_selector(page, _("_Background"), "loadavg-color1", ma);
page = add_page (ma->notebook, _("Harddisk"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
- add_color_selector (page, _("_Read"), "diskload_color0", ma);
- add_color_selector (page, _("_Write"), "diskload_color1", ma);
- add_color_selector (page, _("_Background"), "diskload_color2", ma);
+ add_color_selector (page, _("_Read"), "diskload-color0", ma);
+ add_color_selector (page, _("_Write"), "diskload-color1", ma);
+ add_color_selector (page, _("_Background"), "diskload-color2", ma);
return;
}