aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-02-22 10:23:40 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-02-22 10:23:40 +0800
commitcad0e082bf449119c46e92a000aa47dfba61be68 (patch)
tree3f4dde8510d700af87a29ba5739d4c7c56778337 /calendar/gui
parentbaf32e6a42c8d1997ff12658c16ec617cab65d0d (diff)
downloadgsoc2013-evolution-cad0e082bf449119c46e92a000aa47dfba61be68.tar.gz
gsoc2013-evolution-cad0e082bf449119c46e92a000aa47dfba61be68.tar.zst
gsoc2013-evolution-cad0e082bf449119c46e92a000aa47dfba61be68.zip
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
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-component.c55
-rw-r--r--calendar/gui/component-factory.c55
2 files changed, 80 insertions, 30 deletions
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);