diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-11-19 00:30:14 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-11-19 00:30:14 +0800 |
commit | b47685534d7e5738d712962334537bb329831b9e (patch) | |
tree | 89715be728f4c19046dc0fd638cdaf84a195f27a /calendar/gui/calendar-component.c | |
parent | 9163c12f19f54c0a6a24afd8b46e30112809567d (diff) | |
download | gsoc2013-evolution-b47685534d7e5738d712962334537bb329831b9e.tar.gz gsoc2013-evolution-b47685534d7e5738d712962334537bb329831b9e.tar.zst gsoc2013-evolution-b47685534d7e5738d712962334537bb329831b9e.zip |
added 'sensitive' argument. (fill_popup_menu_cb): disable/enable menu
2003-11-18 Rodrigo Moya <rodrigo@ximian.com>
* gui/calendar-component.c (add_popup_menu_item): added 'sensitive'
argument.
(fill_popup_menu_cb): disable/enable menu items depending on whether
there is a selection or not.
* gui/tasks-component.c (add_popup_menu_item, fill_popup_menu_cb):
ditto.
svn path=/trunk/; revision=23416
Diffstat (limited to 'calendar/gui/calendar-component.c')
-rw-r--r-- | calendar/gui/calendar-component.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 1b0f3b479e..394aff4d36 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -229,7 +229,7 @@ get_default_event (ECal *client, gboolean all_day) /* Callbacks. */ static void add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, - GCallback callback, gpointer user_data) + GCallback callback, gpointer user_data, gboolean sensitive) { GtkWidget *item, *image; @@ -241,8 +241,10 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, if (!image) image = gtk_image_new_from_file (pixmap); - if (image) + 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); } @@ -250,6 +252,9 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, if (callback) g_signal_connect (G_OBJECT (item), "activate", callback, user_data); + if (!sensitive) + gtk_widget_set_sensitive (item, FALSE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); } @@ -328,9 +333,14 @@ rename_calendar_cb (GtkWidget *widget, CalendarComponent *comp) static void fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, CalendarComponent *comp) { - add_popup_menu_item (menu, _("New Calendar"), NULL, G_CALLBACK (new_calendar_cb), comp); - add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_calendar_cb), comp); - add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_calendar_cb), comp); + gboolean sensitive; + + sensitive = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)) ? + TRUE : FALSE; + + add_popup_menu_item (menu, _("New Calendar"), NULL, G_CALLBACK (new_calendar_cb), comp, TRUE); + add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_calendar_cb), comp, sensitive); + add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_calendar_cb), comp, sensitive); } static void |