[gnome-color-manager] Remove the notification of out of date devices
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Remove the notification of out of date devices
- Date: Mon, 23 May 2011 20:29:26 +0000 (UTC)
commit 32761e4289d58034068f52f553f3e0c4f50e4d9d
Author: Richard Hughes <richard hughsie com>
Date: Sat May 21 09:33:11 2011 +0100
Remove the notification of out of date devices
This functionality has moved to gnome-settings-daemon.
configure.ac | 3 -
contrib/gnome-color-manager.spec.in | 1 -
data/org.gnome.color-manager.gschema.migrate | 2 -
data/org.gnome.color-manager.gschema.xml | 15 --
src/Makefile.am | 2 -
src/gcm-session.c | 196 --------------------------
src/gcm-utils.h | 3 -
7 files changed, 0 insertions(+), 222 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 64d89e7..5b6b2cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,9 +112,6 @@ if test x$has_vte = xyes; then
AC_DEFINE(HAVE_VTE,1,[Use VTE terminal widget])
fi
-dnl **** Check for libnotify ****
-PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.7.0)
-
AC_ARG_ENABLE(exiv, AS_HELP_STRING([--enable-exiv],[Enable EXIV support for RAW support]), enable_exiv=$enableval,
enable_exiv=yes)
dnl **** Check for EXIV ****
diff --git a/contrib/gnome-color-manager.spec.in b/contrib/gnome-color-manager.spec.in
index 1d3a98a..682275a 100644
--- a/contrib/gnome-color-manager.spec.in
+++ b/contrib/gnome-color-manager.spec.in
@@ -32,7 +32,6 @@ BuildRequires: libtiff-devel
BuildRequires: libexif-devel
BuildRequires: exiv2-devel
BuildRequires: libcanberra-devel
-BuildRequires: libnotify-devel >= 0.7.0
BuildRequires: glib2-devel >= 2.25.9-2
BuildRequires: docbook-utils
BuildRequires: colord-devel
diff --git a/data/org.gnome.color-manager.gschema.migrate b/data/org.gnome.color-manager.gschema.migrate
index a1d3b1b..bdff55b 100644
--- a/data/org.gnome.color-manager.gschema.migrate
+++ b/data/org.gnome.color-manager.gschema.migrate
@@ -3,6 +3,4 @@ global-display-correction = /apps/gnome-color-manager/global_display_correction
set-icc-profile-atom = /apps/gnome-color-manager/set_icc_profile_atom
use-profiles-from-volumes = /apps/gnome-color-manager/use_profiles_from_volumes
calibration-length = /apps/gnome-color-manager/calibration_length
-recalibrate-printer-threshold = /apps/gnome-color-manager/recalibrate_printer_threshold
-recalibrate-display-threshold = /apps/gnome-color-manager/recalibrate_display_threshold
diff --git a/data/org.gnome.color-manager.gschema.xml b/data/org.gnome.color-manager.gschema.xml
index 807c0ec..f60aa13 100644
--- a/data/org.gnome.color-manager.gschema.xml
+++ b/data/org.gnome.color-manager.gschema.xml
@@ -6,11 +6,6 @@
<value nick="ask" value="3"/>
</enum>
<schema id="org.gnome.color-manager" path="/org/gnome/color-manager/">
- <key name="show-notifications" type="b">
- <default>false</default>
- <summary>If notifications should be shown</summary>
- <description>If set to TRUE then notifications and messages will be used.</description>
- </key>
<key name="global-display-correction" type="b">
<default>true</default>
<summary>Whether the display should be globally corrected or left to applications</summary>
@@ -26,15 +21,5 @@
<summary>The default calibration length</summary>
<description>The length of calibration, as this is proportional to the accuracy. The option 'short' creates a quick profile, 'normal' a regular one, and 'long' takes a really long time, but is more precise and creates a better profile. Use 'ask' if you want the user to choose.</description>
</key>
- <key name="recalibrate-display-threshold" type="i">
- <default>15552000</default>
- <summary>The duration between sending notifications to recalibrate a display</summary>
- <description>This is the number of seconds in between notifying the user to recalibrate each display device. Set to 0 to disable the notification.</description>
- </key>
- <key name="recalibrate-printer-threshold" type="i">
- <default>15552000</default>
- <summary>The duration between sending notifications to recalibrate a printer</summary>
- <description>This is the number of seconds in between notifying the user to recalibrate each printer device. Set to 0 to disable the notification.</description>
- </key>
</schema>
</schemalist>
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d838c8..3b4c383 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,7 +8,6 @@ INCLUDES = \
$(EXIF_CFLAGS) \
$(EXIV_CFLAGS) \
$(COLORD_CFLAGS) \
- $(NOTIFY_CFLAGS) \
$(CANBERRA_CFLAGS) \
$(CLUTTER_CFLAGS) \
-DG_LOG_DOMAIN=\"Gcm\" \
@@ -224,7 +223,6 @@ gcm_session_LDADD = \
$(GTK_LIBS) \
$(TIFF_LIBS) \
$(EXIF_LIBS) \
- $(NOTIFY_LIBS) \
$(LCMS_LIBS) \
$(COLORD_LIBS) \
$(CANBERRA_LIBS) \
diff --git a/src/gcm-session.c b/src/gcm-session.c
index 8fcb8ee..29c3412 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -26,7 +26,6 @@
#include <gdk/gdkx.h>
#include <locale.h>
#include <colord.h>
-#include <libnotify/notify.h>
#include <canberra-gtk.h>
#include <lcms2.h>
@@ -50,201 +49,10 @@ typedef struct {
guint watcher_id;
} GcmSessionPrivate;
-#define GCM_SESSION_NOTIFY_TIMEOUT 30000 /* ms */
#define GCM_ICC_PROFILE_IN_X_VERSION_MAJOR 0
#define GCM_ICC_PROFILE_IN_X_VERSION_MINOR 3
/**
- * cd_device_get_title:
- **/
-static gchar *
-cd_device_get_title (CdDevice *device)
-{
- const gchar *vendor;
- const gchar *model;
-
- model = cd_device_get_model (device);
- vendor = cd_device_get_vendor (device);
- if (model != NULL && vendor != NULL)
- return g_strdup_printf ("%s - %s", vendor, model);
- if (vendor != NULL)
- return g_strdup (vendor);
- if (model != NULL)
- return g_strdup (model);
- return g_strdup (cd_device_get_id (device));
-}
-
-/**
- * gcm_session_notify_cb:
- **/
-static void
-gcm_session_notify_cb (NotifyNotification *notification,
- gchar *action,
- gpointer user_data)
-{
- gboolean ret;
- GError *error = NULL;
- GcmSessionPrivate *priv = (GcmSessionPrivate *) user_data;
-
- if (g_strcmp0 (action, "display") == 0) {
- g_settings_set_int (priv->settings,
- GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD,
- 0);
- } else if (g_strcmp0 (action, "printer") == 0) {
- g_settings_set_int (priv->settings,
- GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD,
- 0);
- } else if (g_strcmp0 (action, "recalibrate") == 0) {
- ret = g_spawn_command_line_async (BINDIR "/gcm-prefs",
- &error);
- if (!ret) {
- g_warning ("failed to spawn: %s", error->message);
- g_error_free (error);
- }
- }
-}
-
-/**
- * gcm_session_notify_recalibrate:
- **/
-static gboolean
-gcm_session_notify_recalibrate (GcmSessionPrivate *priv,
- const gchar *title,
- const gchar *message,
- CdDeviceKind kind)
-{
- gboolean ret;
- GError *error = NULL;
- NotifyNotification *notification;
-
- /* show a bubble */
- notification = notify_notification_new (title, message, GCM_STOCK_ICON);
- notify_notification_set_timeout (notification, GCM_SESSION_NOTIFY_TIMEOUT);
- notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
-
- /* TRANSLATORS: button: this is to open GCM */
- notify_notification_add_action (notification,
- "recalibrate",
- _("Recalibrate now"),
- gcm_session_notify_cb,
- priv, NULL);
-
- /* TRANSLATORS: button: this is to ignore the recalibrate notifications */
- notify_notification_add_action (notification,
- cd_device_kind_to_string (kind),
- _("Ignore"),
- gcm_session_notify_cb,
- priv, NULL);
-
- ret = notify_notification_show (notification, &error);
- if (!ret) {
- g_warning ("failed to show notification: %s",
- error->message);
- g_error_free (error);
- }
- return ret;
-}
-
-/**
- * gcm_session_notify_device:
- **/
-static void
-gcm_session_notify_device (GcmSessionPrivate *priv, CdDevice *device)
-{
- CdDeviceKind kind;
- const gchar *title;
- gchar *device_title = NULL;
- gchar *message;
- gint threshold;
- glong since;
- GTimeVal timeval;
-
- /* get current time */
- g_get_current_time (&timeval);
-
- /* TRANSLATORS: this is when the device has not been recalibrated in a while */
- title = _("Recalibration required");
- device_title = cd_device_get_title (device);
-
- /* check we care */
- kind = cd_device_get_kind (device);
- if (kind == CD_DEVICE_KIND_DISPLAY) {
-
- /* get from GSettings */
- threshold = g_settings_get_int (priv->settings,
- GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD);
-
- /* TRANSLATORS: this is when the display has not been recalibrated in a while */
- message = g_strdup_printf (_("The display '%s' should be recalibrated soon."),
- device_title);
- } else {
-
- /* get from GSettings */
- threshold = g_settings_get_int (priv->settings,
- GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD);
-
- /* TRANSLATORS: this is when the printer has not been recalibrated in a while */
- message = g_strdup_printf (_("The printer '%s' should be recalibrated soon."),
- device_title);
- }
-
- /* check if we need to notify */
- since = timeval.tv_sec - cd_device_get_modified (device);
- if (threshold > since)
- gcm_session_notify_recalibrate (priv, title, message, kind);
- g_free (device_title);
- g_free (message);
-}
-
-/**
- * gcm_session_device_added_notify_cb:
- **/
-static void
-gcm_session_device_added_notify_cb (CdClient *client,
- CdDevice *device,
- GcmSessionPrivate *priv)
-{
- CdDeviceKind kind;
- CdProfile *profile;
- const gchar *filename;
- gchar *basename = NULL;
- gboolean allow_notifications;
-
- /* check we care */
- kind = cd_device_get_kind (device);
- if (kind != CD_DEVICE_KIND_DISPLAY &&
- kind != CD_DEVICE_KIND_PRINTER)
- return;
-
- /* ensure we have a profile */
- profile = cd_device_get_default_profile (device);
- if (profile == NULL) {
- g_debug ("no profile set for %s", cd_device_get_id (device));
- goto out;
- }
-
- /* ensure it's a profile generated by us */
- filename = cd_profile_get_filename (profile);
- basename = g_path_get_basename (filename);
- if (!g_str_has_prefix (basename, "GCM")) {
- g_debug ("not a GCM profile for %s: %s",
- cd_device_get_id (device), filename);
- goto out;
- }
-
- /* do we allow notifications */
- allow_notifications = g_settings_get_boolean (priv->settings,
- GCM_SETTINGS_SHOW_NOTIFICATIONS);
- if (!allow_notifications)
- goto out;
-
- /* handle device */
- gcm_session_notify_device (priv, device);
-out:
- g_free (basename);
-}
-
-/**
* gcm_session_get_output_id:
**/
static gchar *
@@ -1681,7 +1489,6 @@ main (int argc, char *argv[])
if (! g_thread_supported ())
g_thread_init (NULL);
g_type_init ();
- notify_init ("gnome-color-manager");
/* TRANSLATORS: program name, a session wide daemon to watch for updates and changing system state */
g_set_application_name (_("Color Management"));
@@ -1707,9 +1514,6 @@ main (int argc, char *argv[])
/* monitor daemon */
priv->client = cd_client_new ();
- g_signal_connect (priv->client, "device-added",
- G_CALLBACK (gcm_session_device_added_notify_cb),
- priv);
g_signal_connect (priv->client, "profile-added",
G_CALLBACK (gcm_session_profile_added_notify_cb),
priv);
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 91e7a1e..70755f7 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -36,9 +36,6 @@
#define GCM_SETTINGS_GLOBAL_DISPLAY_CORRECTION "global-display-correction"
#define GCM_SETTINGS_SET_ICC_PROFILE_ATOM "set-icc-profile-atom"
#define GCM_SETTINGS_CALIBRATION_LENGTH "calibration-length"
-#define GCM_SETTINGS_SHOW_NOTIFICATIONS "show-notifications"
-#define GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD "recalibrate-printer-threshold"
-#define GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD "recalibrate-display-threshold"
#define GCM_SETTINGS_PROFILE_GRAPH_TYPE "profile-graph-type"
/* DISTROS: you will have to patch if you have changed the name of these packages */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]