aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-10-29 02:42:09 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-10-29 02:42:09 +0800
commitc6fb640109eadb091cb867ad6930811ce9c501e6 (patch)
tree44841452ad62a9d897bdf978dbd2e241d22449f2
parent66318ca6b08244b2a21530a05382af49a1821b51 (diff)
downloadgsoc2013-evolution-c6fb640109eadb091cb867ad6930811ce9c501e6.tar.gz
gsoc2013-evolution-c6fb640109eadb091cb867ad6930811ce9c501e6.tar.zst
gsoc2013-evolution-c6fb640109eadb091cb867ad6930811ce9c501e6.zip
connect to "fill_popup_menu" on the ESourceSelector.
2003-10-28 Rodrigo Moya <rodrigo@ximian.com> * gui/calendar-component.c (impl_createControls): connect to "fill_popup_menu" on the ESourceSelector. (fill_popup_menu_callback): add popup menu items here. (add_popup_menu_item): new function to add items to the popup menu. svn path=/trunk/; revision=23107
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/gui/calendar-component.c36
2 files changed, 44 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index dc031d1bca..75873a6d39 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,13 @@
2003-10-28 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/calendar-component.c (impl_createControls): connect to
+ "fill_popup_menu" on the ESourceSelector.
+ (fill_popup_menu_callback): add popup menu items here.
+ (add_popup_menu_item): new function to add items to the
+ popup menu.
+
+2003-10-28 Rodrigo Moya <rodrigo@ximian.com>
+
* gui/e-cal-view.c: no need to keep the timezone here, it is
already stored in the model.
(e_cal_view_get_timezone): call e_cal_model_get_timezone().
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index eec39adad6..82332073ad 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -119,6 +119,39 @@ update_uris_for_selection (ESourceSelector *selector, CalendarComponent *calenda
/* 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 */
+ image = gtk_image_new_from_file (pixmap);
+ if (!image)
+ image = gtk_image_new_from_stock (pixmap, GTK_ICON_SIZE_MENU);
+
+ if (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_append (menu, item);
+ gtk_widget_show (item);
+}
+
+static void
+fill_popup_menu_callback (ESourceSelector *selector, GtkMenu *menu, CalendarComponent *comp)
+{
+ add_popup_menu_item (menu, _("_New Calendar"), NULL, NULL, selector);
+}
+
+static void
source_selection_changed_callback (ESourceSelector *selector,
CalendarComponent *calendar_component)
{
@@ -254,6 +287,9 @@ impl_createControls (PortableServer_Servant servant,
g_signal_connect_object (selector, "primary_selection_changed",
G_CALLBACK (primary_source_selection_changed_callback),
G_OBJECT (calendar_component), 0);
+ g_signal_connect_object (selector, "fill_popup_menu",
+ G_CALLBACK (fill_popup_menu_callback),
+ G_OBJECT (calendar_component), 0);
update_uris_for_selection (E_SOURCE_SELECTOR (selector), calendar_component);