summaryrefslogtreecommitdiff
path: root/sensors-applet
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2011-11-22 00:52:00 +0100
committerStefano Karapetsas <[email protected]>2011-11-22 00:52:00 +0100
commita509013b9b4a80a13bfb4adb365dee38fb2b81d7 (patch)
treec8e06e0e5354eb9868ade186960ba9e0df29fb68 /sensors-applet
parent69ecddf1317e71f35b1c1de00392dc76f8f1701c (diff)
downloadmate-sensors-applet-a509013b9b4a80a13bfb4adb365dee38fb2b81d7.tar.bz2
mate-sensors-applet-a509013b9b4a80a13bfb4adb365dee38fb2b81d7.tar.xz
converted to MATE (thanks to perberos)
Diffstat (limited to 'sensors-applet')
-rw-r--r--sensors-applet/Makefile.am20
-rw-r--r--sensors-applet/Makefile.in38
-rw-r--r--sensors-applet/about-dialog.c2
-rw-r--r--sensors-applet/active-sensor-libmatenotify.c113
-rw-r--r--sensors-applet/active-sensor-libmatenotify.h35
-rw-r--r--sensors-applet/active-sensor.c40
-rw-r--r--sensors-applet/active-sensor.h8
-rw-r--r--sensors-applet/config.h.in4
-rw-r--r--sensors-applet/main.c6
-rw-r--r--sensors-applet/prefs-dialog.c48
-rw-r--r--sensors-applet/prefs-dialog.h2
-rw-r--r--sensors-applet/sensor-config-dialog.c2
-rw-r--r--sensors-applet/sensors-applet-mateconf.c492
-rw-r--r--sensors-applet/sensors-applet-mateconf.h91
-rw-r--r--sensors-applet/sensors-applet-plugins.c2
-rw-r--r--sensors-applet/sensors-applet.c108
-rw-r--r--sensors-applet/sensors-applet.h18
17 files changed, 880 insertions, 149 deletions
diff --git a/sensors-applet/Makefile.am b/sensors-applet/Makefile.am
index a87feb0..bce8d57 100644
--- a/sensors-applet/Makefile.am
+++ b/sensors-applet/Makefile.am
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \
+INCLUDES = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \
-DG_LOG_DOMAIN=\""Sensors Applet"\" \
-DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \
-DDATADIR=\""$(datadir)"\" \
@@ -8,16 +8,16 @@ INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-I$(top_srcdir) \
- $(GLIB_CFLAGS) $(GTK_CFLAGS) $(GNOME_CFLAGS) $(CAIRO_CFLAGS) $(LIBNOTIFY_CFLAGS)
+ $(GLIB_CFLAGS) $(GTK_CFLAGS) $(MATE_CFLAGS) $(CAIRO_CFLAGS) $(LIBMATENOTIFY_CFLAGS)
-LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(GNOME_LIBS) $(CAIRO_LIBS) $(LIBNOTIFY_LIBS)
+LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(MATE_LIBS) $(CAIRO_LIBS) $(LIBMATENOTIFY_LIBS)
-if LIBNOTIFY
-libnotify_SRC = active-sensor-libnotify.c \
- active-sensor-libnotify.h
+if LIBMATENOTIFY
+libmatenotify_SRC = active-sensor-libmatenotify.c \
+ active-sensor-libmatenotify.h
else
-libnotify_SRC =
+libmatenotify_SRC =
endif
libexec_PROGRAMS = sensors-applet
@@ -35,9 +35,9 @@ sensors_applet_SOURCES = main.c \
sensors-applet-sensor.h \
sensors-applet-plugins.c \
sensors-applet-plugins.h \
- sensors-applet-gconf.c \
- sensors-applet-gconf.h \
- $(libnotify_SRC)
+ sensors-applet-mateconf.c \
+ sensors-applet-mateconf.h \
+ $(libmatenotify_SRC)
# install headers for plugins to use
INST_H_FILES = sensors-applet-plugin.h sensors-applet-sensor.h
diff --git a/sensors-applet/Makefile.in b/sensors-applet/Makefile.in
index dd6765f..e69178a 100644
--- a/sensors-applet/Makefile.in
+++ b/sensors-applet/Makefile.in
@@ -54,14 +54,14 @@ am__sensors_applet_SOURCES_DIST = main.c about-dialog.c about-dialog.h \
sensor-config-dialog.c sensor-config-dialog.h sensors-applet.c \
sensors-applet.h sensors-applet-sensor.h \
sensors-applet-plugins.c sensors-applet-plugins.h \
- sensors-applet-gconf.c sensors-applet-gconf.h \
- active-sensor-libnotify.c active-sensor-libnotify.h
-@LIBNOTIFY_TRUE@am__objects_1 = active-sensor-libnotify.$(OBJEXT)
+ sensors-applet-mateconf.c sensors-applet-mateconf.h \
+ active-sensor-libmatenotify.c active-sensor-libmatenotify.h
+@LIBMATENOTIFY_TRUE@am__objects_1 = active-sensor-libmatenotify.$(OBJEXT)
am_sensors_applet_OBJECTS = main.$(OBJEXT) about-dialog.$(OBJEXT) \
active-sensor.$(OBJEXT) prefs-dialog.$(OBJEXT) \
sensor-config-dialog.$(OBJEXT) sensors-applet.$(OBJEXT) \
sensors-applet-plugins.$(OBJEXT) \
- sensors-applet-gconf.$(OBJEXT) $(am__objects_1)
+ sensors-applet-mateconf.$(OBJEXT) $(am__objects_1)
sensors_applet_OBJECTS = $(am_sensors_applet_OBJECTS)
sensors_applet_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@
@@ -143,8 +143,8 @@ GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
-GNOME_CFLAGS = @GNOME_CFLAGS@
-GNOME_LIBS = @GNOME_LIBS@
+MATE_CFLAGS = @MATE_CFLAGS@
+MATE_LIBS = @MATE_LIBS@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
@@ -164,10 +164,10 @@ LD = @LD@
LDFLAGS = @LDFLAGS@
LIBATASMART_CFLAGS = @LIBATASMART_CFLAGS@
LIBATASMART_LIBS = @LIBATASMART_LIBS@
-LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@
-LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@
+LIBMATENOTIFY_CFLAGS = @LIBMATENOTIFY_CFLAGS@
+LIBMATENOTIFY_LIBS = @LIBMATENOTIFY_LIBS@
LIBOBJS = @LIBOBJS@
-LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(GNOME_LIBS) $(CAIRO_LIBS) $(LIBNOTIFY_LIBS)
+LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(MATE_LIBS) $(CAIRO_LIBS) $(LIBMATENOTIFY_LIBS)
LIBSENSORS_CFLAGS = @LIBSENSORS_CFLAGS@
LIBSENSORS_LIBS = @LIBSENSORS_LIBS@
LIBTOOL = @LIBTOOL@
@@ -266,7 +266,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \
+INCLUDES = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \
-DG_LOG_DOMAIN=\""Sensors Applet"\" \
-DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \
-DDATADIR=\""$(datadir)"\" \
@@ -275,11 +275,11 @@ INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-I$(top_srcdir) \
- $(GLIB_CFLAGS) $(GTK_CFLAGS) $(GNOME_CFLAGS) $(CAIRO_CFLAGS) $(LIBNOTIFY_CFLAGS)
+ $(GLIB_CFLAGS) $(GTK_CFLAGS) $(MATE_CFLAGS) $(CAIRO_CFLAGS) $(LIBMATENOTIFY_CFLAGS)
-@LIBNOTIFY_FALSE@libnotify_SRC =
-@LIBNOTIFY_TRUE@libnotify_SRC = active-sensor-libnotify.c \
-@LIBNOTIFY_TRUE@ active-sensor-libnotify.h
+@LIBMATENOTIFY_FALSE@libmatenotify_SRC =
+@LIBMATENOTIFY_TRUE@libmatenotify_SRC = active-sensor-libmatenotify.c \
+@LIBMATENOTIFY_TRUE@ active-sensor-libmatenotify.h
sensors_applet_SOURCES = main.c \
about-dialog.c \
@@ -295,9 +295,9 @@ sensors_applet_SOURCES = main.c \
sensors-applet-sensor.h \
sensors-applet-plugins.c \
sensors-applet-plugins.h \
- sensors-applet-gconf.c \
- sensors-applet-gconf.h \
- $(libnotify_SRC)
+ sensors-applet-mateconf.c \
+ sensors-applet-mateconf.h \
+ $(libmatenotify_SRC)
# install headers for plugins to use
@@ -413,12 +413,12 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/about-dialog.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/active-sensor-libnotify.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/active-sensor-libmatenotify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/active-sensor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefs-dialog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sensor-config-dialog.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sensors-applet-gconf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sensors-applet-mateconf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sensors-applet-plugins.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sensors-applet.Po@am__quote@
diff --git a/sensors-applet/about-dialog.c b/sensors-applet/about-dialog.c
index 27a86f1..0a538d2 100644
--- a/sensors-applet/about-dialog.c
+++ b/sensors-applet/about-dialog.c
@@ -20,7 +20,7 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#include <gnome.h>
+#include <mate.h>
#include "about-dialog.h"
void about_dialog_open(SensorsApplet *sensors_applet) {
diff --git a/sensors-applet/active-sensor-libmatenotify.c b/sensors-applet/active-sensor-libmatenotify.c
new file mode 100644
index 0000000..a81f4f0
--- /dev/null
+++ b/sensors-applet/active-sensor-libmatenotify.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2005-2009 Alex Murray <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef HAVE_LIBMATENOTIFY
+#include <libmatenotify/notify.h>
+#endif
+
+#include "active-sensor-libmatenotify.h"
+
+static void notif_closed_cb(NotifyNotification *notification,
+ ActiveSensor *active_sensor)
+{
+ g_assert(notification != NULL && active_sensor != NULL);
+
+ int i;
+
+ g_debug("Notification was closed.. setting reference to NULL so we can show again if needed.");
+
+ // set notif reference to NULL
+ for (i = 0; i < NUM_NOTIFS; i++) {
+ if (active_sensor->notification[i] == notification) {
+ active_sensor->notification[i] = NULL;
+ break;
+ }
+ }
+}
+
+
+void active_sensor_libmatenotify_notify_end(ActiveSensor *active_sensor,
+ NotifType notif_type) {
+ GError *error = NULL;
+ if (active_sensor->notification[notif_type]) {
+ g_debug("Closing notification");
+ if(!notify_notification_close(active_sensor->notification[notif_type],
+ &error)) {
+ g_warning("Error closing notification: %s", error->message);
+ g_error_free(error);
+ }
+ g_object_unref(active_sensor->notification[notif_type]);
+ active_sensor->notification[notif_type] = NULL;
+ }
+}
+
+void active_sensor_libmatenotify_notify(ActiveSensor *active_sensor,
+ NotifType notif_type,
+ const gchar *summary,
+ const gchar *message,
+ const gchar *icon_filename,
+ gint timeout_msecs,
+ GtkWidget *attach) {
+ GError *error = NULL;
+
+ if (!notify_is_initted()) {
+ if (!notify_init(PACKAGE)) {
+ return;
+ }
+ }
+ g_debug("Doing notification %s: %s: %s", (notif_type == SENSOR_INTERFACE_ERROR ? "interface-error" : "other") ,summary, message);
+
+ /* leave any existing notification since most likely hasn't changed */
+ if (active_sensor->notification[notif_type] != NULL) {
+ return;
+/* active_sensor_libmatenotify_notify_end(active_sensor, notif_type); */
+ }
+
+ /* now create a new one */
+ g_debug("Creating new notification");
+ active_sensor->notification[notif_type] = notify_notification_new(summary,
+ message,
+ icon_filename,
+ attach);
+ g_signal_connect(active_sensor->notification[notif_type], "closed",
+ G_CALLBACK(notif_closed_cb),
+ active_sensor);
+
+ notify_notification_set_urgency(active_sensor->notification[notif_type],
+ NOTIFY_URGENCY_CRITICAL);
+
+
+ /* timeout may have changed so update it */
+ notify_notification_set_timeout(active_sensor->notification[notif_type],
+ timeout_msecs);
+
+
+ g_debug("showing notification");
+ if (!notify_notification_show(active_sensor->notification[notif_type], &error)) {
+ g_debug("Error showing notification: %s", error->message);
+ g_error_free(error);
+ }
+
+
+
+}
+
diff --git a/sensors-applet/active-sensor-libmatenotify.h b/sensors-applet/active-sensor-libmatenotify.h
new file mode 100644
index 0000000..9ec3729
--- /dev/null
+++ b/sensors-applet/active-sensor-libmatenotify.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2005-2009 Alex Murray <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef ACTIVE_SESNOR_LIBMATENOTIFY_H
+#define ACTIVE_SENSOR_LIBMATENOTIFY_H
+
+#include "sensors-applet.h"
+#include "active-sensor.h"
+
+void active_sensor_libmatenotify_notify(ActiveSensor *active_sensor,
+ NotifType notif_type,
+ const gchar *summary,
+ const gchar *message,
+ const gchar *icon_filename,
+ gint timeout_msecs,
+ GtkWidget *attach);
+void active_sensor_libmatenotify_notify_end(ActiveSensor *active_sensor,
+ NotifType notif_type);
+
+#endif /* SENSORS_APPLET_LIBMATENOTIFY_H */
diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c
index 84b84cc..50dccef 100644
--- a/sensors-applet/active-sensor.c
+++ b/sensors-applet/active-sensor.c
@@ -24,12 +24,12 @@
#include <string.h>
#endif /* HAVE_STRING_H */
-#include <gconf/gconf-client.h>
-#include <gnome.h>
+#include <mateconf/mateconf-client.h>
+#include <mate.h>
#include "active-sensor.h"
#include "sensors-applet-plugins.h"
-#include "sensors-applet-gconf.h"
+#include "sensors-applet-mateconf.h"
typedef enum {
VERY_LOW_SENSOR_VALUE = 0,
@@ -80,7 +80,7 @@ static gboolean active_sensor_execute_alarm(ActiveSensor *active_sensor,
(notif_type == LOW_ALARM ?
"LOW" : "HIGH"),
active_sensor->alarm_command[notif_type]);
- pid = gnome_execute_shell(NULL,
+ pid = mate_execute_shell(NULL,
active_sensor->alarm_command[notif_type]);
g_debug("Command executed in shell with pid %d", pid);
@@ -426,7 +426,7 @@ void active_sensor_update_graph_dimensions(ActiveSensor *as,
ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet,
GtkTreeRowReference *sensor_row) {
ActiveSensor *active_sensor;
- PanelAppletOrient orient;
+ MatePanelAppletOrient orient;
gint graph_size;
gboolean horizontal;
@@ -459,12 +459,12 @@ ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet,
GDK_ALL_EVENTS_MASK);
/* need to set size according to orientation */
- orient = panel_applet_get_orient(active_sensor->sensors_applet->applet);
- graph_size = panel_applet_gconf_get_int(active_sensor->sensors_applet->applet,
+ orient = mate_panel_applet_get_orient(active_sensor->sensors_applet->applet);
+ graph_size = mate_panel_applet_mateconf_get_int(active_sensor->sensors_applet->applet,
GRAPH_SIZE, NULL);
- horizontal = ((orient == PANEL_APPLET_ORIENT_UP) ||
- (orient == PANEL_APPLET_ORIENT_DOWN));
+ horizontal = ((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+ (orient == MATE_PANEL_APPLET_ORIENT_DOWN));
active_sensor_set_graph_dimensions(active_sensor,
(horizontal ? graph_size : sensors_applet->size),
@@ -527,8 +527,8 @@ void active_sensor_update(ActiveSensor *active_sensor,
gchar *tooltip = NULL;
gchar *value_tooltip = NULL;
- /* hidden gconf options */
- GConfClient *client;
+ /* hidden mateconf options */
+ MateConfClient *client;
gint font_size = 0;
gboolean hide_units = FALSE;
@@ -584,14 +584,14 @@ void active_sensor_update(ActiveSensor *active_sensor,
* note this is not unique */
sensor_value = -1;
} else {
- /* use hidden gconf key for hide_units */
+ /* use hidden mateconf key for hide_units */
- if ((client = gconf_client_get_default()) != NULL) {
- hide_units = gconf_client_get_bool(client,
+ if ((client = mateconf_client_get_default()) != NULL) {
+ hide_units = mateconf_client_get_bool(client,
"/apps/sensors-applet/" HIDE_UNITS,
&error);
if (error) {
- g_debug("Could not get hide units from GConf - assuming false");
+ g_debug("Could not get hide units from MateConf - assuming false");
hide_units = FALSE;
g_error_free(error);
error = NULL;
@@ -606,7 +606,7 @@ void active_sensor_update(ActiveSensor *active_sensor,
switch (sensor_type) {
case TEMP_SENSOR:
- scale = (TemperatureScale)panel_applet_gconf_get_int(sensors_applet->applet, TEMPERATURE_SCALE, NULL);
+ scale = (TemperatureScale)mate_panel_applet_mateconf_get_int(sensors_applet->applet, TEMPERATURE_SCALE, NULL);
/* scale value */
sensor_value = sensors_applet_convert_temperature(sensor_value,
CELSIUS,
@@ -661,17 +661,17 @@ void active_sensor_update(ActiveSensor *active_sensor,
g_free(value_tooltip);
/* only do icons and labels / graphs if needed */
- display_mode = panel_applet_gconf_get_int(sensors_applet->applet,
+ display_mode = mate_panel_applet_mateconf_get_int(sensors_applet->applet,
DISPLAY_MODE,
NULL);
/* most users wont have a font size set */
- if ((client = gconf_client_get_default()) != NULL) {
- font_size = gconf_client_get_int(client,
+ if ((client = mateconf_client_get_default()) != NULL) {
+ font_size = mateconf_client_get_int(client,
"/apps/sensors-applet/" FONT_SIZE,
&error);
if (error) {
- g_debug("Could not get font size from GConf - assuming default size");
+ g_debug("Could not get font size from MateConf - assuming default size");
font_size = 0;
g_error_free(error);
error = NULL;
diff --git a/sensors-applet/active-sensor.h b/sensors-applet/active-sensor.h
index 2d4674b..c72f175 100644
--- a/sensors-applet/active-sensor.h
+++ b/sensors-applet/active-sensor.h
@@ -19,9 +19,9 @@
#ifndef ACTIVE_SENSOR_H
#define ACTIVE_SENSOR_H
-#ifdef HAVE_LIBNOTIFY
-#include <libnotify/notify.h>
-#include "active-sensor-libnotify.h"
+#ifdef HAVE_LIBMATENOTIFY
+#include <libmatenotify/notify.h>
+#include "active-sensor-libmatenotify.h"
#endif
#include "sensors-applet.h"
@@ -40,7 +40,7 @@ struct _ActiveSensor {
GtkTreeRowReference *sensor_row;
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
NotifyNotification *notification[NUM_NOTIFS];
#endif
diff --git a/sensors-applet/config.h.in b/sensors-applet/config.h.in
index a32469b..a5d04de 100644
--- a/sensors-applet/config.h.in
+++ b/sensors-applet/config.h.in
@@ -36,8 +36,8 @@
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
-/* libnotify available */
-#undef HAVE_LIBNOTIFY
+/* libmatenotify available */
+#undef HAVE_LIBMATENOTIFY
/* libsensors is available */
#undef HAVE_LIBSENSORS
diff --git a/sensors-applet/main.c b/sensors-applet/main.c
index b04e9eb..ade7edd 100644
--- a/sensors-applet/main.c
+++ b/sensors-applet/main.c
@@ -20,11 +20,11 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#include <panel-applet.h>
+#include <mate-panel-applet.h>
#include <string.h>
#include "sensors-applet.h"
-static gboolean sensors_applet_fill(PanelApplet *applet,
+static gboolean sensors_applet_fill(MatePanelApplet *applet,
const gchar *iid,
gpointer data) {
SensorsApplet *sensors_applet;
@@ -38,7 +38,7 @@ static gboolean sensors_applet_fill(PanelApplet *applet,
return retval;
}
-PANEL_APPLET_BONOBO_FACTORY ("OAFIID:SensorsApplet_Factory",
+MATE_PANEL_APPLET_MATECOMPONENT_FACTORY ("OAFIID:SensorsApplet_Factory",
PANEL_TYPE_APPLET,
PACKAGE,
PACKAGE_VERSION,
diff --git a/sensors-applet/prefs-dialog.c b/sensors-applet/prefs-dialog.c
index fc7d3ac..711fac9 100644
--- a/sensors-applet/prefs-dialog.c
+++ b/sensors-applet/prefs-dialog.c
@@ -20,8 +20,8 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#include <libgnome/libgnome.h>
-#include "sensors-applet-gconf.h"
+#include <libmate/libmate.h>
+#include "sensors-applet-mateconf.h"
#include "prefs-dialog.h"
#include "sensor-config-dialog.h"
@@ -29,12 +29,12 @@
#define NEW_TEMP_SCALE 1
/* when a user closes the prefs-dialog we assume that applet is now
- setup, so store all values in gconf */
+ setup, so store all values in mateconf */
void prefs_dialog_close(SensorsApplet *sensors_applet) {
if (sensors_applet->sensors != NULL) {
- if (sensors_applet_gconf_save_sensors(sensors_applet))
- panel_applet_gconf_set_bool(sensors_applet->applet,
+ if (sensors_applet_mateconf_save_sensors(sensors_applet))
+ mate_panel_applet_mateconf_set_bool(sensors_applet->applet,
IS_SETUP, TRUE, NULL);
}
if (sensors_applet->prefs_dialog) {
@@ -44,7 +44,7 @@ void prefs_dialog_close(SensorsApplet *sensors_applet) {
}
if (sensors_applet->timeout_id == 0) {
- sensors_applet->timeout_id = g_timeout_add_seconds(panel_applet_gconf_get_int(sensors_applet->applet, TIMEOUT, NULL) / 1000, (GSourceFunc)sensors_applet_update_active_sensors, sensors_applet);
+ sensors_applet->timeout_id = g_timeout_add_seconds(mate_panel_applet_mateconf_get_int(sensors_applet->applet, TIMEOUT, NULL) / 1000, (GSourceFunc)sensors_applet_update_active_sensors, sensors_applet);
}
@@ -125,7 +125,7 @@ static void prefs_dialog_timeout_changed(GtkSpinButton *button,
PrefsDialog *prefs_dialog) {
gint value;
value = (gint)(gtk_spin_button_get_value(button) * 1000);
- panel_applet_gconf_set_int(prefs_dialog->sensors_applet->applet, TIMEOUT, value, NULL);
+ mate_panel_applet_mateconf_set_int(prefs_dialog->sensors_applet->applet, TIMEOUT, value, NULL);
}
static void prefs_dialog_display_mode_changed(GtkComboBox *display_mode_combo_box,
@@ -149,7 +149,7 @@ static void prefs_dialog_display_mode_changed(GtkComboBox *display_mode_combo_bo
gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->graph_size_spinbutton),
(display_mode == DISPLAY_GRAPH));
- panel_applet_gconf_set_int(prefs_dialog->sensors_applet->applet,
+ mate_panel_applet_mateconf_set_int(prefs_dialog->sensors_applet->applet,
DISPLAY_MODE,
gtk_combo_box_get_active(display_mode_combo_box),
NULL);
@@ -160,7 +160,7 @@ static void prefs_dialog_display_mode_changed(GtkComboBox *display_mode_combo_bo
static void prefs_dialog_layout_mode_changed(GtkComboBox *layout_mode_combo_box,
PrefsDialog *prefs_dialog) {
- panel_applet_gconf_set_int(prefs_dialog->sensors_applet->applet,
+ mate_panel_applet_mateconf_set_int(prefs_dialog->sensors_applet->applet,
LAYOUT_MODE,
gtk_combo_box_get_active(layout_mode_combo_box),
NULL);
@@ -175,13 +175,13 @@ static void prefs_dialog_temperature_scale_changed(GtkComboBox *temperature_scal
TemperatureScale scales[2];
GtkTreeModel *model;
- scales[OLD_TEMP_SCALE] = (TemperatureScale)panel_applet_gconf_get_int(prefs_dialog->sensors_applet->applet,
+ scales[OLD_TEMP_SCALE] = (TemperatureScale)mate_panel_applet_mateconf_get_int(prefs_dialog->sensors_applet->applet,
TEMPERATURE_SCALE,
NULL);
scales[NEW_TEMP_SCALE] = (TemperatureScale)gtk_combo_box_get_active(temperature_scale_combo_box);
- panel_applet_gconf_set_int(prefs_dialog->sensors_applet->applet,
+ mate_panel_applet_mateconf_set_int(prefs_dialog->sensors_applet->applet,
TEMPERATURE_SCALE,
scales[NEW_TEMP_SCALE],
NULL);
@@ -198,14 +198,14 @@ static void prefs_dialog_temperature_scale_changed(GtkComboBox *temperature_scal
}
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
static void prefs_dialog_display_notifications_toggled(GtkCheckButton *display_notifications,
PrefsDialog *prefs_dialog) {
gboolean notify;
notify = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(display_notifications));
- panel_applet_gconf_set_bool(prefs_dialog->sensors_applet->applet,
+ mate_panel_applet_mateconf_set_bool(prefs_dialog->sensors_applet->applet,
DISPLAY_NOTIFICATIONS,
notify,
NULL);
@@ -222,7 +222,7 @@ static void prefs_dialog_graph_size_changed(GtkSpinButton *button,
PrefsDialog *prefs_dialog) {
gint value;
value = (gint)(gtk_spin_button_get_value(button));
- panel_applet_gconf_set_int(prefs_dialog->sensors_applet->applet, GRAPH_SIZE, value, NULL);
+ mate_panel_applet_mateconf_set_int(prefs_dialog->sensors_applet->applet, GRAPH_SIZE, value, NULL);
/* notify change of number of samples */
sensors_applet_graph_size_changed(prefs_dialog->sensors_applet);
@@ -472,7 +472,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
gtk_combo_box_append_text(prefs_dialog->display_mode_combo_box, _("graph only"));
- display_mode = panel_applet_gconf_get_int(sensors_applet->applet, DISPLAY_MODE, NULL);
+ display_mode = mate_panel_applet_mateconf_get_int(sensors_applet->applet, DISPLAY_MODE, NULL);
gtk_combo_box_set_active(prefs_dialog->display_mode_combo_box, display_mode);
g_signal_connect(prefs_dialog->display_mode_combo_box,
@@ -503,7 +503,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
gtk_combo_box_append_text(prefs_dialog->layout_mode_combo_box, _("beside labels / icons"));
gtk_combo_box_append_text(prefs_dialog->layout_mode_combo_box, _("below labels / icons"));
- gtk_combo_box_set_active(prefs_dialog->layout_mode_combo_box, panel_applet_gconf_get_int(sensors_applet->applet, LAYOUT_MODE, NULL));
+ gtk_combo_box_set_active(prefs_dialog->layout_mode_combo_box, mate_panel_applet_mateconf_get_int(sensors_applet->applet, LAYOUT_MODE, NULL));
g_signal_connect(prefs_dialog->layout_mode_combo_box,
"changed",
@@ -528,7 +528,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
gtk_combo_box_append_text(prefs_dialog->temperature_scale_combo_box, _("Celsius"));
gtk_combo_box_append_text(prefs_dialog->temperature_scale_combo_box, _("Fahrenheit"));
- gtk_combo_box_set_active(prefs_dialog->temperature_scale_combo_box, panel_applet_gconf_get_int(sensors_applet->applet, TEMPERATURE_SCALE, NULL));
+ gtk_combo_box_set_active(prefs_dialog->temperature_scale_combo_box, mate_panel_applet_mateconf_get_int(sensors_applet->applet, TEMPERATURE_SCALE, NULL));
g_signal_connect(prefs_dialog->temperature_scale_combo_box,
"changed",
@@ -543,7 +543,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
NULL);
prefs_dialog->graph_size_adjust = g_object_new(GTK_TYPE_ADJUSTMENT,
- "value", (gdouble)panel_applet_gconf_get_int(sensors_applet->applet,
+ "value", (gdouble)mate_panel_applet_mateconf_get_int(sensors_applet->applet,
GRAPH_SIZE,
NULL),
"lower", 1.0,
@@ -557,7 +557,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
"adjustment", prefs_dialog->graph_size_adjust,
"climb-rate", 1.0,
"digits", 0,
- "value", (gdouble)panel_applet_gconf_get_int(sensors_applet->applet,
+ "value", (gdouble)mate_panel_applet_mateconf_get_int(sensors_applet->applet,
GRAPH_SIZE,
NULL),
"width-chars", 4,
@@ -604,7 +604,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
"adjustment", prefs_dialog->timeout_adjust,
"climb-rate", 0.5,
"digits", 1,
- "value", (gdouble) panel_applet_gconf_get_int(sensors_applet->applet, TIMEOUT, NULL) / 1000.0,
+ "value", (gdouble) mate_panel_applet_mateconf_get_int(sensors_applet->applet, TIMEOUT, NULL) / 1000.0,
"width-chars", 4,
NULL);
@@ -620,7 +620,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
G_CALLBACK(prefs_dialog_timeout_changed),
prefs_dialog);
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
header_text = g_markup_printf_escaped("<b>%s</b>", _("Notifications"));
prefs_dialog->notifications_header = g_object_new(GTK_TYPE_LABEL,
"use-markup", TRUE,
@@ -635,7 +635,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
"label", _("Display _notifications"),
NULL);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(prefs_dialog->display_notifications),
- panel_applet_gconf_get_bool(sensors_applet->applet,
+ mate_panel_applet_mateconf_get_bool(sensors_applet->applet,
DISPLAY_NOTIFICATIONS,
NULL));
g_signal_connect(prefs_dialog->display_notifications,
@@ -665,7 +665,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
prefs_dialog->globals_table = g_object_new(GTK_TYPE_TABLE,
"homogeneous", FALSE,
"n-columns", 3,
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
"n-rows", 9,
#else
"n-rows", 7,
@@ -785,7 +785,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) {
0);
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
gtk_table_attach(prefs_dialog->globals_table,
GTK_WIDGET(prefs_dialog->notifications_header),
0, 2,
diff --git a/sensors-applet/prefs-dialog.h b/sensors-applet/prefs-dialog.h
index 5d1270b..056c133 100644
--- a/sensors-applet/prefs-dialog.h
+++ b/sensors-applet/prefs-dialog.h
@@ -38,7 +38,7 @@ typedef struct {
GtkLabel *timeout_label, *display_mode_label, *layout_mode_label, *temperature_scale_label, *graph_size_label, *update_header, *display_header;
GtkAdjustment *timeout_adjust, *graph_size_adjust;
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
GtkCheckButton *display_notifications;
GtkLabel *notifications_header;
#endif
diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c
index bd55836..23107d7 100644
--- a/sensors-applet/sensor-config-dialog.c
+++ b/sensors-applet/sensor-config-dialog.c
@@ -20,7 +20,7 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#include <gnome.h>
+#include <mate.h>
#include "sensor-config-dialog.h"
#include "sensors-applet.h"
diff --git a/sensors-applet/sensors-applet-mateconf.c b/sensors-applet/sensors-applet-mateconf.c
new file mode 100644
index 0000000..43e9d0c
--- /dev/null
+++ b/sensors-applet/sensors-applet-mateconf.c
@@ -0,0 +1,492 @@
+/*
+ * Copyright (C) 2005-2009 Alex Murray <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include "sensors-applet.h"
+#include "sensors-applet-mateconf.h"
+
+#define DEFAULT_TIMEOUT 2000
+#define DEFAULT_GRAPH_SIZE 42
+
+static const gchar * const compatible_versions[] = {
+ PACKAGE_VERSION, /* always list current version */
+ "2.2.6",
+ "2.2.5",
+ "2.2.4",
+ "2.2.3",
+ "2.2.2",
+};
+
+#define NUM_COMPATIBLE_VERSIONS G_N_ELEMENTS(compatible_versions)
+
+typedef enum {
+ SENSORS_APPLET_MATECONF_ERROR = 0,
+ SENSORS_APPLET_VERSION_ERROR,
+} SensorsAppletMateConfError;
+
+static const gchar * const error_titles[] = {
+ N_("An error occurred loading the stored sensors data"),
+ N_("Incompatible sensors configuration found")
+};
+
+static const gchar * const error_messages[] = {
+ N_("An error has occurred when loading the stored sensors data. "
+ "The default values will be used to recover from this error."),
+
+ N_("Unfortunately the previous configuration for MATE Sensors Applet "
+ "is not compatible with this version. The existing sensors data "
+ "will be overwritten with the default values for this new version.")
+};
+
+/* function to be called if an error occurs
+ when loading values from mateconf */
+static void sensors_applet_mateconf_error_occurred(SensorsAppletMateConfError error) {
+ GtkWidget *dialog;
+ gchar *markup;
+
+ g_debug("Error occurred: %s", error_titles[error]);
+ markup = g_markup_printf_escaped("<span size=\"large\" weight=\"bold\">%s</span>\n\n%s", _(error_titles[error]), _(error_messages[error]));
+
+ dialog = gtk_message_dialog_new_with_markup(NULL, /* no parent window */
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "%s", markup);
+
+ g_free(markup);
+
+ /* runs dialog as modal and doesn't return until user clicks
+ * button */
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
+
+static void sensors_applet_mateconf_set_defaults(SensorsApplet *sensors_applet) {
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet, DISPLAY_MODE, DISPLAY_ICON_WITH_VALUE, NULL);
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet, LAYOUT_MODE, VALUE_BESIDE_LABEL, NULL);
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet, TEMPERATURE_SCALE, CELSIUS, NULL);
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet, TIMEOUT, DEFAULT_TIMEOUT, NULL);
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet, GRAPH_SIZE, DEFAULT_GRAPH_SIZE, NULL);
+#ifdef HAVE_LIBMATENOTIFY
+ mate_panel_applet_mateconf_set_bool(sensors_applet->applet, DISPLAY_NOTIFICATIONS, TRUE, NULL);
+#endif
+ mate_panel_applet_mateconf_set_bool(sensors_applet->applet, IS_SETUP, FALSE, NULL);
+
+}
+
+/**
+ * Returns TRUE is old_version is one of the compatible versions
+ */
+static gboolean sensors_applet_mateconf_is_compatible(const gchar *old_version) {
+ guint i;
+ for (i = 0; i < NUM_COMPATIBLE_VERSIONS; i++) {
+ if (g_ascii_strcasecmp(old_version, compatible_versions[i]) == 0) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+void sensors_applet_mateconf_setup(SensorsApplet *sensors_applet) {
+ gboolean setup = FALSE;
+ gchar *old_version;
+ GError *error = NULL;
+
+ /* need to convert old num_samples value to new GRAPH_SIZE
+ * parameter */
+ gint num_samples;
+ if ((num_samples = mate_panel_applet_mateconf_get_int(sensors_applet->applet,
+ "num_samples",
+ NULL))) {
+ g_debug("Convering old num_samples value %d into graph_size", num_samples);
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet,
+ GRAPH_SIZE,
+ (num_samples + GRAPH_FRAME_EXTRA_WIDTH),
+ NULL);
+ /* reset num_samples to zero */
+ mate_panel_applet_mateconf_set_int(sensors_applet->applet,
+ "num_samples",
+ 0,
+ NULL);
+
+ }
+
+ /* convert old alarm_commands to high and low if exist */
+ GSList *alarm_commands;
+ if ((alarm_commands = mate_panel_applet_mateconf_get_list(sensors_applet->applet,
+ "alarm_commands",
+ MATECONF_VALUE_STRING,
+ NULL))) {
+
+ g_debug("Converting old alarm commands to new high and low commands");
+
+ mate_panel_applet_mateconf_set_list(sensors_applet->applet,
+ LOW_ALARM_COMMANDS,
+ MATECONF_VALUE_STRING,
+ alarm_commands,
+ NULL);
+ mate_panel_applet_mateconf_set_list(sensors_applet->applet,
+ HIGH_ALARM_COMMANDS,
+ MATECONF_VALUE_STRING,
+ alarm_commands,
+ NULL);
+ /* reset old list to null */
+ mate_panel_applet_mateconf_set_list(sensors_applet->applet,
+ "alarm_commands",
+ MATECONF_VALUE_STRING,
+ NULL,
+ NULL);
+ g_slist_foreach(alarm_commands, (GFunc)g_free, NULL);
+ g_slist_free(alarm_commands);
+
+ }
+
+ setup = mate_panel_applet_mateconf_get_bool(sensors_applet->applet,
+ IS_SETUP, &error);
+ if (error) {
+ g_debug("Previous configuration not found: %s, setting up manually", error->message);
+ g_error_free(error);
+ error = NULL;
+ setup = FALSE;
+ }
+
+
+ if (setup) {
+ /* see if setup version matches */
+ old_version = mate_panel_applet_mateconf_get_string(sensors_applet->applet,
+ SENSORS_APPLET_VERSION,
+ &error);
+ /* if versions don't match or there is no saved
+ * version string then need to overwrite old config */
+ if (error) {
+ g_debug("Error getting old version string: %s", error->message);
+ g_error_free(error);
+ error = NULL;
+ old_version = NULL;
+ }
+
+ if (old_version) {
+ if (sensors_applet_mateconf_is_compatible(old_version)) {
+ /* previously setup and versions match so use
+ * old values */
+ g_debug("MateConf data is compatible. Trying to set up sensors from mateconf data");
+ if (sensors_applet_mateconf_setup_sensors(sensors_applet)) {
+ g_debug("done setting up from mateconf");
+ } else {
+ g_debug("Setting mateconf defaults only");
+ sensors_applet_mateconf_set_defaults(sensors_applet);
+ }
+ g_free(old_version);
+
+ return;
+
+
+ }
+ g_free(old_version);
+
+ }
+ sensors_applet_notify(sensors_applet, MATECONF_READ_ERROR);
+
+
+ sensors_applet_mateconf_error_occurred(SENSORS_APPLET_VERSION_ERROR);
+ }
+
+ /* use defaults */
+ g_debug("Setting mateconf defaults only");
+ sensors_applet_mateconf_set_defaults(sensors_applet);
+}
+
+enum {
+ PATHS_INDEX = 0,
+ IDS_INDEX,
+ LABELS_INDEX,
+ INTERFACES_INDEX,
+ SENSOR_TYPES_INDEX,
+ ENABLES_INDEX,
+ LOW_VALUES_INDEX,
+ HIGH_VALUES_INDEX,
+ ALARM_ENABLES_INDEX,
+ LOW_ALARM_COMMANDS_INDEX,
+ HIGH_ALARM_COMMANDS_INDEX,
+ ALARM_TIMEOUTS_INDEX,
+ MULTIPLIERS_INDEX,
+ OFFSETS_INDEX,
+ ICON_TYPES_INDEX,
+ GRAPH_COLORS_INDEX,
+ NUM_KEYS
+};
+
+const gchar * const keys[NUM_KEYS] = {
+ PATHS,
+ IDS,
+ LABELS,
+ INTERFACES,
+ SENSOR_TYPES,
+ ENABLES,
+ LOW_VALUES,
+ HIGH_VALUES,
+ ALARM_ENABLES,
+ LOW_ALARM_COMMANDS,
+ HIGH_ALARM_COMMANDS,
+ ALARM_TIMEOUTS,
+ MULTIPLIERS,
+ OFFSETS,
+ ICON_TYPES,
+ GRAPH_COLORS,
+};
+
+/* MUST CORRESPOND TO ABOVE KEYS */
+const MateConfValueType key_types[NUM_KEYS] = {
+ MATECONF_VALUE_STRING, /* PATHS */
+ MATECONF_VALUE_STRING, /* IDS, */
+ MATECONF_VALUE_STRING, /* LABELS */
+ MATECONF_VALUE_STRING, /* INTERFACES, */
+ MATECONF_VALUE_INT, /* SENSOR_TYPES, */
+ MATECONF_VALUE_BOOL, /* ENABLES, */
+ MATECONF_VALUE_INT, /* LOW_VALUES, */
+ MATECONF_VALUE_INT, /* HIGH_VALUES, */
+ MATECONF_VALUE_BOOL, /* ALARM_ENABLES, */
+ MATECONF_VALUE_STRING, /* LOW_ALARM_COMMANDS, */
+ MATECONF_VALUE_STRING, /* HIGH_ALARM_COMMANDS, */
+ MATECONF_VALUE_INT, /* ALARM_TIMEOUTS, */
+ MATECONF_VALUE_INT, /* MULTIPLIERS, */
+ MATECONF_VALUE_INT, /* OFFSETS, */
+ MATECONF_VALUE_INT, /* ICON_TYPES, */
+ MATECONF_VALUE_STRING /* GRAPH_COLORS, */
+};
+
+void sensors_applet_mateconf_set_current_to_lists(GSList *current[],
+ GSList *lists[],
+ int len) {
+ for (len--; len >= 0; len--) {
+ current[len] = lists[len];
+ }
+}
+
+int sensors_applet_mateconf_current_not_null(GSList *current[],
+ int len) {
+ for (len--; len >= 0; len--) {
+ if (NULL == current[len]) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+void sensors_applet_mateconf_current_get_next(GSList *current[],
+ int len) {
+ for (len--; len >= 0; len--) {
+ current[len] = g_slist_next(current[len]);
+ }
+}
+
+void sensors_applet_mateconf_free_lists(GSList *lists[],
+ int len) {
+ for (len--; len >= 0; len--) {
+ if (key_types[len] == MATECONF_VALUE_STRING) {
+ g_slist_foreach(lists[len], (GFunc)g_free, NULL);
+ }
+ g_slist_free(lists[len]);
+ }
+
+}
+
+/* gets called if are already setup so we don't have to manually go
+ through and find sensors etc again */
+gboolean sensors_applet_mateconf_setup_sensors(SensorsApplet *sensors_applet) {
+ /* everything gets stored except alarm timeout indexes, which
+ we set to -1, and visible which we set to false for all
+ parent nodes and true for all child nodes */
+ int i;
+ GSList *lists[NUM_KEYS] = {NULL};
+
+ GSList *current[NUM_KEYS] = {NULL};
+
+ GError *error = NULL;
+
+ for (i = 0; i < NUM_KEYS; i++) {
+ lists[i] = mate_panel_applet_mateconf_get_list(sensors_applet->applet,
+ keys[i],
+ key_types[i],
+ &error);
+ if (error || NULL == lists[i]) {
+ sensors_applet_notify(sensors_applet, MATECONF_READ_ERROR);
+
+ sensors_applet_mateconf_error_occurred(SENSORS_APPLET_MATECONF_ERROR);
+ if (error) {
+ g_error_free(error);
+ }
+ return FALSE;
+ }
+ }
+
+ for (sensors_applet_mateconf_set_current_to_lists(current,
+ lists,
+ NUM_KEYS);
+ sensors_applet_mateconf_current_not_null(current,
+ NUM_KEYS);
+ sensors_applet_mateconf_current_get_next(current,
+ NUM_KEYS)) {
+
+
+ g_debug("trying to add sensor from mateconf data: %s\n", (gchar *)(current[IDS_INDEX]->data));
+ /* need to ensure correct order */
+ sensors_applet_add_sensor(sensors_applet,
+ (gchar *)(current[PATHS_INDEX]->data),
+ (gchar *)(current[IDS_INDEX]->data),
+ (gchar *)(current[LABELS_INDEX]->data),
+ (gchar *)(current[INTERFACES_INDEX]->data),
+ GPOINTER_TO_UINT(current[SENSOR_TYPES_INDEX]->data),
+ GPOINTER_TO_INT(current[ENABLES_INDEX]->data),
+ (gdouble)(GPOINTER_TO_INT(current[LOW_VALUES_INDEX]->data) / 1000.0),
+ (gdouble)(GPOINTER_TO_INT(current[HIGH_VALUES_INDEX]->data) / 1000.0),
+ GPOINTER_TO_INT(current[ALARM_ENABLES_INDEX]->data),
+ (gchar *)(current[LOW_ALARM_COMMANDS_INDEX]->data),
+ (gchar *)(current[HIGH_ALARM_COMMANDS_INDEX]->data),
+ GPOINTER_TO_INT(current[ALARM_TIMEOUTS_INDEX]->data),
+ (gdouble)(GPOINTER_TO_INT(current[MULTIPLIERS_INDEX]->data) / 1000.0),
+ (gdouble)(GPOINTER_TO_INT(current[OFFSETS_INDEX]->data) / 1000.0),
+ (SensorType)GPOINTER_TO_UINT(current[ICON_TYPES_INDEX]->data),
+ (gchar *)(current[GRAPH_COLORS_INDEX]->data)
+
+ );
+
+ }
+ sensors_applet_mateconf_free_lists(lists,
+ NUM_KEYS);
+
+ return TRUE;
+}
+
+
+gboolean sensors_applet_mateconf_save_sensors(SensorsApplet *sensors_applet) {
+ /* write everything to mateconf except VISIBLE and
+ ALARM_TIMEOUT_INDEX */
+ /* for stepping through GtkTreeStore data structure */
+ GtkTreeIter interfaces_iter, sensors_iter;
+ gboolean not_end_of_interfaces = TRUE, not_end_of_sensors = TRUE;
+
+ /* make sure all are initialized to null - since list of
+ * intializers is horter than number of element, rest get set
+ * to 0 (ie NULL) */
+ GSList *lists[NUM_KEYS] = {NULL};
+ int i;
+ gchar *current_path, *current_id, *current_label, *current_interface,
+ *current_low_alarm_command, *current_high_alarm_command,
+ *current_graph_color;
+ gboolean current_enable, current_alarm_enable;
+ gdouble current_low_value, current_high_value, current_multiplier,
+ current_offset;
+ guint current_alarm_timeout, current_sensor_type,
+ current_icon_type;
+
+ GError *error = NULL;
+
+ /* now step through the GtkTreeStore sensors to
+ find which sensors are enabled */
+ for (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sensors_applet->sensors), &interfaces_iter); not_end_of_interfaces; not_end_of_interfaces = gtk_tree_model_iter_next(GTK_TREE_MODEL(sensors_applet->sensors), &interfaces_iter)) {
+ // store a mateconf key for this interface
+ gtk_tree_model_get(GTK_TREE_MODEL(sensors_applet->sensors),
+ &interfaces_iter,
+ ID_COLUMN, &current_id,
+ -1);
+
+ mate_panel_applet_mateconf_set_bool(sensors_applet->applet, current_id, TRUE, NULL);
+ g_free(current_id);
+
+ /* reset sensors sentinel */
+ not_end_of_sensors = TRUE;
+
+ for (gtk_tree_model_iter_children(GTK_TREE_MODEL(sensors_applet->sensors), &sensors_iter, &interfaces_iter); not_end_of_sensors; not_end_of_sensors = gtk_tree_model_iter_next(GTK_TREE_MODEL(sensors_applet->sensors), &sensors_iter)) {
+ gtk_tree_model_get(GTK_TREE_MODEL(sensors_applet->sensors),
+ &sensors_iter,
+ PATH_COLUMN, &current_path,
+ ID_COLUMN, &current_id,
+ LABEL_COLUMN, &current_label,
+ INTERFACE_COLUMN, &current_interface,
+ SENSOR_TYPE_COLUMN, &current_sensor_type,
+ ENABLE_COLUMN, &current_enable,
+ LOW_VALUE_COLUMN, &current_low_value,
+ HIGH_VALUE_COLUMN, &current_high_value,
+ ALARM_ENABLE_COLUMN, &current_alarm_enable,
+ LOW_ALARM_COMMAND_COLUMN, &current_low_alarm_command,
+ HIGH_ALARM_COMMAND_COLUMN, &current_high_alarm_command,
+ ALARM_TIMEOUT_COLUMN, &current_alarm_timeout,
+ MULTIPLIER_COLUMN, &current_multiplier,
+ OFFSET_COLUMN, &current_offset,
+ ICON_TYPE_COLUMN, &current_icon_type,
+ GRAPH_COLOR_COLUMN, &current_graph_color,
+ -1);
+
+ /* prepend values as this is faster then just
+ reverse list when finished */
+ lists[PATHS_INDEX] = g_slist_prepend(lists[PATHS_INDEX], current_path);
+ lists[IDS_INDEX] = g_slist_prepend(lists[IDS_INDEX], current_id);
+ lists[LABELS_INDEX] = g_slist_prepend(lists[LABELS_INDEX], current_label);
+ lists[INTERFACES_INDEX] = g_slist_prepend(lists[INTERFACES_INDEX], current_interface);
+ lists[ENABLES_INDEX] = g_slist_prepend(lists[ENABLES_INDEX], GINT_TO_POINTER(current_enable));
+ lists[LOW_VALUES_INDEX] = g_slist_prepend(lists[LOW_VALUES_INDEX], GINT_TO_POINTER((gint)(current_low_value * 1000)));
+ lists[HIGH_VALUES_INDEX] = g_slist_prepend(lists[HIGH_VALUES_INDEX], GINT_TO_POINTER((gint)(current_high_value * 1000)));
+ lists[ALARM_ENABLES_INDEX] = g_slist_prepend(lists[ALARM_ENABLES_INDEX], GINT_TO_POINTER(current_alarm_enable));
+ lists[LOW_ALARM_COMMANDS_INDEX] = g_slist_prepend(lists[LOW_ALARM_COMMANDS_INDEX], current_low_alarm_command);
+ lists[HIGH_ALARM_COMMANDS_INDEX] = g_slist_prepend(lists[HIGH_ALARM_COMMANDS_INDEX], current_high_alarm_command);
+ lists[ALARM_TIMEOUTS_INDEX] = g_slist_prepend(lists[ALARM_TIMEOUTS_INDEX], GINT_TO_POINTER(current_alarm_timeout));
+ lists[SENSOR_TYPES_INDEX] = g_slist_prepend(lists[SENSOR_TYPES_INDEX], GUINT_TO_POINTER(current_sensor_type));
+ lists[MULTIPLIERS_INDEX] = g_slist_prepend(lists[MULTIPLIERS_INDEX], GINT_TO_POINTER((gint)(current_multiplier * 1000)));
+ lists[OFFSETS_INDEX] = g_slist_prepend(lists[OFFSETS_INDEX], GINT_TO_POINTER((gint)(current_offset * 1000)));
+ lists[ICON_TYPES_INDEX] = g_slist_prepend(lists[ICON_TYPES_INDEX], GUINT_TO_POINTER(current_icon_type));
+ lists[GRAPH_COLORS_INDEX] = g_slist_prepend(lists[GRAPH_COLORS_INDEX], current_graph_color);
+ }
+ }
+
+ /* keep lists in original order */
+ for (i = 0; i < NUM_KEYS; i++) {
+ if (lists[i] != NULL) {
+ lists[i] = g_slist_reverse(lists[i]);
+
+ mate_panel_applet_mateconf_set_list(sensors_applet->applet,
+ keys[i],
+ key_types[i],
+ lists[i], &error);
+ if (error) {
+ sensors_applet_notify(sensors_applet, MATECONF_WRITE_ERROR);
+
+ g_error_free(error);
+ return FALSE;
+ }
+ } else {
+ g_debug("list %s is NULL", keys[i]);
+ }
+
+ }
+
+ sensors_applet_mateconf_free_lists(lists,
+ NUM_KEYS);
+
+ /* store current version to identify config data */
+ mate_panel_applet_mateconf_set_string(sensors_applet->applet,
+ SENSORS_APPLET_VERSION,
+ PACKAGE_VERSION, &error);
+
+ return TRUE;
+}
+
diff --git a/sensors-applet/sensors-applet-mateconf.h b/sensors-applet/sensors-applet-mateconf.h
new file mode 100644
index 0000000..ce74efe
--- /dev/null
+++ b/sensors-applet/sensors-applet-mateconf.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2005-2009 Alex Murray <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef SENSORS_APPLET_MATECONF_H
+#define SENSORS_APPLET_MATECONF_H
+
+#include "sensors-applet.h"
+#include <mate-panel-applet-mateconf.h>
+
+#define FONT_SIZE "font-size" /* hidden mateconf option specifying font
+ * size in points */
+
+#define HIDE_UNITS "hide-units" /* hidden mateconf option specifying not to
+ * show sensor units */
+
+#define IS_SETUP "setup" /* have we actually set up this instance of
+ * the applet (gets set to true after
+ * closing prefences dialog) */
+
+#define DISPLAY_MODE "display_mode" /* display icons or text labels?*/
+
+#define LAYOUT_MODE "layout_mode" /* value beside or below label */
+#define TEMPERATURE_SCALE "temperature_scale" /* Kelvin,
+ Celsius or
+ Fahrenheit */
+#define DISPLAY_NOTIFICATIONS "display_notifications" /* whether to
+ * display
+ * notifications */
+#define TIMEOUT "timeout_delay" /* delay (in ms) between refreshes */
+#define GRAPH_SIZE "graph_size" /* the size of the graph in pixels -
+ * either width if horizontal, or
+ * height if vertical */
+#define PATHS "paths" /* full paths to filenames */
+#define IDS "ids" /* a list of the sensor device ids */
+#define INTERFACES "interfaces" /* a list of the sensor device
+ * interface for each sensor */
+#define LABELS "labels" /* user defined labels for each sensor */
+#define ENABLES "sensor_enables" /* list of booleans corresponding to
+ * the filenames of whether a sensor
+ * is enabled or not */
+#define LOW_VALUES "low_values" /* stored as ints (1000 * double
+ * value) for accuracy, since can
+ * only do ints easily */
+#define HIGH_VALUES "high_values" /* stored as ints (1000 * double
+ * value) for accuracy, since can
+ * only do ints easily */
+#define ALARM_ENABLES "alarm_enables" /* list of whether each sensor
+ * has its alarm enabled */
+#define LOW_ALARM_COMMANDS "low_alarm_commands" /* list of commands to execute
+ * when each alarm is
+ * activated */
+#define HIGH_ALARM_COMMANDS "high_alarm_commands" /* list of commands to execute
+ * when each alarm is
+ * activated */
+
+#define ALARM_TIMEOUTS "alarm_timeouts" /* list of how often each
+ alarm should be sounded (in
+ seconds) */
+
+#define SENSOR_TYPES "sensor_types" /* used to identify a sensor in a
+ list */
+
+#define MULTIPLIERS "multipliers"
+#define OFFSETS "offsets"
+#define ICON_TYPES "icon_types"
+#define GRAPH_COLORS "graph_colors"
+
+#define SENSORS_APPLET_VERSION "sensors_applet_version" /* version of
+ * config
+ * data */
+
+gboolean sensors_applet_mateconf_save_sensors(SensorsApplet *sensors_applet);
+gboolean sensors_applet_mateconf_setup_sensors(SensorsApplet *sensors_applet);
+void sensors_applet_mateconf_setup(SensorsApplet *sensors_applet);
+
+#endif /* SENSORS_APPLET_MATECONF_H*/
diff --git a/sensors-applet/sensors-applet-plugins.c b/sensors-applet/sensors-applet-plugins.c
index 7dfad78..6533903 100644
--- a/sensors-applet/sensors-applet-plugins.c
+++ b/sensors-applet/sensors-applet-plugins.c
@@ -27,7 +27,7 @@
#include "sensors-applet-plugins.h"
#include "sensors-applet-sensor.h"
-#define SENSORS_APPLET_USER_PLUGIN_DIR ".gnome2/sensors-applet/plugins"
+#define SENSORS_APPLET_USER_PLUGIN_DIR ".mate2/sensors-applet/plugins"
static void load_all_plugins(SensorsApplet *sensors_applet,
const gchar *path)
diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c
index 9486173..ebd0046 100644
--- a/sensors-applet/sensors-applet.c
+++ b/sensors-applet/sensors-applet.c
@@ -28,15 +28,15 @@
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
-#include <gnome.h>
+#include <mate.h>
#include <glib/gprintf.h>
#include "sensors-applet.h"
#include "active-sensor.h"
-#include "sensors-applet-gconf.h"
+#include "sensors-applet-mateconf.h"
#include "sensors-applet-plugins.h"
-#ifdef HAVE_LIBNOTIFY
-#include "active-sensor-libnotify.h"
+#ifdef HAVE_LIBMATENOTIFY
+#include "active-sensor-libmatenotify.h"
#define DEFAULT_NOTIFY_TIMEOUT 3000
#endif
@@ -51,7 +51,7 @@
#define ROW_SPACING 0
/* callbacks for panel menu */
-static void prefs_cb(BonoboUIComponent *uic,
+static void prefs_cb(MateComponentUIComponent *uic,
gpointer *data,
const gchar *verbname) {
@@ -65,7 +65,7 @@ static void prefs_cb(BonoboUIComponent *uic,
prefs_dialog_open(sensors_applet);
}
-static void about_cb(BonoboUIComponent *uic,
+static void about_cb(MateComponentUIComponent *uic,
gpointer data,
const gchar *verbname) {
SensorsApplet *sensors_applet;
@@ -74,7 +74,7 @@ static void about_cb(BonoboUIComponent *uic,
about_dialog_open(sensors_applet);
}
-static void help_cb(BonoboUIComponent *uic,
+static void help_cb(MateComponentUIComponent *uic,
gpointer data,
const gchar *verbname) {
@@ -120,8 +120,8 @@ static void destroy_cb(GtkWidget *widget, gpointer data) {
return;
}
-static void change_background_cb(PanelApplet *applet,
- PanelAppletBackgroundType type,
+static void change_background_cb(MatePanelApplet *applet,
+ MatePanelAppletBackgroundType type,
GdkColor *color,
GdkPixmap *pixmap,
gpointer *data) {
@@ -159,8 +159,8 @@ static void change_background_cb(PanelApplet *applet,
}
}
-static void change_orient_cb (PanelApplet *applet,
- PanelAppletOrient orient,
+static void change_orient_cb (MatePanelApplet *applet,
+ MatePanelAppletOrient orient,
gpointer data) {
SensorsApplet *sensors_applet;
sensors_applet = (SensorsApplet *)data;
@@ -168,18 +168,18 @@ static void change_orient_cb (PanelApplet *applet,
sensors_applet_display_layout_changed(sensors_applet);
}
-static void size_allocate_cb(PanelApplet *applet,
+static void size_allocate_cb(MatePanelApplet *applet,
GtkAllocation *allocation,
gpointer data) {
SensorsApplet *sensors_applet;
- PanelAppletOrient orient;
+ MatePanelAppletOrient orient;
g_debug("size-allocate occurred");
sensors_applet = (SensorsApplet *)data;
- orient = panel_applet_get_orient(sensors_applet->applet);
+ orient = mate_panel_applet_get_orient(sensors_applet->applet);
- if ((orient == PANEL_APPLET_ORIENT_LEFT) ||
- (orient == PANEL_APPLET_ORIENT_RIGHT)) {
+ if ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+ (orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) {
if (sensors_applet->size == allocation->width)
return;
sensors_applet->size = allocation->width;
@@ -212,7 +212,7 @@ static void style_set_cb(GtkWidget *widget,
g_debug("set-style occurred");
- display_mode = panel_applet_gconf_get_int(sensors_applet->applet,
+ display_mode = mate_panel_applet_mateconf_get_int(sensors_applet->applet,
DISPLAY_MODE,
NULL);
if (sensors_applet->sensors) {
@@ -255,14 +255,14 @@ static void style_set_cb(GtkWidget *widget,
}
-static const BonoboUIVerb sensors_applet_menu_verbs[] = {
- BONOBO_UI_UNSAFE_VERB("Preferences", prefs_cb),
- BONOBO_UI_UNSAFE_VERB ("Help", help_cb),
- BONOBO_UI_UNSAFE_VERB("About", about_cb),
- BONOBO_UI_VERB_END
+static const MateComponentUIVerb sensors_applet_menu_verbs[] = {
+ MATECOMPONENT_UI_UNSAFE_VERB("Preferences", prefs_cb),
+ MATECOMPONENT_UI_UNSAFE_VERB ("Help", help_cb),
+ MATECOMPONENT_UI_UNSAFE_VERB("About", about_cb),
+ MATECOMPONENT_UI_VERB_END
};
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
static void notif_closed_cb(NotifyNotification *notification,
SensorsApplet *sensors_applet)
{
@@ -270,12 +270,12 @@ static void notif_closed_cb(NotifyNotification *notification,
sensors_applet->notification = NULL;
}
-#endif // HAVE_LIBNOTIFY
+#endif // HAVE_LIBMATENOTIFY
void sensors_applet_notify(SensorsApplet *sensors_applet,
NotifType notif_type)
{
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
gchar *message;
gchar *summary;
GError *error = NULL;
@@ -293,12 +293,12 @@ void sensors_applet_notify(SensorsApplet *sensors_applet,
}
switch (notif_type) {
- case GCONF_READ_ERROR:
+ case MATECONF_READ_ERROR:
summary = g_strdup_printf(_("Error restoring saved sensor configuration."));
message = g_strdup_printf(_("An error occurred while trying to restore the saved sensor configuration. The previous configuration has been lost and will need to be re-entered."));
break;
- case GCONF_WRITE_ERROR:
+ case MATECONF_WRITE_ERROR:
summary = g_strdup_printf(_("Error saving sensor configuration."));
message = g_strdup_printf(_("An error occurred while trying to save the current sensor configuration. "));
break;
@@ -320,12 +320,12 @@ void sensors_applet_notify(SensorsApplet *sensors_applet,
g_debug("Error showing notification: %s", error->message);
g_error_free(error);
}
-#endif // HAVE_LIBNOTIFY
+#endif // HAVE_LIBMATENOTIFY
}
void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type) {
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
SensorsApplet *sensors_applet;
GList *table_children;
@@ -347,7 +347,7 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType
sensors_applet = active_sensor->sensors_applet;
- if (!panel_applet_gconf_get_bool(sensors_applet->applet,
+ if (!mate_panel_applet_mateconf_get_bool(sensors_applet->applet,
DISPLAY_NOTIFICATIONS,
NULL)) {
g_debug("Wanted to display notification, but user has disabled them");
@@ -411,7 +411,7 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType
case TEMP_SENSOR:
unit_type_title = _("Temperature");
unit_type = _("temperature");
- temp_scale = (TemperatureScale)panel_applet_gconf_get_int(active_sensor->sensors_applet->applet,
+ temp_scale = (TemperatureScale)mate_panel_applet_mateconf_get_int(active_sensor->sensors_applet->applet,
TEMPERATURE_SCALE,
NULL);
@@ -457,7 +457,7 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType
case SENSOR_INTERFACE_ERROR:
summary = g_strdup_printf(_("Error updating sensor %s"), sensor_label);
message = g_strdup_printf(_("An error occurred while trying to update the value of the sensor %s located at %s."), sensor_label, sensor_path);
- timeout_msecs = panel_applet_gconf_get_int(active_sensor->sensors_applet->applet,
+ timeout_msecs = mate_panel_applet_mateconf_get_int(active_sensor->sensors_applet->applet,
TIMEOUT,
NULL);
@@ -467,7 +467,7 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType
g_assert_not_reached();
}
- active_sensor_libnotify_notify(active_sensor,
+ active_sensor_libmatenotify_notify(active_sensor,
notif_type,
summary,
message,
@@ -484,21 +484,21 @@ void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType
void sensors_applet_notify_end(ActiveSensor *active_sensor,
NotifType notif_type) {
-#ifdef HAVE_LIBNOTIFY
- active_sensor_libnotify_notify_end(active_sensor, notif_type);
+#ifdef HAVE_LIBMATENOTIFY
+ active_sensor_libmatenotify_notify_end(active_sensor, notif_type);
#endif
}
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
static void sensors_applet_notify_end_all_gfunc(ActiveSensor *active_sensor,
gpointer data) {
- active_sensor_libnotify_notify_end(active_sensor, LOW_ALARM);
- active_sensor_libnotify_notify_end(active_sensor, HIGH_ALARM);
+ active_sensor_libmatenotify_notify_end(active_sensor, LOW_ALARM);
+ active_sensor_libmatenotify_notify_end(active_sensor, HIGH_ALARM);
}
#endif
void sensors_applet_notify_end_all(SensorsApplet *sensors_applet) {
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
g_list_foreach(sensors_applet->active_sensors,
(GFunc)sensors_applet_notify_end_all_gfunc,
NULL);
@@ -599,14 +599,14 @@ static void sensors_applet_pack_display(SensorsApplet *sensors_applet) {
/* otherwise can acess active_sensors without any worries */
num_active_sensors = g_list_length(sensors_applet->active_sensors);
- display_mode = (DisplayMode)panel_applet_gconf_get_int(sensors_applet->applet,
+ display_mode = (DisplayMode)mate_panel_applet_mateconf_get_int(sensors_applet->applet,
DISPLAY_MODE, NULL);
- layout_mode = (LayoutMode)panel_applet_gconf_get_int(sensors_applet->applet,
+ layout_mode = (LayoutMode)mate_panel_applet_mateconf_get_int(sensors_applet->applet,
LAYOUT_MODE, NULL);
- horizontal = (((panel_applet_get_orient(sensors_applet->applet) == PANEL_APPLET_ORIENT_UP) ||
- (panel_applet_get_orient(sensors_applet->applet) == PANEL_APPLET_ORIENT_DOWN)));
+ horizontal = (((mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_UP) ||
+ (mate_panel_applet_get_orient(sensors_applet->applet) == MATE_PANEL_APPLET_ORIENT_DOWN)));
/* figure out num rows / cols by how high / wide sensors
* labels / icons are and how much size we have to put them
@@ -1302,13 +1302,13 @@ void sensors_applet_graph_size_changed(SensorsApplet *sensors_applet) {
if (sensors_applet->active_sensors) {
- graph_size = panel_applet_gconf_get_int(sensors_applet->applet,
+ graph_size = mate_panel_applet_mateconf_get_int(sensors_applet->applet,
GRAPH_SIZE,
NULL);
- if (panel_applet_get_orient(sensors_applet->applet) ==
- PANEL_APPLET_ORIENT_UP ||
- panel_applet_get_orient(sensors_applet->applet) ==
- PANEL_APPLET_ORIENT_DOWN) {
+ if (mate_panel_applet_get_orient(sensors_applet->applet) ==
+ MATE_PANEL_APPLET_ORIENT_UP ||
+ mate_panel_applet_get_orient(sensors_applet->applet) ==
+ MATE_PANEL_APPLET_ORIENT_DOWN) {
/* is horizontal so set graph_size as width */
dimensions[0] = graph_size;
dimensions[1] = sensors_applet->size;
@@ -1388,16 +1388,16 @@ void sensors_applet_init(SensorsApplet *sensors_applet) {
/* initialise size */
sensors_applet->size = DEFAULT_APPLET_SIZE;
- panel_applet_set_flags(sensors_applet->applet,
- PANEL_APPLET_EXPAND_MINOR);
+ mate_panel_applet_set_flags(sensors_applet->applet,
+ MATE_PANEL_APPLET_EXPAND_MINOR);
g_signal_connect(sensors_applet->applet, "destroy",
G_CALLBACK(destroy_cb),
sensors_applet);
- /* if not setup, write defaults to gconf */
- sensors_applet_gconf_setup(sensors_applet);
+ /* if not setup, write defaults to mateconf */
+ sensors_applet_mateconf_setup(sensors_applet);
/* now do any setup needed manually */
sensors_applet_plugins_load_all(sensors_applet);
@@ -1413,7 +1413,7 @@ void sensors_applet_init(SensorsApplet *sensors_applet) {
}
/* only do menu and signal connections if sensors are found */
- panel_applet_setup_menu_from_file(sensors_applet->applet,
+ mate_panel_applet_setup_menu_from_file(sensors_applet->applet,
DATADIR,
SENSORS_APPLET_MENU_FILE,
NULL,
@@ -1441,7 +1441,7 @@ void sensors_applet_init(SensorsApplet *sensors_applet) {
sensors_applet_update_active_sensors(sensors_applet);
sensors_applet_pack_display(sensors_applet);
- sensors_applet->timeout_id = g_timeout_add_seconds(panel_applet_gconf_get_int(sensors_applet->applet, TIMEOUT, NULL) / 1000,
+ sensors_applet->timeout_id = g_timeout_add_seconds(mate_panel_applet_mateconf_get_int(sensors_applet->applet, TIMEOUT, NULL) / 1000,
(GSourceFunc)sensors_applet_update_active_sensors,
sensors_applet);
gtk_widget_show_all(GTK_WIDGET(sensors_applet->applet));
diff --git a/sensors-applet/sensors-applet.h b/sensors-applet/sensors-applet.h
index ac56dc4..3aecb18 100644
--- a/sensors-applet/sensors-applet.h
+++ b/sensors-applet/sensors-applet.h
@@ -20,15 +20,15 @@
#define SENSORS_APPLET_H
#include <gtk/gtk.h>
-#include <panel-applet.h>
+#include <mate-panel-applet.h>
#include "sensors-applet-sensor.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
-#ifdef HAVE_LIBNOTIFY
-#include <libnotify/notify.h>
+#ifdef HAVE_LIBMATENOTIFY
+#include <libmatenotify/notify.h>
#endif
typedef struct _ActiveSensor ActiveSensor;
@@ -60,7 +60,7 @@ static const gchar * const stock_icons[NUM_ICONS] = {
/* enumeration used to identify columns in the GtkTreeStore data
- * structure and to access specific gconf keys too.
+ * structure and to access specific mateconf keys too.
*/
enum {
PATH_COLUMN = 0,
@@ -110,8 +110,8 @@ typedef enum {
LOW_ALARM = 0,
HIGH_ALARM,
SENSOR_INTERFACE_ERROR,
- GCONF_READ_ERROR,
- GCONF_WRITE_ERROR,
+ MATECONF_READ_ERROR,
+ MATECONF_WRITE_ERROR,
NUM_NOTIFS
} NotifType;
@@ -120,7 +120,7 @@ typedef enum {
struct _SensorsApplet {
/* the actual applet for this instance */
- PanelApplet* applet;
+ MatePanelApplet* applet;
gint size;
GtkTreeStore *sensors;
@@ -137,9 +137,9 @@ struct _SensorsApplet {
* list of labels and sensor values into this container */
GtkWidget *table;
GList *active_sensors;
-#ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBMATENOTIFY
NotifyNotification *notification;
-#endif // HAVE_LIBNOTIFY
+#endif // HAVE_LIBMATENOTIFY
};