aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-component.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-11-17 23:39:39 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-11-17 23:39:39 +0800
commit6af0f0710011c532c6eff1815a39794db91297aa (patch)
tree57a14c662aa03a3ef3ff3c304bd13d7f93b3748a /calendar/gui/calendar-component.c
parent66d47badff98208b1b1c5db1ce0db0d10f32de4b (diff)
downloadgsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.tar
gsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.tar.gz
gsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.tar.bz2
gsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.tar.lz
gsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.tar.xz
gsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.tar.zst
gsoc2013-evolution-6af0f0710011c532c6eff1815a39794db91297aa.zip
try first to create the icon from the stock, and then from a file.
2003-11-17 Rodrigo Moya <rodrigo@ximian.com> * gui/calendar-component.c (add_popup_menu_item): try first to create the icon from the stock, and then from a file. (fill_popup_menu_cb): set callback for 'Rename' menu item. (rename_calendar_cb): callback for 'Rename' menu item. (new_calendar_cb): fixed arguments. * gui/tasks-component.c (impl_createControls): connect to "fill_popup_menu" signal on the source selector. (fill_popup_menu_cb): callback to create our menu items. svn path=/trunk/; revision=23388
Diffstat (limited to 'calendar/gui/calendar-component.c')
-rw-r--r--calendar/gui/calendar-component.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 74d87ec3fe..428d211d07 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -237,9 +237,9 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap,
item = gtk_image_menu_item_new_with_label (label);
/* load the image */
- image = gtk_image_new_from_file (pixmap);
+ image = gtk_image_new_from_stock (pixmap, GTK_ICON_SIZE_MENU);
if (!image)
- image = gtk_image_new_from_stock (pixmap, GTK_ICON_SIZE_MENU);
+ image = gtk_image_new_from_file (pixmap);
if (image)
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
@@ -296,17 +296,52 @@ delete_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
}
static void
-new_calendar_cb (GtkWidget *widget, ESourceSelector *selector)
+new_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
{
new_calendar_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget)));
}
static void
+rename_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
+{
+ GSList *selection;
+ CalendarComponentPrivate *priv;
+ ESource *selected_source;
+ GtkWidget *dialog, *entry;
+
+ priv = comp->priv;
+
+ selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (priv->source_selector));
+ if (!selection)
+ return;
+
+ selected_source = selection->data;
+
+ /* create the dialog to prompt the user for the new name */
+ dialog = gtk_message_dialog_new (gtk_widget_get_toplevel (widget),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_OK_CANCEL,
+ _("Rename this calendar to"));
+ entry = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (entry), e_source_peek_name (selected_source));
+ gtk_widget_show (entry);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, TRUE, FALSE, 6);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+ e_source_set_name (selected_source, gtk_entry_get_text (GTK_ENTRY (entry)));
+
+ gtk_widget_destroy (dialog);
+
+ e_source_selector_free_selection (selection);
+}
+
+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, NULL, NULL);
+ add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_calendar_cb), comp);
}
static void