[empathy] display incoming events right away if user asked to
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] display incoming events right away if user asked to
- Date: Wed, 7 Jul 2010 08:45:17 +0000 (UTC)
commit cc77a379d1daa6130dad17486d52808c874c62a7
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Jul 6 12:23:05 2010 +0200
display incoming events right away if user asked to
src/empathy-event-manager.c | 41 ++++++++++++++++++++++++++++++++++++++---
1 files changed, 38 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index dd4c1c0..490a30b 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -72,6 +72,7 @@ typedef struct {
GtkWidget *dialog;
/* Channel of the CDO that will be used during the approval */
TpChannel *main_channel;
+ gboolean auto_approved;
} EventManagerApproval;
typedef struct {
@@ -191,6 +192,22 @@ autoremove_event_timeout_cb (EventPriv *event)
return FALSE;
}
+static gboolean
+display_notify_area (void)
+
+{
+ GSettings *gsettings;
+ gboolean result;
+
+ gsettings = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
+
+ result = g_settings_get_boolean (gsettings,
+ EMPATHY_PREFS_UI_EVENTS_NOTIFY_AREA);
+ g_object_unref (gsettings);
+
+ return result;
+}
+
static void
event_manager_add (EmpathyEventManager *manager,
EmpathyContact *contact,
@@ -220,6 +237,15 @@ event_manager_add (EmpathyEventManager *manager,
DEBUG ("Adding event %p", event);
priv->events = g_slist_prepend (priv->events, event);
+
+ if (!display_notify_area ())
+ {
+ /* Don't fire the 'event-added' signal as we activate the event now */
+ approval->auto_approved = TRUE;
+ empathy_event_activate (&event->public);
+ return;
+ }
+
g_signal_emit (event->manager, signals[EVENT_ADDED], 0, event);
if (!event->public.must_ack)
@@ -278,10 +304,19 @@ handle_with_time_cb (GObject *source,
static void
event_manager_approval_approve (EventManagerApproval *approval)
{
- gint64 timestamp = gtk_get_current_event_time ();
+ gint64 timestamp;
- if (timestamp == GDK_CURRENT_TIME)
- timestamp = EMPATHY_DISPATCHER_CURRENT_TIME;
+ if (approval->auto_approved)
+ {
+ timestamp = EMPATHY_DISPATCHER_NON_USER_ACTION;
+ }
+ else
+ {
+ timestamp = gtk_get_current_event_time ();
+
+ if (timestamp == GDK_CURRENT_TIME)
+ timestamp = EMPATHY_DISPATCHER_CURRENT_TIME;
+ }
g_assert (approval->operation != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]