void
csd_ldsm_clean (void)
{
        if (ldsm_timeout_id)
                g_source_remove (ldsm_timeout_id);
        ldsm_timeout_id = 0;

        if (ldsm_notified_hash)
                g_hash_table_destroy (ldsm_notified_hash);
        ldsm_notified_hash = NULL;

        if (ldsm_monitor)
                g_object_unref (ldsm_monitor);
        ldsm_monitor = NULL;

        if (settings != NULL) {
                g_object_unref (settings);
        }

        if (dialog) {
                gtk_widget_destroy (GTK_WIDGET (dialog));
                dialog = NULL;
        }

        if (notification != NULL) {
                notify_notification_close (notification, NULL);
                notification = NULL;
        }

        if (ignore_paths) {
                g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
                g_slist_free (ignore_paths);
        }
}
Example #2
0
static void
notify(const char *title, const char *msg, const char *icon)
{

	if (msg == NULL)
		return;
	/* Don't spam the same message */
	if (notify_last_msg) {
		if (notify_last_msg && strcmp(msg, notify_last_msg) == 0)
			return;
		g_free(notify_last_msg);
	}
	notify_last_msg = g_strdup(msg);

	if (nn != NULL)
		notify_notification_close(nn, NULL);

#if NOTIFY_CHECK_VERSION(0,7,0)
	nn = notify_notification_new(title, msg, icon);
	notify_notification_set_hint(nn, "transient",
	    g_variant_new_boolean(TRUE));
#else
	if (gtk_status_icon_get_visible(status_icon))
		nn = notify_notification_new_with_status_icon(title,
		    msg, icon, status_icon);
	else
		nn = notify_notification_new(title, msg, icon, NULL);
#endif

	notify_notification_set_timeout(nn, 5000);
	g_signal_connect(nn, "closed", G_CALLBACK(notify_closed), NULL);
	notify_notification_show(nn, NULL);
}
 void hideNotification() {
     showOnInit = false;
     
     if ((notification) && (isVisible) && (notify_notification_close(NOTIFY_NOTIFICATION(notification), NULL))) {
         isRejectable = false;
     }
 }
Example #4
0
wxTaskBarIconEx::~wxTaskBarIconEx()
{
    m_bUserClicked = false;

    if (m_pWnd)
    {
        m_pWnd->PopEventHandler();
        m_pWnd->Destroy();
        m_pWnd = NULL;
    }

    if (g_pNotification)
    {
        notify_notification_close(g_pNotification, NULL);
        g_pNotification = NULL;
    }

    if (g_pStatusIcon)
    {
        g_object_unref(g_pStatusIcon);
        g_pStatusIcon = NULL;
    }

    if (notify_lib) {
        my_notify_notification_new_with_status_icon = NULL;
        my_notify_notification_new = NULL;
        dlclose(notify_lib);
    }
}
Example #5
0
bool Notification::HideImpl()
{
	if (!this->notification)
		return true;

		return notify_notification_close(this->notification, NULL);
}
Example #6
0
static void
clear_notification (VinoPrompt *prompt)
{
  if (prompt->priv->notification)
    notify_notification_close (prompt->priv->notification, NULL);
  g_clear_object (&prompt->priv->notification);
}
/**
 * notify_uninit:
 *
 * Uninitialized libmatenotify.
 *
 * This should be called when the program no longer needs libmatenotify for
 * the rest of its lifecycle, typically just before exitting.
 */
void
notify_uninit (void)
{
        GList *l;

        if (!_initted) {
                return;
        }

        if (_app_name != NULL) {
                g_free (_app_name);
                _app_name = NULL;
        }

        for (l = _active_notifications; l != NULL; l = l->next) {
                NotifyNotification *n = NOTIFY_NOTIFICATION (l->data);

                if (_notify_notification_get_timeout (n) == 0 ||
                    _notify_notification_has_nondefault_actions (n)) {
                        notify_notification_close (n, NULL);
                }
        }

        g_object_unref (_proxy);

        _initted = FALSE;
}
Example #8
0
static void
status_icon_finalize (GObject *object)
{
	EmpathyStatusIconPriv *priv = GET_PRIV (object);

	if (priv->blink_timeout) {
		g_source_remove (priv->blink_timeout);
	}

	g_signal_handlers_disconnect_by_func (priv->account_manager,
					      status_icon_connection_changed_cb,
					      object);

	if (priv->notification) {
		notify_notification_close (priv->notification, NULL);
		g_object_unref (priv->notification);
		priv->notification = NULL;
	}

	g_object_unref (priv->icon);
	g_object_unref (priv->idle);
	g_object_unref (priv->account_manager);
	g_object_unref (priv->event_manager);
	g_object_unref (priv->ui_manager);
}
Example #9
0
static void onNotifyClick(NotifyNotification* n, char* action, gpointer user_data)
{
    Q_UNUSED(action);

    qcd::TrayIcon::TrayNotifyData* tray_data = nullptr;

    if (user_data)
    {
        tray_data = static_cast<qcd::TrayIcon::TrayNotifyData*>(user_data);

        QUrl url(tray_data->url);
        bool success = QDesktopServices::openUrl(url);
        if (!success)
            qDebug() << "Unable to open url in browser. Maybe the url is corrupted. "\
                        "Specified url: " << url;

        tray_data->tray_icon->setState(qcd::TrayIcon::State::Normal);
    }

    // free user data
    if (user_data)
        free(user_data);

    notify_notification_close (n, NULL);
    g_object_unref(G_OBJECT(n));
}
Example #10
0
File: mailme.c Project: jku/mailme
static void update_notification (NotifyNotification *note,
                                 const char         *display_name,
                                 guint               unread_count,
                                 guint               last_unread_count)
{
  GError *error = NULL;

  if (unread_count == 0) {
    if (!notify_notification_close (note, &error)) {
      g_printerr ("Failed to close notification: %s", error->message);
      g_error_free (error);
    }
  } else {
    char *msg;

    /* Translators: Notification text */
    msg = g_strdup_printf (ngettext ("One unread mail on %1$s",
                                     "%2$d unread mails on %1$s",
                                     unread_count),
                           display_name, unread_count);
    notify_notification_update (note, msg, NULL, "mail-unread");

    /* FIXME: at least gnome-shell does not update the title unless
     * we _show(), but we don't really want to do that when unread count
     * is going down... */
    if (unread_count > last_unread_count)
      if (!notify_notification_show (note, &error)) {
        g_printerr ("Failed to show notification: %s", error->message);
        g_error_free (error);
      }
    g_free (msg);
  }
}
Example #11
0
void* do_playing(void* _p)
{
    (void)_p;

    while(true) {
        control_lock();

        if (!Control.poll_active) {
            control_unlock();
            break;
        }

        int i;

        for (i = 0; i < ACTIVE_NOTIFS_MAX; i ++) {
            if (actives[i].box && time(NULL) >= actives[i].n_timeout)
            {
                GError* ignore;
                notify_notification_close(actives[i].box, &ignore);
                actives[i].box = NULL;
                if(actives[i].id_indicator)
                    *actives[i].id_indicator = -1;    /* reset indicator value */

                memset(&actives[i], 0, sizeof(struct _ActiveNotifications));
            }
        }
        control_unlock();
        usleep(10000);
    }
    pthread_exit(NULL);
}
static void
action_cb (NotifyNotification *notification,
		   gchar *action, gpointer user_data)
{
	PurpleBuddy *buddy = NULL;
	PurpleConversation *conv = NULL;

	purple_debug_info (PLUGIN_ID, "action_cb(), "
					"notification: 0x%lx, action: '%s'", (unsigned long)notification, action);

	buddy = (PurpleBuddy *)g_object_get_data (G_OBJECT(notification), "buddy");
	conv = (PurpleConversation *)g_object_get_data (G_OBJECT(notification), "conv");

	if (buddy) {
		conv = purple_find_conversation_with_account (PURPLE_CONV_TYPE_ANY, buddy->name, buddy->account);

		if (!conv) {
			conv = purple_conversation_new (PURPLE_CONV_TYPE_IM,
										  buddy->account,
										  buddy->name);
		}
	} else if (!conv) {
		purple_debug_warning (PLUGIN_ID, "Got no buddy nor conv!");
		return;
	}

	conv->ui_ops->present (conv);

	notify_notification_close (notification, NULL);
}
Example #13
0
void
notify_close(void)
{
#ifdef NOTIFY
	if (nn != NULL)
		notify_notification_close(nn, NULL);
#endif
}
Example #14
0
/* libnotify callback, called when the "Next" button is pressed */
static void Next( NotifyNotification *notification, gchar *psz, gpointer p )
{
    intf_thread_t *p_object = (intf_thread_t *)p;

    VLC_UNUSED(psz);
    notify_notification_close( notification, NULL );
    playlist_Next( pl_Get( p_object ) );
}
Example #15
0
static void
notification_close_helper (EmpathyStatusIconPriv *priv)
{
	if (priv->notification != NULL) {
		notify_notification_close (priv->notification, NULL);
		priv->notification = NULL;
	}
}
Example #16
0
void close_notification(void)
{
	if (notify) {
		g_signal_handlers_destroy(notify);
		notify_notification_close(notify, NULL);
		notify = NULL;
	}
}
Example #17
0
void notifier_destroy ()
{
	if (!notify_is_initted ())
		return;

	notify_notification_close (Notification, NULL);
	notify_uninit ();
}
Example #18
0
/* libnotify callback, called when the "Previous" button is pressed */
static void Prev( NotifyNotification *notification, gchar *psz, gpointer p )
{
    vlc_object_t *p_object = (vlc_object_t*)p;

    VLC_UNUSED(psz);
    notify_notification_close( notification, NULL );
    playlist_Prev( pl_Get( p_object ) );
}
static void
cleanup_notification (RBNotificationPlugin *plugin)
{
	if (plugin->notification != NULL) {
		g_signal_handlers_disconnect_by_func (plugin->notification,
						      G_CALLBACK (notification_closed_cb),
						      plugin);
		notify_notification_close (plugin->notification, NULL);
		plugin->notification = NULL;
	}
	if (plugin->misc_notification != NULL) {
		g_signal_handlers_disconnect_by_func (plugin->misc_notification,
						      G_CALLBACK (notification_closed_cb),
						      plugin);
		notify_notification_close (plugin->misc_notification, NULL);
		plugin->misc_notification = NULL;
	}
}
Example #20
0
static void
hide_notifications (NotifyNotification *notify)
{
	GError *error = NULL;
	if (!notify_notification_close (notify, &error)) {
		g_warning (_("Error closing notification: %s\n"), error->message);
		g_error_free (error);
	}
}
Example #21
0
// Close all notifications of the vector.
void close_notifications ()
{
    while (notifications.size () != 0)
    {
        GError *error = NULL;
        notify_notification_close (&notifications.back (), &error);
        notifications.pop_back ();
    }
}
Example #22
0
static void
lbi_notification_parent_weak_notify(gpointer data, GObject * parent)
{
    NotifyNotification *note = NOTIFY_NOTIFICATION(data);
    g_signal_handlers_disconnect_by_func(note, lbi_notification_closed_cb,
                                         parent);
    notify_notification_close(note, NULL);
    g_object_unref(note);
}
Example #23
0
void osd_hide (void)
{
    if (! notification)
        return;

    notify_notification_close (notification, NULL);
    g_object_unref (notification);
    notification = NULL;
}
static void
notify_deleting_conversation_cb (PurpleConversation *conv,
				 gpointer data)
{
    NotifyNotification *notification;

    notification = g_hash_table_lookup (buddy_hash, conv);
    if (notification != NULL)
	notify_notification_close (notification, NULL);
}
Example #25
0
static void Prev( NotifyNotification *notification, gchar *psz, gpointer p )
{   /* libnotify callback, called when the "Previous" button is pressed */
    vlc_object_t *p_object = (vlc_object_t*)p;

    VLC_UNUSED(psz);
    notify_notification_close( notification, NULL );
    playlist_t *p_playlist = pl_Hold( p_object );
    playlist_Prev( p_playlist );
    pl_Release( p_object );
}
Example #26
0
	Notify::~Notify()
	{
#ifdef Q_WS_X11
		if(mNotification)
		{
			notify_notification_close(mNotification, 0);
			g_object_unref(mNotification);
		}
#endif
	}
Example #27
0
void closeNotify(NotifyNotification *notification)
{
	if (!notify_notification_close(notification, &error)) {
		g_error("Closing notification failed: %s", error->message);
        g_error_free(error);
	}
	
	isNotifyActive = 0;
	g_object_unref(notification);
}
static void
ignore_callback (NotifyNotification *n,
                 const char         *action)
{
        g_assert (action != NULL);
        g_assert (strcmp (action, "ignore") == 0);

        /* Do nothing */

        notify_notification_close (n, NULL);
}
static void
empty_trash_callback (NotifyNotification *n,
                      const char         *action)
{
        g_assert (action != NULL);
        g_assert (strcmp (action, "empty-trash") == 0);

        csd_ldsm_show_empty_trash ();

        notify_notification_close (n, NULL);
}
static void
progress_ui_handler_hide_notification_or_status (NautilusProgressUIHandler *self)
{
	if (self->priv->status_icon != NULL) {
		gtk_status_icon_set_visible (self->priv->status_icon, FALSE);
	}

	if (self->priv->progress_notification != NULL) {
		notify_notification_close (self->priv->progress_notification, NULL);
		g_clear_object (&self->priv->progress_notification);
	}
}