From cad0e082bf449119c46e92a000aa47dfba61be68 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 22 Feb 2002 02:23:40 +0000 Subject: New helper function. (create_object): Add icons for the various user * gui/component-factory.c (add_creatable_item): New helper function. (create_object): Add icons for the various user creatable items. svn path=/trunk/; revision=15790 --- calendar/ChangeLog | 10 +++++-- calendar/gui/calendar-component.c | 55 ++++++++++++++++++++++++++++----------- calendar/gui/component-factory.c | 55 ++++++++++++++++++++++++++++----------- 3 files changed, 88 insertions(+), 32 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 46efeed232..2463ef52bc 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,10 +1,16 @@ +2002-02-21 Ettore Perazzoli + + * gui/component-factory.c (add_creatable_item): New helper + function. + (create_object): Add icons for the various user creatable items. + 2002-02-19 JP Rosevear * gui/e-itip-control.c (send_item): pass extra itip_send_comp - params + params (send_freebusy): ditto (ok_clicked_cb): ditto, including the timezones culled from the - component + component * gui/e-week-view.c: pass extra itip_send_comp params diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 26b5a1efb9..b4fde12177 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -620,6 +620,37 @@ sc_user_create_new_item_cb (EvolutionShellComponent *shell_component, /* The factory function. */ +static void +add_creatable_item (EvolutionShellComponent *shell_component, + const char *id, + const char *description, + const char *menu_description, + char menu_shortcut, + const char *icon_name) +{ + char *icon_path; + GdkPixbuf *icon; + + if (icon_name == NULL) { + icon_path = NULL; + icon = NULL; + } else { + icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, icon_name); + icon = gdk_pixbuf_new_from_file (icon_path); + } + + evolution_shell_component_add_user_creatable_item (shell_component, + id, + description, + menu_description, + menu_shortcut, + icon); + + if (icon != NULL) + gdk_pixbuf_unref (icon); + g_free (icon_path); +} + static BonoboObject * create_object (void) { @@ -648,23 +679,17 @@ create_object (void) /* User creatable items */ - evolution_shell_component_add_user_creatable_item (shell_component, - CREATE_EVENT_ID, - _("New appointment"), - _("_Appointment"), 'a', - NULL); + add_creatable_item (shell_component, CREATE_MEETING_ID, + _("New meeting"), _("_Meeting"), + 's', "meeting-request.png"); - evolution_shell_component_add_user_creatable_item (shell_component, - CREATE_MEETING_ID, - _("New meeting"), - _("_Meeting"), 's', - NULL); + add_creatable_item (shell_component, CREATE_TASK_ID, + _("New task"), _("_Task"), + 't', "new_task-16.png"); - evolution_shell_component_add_user_creatable_item (shell_component, - CREATE_TASK_ID, - _("New task"), - _("_Task"), 't', - NULL); + add_creatable_item (shell_component, CREATE_EVENT_ID, + _("New appointment"), _("_Appointment"), + 'a', "new_appointment.xpm"); gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", GTK_SIGNAL_FUNC (sc_user_create_new_item_cb), NULL); diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index 26b5a1efb9..b4fde12177 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -620,6 +620,37 @@ sc_user_create_new_item_cb (EvolutionShellComponent *shell_component, /* The factory function. */ +static void +add_creatable_item (EvolutionShellComponent *shell_component, + const char *id, + const char *description, + const char *menu_description, + char menu_shortcut, + const char *icon_name) +{ + char *icon_path; + GdkPixbuf *icon; + + if (icon_name == NULL) { + icon_path = NULL; + icon = NULL; + } else { + icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, icon_name); + icon = gdk_pixbuf_new_from_file (icon_path); + } + + evolution_shell_component_add_user_creatable_item (shell_component, + id, + description, + menu_description, + menu_shortcut, + icon); + + if (icon != NULL) + gdk_pixbuf_unref (icon); + g_free (icon_path); +} + static BonoboObject * create_object (void) { @@ -648,23 +679,17 @@ create_object (void) /* User creatable items */ - evolution_shell_component_add_user_creatable_item (shell_component, - CREATE_EVENT_ID, - _("New appointment"), - _("_Appointment"), 'a', - NULL); + add_creatable_item (shell_component, CREATE_MEETING_ID, + _("New meeting"), _("_Meeting"), + 's', "meeting-request.png"); - evolution_shell_component_add_user_creatable_item (shell_component, - CREATE_MEETING_ID, - _("New meeting"), - _("_Meeting"), 's', - NULL); + add_creatable_item (shell_component, CREATE_TASK_ID, + _("New task"), _("_Task"), + 't', "new_task-16.png"); - evolution_shell_component_add_user_creatable_item (shell_component, - CREATE_TASK_ID, - _("New task"), - _("_Task"), 't', - NULL); + add_creatable_item (shell_component, CREATE_EVENT_ID, + _("New appointment"), _("_Appointment"), + 'a', "new_appointment.xpm"); gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", GTK_SIGNAL_FUNC (sc_user_create_new_item_cb), NULL); -- cgit v1.2.3