From 540e6ff01b4d780deec5ef116bd943162e19d293 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 2 Jun 2014 23:10:36 +0800 Subject: [PATCH] gtk: Implement click event for status icon. --- atom/browser/ui/gtk/status_icon.cc | 5 +++++ atom/browser/ui/gtk/status_icon.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/atom/browser/ui/gtk/status_icon.cc b/atom/browser/ui/gtk/status_icon.cc index 3de2a8f6c58..433e4af13e5 100644 --- a/atom/browser/ui/gtk/status_icon.cc +++ b/atom/browser/ui/gtk/status_icon.cc @@ -12,6 +12,7 @@ namespace atom { StatusIcon::StatusIcon() : icon_(gtk_status_icon_new()) { gtk_status_icon_set_visible(icon_, TRUE); + g_signal_connect(icon_, "activate", G_CALLBACK(OnActivateThunk), this); g_signal_connect(icon_, "popup-menu", G_CALLBACK(OnPopupMenuThunk), this); } @@ -48,4 +49,8 @@ void StatusIcon::OnPopupMenu(GtkWidget* widget, guint button, guint time) { menu_->PopupAsContextForStatusIcon(time, button, icon_); } +void StatusIcon::OnActivate(GtkWidget* widget) { + NotifyClicked(); +} + } // namespace atom diff --git a/atom/browser/ui/gtk/status_icon.h b/atom/browser/ui/gtk/status_icon.h index 60e6dd3566e..9c8aa1f5abf 100644 --- a/atom/browser/ui/gtk/status_icon.h +++ b/atom/browser/ui/gtk/status_icon.h @@ -30,6 +30,9 @@ class StatusIcon : public TrayIcon { // Callback invoked when user right-clicks on the status icon. CHROMEGTK_CALLBACK_2(StatusIcon, void, OnPopupMenu, guint, guint); + // Callback invoked when the icon is clicked. + CHROMEGTK_CALLBACK_0(StatusIcon, void, OnActivate); + // The currently-displayed icon for the window. GtkStatusIcon* icon_;