aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog47
-rw-r--r--shell/Evolution-Shortcuts.idl1
-rw-r--r--shell/e-corba-shortcuts.c17
-rw-r--r--shell/e-shell-folder-commands.c5
-rw-r--r--shell/e-shell-view-menu.c5
-rw-r--r--shell/e-shortcuts-view-model.c5
-rw-r--r--shell/e-shortcuts-view.c25
-rw-r--r--shell/e-shortcuts.c97
-rw-r--r--shell/e-shortcuts.h10
-rw-r--r--shell/e-storage-set-view.c3
10 files changed, 154 insertions, 61 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 688ed98d4e..bf0aa953f9 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,52 @@
2002-07-09 Ettore Perazzoli <ettore@ximian.com>
+ * e-shortcuts-view-model.c (get_icon_for_item): If the
+ custom_icon_name is not NULL, return the pixbuf for it.
+
+ * e-storage-set-view.c: #include "e-icon-factory.h".
+
+ * e-shortcuts-view.c (impl_shortcut_dropped): Pass the
+ custom_icon_name.
+ (get_shortcut_info): New arg @custom_icon_name_return.
+ (rename_shortcut_cb): Pass the custom_icon_name here.
+
+ * e-shell-view-menu.c (new_shortcut_dialog_folder_selected_cb):
+ Pass the custom_icon_name for the folder's shortcut.
+
+ * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar):
+ Pass the custom_icon_name for the folder's shortcut.
+
+ * e-corba-shortcuts.c (impl_add): Use the customIconName member in
+ struct ::Shortcuts::Shortcut.
+ (shorcut_list_to_corba): Set the customIconName member on the
+ returned shortcuts.
+ (impl_get): Likewise.
+
+ * Evolution-Shortcuts.idl: New member customIconName in struct
+ Shortcut.
+
+ * e-shortcuts.c (shortcut_item_new): New arg @custom_icon_name;
+ initialize the member in EShortcutItem from it.
+ (shortcut_item_update): New arg @custom_icon_name; set the
+ custom_icon_name from it. Also remove some braindeadness from
+ this code.
+ (update_shortcut_and_emit_signal): New arg @custom_icon_name.
+ (load_shortcuts): Load the custom icon name from the XML
+ [eg. <item name="foo" type="mail" icon="inbox">].
+ (save_shortcuts): Save the custom icon name in the XML.
+ (e_shortcuts_add_shortcut): New arg @custom_icon_name.
+ (update_shortcuts_by_path): Pass the custom_icon_name to
+ update_shortcut_and_emit_signal().
+ (e_shortcuts_update_shortcut): New arg @custom_icon_name; pass it
+ to update_shortcut_and_emit_signal().
+ (e_shortcuts_add_default_group): Pass "inbox" as the
+ custom_icon_name for the inbox shortcut, and NULL for the other
+ shortcuts.
+
+ * e-shortcuts.h: New member custom_icon_name in EShortcutItem.
+
+2002-07-09 Ettore Perazzoli <ettore@ximian.com>
+
* e-shortcuts-view.c (impl_shortcut_drag_motion): Remove debugging
message.
(impl_shortcut_drag_motion): Likewise.
diff --git a/shell/Evolution-Shortcuts.idl b/shell/Evolution-Shortcuts.idl
index ffd3a9cf21..cf98f47e36 100644
--- a/shell/Evolution-Shortcuts.idl
+++ b/shell/Evolution-Shortcuts.idl
@@ -19,6 +19,7 @@ module Evolution {
string uri;
string name;
string type;
+ string customIconName;
};
typedef sequence <Shortcut> ShortcutList;
diff --git a/shell/e-corba-shortcuts.c b/shell/e-corba-shortcuts.c
index fa416f6723..06f68144d0 100644
--- a/shell/e-corba-shortcuts.c
+++ b/shell/e-corba-shortcuts.c
@@ -74,9 +74,10 @@ shortcut_list_to_corba (const GSList *shortcut_list,
item = (const EShortcutItem *) p->data;
- buffer[i].uri = CORBA_string_dup (e_safe_corba_string (item->uri));
- buffer[i].name = CORBA_string_dup (e_safe_corba_string (item->name));
- buffer[i].type = CORBA_string_dup (e_safe_corba_string (item->type));
+ buffer[i].uri = CORBA_string_dup (e_safe_corba_string (item->uri));
+ buffer[i].name = CORBA_string_dup (e_safe_corba_string (item->name));
+ buffer[i].type = CORBA_string_dup (e_safe_corba_string (item->type));
+ buffer[i].customIconName = CORBA_string_dup (e_safe_corba_string (item->custom_icon_name));
}
CORBA_sequence_set_release (shortcut_list_return, TRUE);
@@ -119,7 +120,8 @@ impl_add (PortableServer_Servant servant,
string_from_corba (shortcut->uri),
string_from_corba (shortcut->name),
0,
- string_from_corba (shortcut->type));
+ string_from_corba (shortcut->type),
+ string_from_corba (shortcut->customIconName));
}
static void
@@ -159,9 +161,10 @@ impl_get (PortableServer_Servant servant,
}
retval = GNOME_Evolution_Shortcuts_Shortcut__alloc ();
- retval->uri = CORBA_string_dup (e_safe_corba_string (item->uri));
- retval->name = CORBA_string_dup (e_safe_corba_string (item->name));
- retval->type = CORBA_string_dup (e_safe_corba_string (item->type));
+ retval->uri = CORBA_string_dup (e_safe_corba_string (item->uri));
+ retval->name = CORBA_string_dup (e_safe_corba_string (item->name));
+ retval->type = CORBA_string_dup (e_safe_corba_string (item->type));
+ retval->customIconName = CORBA_string_dup (e_safe_corba_string (item->custom_icon_name));
return retval;
}
diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c
index a9a8c9bc51..884fa97c05 100644
--- a/shell/e-shell-folder-commands.c
+++ b/shell/e-shell-folder-commands.c
@@ -602,7 +602,10 @@ e_shell_command_add_to_shortcut_bar (EShell *shell,
storage_set = e_shell_get_storage_set (shell);
folder = e_storage_set_get_folder (storage_set, e_shell_view_get_current_path (shell_view));
- e_shortcuts_add_shortcut (shortcuts, group_num, -1, uri, NULL, unread_count, e_folder_get_type_string (folder));
+ e_shortcuts_add_shortcut (shortcuts, group_num, -1, uri, NULL,
+ unread_count,
+ e_folder_get_type_string (folder),
+ e_folder_get_custom_icon_name (folder));
g_free (uri);
}
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index 5c0a463041..89de502b3d 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -573,7 +573,10 @@ new_shortcut_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_sele
evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
/* FIXME: I shouldn't have to set the type here. Maybe. */
- e_shortcuts_add_shortcut (shortcuts, group_num, -1, evolution_uri, NULL, e_folder_get_unread_count (folder), e_folder_get_type_string (folder));
+ e_shortcuts_add_shortcut (shortcuts, group_num, -1, evolution_uri, NULL,
+ e_folder_get_unread_count (folder),
+ e_folder_get_type_string (folder),
+ e_folder_get_custom_icon_name (folder));
g_free (evolution_uri);
diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c
index 105ccb0df9..d311590cf7 100644
--- a/shell/e-shortcuts-view-model.c
+++ b/shell/e-shortcuts-view-model.c
@@ -29,6 +29,8 @@
#include "e-shortcuts-view-model.h"
+#include "e-icon-factory.h"
+
#include <glib.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-i18n.h>
@@ -55,6 +57,9 @@ get_icon_for_item (EShortcutsViewModel *shortcuts_view_model,
priv = shortcuts_view_model->priv;
+ if (item->custom_icon_name != NULL)
+ return e_icon_factory_get_icon (item->custom_icon_name, want_mini);
+
if (item->type != NULL) {
EStorageSet *storage_set;
EFolderTypeRegistry *folder_type_registry;
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c
index ed0e72c8d7..b926471281 100644
--- a/shell/e-shortcuts-view.c
+++ b/shell/e-shortcuts-view.c
@@ -380,7 +380,8 @@ rename_shortcut_cb (GtkWidget *widget,
return;
e_shortcuts_update_shortcut (shortcuts, menu_data->group_num, menu_data->item_num,
- shortcut_item->uri, new_name, shortcut_item->unread_count, shortcut_item->type);
+ shortcut_item->uri, new_name, shortcut_item->unread_count,
+ shortcut_item->type, shortcut_item->custom_icon_name);
g_free (new_name);
}
@@ -502,7 +503,8 @@ static void
get_shortcut_info (EShortcutsView *shortcuts_view,
const char *item_url,
int *unread_count_return,
- const char **type_return)
+ const char **type_return,
+ const char **custom_icon_name_return)
{
EShortcutsViewPrivate *priv;
EStorageSet *storage_set;
@@ -522,11 +524,13 @@ get_shortcut_info (EShortcutsView *shortcuts_view,
folder = e_storage_set_get_folder (storage_set, path);
if (folder != NULL) {
- *unread_count_return = e_folder_get_unread_count (folder);
- *type_return = e_folder_get_type_string (folder);
+ *unread_count_return = e_folder_get_unread_count (folder);
+ *type_return = e_folder_get_type_string (folder);
+ *custom_icon_name_return = e_folder_get_custom_icon_name (folder);
} else {
- *unread_count_return = 0;
- *type_return = NULL;
+ *unread_count_return = 0;
+ *type_return = NULL;
+ *custom_icon_name_return = NULL;
}
}
@@ -541,6 +545,7 @@ impl_shortcut_dropped (EShortcutBar *shortcut_bar,
EShortcutsViewPrivate *priv;
int unread_count;
const char *type;
+ const char *custom_icon_name;
char *tmp;
char *tp;
char *name_without_unread;
@@ -548,7 +553,7 @@ impl_shortcut_dropped (EShortcutBar *shortcut_bar,
shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar);
priv = shortcuts_view->priv;
- get_shortcut_info (shortcuts_view, item_url, &unread_count, &type);
+ get_shortcut_info (shortcuts_view, item_url, &unread_count, &type, &custom_icon_name);
/* Looks funny, but keeps it from adding the unread count
repeatedly when dragging folders around */
@@ -560,7 +565,11 @@ impl_shortcut_dropped (EShortcutBar *shortcut_bar,
e_shortcuts_add_shortcut (priv->shortcuts,
group_num, position,
- item_url, name_without_unread, unread_count, type);
+ item_url,
+ name_without_unread,
+ unread_count,
+ type,
+ custom_icon_name);
g_free (tmp);
g_free (name_without_unread);
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index e253764571..24c62fdfcb 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -131,7 +131,8 @@ static EShortcutItem *
shortcut_item_new (const char *uri,
const char *name,
int unread_count,
- const char *type)
+ const char *type,
+ const char *custom_icon_name)
{
EShortcutItem *new;
@@ -139,10 +140,11 @@ shortcut_item_new (const char *uri,
name = g_basename (uri);
new = g_new (EShortcutItem, 1);
- new->uri = g_strdup (uri);
- new->name = g_strdup (name);
- new->type = g_strdup (type);
- new->unread_count = unread_count;
+ new->uri = g_strdup (uri);
+ new->name = g_strdup (name);
+ new->type = g_strdup (type);
+ new->custom_icon_name = g_strdup (custom_icon_name);
+ new->unread_count = unread_count;
return new;
}
@@ -152,38 +154,33 @@ shortcut_item_update (EShortcutItem *shortcut_item,
const char *uri,
const char *name,
int unread_count,
- const char *type)
+ const char *type,
+ const char *custom_icon_name)
{
gboolean changed = FALSE;
if (name == NULL)
name = g_basename (uri);
- if (shortcut_item->uri == NULL || uri == NULL ||
- strcmp (shortcut_item->uri, uri) != 0) {
- g_free (shortcut_item->uri);
- shortcut_item->uri = g_strdup (uri);
+ if (shortcut_item->unread_count != unread_count) {
+ shortcut_item->unread_count = unread_count;
changed = TRUE;
}
- if (shortcut_item->name == NULL || name == NULL ||
- strcmp (shortcut_item->name, name) != 0) {
- g_free (shortcut_item->name);
- shortcut_item->name = g_strdup (name);
- changed = TRUE;
+#define UPDATE_STRING(member) \
+ if (shortcut_item->member == NULL || member == NULL || \
+ strcmp (shortcut_item->member, member) != 0) { \
+ g_free (shortcut_item->member); \
+ shortcut_item->member = g_strdup (member); \
+ changed = TRUE; \
}
- if (shortcut_item->unread_count != unread_count) {
- shortcut_item->unread_count = unread_count;
- changed = FALSE;
- }
+ UPDATE_STRING (uri);
+ UPDATE_STRING (name);
+ UPDATE_STRING (type);
+ UPDATE_STRING (custom_icon_name);
- if (shortcut_item->type == NULL || type == NULL ||
- strcmp (shortcut_item->type, type) != 0) {
- g_free (shortcut_item->type);
- shortcut_item->type = g_strdup (type);
- changed = TRUE;
- }
+#undef UPDATE_STRING
return changed;
}
@@ -236,17 +233,18 @@ update_shortcut_and_emit_signal (EShortcuts *shortcuts,
const char *uri,
const char *name,
int unread_count,
- const char *type)
+ const char *type,
+ const char *custom_icon_name)
{
/* Only thing that changed was the unread count */
if (shortcut_item->unread_count != unread_count
- && !shortcut_item_update (shortcut_item, uri, name, unread_count, type)) {
+ && !shortcut_item_update (shortcut_item, uri, name, unread_count, type, custom_icon_name)) {
gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num);
return FALSE;
}
/* Unread count is the same, but other stuff changed */
- else if (shortcut_item_update (shortcut_item, uri, name, unread_count, type)) {
+ else if (shortcut_item_update (shortcut_item, uri, name, unread_count, type, custom_icon_name)) {
gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num);
return TRUE;
}
@@ -336,6 +334,7 @@ load_shortcuts (EShortcuts *shortcuts,
xmlChar *uri;
xmlChar *name;
xmlChar *type;
+ xmlChar *icon;
if (strcmp ((char *) q->name, "item") != 0)
continue;
@@ -351,12 +350,18 @@ load_shortcuts (EShortcuts *shortcuts,
if (folder != NULL) {
name = xmlMemStrdup (e_folder_get_name (folder));
type = xmlMemStrdup (e_folder_get_type_string (folder));
+
+ if (e_folder_get_custom_icon_name (folder) != NULL)
+ icon = xmlMemStrdup (e_folder_get_custom_icon_name (folder));
+ else
+ icon = NULL;
} else {
name = xmlGetProp (q, "name");
type = xmlGetProp (q, "type");
+ icon = xmlGetProp (q, "icon");
}
- shortcut_item = shortcut_item_new (uri, name, 0, type);
+ shortcut_item = shortcut_item_new (uri, name, 0, type, icon);
shortcut_group->shortcuts = g_slist_prepend (shortcut_group->shortcuts,
shortcut_item);
@@ -364,6 +369,8 @@ load_shortcuts (EShortcuts *shortcuts,
xmlFree (name);
if (type != NULL)
xmlFree (type);
+ if (icon != NULL)
+ xmlFree (icon);
}
xmlFree (uri);
@@ -431,6 +438,8 @@ save_shortcuts (EShortcuts *shortcuts,
if (shortcut->type != NULL)
xmlSetProp (shortcut_node, (xmlChar *) "type", shortcut->type);
+ if (shortcut->custom_icon_name != NULL)
+ xmlSetProp (shortcut_node, (xmlChar *) "icon", shortcut->custom_icon_name);
}
}
@@ -526,7 +535,8 @@ update_shortcuts_by_path (EShortcuts *shortcuts,
evolution_uri,
shortcut_item->name,
e_folder_get_unread_count (folder),
- e_folder_get_type_string (folder));
+ e_folder_get_type_string (folder),
+ e_folder_get_custom_icon_name (folder));
}
}
}
@@ -990,7 +1000,8 @@ e_shortcuts_add_shortcut (EShortcuts *shortcuts,
const char *uri,
const char *name,
int unread_count,
- const char *type)
+ const char *type,
+ const char *custom_icon_name)
{
EShortcutsPrivate *priv;
ShortcutGroup *group;
@@ -1010,7 +1021,7 @@ e_shortcuts_add_shortcut (EShortcuts *shortcuts,
if (num == -1)
num = g_slist_length (group->shortcuts);
- item = shortcut_item_new (uri, name, unread_count, type);
+ item = shortcut_item_new (uri, name, unread_count, type, custom_icon_name);
group->shortcuts = g_slist_insert (group->shortcuts, item, num);
@@ -1026,7 +1037,8 @@ e_shortcuts_update_shortcut (EShortcuts *shortcuts,
const char *uri,
const char *name,
int unread_count,
- const char *type)
+ const char *type,
+ const char *custom_icon_name)
{
EShortcutItem *shortcut_item;
@@ -1035,7 +1047,8 @@ e_shortcuts_update_shortcut (EShortcuts *shortcuts,
shortcut_item = get_item (shortcuts, group_num, num);
- update_shortcut_and_emit_signal (shortcuts, shortcut_item, group_num, num, uri, name, unread_count, type);
+ update_shortcut_and_emit_signal (shortcuts, shortcut_item, group_num, num,
+ uri, name, unread_count, type, custom_icon_name);
make_dirty (shortcuts);
}
@@ -1053,22 +1066,24 @@ e_shortcuts_add_default_group (EShortcuts *shortcuts)
e_shortcuts_add_group (shortcuts, -1, utf);
g_free (utf);
- /* FIXME: Inbox shortcut should point to something else for
- people who won't care about using /Local Folders/Inbox */
utf = e_utf8_from_locale_string (_("Summary"));
- e_shortcuts_add_shortcut (shortcuts, 0, -1, E_SUMMARY_URI, utf, 0, "summary");
+ e_shortcuts_add_shortcut (shortcuts, 0, -1, E_SUMMARY_URI, utf, 0, "summary", NULL);
g_free (utf);
+
utf = e_utf8_from_locale_string (_("Inbox"));
- e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_INBOX_URI, utf, 0, "mail");
+ e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_INBOX_URI, utf, 0, "mail", "inbox");
g_free (utf);
+
utf = e_utf8_from_locale_string (_("Calendar"));
- e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_CALENDAR_URI, utf, 0, "calendar");
+ e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_CALENDAR_URI, utf, 0, "calendar", NULL);
g_free (utf);
+
utf = e_utf8_from_locale_string (_("Tasks"));
- e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_TASKS_URI, utf, 0, "tasks");
+ e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_TASKS_URI, utf, 0, "tasks", NULL);
g_free (utf);
+
utf = e_utf8_from_locale_string (_("Contacts"));
- e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_CONTACTS_URI, utf, 0, "contacts");
+ e_shortcuts_add_shortcut (shortcuts, 0, -1, E_LOCAL_CONTACTS_URI, utf, 0, "contacts", NULL);
g_free (utf);
}
diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h
index a50e726a4a..065d23f9b2 100644
--- a/shell/e-shortcuts.h
+++ b/shell/e-shortcuts.h
@@ -55,6 +55,10 @@ struct _EShortcutItem {
folder, this is NULL. */
char *type;
+ /* Custom icon for the shortcut. If this is NULL, then the shortcut
+ should just use the icon for the type. */
+ char *custom_icon_name;
+
/* Number of unread items in the folder. Zero if not a folder. */
int unread_count;
};
@@ -123,14 +127,16 @@ void e_shortcuts_add_shortcut (EShortcuts *shortcuts,
const char *uri,
const char *name,
int unread_count,
- const char *type);
+ const char *type,
+ const char *custom_icon_name);
void e_shortcuts_update_shortcut (EShortcuts *shortcuts,
int group_num,
int num,
const char *uri,
const char *name,
int unread_count,
- const char *type);
+ const char *type,
+ const char *custom_icon_name);
void e_shortcuts_remove_group (EShortcuts *shortcuts,
int group_num);
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index a166796025..d6a0bf9cd7 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -28,8 +28,9 @@
#include "e-storage-set-view.h"
#include "e-util/e-gtk-utils.h"
-#include "e-folder-dnd-bridge.h"
+#include "e-icon-factory.h"
+#include "e-folder-dnd-bridge.h"
#include "e-shell-constants.h"
#include <glib.h>