aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/tasks-component.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-11-19 00:30:14 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-11-19 00:30:14 +0800
commitb47685534d7e5738d712962334537bb329831b9e (patch)
tree89715be728f4c19046dc0fd638cdaf84a195f27a /calendar/gui/tasks-component.c
parent9163c12f19f54c0a6a24afd8b46e30112809567d (diff)
downloadgsoc2013-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/tasks-component.c')
-rw-r--r--calendar/gui/tasks-component.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index e1603893e2..f23d4bf732 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -200,7 +200,7 @@ get_default_task (ECal *ecal)
/* 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;
@@ -212,8 +212,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);
}
@@ -221,6 +223,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);
}
@@ -298,9 +303,17 @@ rename_task_list_cb (GtkWidget *widget, TasksComponent *comp)
static void
fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, TasksComponent *component)
{
- add_popup_menu_item (menu, _("New Task List"), GTK_STOCK_NEW, G_CALLBACK (new_task_list_cb), component);
- add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_task_list_cb), component);
- add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_task_list_cb), component);
+ gboolean sensitive;
+
+ sensitive = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)) ?
+ TRUE : FALSE;
+
+ add_popup_menu_item (menu, _("New Task List"), GTK_STOCK_NEW, G_CALLBACK (new_task_list_cb),
+ component, TRUE);
+ add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_task_list_cb),
+ component, sensitive);
+ add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_task_list_cb),
+ component, sensitive);
}
static void