From fab4ce42cdef5d1046b0f17d77dbca9dc384962d Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Tue, 15 Dec 2009 02:31:52 -0500 Subject: Don't omit notifications for downloads If a download is finished while the GtkStatusIcon for DownloadView is not embedded the finished notification for such download is missed and user is left wondering what happened with his/her download. This makes notifications show whether there is or not a GtkStatusIcon to attach to. Bug #604599 --- embed/downloader-view.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'embed') diff --git a/embed/downloader-view.c b/embed/downloader-view.c index b23d0426e..59653c5b0 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -75,7 +75,6 @@ struct _DownloaderViewPrivate #endif guint source_id; - guint notification_timeout; }; enum @@ -199,7 +198,7 @@ remove_download (WebKitDownload *download, WebKitDownloadStatus status; g_signal_handlers_disconnect_matched - (download, G_SIGNAL_MATCH_DATA , + (download, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view); status = webkit_download_get_status (download); @@ -272,11 +271,6 @@ downloader_view_finalize (GObject *object) priv->source_id = 0; } - if (priv->notification_timeout != 0) - { - g_source_remove (priv->notification_timeout); - } - g_hash_table_destroy (dv->priv->downloads_hash); G_OBJECT_CLASS (downloader_view_parent_class)->finalize (object); @@ -622,30 +616,23 @@ update_buttons_timeout_cb (DownloaderView *dv) } #ifdef HAVE_LIBNOTIFY -static gboolean -queue_show_notification (DownloaderView *dv) -{ - if (gtk_status_icon_is_embedded (dv->priv->status_icon)) - { - notify_notification_show (dv->priv->notification, NULL); - dv->priv->notification_timeout = 0; - return FALSE; - } - - return TRUE; -} - static void show_notification_window (DownloaderView *dv) { if (gtk_status_icon_is_embedded (dv->priv->status_icon)) - notify_notification_show (dv->priv->notification, NULL); + { + notify_notification_attach_to_status_icon + (dv->priv->notification, + dv->priv->status_icon); + } else { - if (dv->priv->notification_timeout != 0) - g_source_remove (dv->priv->notification_timeout); - dv->priv->notification_timeout = g_timeout_add_seconds (1, (GSourceFunc) queue_show_notification, dv); + notify_notification_attach_to_status_icon + (dv->priv->notification, + NULL); } + + notify_notification_show (dv->priv->notification, NULL); } #endif -- cgit v1.2.3