aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-10-12 11:26:25 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-10-12 11:26:25 +0800
commit3263d05e9cce60ec5e31e82881f180ced908eb39 (patch)
treeb7bfc6209111dec3cba0708468ace2530f715ee8 /calendar/gui
parent31fed55c8038eaf27ed4f51b33500e6f243c8d59 (diff)
downloadgsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.tar
gsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.tar.gz
gsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.tar.bz2
gsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.tar.lz
gsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.tar.xz
gsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.tar.zst
gsoc2013-evolution-3263d05e9cce60ec5e31e82881f180ced908eb39.zip
convert to epopup. (add_popup_menu_item): removed, now redundant.
2004-10-11 Not Zed <NotZed@Ximian.com> * gui/alarm-notify/alarm-queue.c (tray_icon_clicked_cb): convert to epopup. (add_popup_menu_item): removed, now redundant. svn path=/trunk/; revision=27546
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c75
1 files changed, 31 insertions, 44 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 223fd6fa9f..e9b4e6f8e0 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -51,6 +51,7 @@
#include "alarm-queue.h"
#include "config-data.h"
#include "util.h"
+#include "e-util/e-popup.h"
@@ -800,36 +801,6 @@ tray_icon_destroyed_cb (GtkWidget *tray, gpointer user_data)
}
/* Callbacks. */
-static void
-add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap,
- GCallback callback, gpointer user_data)
-{
- GtkWidget *item, *image;
-
- if (pixmap) {
- item = gtk_image_menu_item_new_with_label (label);
-
- /* load the image */
- if (g_file_test (pixmap, G_FILE_TEST_EXISTS))
- image = gtk_image_new_from_file (pixmap);
- else
- image = gtk_image_new_from_stock (pixmap, GTK_ICON_SIZE_MENU);
-
- if (image) {
- gtk_widget_show (image);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- }
- } else {
- item = gtk_menu_item_new_with_label (label);
- }
-
- if (callback)
- g_signal_connect (G_OBJECT (item), "activate", callback, user_data);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-}
-
static gboolean
open_alarm_dialog (TrayIconData *tray_data)
{
@@ -854,13 +825,15 @@ open_alarm_dialog (TrayIconData *tray_data)
}
static void
-popup_dismiss_cb (GtkWidget *widget, TrayIconData *tray_data)
+popup_dismiss_cb (EPopup *ep, EPopupItem *pitem, void *data)
{
+ TrayIconData *tray_data = data;
+
gtk_widget_destroy (tray_data->tray_icon);
}
static void
-popup_dismiss_all_cb (GtkWidget *widget, TrayIconData *tray_data)
+popup_dismiss_all_cb (EPopup *ep, EPopupItem *pitem, void *data)
{
while (tray_icons_list != NULL) {
TrayIconData *tray_data = tray_icons_list->data;
@@ -872,11 +845,25 @@ popup_dismiss_all_cb (GtkWidget *widget, TrayIconData *tray_data)
}
static void
-popup_open_cb (GtkWidget *widget, TrayIconData *tray_data)
+popup_open_cb (EPopup *ep, EPopupItem *pitem, void *data)
{
+ TrayIconData *tray_data = data;
+
open_alarm_dialog (tray_data);
}
+static EPopupItem tray_items[] = {
+ { E_POPUP_ITEM, "00.open", N_("Open"), popup_open_cb, NULL, GTK_STOCK_OPEN },
+ { E_POPUP_ITEM, "10.dismiss", N_("Dismiss"), popup_dismiss_cb, NULL, NULL },
+ { E_POPUP_ITEM, "20.dismissall", N_("Dismiss All"), popup_dismiss_all_cb, NULL, NULL },
+};
+
+static void
+tray_popup_free(EPopup *ep, GSList *items, void *data)
+{
+ g_slist_free(items);
+}
+
static gint
tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
@@ -886,17 +873,17 @@ tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_da
if (event->button == 1) {
return open_alarm_dialog (tray_data);
} else if (event->button == 3) {
- GtkWidget *menu;
-
- /* display popup menu */
- menu = gtk_menu_new ();
- add_popup_menu_item (GTK_MENU (menu), _("Open"), GTK_STOCK_OPEN,
- G_CALLBACK (popup_open_cb), tray_data);
- add_popup_menu_item (GTK_MENU (menu), _("Dismiss"), NULL,
- G_CALLBACK (popup_dismiss_cb), tray_data);
- add_popup_menu_item (GTK_MENU (menu), _("Dismiss All"), NULL,
- G_CALLBACK (popup_dismiss_all_cb), tray_data);
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time);
+ GtkMenu *menu;
+ GSList *menus = NULL;
+ EPopup *ep;
+ int i;
+
+ ep = e_popup_new("com.novell.evolution.alarmNotify.popup");
+ for (i=0;i<sizeof(tray_items)/sizeof(tray_items[0]);i++)
+ menus = g_slist_prepend(menus, &tray_items[i]);
+ e_popup_add_items(ep, menus, tray_popup_free, tray_data);
+ menu = e_popup_create_menu_once(ep, NULL, 0);
+ gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
return TRUE;
}