aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-12-17 04:52:58 +0800
committerChristian Persch <chpe@src.gnome.org>2004-12-17 04:52:58 +0800
commitfb9a15960ab8001fa51ecb794afda2738e8de4b0 (patch)
tree78943c1122617b7eb641f943e4931859d744e63b /embed
parent7e75b259439311d98f52fbdd5f1f5e8df47f1a7f (diff)
downloadgsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.gz
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.bz2
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.lz
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.xz
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.zst
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.zip
Implement context menu on tray icon, as per HIG. Fixes bug #152903.
2004-12-16 Christian Persch <chpe@cvs.gnome.org> * embed/downloader-view.c: (show_downloader_cb), (status_icon_popup_menu_cb), (show_status_icon): * lib/egg/eggstatusicon.c: (egg_status_icon_class_init), (egg_status_icon_init), (egg_status_icon_finalize), (emit_activate_signal), (emit_popup_menu_signal), (egg_status_icon_size_allocate), (egg_status_icon_button_press), (egg_status_icon_set_tooltip): * lib/egg/eggstatusicon.h: * lib/ephy-gui.c: (ephy_gui_menu_position_under_widget), (ephy_gui_menu_position_on_panel): * lib/ephy-gui.h: Implement context menu on tray icon, as per HIG. Fixes bug #152903.
Diffstat (limited to 'embed')
-rw-r--r--embed/downloader-view.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index e2b7e8edd..f8e1f2400 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -25,6 +25,8 @@
#include "ephy-file-helpers.h"
#include "ephy-embed-shell.h"
#include "ephy-stock-icons.h"
+#include "ephy-gui.h"
+#include "ephy-debug.h"
#include <libgnomevfs/gnome-vfs-utils.h>
#include <eggstatusicon.h>
@@ -39,6 +41,10 @@
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtkicontheme.h>
#include <gtk/gtkiconfactory.h>
+#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkmenushell.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkmain.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <glib/gi18n.h>
@@ -157,11 +163,33 @@ downloader_view_class_init (DownloaderViewClass *klass)
}
static void
-status_icon_activated (EggStatusIcon *icon, DownloaderView *dv)
+show_downloader_cb (DownloaderView *dv)
{
gtk_window_present (GTK_WINDOW (dv->priv->window));
}
+static gboolean
+status_icon_popup_menu_cb (EggStatusIcon *icon,
+ DownloaderView *dv)
+{
+ GtkWidget *menu, *item;
+ guint button = 0;
+
+ menu = gtk_menu_new ();
+
+ item = gtk_menu_item_new_with_mnemonic (_("_Show Downloader..."));
+ g_signal_connect_swapped (item, "activate",
+ G_CALLBACK (show_downloader_cb), dv);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show_all (menu);
+
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
+ ephy_gui_menu_position_on_panel, icon->tray_icon,
+ button, gtk_get_current_event_time ());
+
+ return TRUE;
+}
+
static void
show_status_icon (DownloaderView *dv)
{
@@ -171,8 +199,10 @@ show_status_icon (DownloaderView *dv)
dv->priv->status_icon = egg_status_icon_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
- g_signal_connect (dv->priv->status_icon, "activate",
- G_CALLBACK (status_icon_activated), dv);
+ g_signal_connect_swapped (dv->priv->status_icon, "activate",
+ G_CALLBACK (show_downloader_cb), dv);
+ g_signal_connect (dv->priv->status_icon, "popup-menu",
+ G_CALLBACK(status_icon_popup_menu_cb), dv);
}
static void