aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
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
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')
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/calendar-component.c43
-rw-r--r--calendar/gui/tasks-component.c41
3 files changed, 92 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 80a0887e44..0aa0e65ef4 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,17 @@
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.
+
+2003-11-17 Rodrigo Moya <rodrigo@ximian.com>
+
* idl/evolution-calendar.idl: remove the AlarmNotify service, no
more need for it, since the alarm daemon will listen for changes
on the GConf key.
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
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 58448dc646..f79ddfd3a8 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -199,6 +199,44 @@ 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)
+{
+ GtkWidget *item, *image;
+
+ if (pixmap) {
+ item = gtk_image_menu_item_new_with_label (label);
+
+ /* load the image */
+ image = gtk_image_new_from_stock (pixmap, GTK_ICON_SIZE_MENU);
+ if (!image)
+ image = gtk_image_new_from_file (pixmap);
+
+ 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_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+}
+
+static void
+new_task_list_cb (GtkWidget *widget, TasksComponent *component)
+{
+}
+
+static void
+fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, TasksComponent *component)
+{
+ add_popup_menu (menu, _("New Task List"), GTK_STOCK_NEW, G_CALLBACK (new_task_list_cb), component);
+}
+
+static void
source_selection_changed_cb (ESourceSelector *selector, TasksComponent *component)
{
update_uris_for_selection (component);
@@ -337,6 +375,9 @@ impl_createControls (PortableServer_Servant servant,
g_signal_connect_object (priv->source_selector, "primary_selection_changed",
G_CALLBACK (primary_source_selection_changed_cb),
G_OBJECT (component), 0);
+ g_signal_connect_object (priv->source_selector, "fill_popup_menu",
+ G_CALLBACK (fill_popup_menu_cb),
+ G_OBJECT (component), 0);
/* Load the selection from the last run */
update_selection (component);