From 3263d05e9cce60ec5e31e82881f180ced908eb39 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 12 Oct 2004 03:26:25 +0000 Subject: convert to epopup. (add_popup_menu_item): removed, now redundant. 2004-10-11 Not Zed * 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 --- calendar/gui/alarm-notify/alarm-queue.c | 75 ++++++++++++++------------------- 1 file changed, 31 insertions(+), 44 deletions(-) (limited to 'calendar/gui/alarm-notify') 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;ibutton, event->time); return TRUE; } -- cgit v1.2.3