Re: [evolution-patches] calendar/addressbook/everything popup stuff
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: Re: [evolution-patches] calendar/addressbook/everything popup stuff
- Date: Wed, 06 Oct 2004 19:33:35 +0800
This includes the last patch and does the main context menu in the calendar as well, and as well finishing some api off and associated cascading fixes.
Another big patch nobody will probably read, but maybe i missed something obvious. The calendar stuff is the main thing.
On Wed, 2004-10-06 at 12:40 +0800, Not Zed wrote:
This is the remaining e-popup-menu removal in the addressbook.
I wonder if the popup menu there serves any useful purpose anyway? Should the whole thing be removed? There isn't one anywhere else on that window (its the one you get when you click on to/cc in the composer)
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1840
diff -u -p -r1.1840 ChangeLog
--- addressbook/ChangeLog 6 Oct 2004 03:22:21 -0000 1.1840
+++ addressbook/ChangeLog 6 Oct 2004 11:15:42 -0000
@@ -1,3 +1,28 @@
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * gui/component/addressbook-view.c (popup_event_callback):
+ * gui/component/select-names/e-select-names.c (section_right_click_cb):
+ * gui/widgets/e-addressbook-view.c (do_popup_menu): fix for
+ e-popup api changes. Moved all mask specifiers to visible rather
+ than enable in the menu table.
+
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * gui/contact-editor/e-contact-editor.c: removed
+ gnome-popup-menu.h (unused).
+
+ * gui/widgets/e-addressbook-reflow-adapter.c:
+ * gui/widgets/eab-popup-control.c: remove e-popup-menu.h (unused).
+
+ * gui/component/select-names/e-select-names.c
+ (section_right_click_cb): use e-popup. Somewhat overengineered
+ for this use ...
+ (remove_cb): api changes.
+
+ * gui/widgets/eab-popup.c (eab_popup_target_new_select_names):
+ added pretty useless wrapper for the select names popup. Added to
+ hook maps.
+
2004-10-01 Not Zed <NotZed Ximian com>
* gui/widgets/e-addressbook-view.c (do_popup_menu): convert to
Index: addressbook/gui/component/addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-view.c,v
retrieving revision 1.20
diff -u -p -r1.20 addressbook-view.c
--- addressbook/gui/component/addressbook-view.c 6 Oct 2004 03:22:22 -0000 1.20
+++ addressbook/gui/component/addressbook-view.c 6 Oct 2004 11:15:42 -0000
@@ -741,9 +741,9 @@ primary_source_selection_changed_callbac
}
static EPopupItem abv_source_popups[] = {
- { E_POPUP_ITEM, "10.new", N_("New Address Book"), new_addressbook_cb, NULL, NULL, 0 },
- { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_addressbook_cb, NULL, "stock_delete", EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_addressbook_cb, NULL, NULL, EAB_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "10.new", N_("New Address Book"), new_addressbook_cb, NULL, NULL, 0, 0 },
+ { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_addressbook_cb, NULL, "stock_delete", 0, EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_addressbook_cb, NULL, NULL, 0, EAB_POPUP_SOURCE_PRIMARY },
};
static void
@@ -770,8 +770,7 @@ popup_event_callback(ESourceSelector *se
e_popup_add_items((EPopup *)ep, menus, abv_source_popup_free, view);
- /* visibility is disabled, we only disable menu items */
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
return TRUE;
Index: addressbook/gui/component/select-names/e-select-names.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names.c,v
retrieving revision 1.134
diff -u -p -r1.134 e-select-names.c
--- addressbook/gui/component/select-names/e-select-names.c 19 Aug 2004 04:36:47 -0000 1.134
+++ addressbook/gui/component/select-names/e-select-names.c 6 Oct 2004 11:15:42 -0000
@@ -29,7 +29,6 @@
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-table-without.h>
-#include <gal/widgets/e-popup-menu.h>
#include <libebook/e-book.h>
#include <libebook/e-contact.h>
@@ -38,6 +37,7 @@
#include <addressbook/util/eab-book-util.h>
#include <addressbook/gui/component/addressbook-component.h>
#include <addressbook/gui/component/addressbook.h>
+#include <addressbook/gui/widgets/eab-popup.h>
#include "e-select-names-config.h"
#include "e-select-names.h"
@@ -678,36 +678,44 @@ remove_address(ETable *table, int row, i
e_select_names_model_delete (child->source, row);
}
-struct _RightClickData {
- ESelectNamesChild *child;
- int row;
-};
-typedef struct _RightClickData RightClickData;
-
static void
-remove_cb (GtkWidget *widget, void *data)
+remove_cb (EPopup *ep, EPopupItem *pitem, void *data)
{
- RightClickData *rcdata = (RightClickData *)data;
+ EABPopupTargetSelectNames *t = (EABPopupTargetSelectNames *)ep->target;
- e_select_names_model_delete (rcdata->child->source, rcdata->row);
+ e_select_names_model_delete (t->model, t->row);
+}
+
+static EPopupItem esn_select_popups[] = {
+ { E_POPUP_ITEM, "20.delete", N_("Remove"), remove_cb, NULL, NULL, 0, 0 },
+};
- /* Free everything we've created */
- g_free (rcdata);
+static void
+esn_select_popup_free (EPopup *ep, GSList *list, void *data)
+{
+ g_slist_free (list);
}
static void
section_right_click_cb (ETable *et, int row, int col, GdkEvent *ev, ESelectNamesChild *child)
{
- static EPopupMenu right_click_menu[] = {
- E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0),
- E_POPUP_TERMINATOR
- };
- RightClickData *rcdata = g_new0 (RightClickData, 1);
+ EABPopup *ep;
+ EABPopupTargetSelectNames *t;
+ GSList *menus = NULL;
+ int i;
+ GtkMenu *menu;
+
+ ep = eab_popup_new("com.novell.evolution.addressbook.selectNames.popup");
+ t = eab_popup_target_new_select_names(ep, child->source, row);
+ t->target.widget = (GtkWidget *)et;
+
+ for (i=0;i<sizeof(esn_select_popups)/sizeof(esn_select_popups[0]);i++)
+ menus = g_slist_prepend(menus, &esn_select_popups[i]);
- rcdata->row = row;
- rcdata->child = child;
+ e_popup_add_items((EPopup *)ep, menus, esn_select_popup_free, NULL);
- e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata);
+ menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
+ gtk_menu_popup(menu, NULL, NULL, NULL, NULL, ev->button.button, ev->button.time);
}
void
Index: addressbook/gui/contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.218
diff -u -p -r1.218 e-contact-editor.c
--- addressbook/gui/contact-editor/e-contact-editor.c 13 Sep 2004 16:26:49 -0000 1.218
+++ addressbook/gui/contact-editor/e-contact-editor.c 6 Oct 2004 11:15:43 -0000
@@ -34,7 +34,6 @@
#include <gtk/gtkstock.h>
#include <gtk/gtkentry.h>
#include <gtk/gtklabel.h>
-#include <libgnomeui/gnome-popup-menu.h>
#include <libgnomeui/gnome-window-icon.h>
#include <libgnome/gnome-util.h>
#include <libgnome/gnome-i18n.h>
Index: addressbook/gui/widgets/e-addressbook-reflow-adapter.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-reflow-adapter.c,v
retrieving revision 1.30
diff -u -p -r1.30 e-addressbook-reflow-adapter.c
--- addressbook/gui/widgets/e-addressbook-reflow-adapter.c 21 Oct 2003 18:48:55 -0000 1.30
+++ addressbook/gui/widgets/e-addressbook-reflow-adapter.c 6 Oct 2004 11:15:43 -0000
@@ -12,7 +12,6 @@
#include "eab-gui-util.h"
#include "e-minicard.h"
-#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-gui-utils.h>
#include "addressbook/printing/e-contact-print.h"
#include "addressbook/printing/e-contact-print-envelope.h"
Index: addressbook/gui/widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.150
diff -u -p -r1.150 e-addressbook-view.c
--- addressbook/gui/widgets/e-addressbook-view.c 6 Oct 2004 03:22:22 -0000 1.150
+++ addressbook/gui/widgets/e-addressbook-view.c 6 Oct 2004 11:15:44 -0000
@@ -913,24 +913,24 @@ new_list (EPopup *ep, EPopupItem *pitem,
}
static EPopupItem eabv_popup_items[] = {
- { E_POPUP_ITEM, "10.new", N_("New Contact..."), new_card, NULL, "stock_contact", EAB_POPUP_SELECT_EDITABLE},
- { E_POPUP_ITEM, "15.newlist", N_("New Contact List..."), new_list, NULL, "stock_contact-list", EAB_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "10.new", N_("New Contact..."), new_card, NULL, "stock_contact", 0, EAB_POPUP_SELECT_EDITABLE},
+ { E_POPUP_ITEM, "15.newlist", N_("New Contact List..."), new_list, NULL, "stock_contact-list", 0, EAB_POPUP_SELECT_EDITABLE },
{ E_POPUP_BAR, "20.bar" },
- { E_POPUP_ITEM, "30.saveas", N_("Save as VCard..."), save_as, NULL, "stock_save-as", EAB_POPUP_SELECT_MANY },
- { E_POPUP_ITEM, "40.forward", N_("Forward Contact"), send_as, NULL, "stock_mail-forward", EAB_POPUP_SELECT_MANY },
- { E_POPUP_ITEM, "50.mailto", N_("Send Message to Contact"), send_to, NULL, "stock_mail-send", EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EMAIL },
- { E_POPUP_ITEM, "60.print", N_("Print"), print, NULL, "stock_print", EAB_POPUP_SELECT_MANY },
+ { E_POPUP_ITEM, "30.saveas", N_("Save as VCard..."), save_as, NULL, "stock_save-as", 0, EAB_POPUP_SELECT_MANY },
+ { E_POPUP_ITEM, "40.forward", N_("Forward Contact"), send_as, NULL, "stock_mail-forward", 0, EAB_POPUP_SELECT_MANY },
+ { E_POPUP_ITEM, "50.mailto", N_("Send Message to Contact"), send_to, NULL, "stock_mail-send", 0, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EMAIL },
+ { E_POPUP_ITEM, "60.print", N_("Print"), print, NULL, "stock_print", 0, EAB_POPUP_SELECT_MANY },
{ E_POPUP_BAR, "70.bar" },
- { E_POPUP_ITEM, "80.copyto", N_("Copy to Address Book..."), copy_to_folder, NULL, NULL, EAB_POPUP_SELECT_MANY },
- { E_POPUP_ITEM, "90.moveto", N_("Move to Address Book..."), move_to_folder, NULL, NULL, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "80.copyto", N_("Copy to Address Book..."), copy_to_folder, NULL, NULL, 0, EAB_POPUP_SELECT_MANY },
+ { E_POPUP_ITEM, "90.moveto", N_("Move to Address Book..."), move_to_folder, NULL, NULL, 0, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE },
{ E_POPUP_BAR, "a0.bar" },
- { E_POPUP_BAR, "b0.cut", N_("Cut"), cut, NULL, "stock_cut", EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, "c0.copy", N_("Copy"), copy, NULL, "stock_copy", EAB_POPUP_SELECT_MANY },
- { E_POPUP_ITEM, "d0.paste", N_("Paste"), paste, NULL, "stock_paste", EAB_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, "e0.delete", N_("Delete"), delete, NULL, "stock_delete", EAB_POPUP_SELECT_EDITABLE|EAB_POPUP_SELECT_MANY },
+ { E_POPUP_BAR, "b0.cut", N_("Cut"), cut, NULL, "stock_cut", 0, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "c0.copy", N_("Copy"), copy, NULL, "stock_copy", 0, EAB_POPUP_SELECT_MANY },
+ { E_POPUP_ITEM, "d0.paste", N_("Paste"), paste, NULL, "stock_paste", 0, EAB_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "e0.delete", N_("Delete"), delete, NULL, "stock_delete", 0, EAB_POPUP_SELECT_EDITABLE|EAB_POPUP_SELECT_MANY },
};
static void
@@ -991,9 +991,7 @@ do_popup_menu(EABView *view, GdkEvent *e
e_popup_add_items((EPopup *)ep, menus, eabv_popup_free, contact_and_book);
- /* visibility is disabled, we only disable menu items */
- /* FIXME: when enable is implemented in e-popup */
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button.button:0, event?event->button.time:gtk_get_current_event_time());
}
Index: addressbook/gui/widgets/eab-popup-control.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-popup-control.c,v
retrieving revision 1.10
diff -u -p -r1.10 eab-popup-control.c
--- addressbook/gui/widgets/eab-popup-control.c 4 Aug 2004 15:23:13 -0000 1.10
+++ addressbook/gui/widgets/eab-popup-control.c 6 Oct 2004 11:15:44 -0000
@@ -48,7 +48,6 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-property-bag.h>
#include <bonobo/bonobo-generic-factory.h>
-#include <gal/widgets/e-popup-menu.h>
#include <addressbook/util/eab-book-util.h>
#include <addressbook/gui/contact-editor/e-contact-editor.h>
#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
Index: addressbook/gui/widgets/eab-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-popup.c,v
retrieving revision 1.1
diff -u -p -r1.1 eab-popup.c
--- addressbook/gui/widgets/eab-popup.c 6 Oct 2004 03:22:22 -0000 1.1
+++ addressbook/gui/widgets/eab-popup.c 6 Oct 2004 11:15:44 -0000
@@ -65,6 +65,11 @@ eabp_target_free(EPopup *ep, EPopupTarge
g_object_unref(s->selector);
break; }
+ case EAB_POPUP_TARGET_SELECT_NAMES: {
+ EABPopupTargetSelectNames *s = (EABPopupTargetSelectNames *)t;
+
+ g_object_unref(s->model);
+ break; }
}
((EPopupClass *)eabp_parent)->target_free(ep, t);
@@ -189,6 +194,18 @@ eab_popup_target_new_source(EABPopup *ea
return t;
}
+EABPopupTargetSelectNames *
+eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row)
+{
+ EABPopupTargetSelectNames *t = e_popup_target_new(&eabp->popup, EAB_POPUP_TARGET_SELECT_NAMES, sizeof(*t));
+
+ t->model = model;
+ g_object_ref(model);
+ t->row = row;
+
+ return t;
+}
+
/* ********************************************************************** */
/* Popup menu plugin handler */
@@ -231,9 +248,14 @@ static const EPopupHookTargetMask eabph_
{ 0 }
};
+static const EPopupHookTargetMask eabph_select_names_masks[] = {
+ { 0 }
+};
+
static const EPopupHookTargetMap eabph_targets[] = {
{ "select", EAB_POPUP_TARGET_SELECT, eabph_select_masks },
{ "source", EAB_POPUP_TARGET_SOURCE, eabph_source_masks },
+ { "select-names", EAB_POPUP_TARGET_SELECT_NAMES, eabph_select_names_masks },
{ 0 }
};
Index: addressbook/gui/widgets/eab-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-popup.h,v
retrieving revision 1.1
diff -u -p -r1.1 eab-popup.h
--- addressbook/gui/widgets/eab-popup.h 6 Oct 2004 03:22:22 -0000 1.1
+++ addressbook/gui/widgets/eab-popup.h 6 Oct 2004 11:15:44 -0000
@@ -45,6 +45,7 @@ typedef struct _EABPopupClass EABPopupCl
enum _eab_popup_target_t {
EAB_POPUP_TARGET_SELECT,
EAB_POPUP_TARGET_SOURCE,
+ EAB_POPUP_TARGET_SELECT_NAMES,
};
/**
@@ -77,6 +78,7 @@ enum _eab_popup_target_source_t {
typedef struct _EABPopupTargetSelect EABPopupTargetSelect;
typedef struct _EABPopupTargetSource EABPopupTargetSource;
+typedef struct _EABPopupTargetSelectNames EABPopupTargetSelectNames;
/**
* struct _EABPopupTargetSelect - A list of address cards.
@@ -109,6 +111,23 @@ struct _EABPopupTargetSource {
struct _ESourceSelector *selector;
};
+/**
+ * struct _EABPopupTargetSelectNames - A select names target.
+ *
+ * @target: Superclass.
+ * @model: Select names model.
+ * @row: Row of item selected.
+ *
+ * This target is used to represent an item selected in an
+ * ESelectNames model.
+ **/
+struct _EABPopupTargetSelectNames {
+ EPopupTarget target;
+
+ struct _ESelectNamesModel *model;
+ int row;
+};
+
typedef struct _EPopupItem EABPopupItem;
/* The object */
@@ -128,6 +147,7 @@ EABPopup *eab_popup_new(const char *menu
EABPopupTargetSelect *eab_popup_target_new_select(EABPopup *eabp, struct _EBook *book, int readonly, GPtrArray *cards);
EABPopupTargetSource *eab_popup_target_new_source(EABPopup *eabp, struct _ESourceSelector *selector);
+EABPopupTargetSelectNames *eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row);
/* ********************************************************************** */
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2522
diff -u -p -r1.2522 ChangeLog
--- calendar/ChangeLog 6 Oct 2004 03:22:38 -0000 1.2522
+++ calendar/ChangeLog 6 Oct 2004 11:15:46 -0000
@@ -1,3 +1,37 @@
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * gui/gnome-cal.c (gnome_calendar_setup_view_popup): rename to
+ view_popup_factory. Make it build an epopup item list directly.
+ Can't re-use the galview cruft :-/
+ (gnome_calendar_discard_view_popup): no longer needed.
+ (gc_set_view, gc_save_custom_view, gc_define_views_response)
+ (gc_define_views): implement the gal-view popup menu items.
+
+ * gui/gnome-cal.h:
+ * gui/e-week-view.h:
+ * gui/e-day-view.h:
+ * gui/e-cal-list-view.h: removed old e-popup-menu header.
+
+ * gui/e-calendar-view.c (setup_popup_icons): removed.
+ (e_calendar_view_create_popup_menu): converted to use e-popup.
+ (on_paste, on_copy, on_cut, on_delete_occurrence)
+ (on_unrecur_appointment, on_delete_appointment, on_publish)
+ (on_forward, on_meeting, on_move_to, on_copy_to, on_print_event)
+ (on_save_as, on_print, on_edit_appointment, on_goto_today)
+ (on_goto_date, on_new_task, on_new_meeting, on_new_event)
+ (on_new_appointment): convert to use e-popup stuff.
+
+ * gui/tasks-component.c (popup_event_cb): e-popup api changes.
+
+ * gui/e-cal-popup.c (e_cal_popup_target_new_select): implement the
+ selection target.
+ (ecalp_target_free): and free it.
+
+ * gui/e-cal-model.h: Make the ECalModel struct non-anonymous so it
+ can be forward-declared.
+
+ * gui/calendar-component.c (popup_event_cb): e-popup api changes.
+
2004-10-01 Not Zed <NotZed Ximian com>
* gui/tasks-component.c (create_component_view): cast warning
Index: calendar/gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.184
diff -u -p -r1.184 calendar-component.c
--- calendar/gui/calendar-component.c 6 Oct 2004 03:22:39 -0000 1.184
+++ calendar/gui/calendar-component.c 6 Oct 2004 11:15:47 -0000
@@ -379,10 +379,10 @@ edit_calendar_cb (EPopup *ep, EPopupItem
}
static EPopupItem ecc_source_popups[] = {
- { E_POPUP_ITEM, "10.new", N_("New Calendar"), new_calendar_cb, NULL, "stock_calendar", 0 },
- { E_POPUP_ITEM, "15.copy", N_("Copy"), copy_calendar_cb, NULL, "stock_folder-copy", E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_calendar_cb, NULL, "stock_delete", E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_calendar_cb, NULL, NULL, E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "10.new", N_("New Calendar"), new_calendar_cb, NULL, "stock_calendar", 0, 0 },
+ { E_POPUP_ITEM, "15.copy", N_("Copy"), copy_calendar_cb, NULL, "stock_folder-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_calendar_cb, NULL, "stock_delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_calendar_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
};
static void
@@ -409,8 +409,7 @@ popup_event_cb(ESourceSelector *selector
e_popup_add_items((EPopup *)ep, menus, ecc_source_popup_free, component_view);
- /* visibility is disabled, we only disable menu items */
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
return TRUE;
Index: calendar/gui/e-cal-list-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-list-view.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-cal-list-view.c
--- calendar/gui/e-cal-list-view.c 2 Aug 2004 07:33:37 -0000 1.10
+++ calendar/gui/e-cal-list-view.c 6 Oct 2004 11:15:47 -0000
@@ -367,10 +367,10 @@ e_cal_list_view_destroy (GtkObject *obje
static void
e_cal_list_view_show_popup_menu (ECalListView *cal_list_view, gint row, GdkEvent *gdk_event)
{
- GtkMenu *popup;
+ GtkMenu *menu;
- popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (cal_list_view));
- e_popup_menu (popup, gdk_event);
+ menu = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (cal_list_view));
+ gtk_menu_popup(menu, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0, gdk_event?gdk_event->button.time:gtk_get_current_event_time());
}
static gboolean
Index: calendar/gui/e-cal-list-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-list-view.h,v
retrieving revision 1.5
diff -u -p -r1.5 e-cal-list-view.h
--- calendar/gui/e-cal-list-view.h 25 Mar 2004 17:56:06 -0000 1.5
+++ calendar/gui/e-cal-list-view.h 6 Oct 2004 11:15:47 -0000
@@ -26,7 +26,6 @@
#include <time.h>
#include <gtk/gtktable.h>
#include <gtk/gtktooltips.h>
-#include <gal/widgets/e-popup-menu.h>
#include "e-calendar-view.h"
#include "gnome-cal.h"
Index: calendar/gui/e-cal-model.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.h,v
retrieving revision 1.13
diff -u -p -r1.13 e-cal-model.h
--- calendar/gui/e-cal-model.h 2 Aug 2004 07:33:38 -0000 1.13
+++ calendar/gui/e-cal-model.h 6 Oct 2004 11:15:47 -0000
@@ -76,7 +76,7 @@ typedef struct {
gpointer cb_data;
} ECalModelGenerateInstancesData;
-typedef struct {
+typedef struct _ECalModel {
ETableModel model;
ECalModelPrivate *priv;
} ECalModel;
Index: calendar/gui/e-cal-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.c,v
retrieving revision 1.1
diff -u -p -r1.1 e-cal-popup.c
--- calendar/gui/e-cal-popup.c 6 Oct 2004 03:22:39 -0000 1.1
+++ calendar/gui/e-cal-popup.c 6 Oct 2004 11:15:47 -0000
@@ -31,6 +31,10 @@
#include "e-cal-popup.h"
#include "widgets/misc/e-source-selector.h"
+#include "gui/e-calendar-view.h"
+#include "gui/e-cal-model.h"
+#include "itip-utils.h"
+
static GObjectClass *ecalp_parent;
static void
@@ -51,9 +55,12 @@ ecalp_target_free(EPopup *ep, EPopupTarg
switch (t->type) {
case E_CAL_POPUP_TARGET_SELECT: {
ECalPopupTargetSelect *s = (ECalPopupTargetSelect *)t;
+ int i;
- /* FIXME: implement */
- s = s;
+ for (i=0;i<s->events->len;i++)
+ e_cal_model_free_component_data(s->events->pdata[i]);
+ g_ptr_array_free(s->events, TRUE);
+ g_object_unref(s->model);
break; }
case E_CAL_POPUP_TARGET_SOURCE: {
ECalPopupTargetSource *s = (ECalPopupTargetSource *)t;
@@ -110,12 +117,69 @@ ECalPopup *e_cal_popup_new(const char *m
* Return value:
**/
ECalPopupTargetSelect *
-e_cal_popup_target_new_select(ECalPopup *eabp)
+e_cal_popup_target_new_select(ECalPopup *eabp, ECalendarView *view)
{
ECalPopupTargetSelect *t = e_popup_target_new(&eabp->popup, E_CAL_POPUP_TARGET_SELECT, sizeof(*t));
guint32 mask = ~0;
+ GList *events, *l;
+ ECal *client;
+ gboolean read_only;
+
+ t->model = e_calendar_view_get_model(view);
+ g_object_ref(t->model);
+ t->events = g_ptr_array_new();
+ l = events = e_calendar_view_get_selected_events(view);
+ for (l=events;l;l=g_list_next(l)) {
+ ECalendarViewEvent *event = l->data;
+
+ if (event)
+ g_ptr_array_add(t->events, e_cal_model_copy_component_data(event->comp_data));
+ }
+
+ /* In reality this is only ever called with a single event or none */
+
+ if (t->events->len == 0) {
+ client = e_cal_model_get_default_client(t->model);
+ } else {
+ ECalendarViewEvent *event = (ECalendarViewEvent *)events->data;
+
+ mask &= ~E_CAL_POPUP_SELECT_MANY;
+ if (events->next == NULL)
+ mask &= ~E_CAL_POPUP_SELECT_ONE;
+
+ if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ mask &= ~E_CAL_POPUP_SELECT_RECURRING;
+ else
+ mask &= ~E_CAL_POPUP_SELECT_NONRECURRING;
+
+ if (e_cal_util_component_is_instance (event->comp_data->icalcomp))
+ mask &= ~E_CAL_POPUP_SELECT_INSTANCE;
+
+ if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) {
+ ECalComponent *comp;
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ if (!itip_organizer_is_user (comp, event->comp_data->client))
+ mask &= ~E_CAL_POPUP_SELECT_ORGANIZER;
+
+ g_object_unref (comp);
+ } else {
+ /* organiser is synonym for owner in this case */
+ mask &= ~(E_CAL_POPUP_SELECT_ORGANIZER|E_CAL_POPUP_SELECT_NOTMEETING);
+ }
+
+ client = event->comp_data->client;
+ }
+
+ g_list_free(events);
+
+ e_cal_is_read_only(client, &read_only, NULL);
+ if (!read_only)
+ mask &= ~E_CAL_POPUP_SELECT_EDITABLE;
- /* FIXME: impelement */
+ /* This bit isn't implemented ... */
+ mask &= ~E_CAL_POPUP_SELECT_NOTEDITING;
t->target.mask = mask;
Index: calendar/gui/e-cal-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.h,v
retrieving revision 1.1
diff -u -p -r1.1 e-cal-popup.h
--- calendar/gui/e-cal-popup.h 6 Oct 2004 03:22:39 -0000 1.1
+++ calendar/gui/e-cal-popup.h 6 Oct 2004 11:15:47 -0000
@@ -34,6 +34,8 @@ extern "C" {
typedef struct _ECalPopup ECalPopup;
typedef struct _ECalPopupClass ECalPopupClass;
+struct _ECalendarView;
+
/**
* enum _e_cal_popup_target_t - A list of mail popup target types.
*
@@ -52,11 +54,26 @@ enum _e_cal_popup_target_t {
*
* @E_CAL_POPUP_SELECT_ONE: Only one item is selected.
* @E_CAL_POPUP_SELECT_MANY: One ore more items are selected.
+ * @E_CAL_POPUP_SELECT_EDITABLE: The selection is editable.
+ * @E_CAL_POPUP_SELECT_RECURRING: Is a recurring event.
+ * @E_CAL_POPUP_SELECT_NONRECURRING: Is not a recurring event.
+ * @E_CAL_POPUP_SELECT_INSTANCE: This is an instance event.
+ * @E_CAL_POPUP_SELECT_ORGANIZER: The user is the organiser of the event.
+ * @E_CAL_POPUP_SELECT_NOTEDITING: The event is not being edited already.
+ * @E_CAL_POPUP_SELECT_NOTMEETING: The event is not a meeting.
*
**/
enum _e_cal_popup_target_select_t {
- E_CAL_POPUP_SELECT_ONE = 1<<1,
- E_CAL_POPUP_SELECT_MANY = 1<<2,
+ E_CAL_POPUP_SELECT_ONE = 1<<0,
+ E_CAL_POPUP_SELECT_MANY = 1<<1,
+ E_CAL_POPUP_SELECT_EDITABLE = 1<<2,
+ E_CAL_POPUP_SELECT_RECURRING = 1<<3,
+ E_CAL_POPUP_SELECT_NONRECURRING = 1<<4,
+ E_CAL_POPUP_SELECT_INSTANCE = 1<<5,
+
+ E_CAL_POPUP_SELECT_ORGANIZER = 1<<6,
+ E_CAL_POPUP_SELECT_NOTEDITING = 1<<7,
+ E_CAL_POPUP_SELECT_NOTMEETING = 1<<8,
};
/**
@@ -78,15 +95,21 @@ typedef struct _ECalPopupTargetSource EC
/**
* struct _ECalPopupTargetSelect - A list of address cards.
*
- * @target: Superclass.
+ * @target: Superclass. target.widget is an ECalendarView.
+ * @model: The ECalModel.
+ * @events: The selected events. These are ECalModelComponent's.
*
* Used to represent a selection of appointments as context for a popup
* menu.
*
- * FIXME: impelemnt me
+ * TODO: For maximum re-usability references to the view could be removed
+ * from this structure.
**/
struct _ECalPopupTargetSelect {
EPopupTarget target;
+
+ struct _ECalModel *model;
+ GPtrArray *events;
};
/**
@@ -120,7 +143,7 @@ GType e_cal_popup_get_type(void);
ECalPopup *e_cal_popup_new(const char *menuid);
-ECalPopupTargetSelect *e_cal_popup_target_new_select(ECalPopup *eabp);
+ECalPopupTargetSelect *e_cal_popup_target_new_select(ECalPopup *eabp, struct _ECalendarView *view);
ECalPopupTargetSource *e_cal_popup_target_new_source(ECalPopup *eabp, struct _ESourceSelector *selector);
/* ********************************************************************** */
Index: calendar/gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.63
diff -u -p -r1.63 e-calendar-view.c
--- calendar/gui/e-calendar-view.c 10 Aug 2004 14:04:20 -0000 1.63
+++ calendar/gui/e-calendar-view.c 6 Oct 2004 11:15:47 -0000
@@ -56,6 +56,7 @@
#include "print.h"
#include "goto.h"
#include "ea-calendar.h"
+#include "e-cal-popup.h"
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "stock_calendar"
@@ -72,9 +73,6 @@ struct _ECalendarViewPrivate {
EActivityHandler *activity_handler;
guint activity_id;
- /* The popup menu */
- EPopupMenu *view_menu;
-
/* The default category */
char *default_category;
};
@@ -942,57 +940,58 @@ e_calendar_view_delete_selected_occurren
}
static void
-on_new_appointment (GtkWidget *widget, gpointer user_data)
+on_new_appointment (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = (ECalendarView *) user_data;
+ ECalendarView *cal_view = data;
e_calendar_view_new_appointment (cal_view);
}
static void
-on_new_event (GtkWidget *widget, gpointer user_data)
+on_new_event (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = (ECalendarView *) user_data;
+ ECalendarView *cal_view = data;
e_calendar_view_new_appointment_full (cal_view, TRUE, FALSE);
}
static void
-on_new_meeting (GtkWidget *widget, gpointer user_data)
+on_new_meeting (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = (ECalendarView *) user_data;
+ ECalendarView *cal_view = data;
e_calendar_view_new_appointment_full (cal_view, FALSE, TRUE);
}
static void
-on_new_task (GtkWidget *widget, gpointer user_data)
+on_new_task (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = (ECalendarView *) user_data;
+ ECalendarView *cal_view = data;
+
gnome_calendar_new_task (cal_view->priv->calendar);
}
static void
-on_goto_date (GtkWidget *widget, gpointer user_data)
+on_goto_date (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
goto_dialog (cal_view->priv->calendar);
}
static void
-on_goto_today (GtkWidget *widget, gpointer user_data)
+on_goto_today (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
calendar_goto_today (cal_view->priv->calendar);
}
static void
-on_edit_appointment (GtkWidget *widget, gpointer user_data)
+on_edit_appointment (EPopup *ep, EPopupItem *pitem, void *data)
{
+ ECalendarView *cal_view = data;
GList *selected;
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
@@ -1007,15 +1006,13 @@ on_edit_appointment (GtkWidget *widget,
}
static void
-on_print (GtkWidget *widget, gpointer user_data)
+on_print (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view;
+ ECalendarView *cal_view = data;
time_t start, end;
GnomeCalendarViewType view_type;
PrintView print_view;
- cal_view = E_CALENDAR_VIEW (user_data);
-
e_calendar_view_get_visible_time_range (cal_view, &start, &end);
view_type = gnome_calendar_get_view (cal_view->priv->calendar);
@@ -1042,17 +1039,15 @@ on_print (GtkWidget *widget, gpointer us
}
static void
-on_save_as (GtkWidget *widget, gpointer user_data)
+on_save_as (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view;
+ ECalendarView *cal_view = data;
GList *selected;
char *filename;
char *ical_string;
FILE *file;
ECalendarViewEvent *event;
- cal_view = E_CALENDAR_VIEW (user_data);
-
selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
@@ -1082,14 +1077,13 @@ on_save_as (GtkWidget *widget, gpointer
}
static void
-on_print_event (GtkWidget *widget, gpointer user_data)
+on_print_event (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view;
+ ECalendarView *cal_view = data;
GList *selected;
ECalendarViewEvent *event;
ECalComponent *comp;
- cal_view = E_CALENDAR_VIEW (user_data);
selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
@@ -1189,26 +1183,26 @@ transfer_selected_items (ECalendarView *
}
static void
-on_copy_to (GtkWidget *widget, gpointer user_data)
+on_copy_to (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
transfer_selected_items (cal_view, FALSE);
}
static void
-on_move_to (GtkWidget *widget, gpointer user_data)
+on_move_to (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
transfer_selected_items (cal_view, TRUE);
}
static void
-on_meeting (GtkWidget *widget, gpointer user_data)
+on_meeting (EPopup *ep, EPopupItem *pitem, void *data)
{
+ ECalendarView *cal_view = data;
GList *selected;
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
@@ -1220,10 +1214,10 @@ on_meeting (GtkWidget *widget, gpointer
}
static void
-on_forward (GtkWidget *widget, gpointer user_data)
+on_forward (EPopup *ep, EPopupItem *pitem, void *data)
{
+ ECalendarView *cal_view = data;
GList *selected;
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
@@ -1240,24 +1234,23 @@ on_forward (GtkWidget *widget, gpointer
}
static void
-on_publish (GtkWidget *widget, gpointer user_data)
+on_publish (EPopup *ep, EPopupItem *pitem, void *data)
{
e_pub_publish (TRUE);
}
static void
-on_delete_appointment (GtkWidget *widget, gpointer user_data)
+on_delete_appointment (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view;
+ ECalendarView *cal_view = data;
- cal_view = E_CALENDAR_VIEW (user_data);
e_calendar_view_delete_selected_event (cal_view);
}
static void
-on_unrecur_appointment (GtkWidget *widget, gpointer user_data)
+on_unrecur_appointment (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view;
+ ECalendarView *cal_view = data;
ECalendarViewEvent *event;
ECalComponent *comp, *new_comp;
ECalComponentDateTime date;
@@ -1265,8 +1258,6 @@ on_unrecur_appointment (GtkWidget *widge
GList *selected;
char *new_uid;
- cal_view = E_CALENDAR_VIEW (user_data);
-
selected = e_calendar_view_get_selected_events (cal_view);
if (!selected)
return;
@@ -1326,266 +1317,126 @@ on_unrecur_appointment (GtkWidget *widge
}
static void
-on_delete_occurrence (GtkWidget *widget, gpointer user_data)
+on_delete_occurrence (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view;
+ ECalendarView *cal_view = data;
- cal_view = E_CALENDAR_VIEW (user_data);
e_calendar_view_delete_selected_occurrence (cal_view);
}
static void
-on_cut (GtkWidget *widget, gpointer user_data)
+on_cut (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
e_calendar_view_cut_clipboard (cal_view);
}
static void
-on_copy (GtkWidget *widget, gpointer user_data)
+on_copy (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
e_calendar_view_copy_clipboard (cal_view);
}
static void
-on_paste (GtkWidget *widget, gpointer user_data)
+on_paste (EPopup *ep, EPopupItem *pitem, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (user_data);
+ ECalendarView *cal_view = data;
e_calendar_view_paste_clipboard (cal_view);
}
-enum {
- /*
- * This is used to "flag" events that can not be editted
- */
- MASK_EDITABLE = 1,
-
- /*
- * To disable recurring actions to be displayed
- */
- MASK_RECURRING = 2,
-
- /*
- * To disable actions for non-recurring items to be displayed
- */
- MASK_SINGLE = 4,
-
- /*
- * This is used to when an event is currently being edited
- * in another window and we want to disable the event
- * from being edited twice
- */
- MASK_EDITING = 8,
-
- /*
- * This is used to when an event is already a meeting and
- * we want to disable the schedule meeting command
- */
- MASK_MEETING = 16,
-
- /*
- * To disable cut and copy for meetings the user is not the
- * organizer of
- */
- MASK_MEETING_ORGANIZER = 32,
-
- /*
- * To disable things not valid for instances
- */
- MASK_INSTANCE = 64
-};
-
-static EPopupMenu main_items [] = {
- E_POPUP_ITEM (N_("New _Appointment..."), GTK_SIGNAL_FUNC (on_new_appointment), 0),
- E_POPUP_ITEM (N_("New All Day _Event"), GTK_SIGNAL_FUNC (on_new_event), 0),
- E_POPUP_ITEM (N_("New Meeting"), GTK_SIGNAL_FUNC (on_new_meeting), 0),
- E_POPUP_ITEM (N_("New Task"), GTK_SIGNAL_FUNC (on_new_task), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Print..."), GTK_SIGNAL_FUNC (on_print), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Paste"), GTK_SIGNAL_FUNC (on_paste), MASK_EDITABLE),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_SUBMENU (N_("Current View"), NULL, 0),
+static EPopupItem ecv_main_items [] = {
+ { E_POPUP_ITEM, "00.new", N_("New _Appointment..."), on_new_appointment, NULL, "stock_new-appointment", 0, 0 },
+ { E_POPUP_ITEM, "10.newallday", N_("New All Day _Event"), on_new_event, NULL, "stock_new-24h-appointment", 0, 0},
+ { E_POPUP_ITEM, "20.meeting", N_("New Meeting"), on_new_meeting, NULL, "stock_new-meeting", 0, 0},
+ { E_POPUP_ITEM, "30.task", N_("New Task"), on_new_task, NULL, "stock_task", 0, 0},
+
+ { E_POPUP_BAR, "40."},
+ { E_POPUP_ITEM, "40.print", N_("_Print..."), on_print, NULL, GTK_STOCK_PRINT, 0, 0 },
+
+ { E_POPUP_BAR, "50." },
+ { E_POPUP_ITEM, "50.paste", N_("_Paste"), on_paste, NULL, GTK_STOCK_PASTE, 0, E_CAL_POPUP_SELECT_EDITABLE },
+
+ { E_POPUP_BAR, "60." },
+ /* FIXME: hook in this somehow */
+ { E_POPUP_SUBMENU, "60.view", N_("Current View") },
- E_POPUP_ITEM (N_("Select _Today"), GTK_SIGNAL_FUNC (on_goto_today), 0),
- E_POPUP_ITEM (N_("_Select Date..."), GTK_SIGNAL_FUNC (on_goto_date), 0),
-
- E_POPUP_SEPARATOR,
+ { E_POPUP_ITEM, "61.today", N_("Select _Today"), on_goto_today, NULL, GTK_STOCK_HOME },
+ { E_POPUP_ITEM, "62.todate", N_("_Select Date..."), on_goto_date, NULL, GTK_STOCK_JUMP_TO },
- E_POPUP_ITEM (N_("_Publish Free/Busy Information"), GTK_SIGNAL_FUNC (on_publish), 0),
+ { E_POPUP_BAR, "70." },
- E_POPUP_TERMINATOR
+ /* TODO: Why is this in a context menu when it applies globally? */
+ { E_POPUP_ITEM, "70.publish", N_("_Publish Free/Busy Information"), on_publish, },
};
-static EPopupMenu child_items [] = {
- E_POPUP_ITEM (N_("_Open"), GTK_SIGNAL_FUNC (on_edit_appointment), MASK_EDITING),
- E_POPUP_ITEM (N_("_Save As..."), GTK_SIGNAL_FUNC (on_save_as), MASK_EDITING),
- E_POPUP_ITEM (N_("_Print..."), GTK_SIGNAL_FUNC (on_print_event), MASK_EDITING),
-
- /* Only show this separator if one of the above is shown. */
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("C_ut"), GTK_SIGNAL_FUNC (on_cut), MASK_EDITING | MASK_EDITABLE | MASK_MEETING_ORGANIZER),
- E_POPUP_ITEM (N_("_Copy"), GTK_SIGNAL_FUNC (on_copy), MASK_EDITING | MASK_MEETING_ORGANIZER),
- E_POPUP_ITEM (N_("_Paste"), GTK_SIGNAL_FUNC (on_paste), MASK_EDITABLE),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Cop_y to Calendar..."), GTK_SIGNAL_FUNC (on_copy_to), MASK_EDITING),
- E_POPUP_ITEM (N_("Mo_ve to Calendar..."), GTK_SIGNAL_FUNC (on_move_to), MASK_EDITING | MASK_EDITABLE),
- E_POPUP_ITEM (N_("_Schedule Meeting..."), GTK_SIGNAL_FUNC (on_meeting), MASK_EDITABLE | MASK_EDITING | MASK_MEETING),
- E_POPUP_ITEM (N_("_Forward as iCalendar..."), GTK_SIGNAL_FUNC (on_forward), MASK_EDITING),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), GTK_SIGNAL_FUNC (on_unrecur_appointment), MASK_EDITABLE | MASK_RECURRING | MASK_EDITING | MASK_INSTANCE),
- E_POPUP_ITEM (N_("Delete this _Occurrence"), GTK_SIGNAL_FUNC (on_delete_occurrence), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
- E_POPUP_ITEM (N_("Delete _All Occurrences"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
-
- E_POPUP_TERMINATOR
+static EPopupItem ecv_child_items [] = {
+ { E_POPUP_ITEM, "00.open", N_("_Open"), on_edit_appointment, NULL, GTK_STOCK_OPEN, 0, E_CAL_POPUP_SELECT_NOTEDITING },
+ { E_POPUP_ITEM, "10.saveas", N_("_Save As..."), on_save_as, NULL, GTK_STOCK_SAVE_AS, 0, E_CAL_POPUP_SELECT_NOTEDITING },
+ { E_POPUP_ITEM, "20.print", N_("_Print..."), on_print_event, NULL, GTK_STOCK_PRINT, 0, E_CAL_POPUP_SELECT_NOTEDITING },
+
+ { E_POPUP_BAR, "30." },
+
+ { E_POPUP_ITEM, "31.cut", N_("C_ut"), on_cut, NULL, GTK_STOCK_CUT, 0, E_CAL_POPUP_SELECT_NOTEDITING|E_CAL_POPUP_SELECT_EDITABLE|E_CAL_POPUP_SELECT_ORGANIZER },
+ { E_POPUP_ITEM, "32.copy", N_("_Copy"), on_copy, NULL, GTK_STOCK_COPY, 0, E_CAL_POPUP_SELECT_NOTEDITING|E_CAL_POPUP_SELECT_ORGANIZER },
+ { E_POPUP_ITEM, "33.paste", N_("_Paste"), on_paste, NULL, GTK_STOCK_PASTE, 0, E_CAL_POPUP_SELECT_EDITABLE },
+
+ { E_POPUP_BAR, "40." },
+
+ { E_POPUP_ITEM, "41.copyto", N_("Cop_y to Calendar..."), on_copy_to, NULL, NULL, 0, E_CAL_POPUP_SELECT_NOTEDITING },
+ { E_POPUP_ITEM, "42.moveto", N_("Mo_ve to Calendar..."), on_move_to, NULL, NULL, 0, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "43.schedule", N_("_Schedule Meeting..."), on_meeting, NULL, NULL, 0, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_NOTMEETING },
+ { E_POPUP_ITEM, "44.forward", N_("_Forward as iCalendar..."), on_forward, NULL, "stock_mail-forward", 0, E_CAL_POPUP_SELECT_NOTEDITING },
+
+ { E_POPUP_BAR, "50." },
+
+ { E_POPUP_ITEM, "51.delete", N_("_Delete"), on_delete_appointment, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_NONRECURRING, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "52.move", N_("Make this Occurrence _Movable"), on_unrecur_appointment, NULL, NULL, E_CAL_POPUP_SELECT_RECURRING | E_CAL_POPUP_SELECT_INSTANCE, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "53.delete", N_("Delete this _Occurrence"), on_delete_occurrence, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_RECURRING, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE },
+ { E_POPUP_ITEM, "54.delete", N_("Delete _All Occurrences"), on_delete_appointment, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_RECURRING, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE },
};
static void
-free_view_popup (GtkWidget *widget, gpointer data)
+ecv_popup_free (EPopup *ep, GSList *list, void *data)
{
- ECalendarView *cal_view = E_CALENDAR_VIEW (data);
-
- if (cal_view->priv->view_menu == NULL)
- return;
-
- gnome_calendar_discard_view_popup (cal_view->priv->calendar, cal_view->priv->view_menu);
- cal_view->priv->view_menu = NULL;
-}
-
-static void
-setup_popup_icons (EPopupMenu *context_menu)
-{
- gint i;
-
- for (i = 0; context_menu[i].name; i++) {
- GtkWidget *pixmap_widget = NULL;
- GdkPixbuf *pixbuf;
-
- if (!strcmp (context_menu[i].name, _("_Copy")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("C_ut")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Delete")) ||
- !strcmp (context_menu[i].name, _("Delete this _Occurrence")) ||
- !strcmp (context_menu[i].name, _("Delete _All Occurrences")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("Go to _Today")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Go to Date...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("New _Appointment..."))) {
- pixbuf = e_icon_factory_get_icon ("stock_new-appointment", E_ICON_SIZE_MENU);
- pixmap_widget = gtk_image_new_from_pixbuf (pixbuf);
- gdk_pixbuf_unref (pixbuf);
- }
- else if (!strcmp (context_menu[i].name, _("New All Day _Event"))) {
- pixbuf = e_icon_factory_get_icon ("stock_new-24h-appointment", E_ICON_SIZE_MENU);
- pixmap_widget = gtk_image_new_from_pixbuf (pixbuf);
- gdk_pixbuf_unref (pixbuf);
- }
- else if (!strcmp (context_menu[i].name, _("New Meeting"))) {
- pixbuf = e_icon_factory_get_icon ("stock_new-meeting", E_ICON_SIZE_MENU);
- pixmap_widget = gtk_image_new_from_pixbuf (pixbuf);
- gdk_pixbuf_unref (pixbuf);
- }
- else if (!strcmp (context_menu[i].name, _("New Task"))) {
- pixbuf = e_icon_factory_get_icon ("stock_task", E_ICON_SIZE_MENU);
- pixmap_widget = gtk_image_new_from_pixbuf (pixbuf);
- gdk_pixbuf_unref (pixbuf);
- }
- else if (!strcmp (context_menu[i].name, _("_Open")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Paste")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Print...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Save As...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Settings...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
-
- if (pixmap_widget)
- gtk_widget_show (pixmap_widget);
- context_menu[i].pixmap_widget = pixmap_widget;
- }
+ g_slist_free(list);
}
GtkMenu *
e_calendar_view_create_popup_menu (ECalendarView *cal_view)
{
- GList *selected;
- EPopupMenu *context_menu;
- guint32 disable_mask = 0, hide_mask = 0;
- GtkMenu *popup;
- ECal *client = NULL;
- gboolean read_only = TRUE;
-
- g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
+ ECalPopup *ep;
+ GSList *menus = NULL;
+ int i;
+ ECalPopupTargetSelect *t;
- /* get the selection */
- selected = e_calendar_view_get_selected_events (cal_view);
+ g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
- if (selected == NULL) {
- cal_view->priv->view_menu = gnome_calendar_setup_view_popup (cal_view->priv->calendar);
- main_items[9].submenu = cal_view->priv->view_menu;
- context_menu = main_items;
+ /* We could do this using a factory on the ECalPopup class,
+ * that way we would get called implicitly whenever a popup
+ * menu was created rather than everyone having to call us.
+ * We could also have a different menu id for each view */
+
+ ep = e_cal_popup_new("com.novell.evolution.calendar.view.popup");
+ t = e_cal_popup_target_new_select(ep, cal_view);
+ t->target.widget = (GtkWidget *)cal_view;
+
+ if (t->events->len == 0) {
+ for (i=0;i<sizeof(ecv_main_items)/sizeof(ecv_main_items[0]);i++)
+ menus = g_slist_prepend(menus, &ecv_main_items[i]);
- client = e_cal_model_get_default_client (cal_view->priv->model);
+ gnome_calendar_view_popup_factory(cal_view->priv->calendar, (EPopup *)ep, "60.view");
} else {
- ECalendarViewEvent *event;
-
- context_menu = child_items;
-
- event = (ECalendarViewEvent *) selected->data;
- if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
- hide_mask |= MASK_SINGLE;
- else
- hide_mask |= MASK_RECURRING;
-
- if (e_cal_util_component_is_instance (event->comp_data->icalcomp))
- hide_mask |= MASK_INSTANCE;
-
- if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) {
- ECalComponent *comp;
-
- disable_mask |= MASK_MEETING;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- if (!itip_organizer_is_user (comp, event->comp_data->client))
- disable_mask |= MASK_MEETING_ORGANIZER;
-
- g_object_unref (comp);
- }
-
- client = event->comp_data->client;
+ for (i=0;i<sizeof(ecv_child_items)/sizeof(ecv_child_items[0]);i++)
+ menus = g_slist_prepend(menus, &ecv_child_items[i]);
}
- e_cal_is_read_only (client, &read_only, NULL);
- if (read_only)
- disable_mask |= MASK_EDITABLE;
-
- setup_popup_icons (context_menu);
- popup = e_popup_menu_create (context_menu, disable_mask, hide_mask, cal_view);
- g_signal_connect (popup, "selection-done", G_CALLBACK (free_view_popup), cal_view);
+ e_popup_add_items((EPopup *)ep, menus, ecv_popup_free, cal_view);
- return popup;
+ return e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
}
void
Index: calendar/gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.252
diff -u -p -r1.252 e-day-view.c
--- calendar/gui/e-day-view.c 2 Aug 2004 07:33:38 -0000 1.252
+++ calendar/gui/e-day-view.c 6 Oct 2004 11:15:49 -0000
@@ -3289,7 +3289,7 @@ e_day_view_show_popup_menu (EDayView *da
popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (day_view));
g_object_weak_ref (G_OBJECT (popup), popup_destroyed_cb, day_view);
- e_popup_menu (popup, gdk_event);
+ gtk_menu_popup (popup, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0, gdk_event?gdk_event->button.time:gtk_get_current_event_time());
}
static gboolean
Index: calendar/gui/e-day-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.h,v
retrieving revision 1.61
diff -u -p -r1.61 e-day-view.h
--- calendar/gui/e-day-view.h 19 Apr 2004 15:19:32 -0000 1.61
+++ calendar/gui/e-day-view.h 6 Oct 2004 11:15:49 -0000
@@ -28,7 +28,6 @@
#include <gtk/gtktable.h>
#include <gtk/gtktooltips.h>
#include <libgnomecanvas/gnome-canvas.h>
-#include <gal/widgets/e-popup-menu.h>
#include "e-calendar-view.h"
#include "gnome-cal.h"
Index: calendar/gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.223
diff -u -p -r1.223 e-week-view.c
--- calendar/gui/e-week-view.c 8 Sep 2004 17:34:46 -0000 1.223
+++ calendar/gui/e-week-view.c 6 Oct 2004 11:15:50 -0000
@@ -3935,7 +3935,7 @@ e_week_view_show_popup_menu (EWeekView
popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (week_view));
g_object_weak_ref (G_OBJECT (popup), popup_destroyed_cb, week_view);
- e_popup_menu (popup, (GdkEvent *) bevent);
+ gtk_menu_popup (popup, NULL, NULL, NULL, NULL, bevent?bevent->button:0, bevent?bevent->time:gtk_get_current_event_time());
}
static gboolean
Index: calendar/gui/e-week-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.h,v
retrieving revision 1.55
diff -u -p -r1.55 e-week-view.h
--- calendar/gui/e-week-view.h 22 Jun 2004 18:55:33 -0000 1.55
+++ calendar/gui/e-week-view.h 6 Oct 2004 11:15:50 -0000
@@ -26,7 +26,6 @@
#include <gtk/gtktable.h>
#include <libgnomecanvas/gnome-canvas.h>
-#include <gal/widgets/e-popup-menu.h>
#include "e-calendar-view.h"
#include "gnome-cal.h"
Index: calendar/gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.351
diff -u -p -r1.351 gnome-cal.c
--- calendar/gui/gnome-cal.c 21 Sep 2004 16:15:19 -0000 1.351
+++ calendar/gui/gnome-cal.c 6 Oct 2004 11:15:51 -0000
@@ -47,6 +47,7 @@
#include <libecal/e-cal-time-util.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
+#include <gal/menus/gal-define-views-dialog.h>
#include "widgets/menus/gal-view-menus.h"
#include "widgets/misc/e-error.h"
#include "e-comp-editor-registry.h"
@@ -77,6 +78,7 @@
#include "misc.h"
#include "ea-calendar.h"
#include "common/authentication.h"
+#include "e-cal-popup.h"
/* FIXME glib 2.4 and above has this */
#ifndef G_MAXINT32
@@ -1982,36 +1984,137 @@ gnome_calendar_discard_view_menus (Gnome
priv->view_menus = NULL;
}
-EPopupMenu *
-gnome_calendar_setup_view_popup (GnomeCalendar *gcal)
+/* This is copied/moved from gal-view-instance, only the calendar uses this for a popup menu */
+static void
+gc_set_view(EPopup *ep, EPopupItem *pitem, void *data)
{
- GnomeCalendarPrivate *priv;
+ GnomeCalendar *gcal = data;
- g_return_val_if_fail (gcal != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+ if (pitem->type & E_POPUP_ACTIVE)
+ gal_view_instance_set_current_view_id(gcal->priv->view_instance, (char *)pitem->user_data);
+}
- priv = gcal->priv;
+static void
+gc_save_custom_view(EPopup *ep, EPopupItem *pitem, void *data)
+{
+ GnomeCalendar *gcal = data;
- g_return_val_if_fail (priv->view_instance != NULL, NULL);
+ gal_view_instance_save_as(gcal->priv->view_instance);
+}
- return gal_view_instance_get_popup_menu (priv->view_instance);
+static void
+gc_define_views_response(GtkWidget *d, int id, GnomeCalendar *gcal)
+{
+ if (id == GTK_RESPONSE_OK)
+ gal_view_collection_save(gcal->priv->view_instance->collection);
+
+ gtk_widget_destroy(d);
}
-void
-gnome_calendar_discard_view_popup (GnomeCalendar *gcal, EPopupMenu *popup)
+static void
+gc_define_views(EPopup *ep, EPopupItem *pitem, void *data)
{
+ GnomeCalendar *gcal = data;
+ GtkWidget *dialog = gal_define_views_dialog_new(gcal->priv->view_instance->collection);
+
+ g_signal_connect(dialog, "response", G_CALLBACK(gc_define_views_response), data);
+ gtk_widget_show(dialog);
+}
+
+static EPopupItem gc_popups[] = {
+ /* Code generates the path to fit */
+ { E_POPUP_BAR, NULL },
+ { E_POPUP_RADIO|E_POPUP_ACTIVE, NULL, N_("Custom View"), },
+ { E_POPUP_ITEM, NULL, N_("Save Custom View"), gc_save_custom_view },
+
+ /* index == 3, when we have non-custom view */
+ { E_POPUP_BAR, NULL },
+ { E_POPUP_ITEM, NULL, N_("Define Views..."), gc_define_views },
+};
+static void
+gc_popup_free (EPopup *ep, GSList *list, void *data)
+{
+ while (list) {
+ GSList *n = list->next;
+ EPopupItem *pitem = list->data;
+
+ g_free(pitem->path);
+ g_free(pitem->label);
+ g_free(pitem->user_data);
+ g_free(pitem);
+ g_slist_free_1(list);
+ list = n;
+ }
+}
+
+static void
+gc_popup_free_static (EPopup *ep, GSList *list, void *data)
+{
+ while (list) {
+ GSList *n = list->next;
+ EPopupItem *pitem = list->data;
+
+ g_free(pitem->path);
+ g_free(pitem);
+ g_slist_free_1(list);
+ list = n;
+ }
+}
+
+void
+gnome_calendar_view_popup_factory (GnomeCalendar *gcal, EPopup *ep, const char *prefix)
+{
GnomeCalendarPrivate *priv;
+ int length;
+ int i;
+ gboolean found = FALSE;
+ char *id;
+ GSList *menus = NULL;
+ EPopupItem *pitem;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (prefix != NULL);
priv = gcal->priv;
g_return_if_fail (priv->view_instance != NULL);
- gal_view_instance_free_popup_menu (priv->view_instance, popup);
+ length = gal_view_collection_get_count(priv->view_instance->collection);
+ id = gal_view_instance_get_current_view_id (priv->view_instance);
+
+ for (i = 0; i < length; i++) {
+ GalViewCollectionItem *item = gal_view_collection_get_view_item(priv->view_instance->collection, i);
+
+ pitem = g_malloc0(sizeof(*pitem));
+ pitem->type = E_POPUP_RADIO;
+ pitem->path = g_strdup_printf("%s/%02d.item", prefix, i);
+ pitem->label = g_strdup(item->title);
+ pitem->activate = gc_set_view;
+ pitem->user_data = g_strdup(item->id);
+
+ if (!found && id && !strcmp (id, item->id)) {
+ found = TRUE;
+ pitem->type |= E_POPUP_ACTIVE;
+ }
+
+ menus = g_slist_prepend(menus, pitem);
+ }
+
+ if (menus)
+ e_popup_add_items(ep, menus, gc_popup_free, gcal);
+
+ menus = NULL;
+ for (i = found?3:0; i<sizeof(gc_popups)/sizeof(gc_popups[0]);i++) {
+ pitem = g_malloc0(sizeof(*pitem));
+ memcpy(pitem, &gc_popups[i], sizeof(*pitem));
+ pitem->path = g_strdup_printf("%s/%02d.item", prefix, i+length);
+ menus = g_slist_prepend(menus, pitem);
+ }
+
+ e_popup_add_items(ep, menus, gc_popup_free_static, gcal);
}
static void
Index: calendar/gui/gnome-cal.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.h,v
retrieving revision 1.100
diff -u -p -r1.100 gnome-cal.h
--- calendar/gui/gnome-cal.h 29 Apr 2004 19:36:53 -0000 1.100
+++ calendar/gui/gnome-cal.h 6 Oct 2004 11:15:51 -0000
@@ -28,7 +28,6 @@
#include <time.h>
#include <gtk/gtkvbox.h>
#include <bonobo/bonobo-ui-component.h>
-#include <gal/widgets/e-popup-menu.h>
#include <widgets/misc/e-calendar.h>
#include <libecal/e-cal.h>
@@ -38,6 +37,8 @@ G_BEGIN_DECLS
+struct _EPopup;
+
#define GNOME_TYPE_CALENDAR (gnome_calendar_get_type ())
#define GNOME_CALENDAR(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CALENDAR, GnomeCalendar))
#define GNOME_CALENDAR_CLASS(klass) (GTK_CHECK_CAST_CLASS ((klass), GNOME_TYPE_CALENDAR, \
@@ -137,8 +138,7 @@ GtkWidget *gnome_calendar_get_view_noteb
void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic);
void gnome_calendar_discard_view_menus (GnomeCalendar *gcal);
-EPopupMenu *gnome_calendar_setup_view_popup (GnomeCalendar *gcal);
-void gnome_calendar_discard_view_popup (GnomeCalendar *gcal, EPopupMenu *popup);
+void gnome_calendar_view_popup_factory (GnomeCalendar *gcal, struct _EPopup *ep, const char *prefix);
void gnome_calendar_set_selected_time_range (GnomeCalendar *gcal,
time_t start_time,
Index: calendar/gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.75
diff -u -p -r1.75 tasks-component.c
--- calendar/gui/tasks-component.c 6 Oct 2004 03:22:39 -0000 1.75
+++ calendar/gui/tasks-component.c 6 Oct 2004 11:15:51 -0000
@@ -325,10 +325,10 @@ edit_task_list_cb (EPopup *ep, EPopupIte
}
static EPopupItem etc_source_popups[] = {
- { E_POPUP_ITEM, "10.new", N_("New Task List"), new_task_list_cb, NULL, "stock_todo", 0 },
- { E_POPUP_ITEM, "15.copy", N_("Copy"), copy_task_list_cb, NULL, "stock_folder-copy", E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_task_list_cb, NULL, "stock_delete", E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_task_list_cb, NULL, NULL, E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "10.new", N_("New Task List"), new_task_list_cb, NULL, "stock_todo", 0, 0 },
+ { E_POPUP_ITEM, "15.copy", N_("Copy"), copy_task_list_cb, NULL, "stock_folder-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_task_list_cb, NULL, "stock_delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
+ { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_task_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
};
static void
@@ -355,8 +355,7 @@ popup_event_cb(ESourceSelector *selector
e_popup_add_items((EPopup *)ep, menus, etc_source_popup_free, component_view);
- /* visibility is disabled, we only disable menu items */
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
return TRUE;
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.663
diff -u -p -r1.663 ChangeLog
--- composer/ChangeLog 1 Oct 2004 05:30:22 -0000 1.663
+++ composer/ChangeLog 6 Oct 2004 11:15:52 -0000
@@ -1,3 +1,8 @@
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * e-msg-composer.c (drag_data_received):
+ * e-msg-composer-attachment-bar.c (emcab_popup): e-popup api changes.
+
2004-10-01 JP Rosevear <jpr novell com>
* e-msg-composer.c: uses GTKHTML_API_VERSION for the bonobo server
Index: composer/e-msg-composer-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.c,v
retrieving revision 1.90
diff -u -p -r1.90 e-msg-composer-attachment-bar.c
--- composer/e-msg-composer-attachment-bar.c 20 Sep 2004 05:59:54 -0000 1.90
+++ composer/e-msg-composer-attachment-bar.c 6 Oct 2004 11:15:52 -0000
@@ -513,7 +513,7 @@ emcab_popup(EMsgComposerAttachmentBar *b
e_popup_add_items((EPopup *)emp, menus, emcab_popups_free, bar);
t = em_popup_target_new_attachments(emp, attachments);
t->target.widget = (GtkWidget *)bar;
- menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)t, t->target.mask, t->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)t, 0);
if (event == NULL)
gtk_menu_popup(menu, NULL, NULL, emcab_popup_position, bar, 0, gtk_get_current_event_time());
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.484
diff -u -p -r1.484 e-msg-composer.c
--- composer/e-msg-composer.c 1 Oct 2004 05:30:22 -0000 1.484
+++ composer/e-msg-composer.c 6 Oct 2004 11:15:53 -0000
@@ -2929,7 +2929,7 @@ drag_data_received (EMsgComposer *compos
menus = g_slist_append(menus, &drop_popup_menu[i]);
e_popup_add_items((EPopup *)emp, menus, drop_popup_free, m);
- menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0, 0);
+ menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, time);
} else {
drop_action(composer, context, context->action, selection, info, time);
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.483
diff -u -p -r1.483 ChangeLog
--- e-util/ChangeLog 20 Sep 2004 05:59:54 -0000 1.483
+++ e-util/ChangeLog 6 Oct 2004 11:15:54 -0000
@@ -1,3 +1,12 @@
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * e-popup.c (e_popup_create_menu): only take one mask parameter,
+ and implement EPopupItem->enable to do what the other mask did.
+ (ep_activate): if this is a toggle or radiobutton, set the active
+ state on the item->type.
+ (e_popup_create_menu): if a menu image starts with gtk-, then
+ assume it is a gtk stock image instead.
+
2004-08-27 Not Zed <NotZed Ximian com>
* e-passwords.c (e_passwords_ask_password): return cancelled if
Index: e-util/e-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-popup.c,v
retrieving revision 1.2
diff -u -p -r1.2 e-popup.c
--- e-util/e-popup.c 20 Sep 2004 05:59:54 -0000 1.2
+++ e-util/e-popup.c 6 Oct 2004 11:15:54 -0000
@@ -254,7 +254,22 @@ ep_cmp(const void *ap, const void *bp)
static void
ep_activate(GtkWidget *w, struct _item_node *inode)
{
- inode->item->activate(inode->menu->popup, inode->item, inode->menu->data);
+ EPopupItem *item = inode->item;
+ guint32 type = item->type & E_POPUP_TYPE_MASK;
+
+ /* this is a bit hackish, use the item->type to transmit the
+ active state, presumes we can write to this memory ... The
+ alternative is the EMenu idea of different callbacks, but
+ thats painful for breaking type-safety on callbacks */
+
+ if (type == E_POPUP_TOGGLE || type == E_POPUP_RADIO) {
+ if (gtk_check_menu_item_get_active((GtkCheckMenuItem *)w))
+ item->type |= E_POPUP_ACTIVE;
+ else
+ item->type &= ~E_POPUP_ACTIVE;
+ }
+
+ item->activate(inode->menu->popup, item, inode->menu->data);
}
/**
@@ -262,18 +277,18 @@ ep_activate(GtkWidget *w, struct _item_n
* @emp: An EPopup derived object.
* @target: popup target, if set, then factories will be invoked.
* This is then owned by the menu.
- * @hide_mask: used to hide menu items, not sure of it's utility,
- * since you could just 'not add them' in the first place. Saves
- * copying logic anyway.
- * @disable_mask: used to disable menu items.
+ * @mask: If supplied, overrides the target specified mask or provides
+ * a mask if no target is supplied. Used to enable or show menu
+ * items.
*
* All of the menu items registered on @emp are sorted by path, and
* then converted into a menu heirarchy.
*
+ *
* Return value: A GtkMenu which can be popped up when ready.
**/
GtkMenu *
-e_popup_create_menu(EPopup *emp, EPopupTarget *target, guint32 hide_mask, guint32 disable_mask)
+e_popup_create_menu(EPopup *emp, EPopupTarget *target, guint32 mask)
{
struct _EPopupPrivate *p = emp->priv;
struct _menu_node *mnode, *nnode;
@@ -288,6 +303,9 @@ e_popup_create_menu(EPopup *emp, EPopupT
emp->target = target;
ep_add_static_items(emp);
+ if (target && mask == 0)
+ mask = target->mask;
+
/* FIXME: need to override old ones with new names */
mnode = (struct _menu_node *)p->menus.head;
nnode = mnode->next;
@@ -320,9 +338,9 @@ e_popup_create_menu(EPopup *emp, EPopupT
/* for bar's, the mask is exclusive or */
if (item->visible) {
if ((item->type & E_POPUP_TYPE_MASK) == E_POPUP_BAR) {
- if ((item->visible & hide_mask) == item->visible)
+ if ((item->visible & mask) == item->visible)
continue;
- } else if (item->visible & hide_mask)
+ } else if (item->visible & mask)
continue;
}
@@ -341,10 +359,15 @@ e_popup_create_menu(EPopup *emp, EPopupT
if (item->image) {
GdkPixbuf *pixbuf;
GtkWidget *image;
-
- pixbuf = e_icon_factory_get_icon ((char *)item->image, E_ICON_SIZE_MENU);
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
+
+ /* work-around e-icon-factory now doing GTK_STOCK stuff */
+ if (strncmp((char *)item->image, "gtk-", 4) == 0) {
+ image = gtk_image_new_from_stock((char *)item->image, GTK_ICON_SIZE_MENU);
+ } else {
+ pixbuf = e_icon_factory_get_icon((char *)item->image, E_ICON_SIZE_MENU);
+ image = gtk_image_new_from_pixbuf(pixbuf);
+ g_object_unref(pixbuf);
+ }
gtk_widget_show(image);
menuitem = (GtkMenuItem *)gtk_image_menu_item_new();
@@ -394,7 +417,7 @@ e_popup_create_menu(EPopup *emp, EPopupT
gtk_menu_shell_append((GtkMenuShell *)thismenu, (GtkWidget *)menuitem);
- if (item->visible & disable_mask)
+ if (item->enable & mask)
gtk_widget_set_sensitive((GtkWidget *)menuitem, FALSE);
gtk_widget_show((GtkWidget *)menuitem);
@@ -425,8 +448,7 @@ ep_popup_done(GtkWidget *w, EPopup *emp)
* considered a valid pointer.
* @target: If set, the target of the selection. Static menu
* items will be added. The target will be freed once complete.
- * @hide_mask:
- * @disable_mask:
+ * @mask: Enable/disable and visibility mask.
*
* Like popup_create_menu, but automatically sets up the menu
* so that it is destroyed once a selection takes place, and
@@ -436,11 +458,11 @@ ep_popup_done(GtkWidget *w, EPopup *emp)
* Return value: A menu, to popup.
**/
GtkMenu *
-e_popup_create_menu_once(EPopup *emp, EPopupTarget *target, guint32 hide_mask, guint32 disable_mask)
+e_popup_create_menu_once(EPopup *emp, EPopupTarget *target, guint32 mask)
{
GtkMenu *menu;
- menu = e_popup_create_menu(emp, target, hide_mask, disable_mask);
+ menu = e_popup_create_menu(emp, target, mask);
g_signal_connect(menu, "selection_done", G_CALLBACK(ep_popup_done), emp);
Index: e-util/e-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-popup.h,v
retrieving revision 1.2
diff -u -p -r1.2 e-popup.h
--- e-util/e-popup.h 20 Sep 2004 05:59:54 -0000 1.2
+++ e-util/e-popup.h 6 Oct 2004 11:15:54 -0000
@@ -115,8 +115,8 @@ struct _EPopupItem {
EPopupActivateFunc activate;
void *user_data; /* user data, not passed directly to @activate */
void *image; /* char* for item type, GtkWidget * for image type */
- guint32 visible; /* visibility mask */
- guint32 enable; /* sensitivity mask, unimplemented */
+ guint32 visible; /* visibility mask */
+ guint32 enable; /* sensitivity mask */
};
/**
@@ -202,8 +202,8 @@ void e_popup_add_items(EPopup *, GSList
void e_popup_add_static_items(EPopup *emp, EPopupTarget *target);
/* do not call e_popup_create_menu, it can leak structures if not used right */
-struct _GtkMenu *e_popup_create_menu(EPopup *, EPopupTarget *, guint32 hide_mask, guint32 disable_mask);
-struct _GtkMenu *e_popup_create_menu_once(EPopup *emp, EPopupTarget *, guint32 hide_mask, guint32 disable_mask);
+struct _GtkMenu *e_popup_create_menu(EPopup *, EPopupTarget *, guint32 mask);
+struct _GtkMenu *e_popup_create_menu_once(EPopup *emp, EPopupTarget *, guint32 mask);
void *e_popup_target_new(EPopup *, int type, size_t size);
void e_popup_target_free(EPopup *, void *);
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3467
diff -u -p -r1.3467 ChangeLog
--- mail/ChangeLog 6 Oct 2004 03:33:55 -0000 1.3467
+++ mail/ChangeLog 6 Oct 2004 11:15:57 -0000
@@ -1,3 +1,14 @@
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * em-folder-tree.c (emft_get_folder_info__desc): fix busted cast.
+
+ * *.c: e-popup api changes.
+
+2004-10-06 Not Zed <NotZed Ximian com>
+
+ * em-folder-tree.c (emft_tree_button_press): remove some debug
+ that made it in accidentally.
+
2004-10-05 Not Zed <NotZed Ximian com>
* em-folder-tree.c (emft_popup_copy_folder_selected): remove old
Index: mail/em-folder-tree.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-tree.c,v
retrieving revision 1.130
diff -u -p -r1.130 em-folder-tree.c
--- mail/em-folder-tree.c 6 Oct 2004 03:33:55 -0000 1.130
+++ mail/em-folder-tree.c 6 Oct 2004 11:15:58 -0000
@@ -1101,7 +1101,7 @@ tree_drag_data_received(GtkWidget *widge
menus = g_slist_append(menus, item);
}
e_popup_add_items((EPopup *)emp, menus, emft_drop_popup_free, m);
- menu = e_popup_create_menu_once((EPopup *)emp, NULL, mask, mask);
+ menu = e_popup_create_menu_once((EPopup *)emp, NULL, mask);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
} else {
tree_drag_data_action(m);
@@ -1711,7 +1711,7 @@ struct _EMFolderTreeGetFolderInfo {
static char *
emft_get_folder_info__desc(struct _mail_msg *mm, int done)
{
- struct _EMFolderTreeGetFolderInfo *m = (struct _get_folderinfo_msg *)mm;
+ struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *)mm;
char *ret, *name;
name = camel_service_get_name((CamelService *)m->store, TRUE);
@@ -2728,18 +2728,18 @@ static EPopupItem emft_popup_menu[] = {
{ E_POPUP_BAR, "10.emc" },
#endif
- { E_POPUP_ITEM, "10.emc.00", N_("_Copy..."), emft_popup_copy, NULL, "stock_folder-copy", EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT },
- { E_POPUP_ITEM, "10.emc.01", N_("_Move..."), emft_popup_move, NULL, "stock_folder-move", EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
+ { E_POPUP_ITEM, "10.emc.00", N_("_Copy..."), emft_popup_copy, NULL, "stock_folder-copy", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT },
+ { E_POPUP_ITEM, "10.emc.01", N_("_Move..."), emft_popup_move, NULL, "stock_folder-move", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
{ E_POPUP_BAR, "20.emc" },
/* FIXME: need to disable for nochildren folders */
- { E_POPUP_ITEM, "20.emc.00", N_("_New Folder..."), emft_popup_new_folder, NULL, "stock_folder", EM_POPUP_FOLDER_INFERIORS },
+ { E_POPUP_ITEM, "20.emc.00", N_("_New Folder..."), emft_popup_new_folder, NULL, "stock_folder", 0, EM_POPUP_FOLDER_INFERIORS },
/* FIXME: need to disable for undeletable folders */
- { E_POPUP_ITEM, "20.emc.01", N_("_Delete"), emft_popup_delete_folder, NULL, "stock_delete", EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
- { E_POPUP_ITEM, "20.emc.01", N_("_Rename..."), emft_popup_rename_folder, NULL, NULL, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
+ { E_POPUP_ITEM, "20.emc.01", N_("_Delete"), emft_popup_delete_folder, NULL, "stock_delete", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
+ { E_POPUP_ITEM, "20.emc.01", N_("_Rename..."), emft_popup_rename_folder, NULL, NULL, 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
{ E_POPUP_BAR, "80.emc" },
- { E_POPUP_ITEM, "80.emc.00", N_("_Properties"), emft_popup_properties, NULL, "stock_folder-properties", EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT }
+ { E_POPUP_ITEM, "80.emc.00", N_("_Properties"), emft_popup_properties, NULL, "stock_folder-properties", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT }
};
static void
@@ -2789,10 +2789,8 @@ emft_tree_button_press (GtkTreeView *tre
gtk_tree_path_free (tree_path);
/* FIXME: we really need the folderinfo to build a proper menu */
- if (!emft_selection_get_selected (selection, &model, &iter)) {
- printf("nothing selected!\n");
+ if (!emft_selection_get_selected (selection, &model, &iter))
return FALSE;
- }
gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store,
COL_STRING_URI, &uri, COL_STRING_FULL_NAME, &full_name,
@@ -2833,7 +2831,7 @@ emft_tree_button_press (GtkTreeView *tre
e_popup_add_items ((EPopup *)emp, menus, emft_popup_free, emft);
- menu = e_popup_create_menu_once ((EPopup *)emp, (EPopupTarget *)target, 0, target->target.mask);
+ menu = e_popup_create_menu_once ((EPopup *)emp, (EPopupTarget *)target, 0);
if (event == NULL || event->type == GDK_KEY_PRESS) {
/* FIXME: menu pos function */
Index: mail/em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.86
diff -u -p -r1.86 em-folder-view.c
--- mail/em-folder-view.c 20 Sep 2004 05:59:54 -0000 1.86
+++ mail/em-folder-view.c 6 Oct 2004 11:15:58 -0000
@@ -1048,7 +1048,7 @@ emfv_popup(EMFolderView *emfv, GdkEvent
e_popup_add_items((EPopup *)emp, label_list, emfv_popup_labels_free, emfv);
- menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, target->target.mask, target->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0);
if (event == NULL || event->type == GDK_KEY_PRESS) {
/* FIXME: menu pos function */
@@ -2202,7 +2202,7 @@ emfv_format_popup_event(EMFormatHTMLDisp
e_popup_add_items((EPopup *)emp, menus, emfv_uri_popup_free, emfv);
}
- menu = e_popup_create_menu_once((EPopup *)emp, target, target->mask, target->mask);
+ menu = e_popup_create_menu_once((EPopup *)emp, target, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
return TRUE;
Index: mail/em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.52
diff -u -p -r1.52 em-format-html-display.c
--- mail/em-format-html-display.c 22 Sep 2004 01:32:18 -0000 1.52
+++ mail/em-format-html-display.c 6 Oct 2004 11:15:59 -0000
@@ -1106,7 +1106,7 @@ efhd_attachment_popup(GtkWidget *w, GdkE
e_popup_add_items((EPopup *)emp, menus, efhd_menu_items_free, info);
- menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, target->target.mask, target->target.mask);
+ menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0);
if (event)
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
else
Index: mail/message-list.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/message-list.c,v
retrieving revision 1.399
diff -u -p -r1.399 message-list.c
--- mail/message-list.c 20 Sep 2004 05:59:55 -0000 1.399
+++ mail/message-list.c 6 Oct 2004 11:16:00 -0000
@@ -1757,7 +1757,7 @@ ml_tree_drag_data_received (ETree *tree,
menus = g_slist_append(menus, &ml_drop_popup_menu[i]);
e_popup_add_items((EPopup *)emp, menus, ml_drop_popup_free, m);
- menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0, 0);
+ menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0);
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
} else {
ml_drop_action(m);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]