aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-20 12:42:04 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-20 12:42:04 +0800
commitd9ed7a6a6366e5b47341c31409f4ac0f12aca690 (patch)
tree49f414492082b291156a8de6558b25f4dc3794f5 /shell
parent5ab5cd2560b80b34432173508bed44d8fbc03b5f (diff)
downloadgsoc2013-evolution-d9ed7a6a6366e5b47341c31409f4ac0f12aca690.tar.gz
gsoc2013-evolution-d9ed7a6a6366e5b47341c31409f4ac0f12aca690.tar.zst
gsoc2013-evolution-d9ed7a6a6366e5b47341c31409f4ac0f12aca690.zip
Added display_name and description to the type.
* evolution-test-component.c: Added display_name and description to the type. * evolution-shell-component.c (impl__get_supported_types): Pass `display_name' and `description' here. (evolution_shell_component_construct): Likewise. * evolution-shell-component.h: New members `display_name', `description' in `EvolutionShellComponentFolderType'. * e-component-registry.c (register_type): New args @description and @display_name. Pass to `e_folder_type_registry_register_type()'. (register_component): Pass the values returned in the sequence from __get_supported_types. * e-folder-type-registry.c: New members `display_name' and `description' in `struct _FolderType'. (folder_type_new): New args @description and @display_name. Initialize the respective fields in the `FolderType' accordingly. (folder_type_free): Free `display_name' and `description'. (register_folder_type): New args @display_name, @description. (e_folder_type_registry_register_type): New args @display_name, @description. (e_folder_type_registry_get_description_for_type): New. (e_folder_type_registry_get_display_name_for_type): New. * Evolution-ShellComponent.idl: Added `display_name' and `description' fields to the `FolderType' struct. svn path=/trunk/; revision=12245
Diffstat (limited to 'shell')
-rw-r--r--shell/.cvsignore19
-rw-r--r--shell/ChangeLog32
-rw-r--r--shell/Evolution-ShellComponent.idl3
-rw-r--r--shell/e-component-registry.c10
-rw-r--r--shell/e-folder-type-registry.c60
-rw-r--r--shell/e-folder-type-registry.h24
-rw-r--r--shell/e-shell-folder-creation-dialog.c53
-rw-r--r--shell/e-shell-folder-title-bar.c8
-rw-r--r--shell/evolution-shell-component.c8
-rw-r--r--shell/evolution-shell-component.h3
-rw-r--r--shell/evolution-test-component.c2
11 files changed, 190 insertions, 32 deletions
diff --git a/shell/.cvsignore b/shell/.cvsignore
index dea956c59d..dc7b762b85 100644
--- a/shell/.cvsignore
+++ b/shell/.cvsignore
@@ -1,15 +1,16 @@
+*.lo
.deps
.libs
.pure
-evolution
-evolution.pure
-evolution-test-component
-Makefile.in
-Makefile
-Evolution-stubs.c
-Evolution-skels.c
Evolution-common.c
+Evolution-skels.c
+Evolution-stubs.c
Evolution.h
GNOME_Evolution_Shell.oaf
-*.lo
-libeshell.la \ No newline at end of file
+ID
+Makefile
+Makefile.in
+evolution
+evolution-test-component
+evolution.pure
+libeshell.la
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 2946f23bdf..17aa3249a7 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,35 @@
+2001-08-20 Ettore Perazzoli <ettore@ximian.com>
+
+ * evolution-test-component.c: Added display_name and description
+ to the type.
+
+ * evolution-shell-component.c (impl__get_supported_types): Pass
+ `display_name' and `description' here.
+ (evolution_shell_component_construct): Likewise.
+
+ * evolution-shell-component.h: New members `display_name',
+ `description' in `EvolutionShellComponentFolderType'.
+
+ * e-component-registry.c (register_type): New args @description
+ and @display_name. Pass to
+ `e_folder_type_registry_register_type()'.
+ (register_component): Pass the values returned in the sequence
+ from __get_supported_types.
+
+ * e-folder-type-registry.c: New members `display_name' and
+ `description' in `struct _FolderType'.
+ (folder_type_new): New args @description and @display_name.
+ Initialize the respective fields in the `FolderType' accordingly.
+ (folder_type_free): Free `display_name' and `description'.
+ (register_folder_type): New args @display_name, @description.
+ (e_folder_type_registry_register_type): New args @display_name,
+ @description.
+ (e_folder_type_registry_get_description_for_type): New.
+ (e_folder_type_registry_get_display_name_for_type): New.
+
+ * Evolution-ShellComponent.idl: Added `display_name' and
+ `description' fields to the `FolderType' struct.
+
2001-08-19 Ettore Perazzoli <ettore@ximian.com>
* e-shell.c (destroy): Put the bonobo_object_release_unref() for
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index 9a041fa00e..c061e7241b 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -18,6 +18,9 @@ module Evolution {
string name;
string icon_name;
+ string display_name;
+ string description;
+
boolean user_creatable;
sequence<string> accepted_dnd_types;
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index e37fa5fe43..acbed694f5 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -105,6 +105,8 @@ static gboolean
register_type (EComponentRegistry *component_registry,
const char *name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -121,7 +123,9 @@ register_type (EComponentRegistry *component_registry,
g_assert (folder_type_registry != NULL);
if (! e_folder_type_registry_register_type (folder_type_registry,
- name, icon_name, user_creatable,
+ name, icon_name,
+ display_name, description,
+ user_creatable,
num_exported_dnd_types,
exported_dnd_types,
num_accepted_dnd_types,
@@ -189,7 +193,9 @@ register_component (EComponentRegistry *component_registry,
type = supported_types->_buffer + i;
if (! register_type (component_registry,
- type->name, type->icon_name, type->user_creatable,
+ type->name, type->icon_name,
+ type->display_name, type->description,
+ type->user_creatable,
type->exported_dnd_types._length,
(const char **) type->exported_dnd_types._buffer,
type->accepted_dnd_types._length,
diff --git a/shell/e-folder-type-registry.c b/shell/e-folder-type-registry.c
index ac520ff308..97fb7b4c25 100644
--- a/shell/e-folder-type-registry.c
+++ b/shell/e-folder-type-registry.c
@@ -41,6 +41,10 @@ static GtkObjectClass *parent_class = NULL;
struct _FolderType {
char *name;
char *icon_name;
+
+ char *display_name;
+ char *description;
+
gboolean user_creatable;
GList *exported_dnd_types; /* char * */
@@ -64,6 +68,8 @@ struct _EFolderTypeRegistryPrivate {
static FolderType *
folder_type_new (const char *name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -78,6 +84,9 @@ folder_type_new (const char *name,
new->name = g_strdup (name);
new->icon_name = g_strdup (icon_name);
+ new->display_name = g_strdup (display_name);
+ new->description = g_strdup (description);
+
new->user_creatable = user_creatable;
new->exported_dnd_types = NULL;
@@ -122,6 +131,8 @@ folder_type_free (FolderType *folder_type)
{
g_free (folder_type->name);
g_free (folder_type->icon_name);
+ g_free (folder_type->display_name);
+ g_free (folder_type->description);
if (folder_type->icon_pixbuf != NULL)
gdk_pixbuf_unref (folder_type->icon_pixbuf);
@@ -149,6 +160,8 @@ static gboolean
register_folder_type (EFolderTypeRegistry *folder_type_registry,
const char *name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -164,7 +177,9 @@ register_folder_type (EFolderTypeRegistry *folder_type_registry,
if (get_folder_type (folder_type_registry, name) != NULL)
return FALSE;
- folder_type = folder_type_new (name, icon_name, user_creatable,
+ folder_type = folder_type_new (name, icon_name,
+ display_name, description,
+ user_creatable,
num_exported_dnd_types, exported_dnd_types,
num_accepted_dnd_types, accepted_dnd_types);
g_hash_table_insert (priv->name_to_type, folder_type->name, folder_type);
@@ -279,6 +294,8 @@ gboolean
e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -290,7 +307,8 @@ e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
g_return_val_if_fail (type_name != NULL, FALSE);
g_return_val_if_fail (icon_name != NULL, FALSE);
- return register_folder_type (folder_type_registry, type_name, icon_name, user_creatable,
+ return register_folder_type (folder_type_registry, type_name, icon_name,
+ display_name, description, user_creatable,
num_exported_dnd_types, exported_dnd_types,
num_accepted_dnd_types, accepted_dnd_types);
}
@@ -419,6 +437,44 @@ e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type
return folder_type->user_creatable;
}
+const char *
+e_folder_type_registry_get_display_name_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name)
+{
+ const FolderType *folder_type;
+
+ g_return_val_if_fail (folder_type_registry != NULL, NULL);
+ g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL);
+ g_return_val_if_fail (type_name != NULL, NULL);
+
+ folder_type = get_folder_type (folder_type_registry, type_name);
+ if (folder_type == NULL) {
+ g_warning ("e_folder_type_registry_type_get_display_name_for_type() -- Unknown type `%s'", type_name);
+ return FALSE;
+ }
+
+ return folder_type->display_name;
+}
+
+const char *
+e_folder_type_registry_get_description_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name)
+{
+ const FolderType *folder_type;
+
+ g_return_val_if_fail (folder_type_registry != NULL, NULL);
+ g_return_val_if_fail (E_IS_FOLDER_TYPE_REGISTRY (folder_type_registry), NULL);
+ g_return_val_if_fail (type_name != NULL, NULL);
+
+ folder_type = get_folder_type (folder_type_registry, type_name);
+ if (folder_type == NULL) {
+ g_warning ("e_folder_type_registry_get_description_for_type() -- Unknown type `%s'", type_name);
+ return FALSE;
+ }
+
+ return folder_type->description;
+}
+
GList *
e_folder_type_registry_get_exported_dnd_types_for_type (EFolderTypeRegistry *folder_type_registry,
diff --git a/shell/e-folder-type-registry.h b/shell/e-folder-type-registry.h
index 1bcb87b3ac..580bba4f41 100644
--- a/shell/e-folder-type-registry.h
+++ b/shell/e-folder-type-registry.h
@@ -63,6 +63,8 @@ EFolderTypeRegistry *e_folder_type_registry_new (void);
gboolean e_folder_type_registry_register_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name,
const char *icon_name,
+ const char *display_name,
+ const char *description,
gboolean user_creatable,
int num_exported_dnd_types,
const char **exported_dnd_types,
@@ -74,15 +76,19 @@ gboolean e_folder_type_registry_set_handler_for_type (EFolderTypeRegistry
GList *e_folder_type_registry_get_type_names (EFolderTypeRegistry *folder_type_registry);
-GdkPixbuf *e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name,
- gboolean mini);
-const char *e_folder_type_registry_get_icon_name_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name);
-EvolutionShellComponentClient *e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry,
- const char *type_name);
-gboolean e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type_registry,
- const char *type_name);
+GdkPixbuf *e_folder_type_registry_get_icon_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name,
+ gboolean mini);
+const char *e_folder_type_registry_get_icon_name_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
+EvolutionShellComponentClient *e_folder_type_registry_get_handler_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
+gboolean e_folder_type_registry_type_is_user_creatable (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
+const char *e_folder_type_registry_get_display_name_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
+const char *e_folder_type_registry_get_description_for_type (EFolderTypeRegistry *folder_type_registry,
+ const char *type_name);
GList *e_folder_type_registry_get_exported_dnd_types_for_type (EFolderTypeRegistry *folder_type_registry,
const char *type_name);
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
index 6cc5138e8e..52b66d742e 100644
--- a/shell/e-shell-folder-creation-dialog.c
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -340,6 +340,23 @@ add_storage_set_view (GtkWidget *dialog,
return storage_set_view;
}
+struct _TypeWithDisplayName {
+ const char *type;
+ const char *display_name;
+};
+typedef struct _TypeWithDisplayName TypeWithDisplayName;
+
+static int
+type_with_display_name_compare_func (const void *a, const void *b)
+{
+ const TypeWithDisplayName *val_a, *val_b;
+
+ val_a = (const TypeWithDisplayName *) a;
+ val_b = (const TypeWithDisplayName *) b;
+
+ return g_strcasecmp (val_a->display_name, val_b->display_name);
+}
+
static GList *
add_folder_types (GtkWidget *dialog,
GladeXML *gui,
@@ -349,6 +366,7 @@ add_folder_types (GtkWidget *dialog,
GtkWidget *folder_type_option_menu;
GtkWidget *menu;
GList *folder_types;
+ GList *types_with_display_names;
GList *p;
int default_item;
int i;
@@ -374,31 +392,48 @@ add_folder_types (GtkWidget *dialog,
if (folder_types == NULL)
return NULL; /* Uh? */
- folder_types = g_list_sort (folder_types, (GCompareFunc) g_strcasecmp);
+ types_with_display_names = NULL;
+ for (p = folder_types; p != NULL; p = p->next) {
+ TypeWithDisplayName *new;
+
+ new = g_new (TypeWithDisplayName, 1);
+ new->type = g_strdup ((const char *) p->data);
+ new->display_name = e_folder_type_registry_get_display_name_for_type (folder_type_registry, new->type);
+
+ types_with_display_names = g_list_prepend (types_with_display_names, new);
+ }
+
+ types_with_display_names = g_list_sort (types_with_display_names, type_with_display_name_compare_func);
- /* FIXME: Use descriptive name (not in the registry's implementation yet). */
/* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again). */
default_item = 0;
- for (p = folder_types, i = 0; p != NULL; p = p->next, i++) {
- const char *type_name;
+ i = 0;
+ for (p = types_with_display_names; p != NULL; p = p->next) {
+ const TypeWithDisplayName *type;
GtkWidget *menu_item;
- type_name = (const char *) p->data;
+ type = (const TypeWithDisplayName *) p->data;
- if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type_name))
+ if (! e_folder_type_registry_type_is_user_creatable (folder_type_registry, type->type))
continue;
- menu_item = gtk_menu_item_new_with_label (type_name);
+ menu_item = gtk_menu_item_new_with_label (type->display_name);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU (menu), menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "folder_type", (void *) type_name);
+ gtk_object_set_data (GTK_OBJECT (menu_item), "folder_type", (void *) type->type);
- if (strcmp (type_name, "mail") == 0)
+ if (strcmp (type->type, "mail") == 0)
default_item = i;
+
+ i ++;
}
+ for (p = types_with_display_names; p != NULL; p = p->next)
+ g_free (p->data);
+ g_list_free (types_with_display_names);
+
gtk_option_menu_set_menu (GTK_OPTION_MENU (folder_type_option_menu), menu);
gtk_widget_show (menu);
diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c
index 92b4a6577d..836da098cb 100644
--- a/shell/e-shell-folder-title-bar.c
+++ b/shell/e-shell-folder-title-bar.c
@@ -152,6 +152,14 @@ label_realize_callback (GtkWidget *widget,
style->font = bolded_font;
gtk_style_attach (style, widget->window);
+
+ if (E_IS_CLIPPED_LABEL (widget)) {
+ char *text;
+
+ text = g_strdup (e_clipped_label_get_text (E_CLIPPED_LABEL (widget)));
+ e_clipped_label_set_text (E_CLIPPED_LABEL (widget), text);
+ g_free (text);
+ }
}
static void
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index 0c2c72b004..eedbb98695 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -32,6 +32,7 @@
#include <glib.h>
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-object.h>
+#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
@@ -197,6 +198,8 @@ impl__get_supported_types (PortableServer_Servant servant,
corba_folder_type = folder_type_list->_buffer + i;
corba_folder_type->name = CORBA_string_dup (folder_type->name);
corba_folder_type->icon_name = CORBA_string_dup (folder_type->icon_name);
+ corba_folder_type->display_name = CORBA_string_dup (folder_type->display_name);
+ corba_folder_type->description = CORBA_string_dup (folder_type->description);
corba_folder_type->user_creatable = folder_type->user_creatable;
fill_corba_sequence_from_null_terminated_string_array (& corba_folder_type->exported_dnd_types,
@@ -733,6 +736,11 @@ evolution_shell_component_construct (EvolutionShellComponent *shell_component,
new = g_new (EvolutionShellComponentFolderType, 1);
new->name = g_strdup (folder_types[i].name);
new->icon_name = g_strdup (folder_types[i].icon_name);
+
+ /* Notice that these get translated here. */
+ new->display_name = g_strdup (_(folder_types[i].display_name));
+ new->description = g_strdup (_(folder_types[i].description));
+
new->user_creatable = folder_types[i].user_creatable;
new->accepted_dnd_types = duplicate_null_terminated_string_array (folder_types[i].accepted_dnd_types);
new->exported_dnd_types = duplicate_null_terminated_string_array (folder_types[i].exported_dnd_types);
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index 2505cf7e33..6fe70ac8fe 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -110,6 +110,9 @@ typedef char * (* EvolutionShellComponentGetDndSelectionFn) (EvolutionShellCompo
struct _EvolutionShellComponentFolderType {
char *name;
char *icon_name;
+ char *display_name;
+ char *description;
+
gboolean user_creatable;
/* The following are NULL-terminated arrays. */
diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c
index b4ad8334a5..e29773e4dd 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -40,7 +40,7 @@
#define COMPONENT_ID "OAFIID:GNOME_Evolution_TestComponent_ShellComponent"
static const EvolutionShellComponentFolderType folder_types[] = {
- { "test", "/usr/share/pixmaps/gnome-money.png", FALSE, NULL, NULL },
+ { "test", "/usr/share/pixmaps/gnome-money.png", N_("Test"), N_("Test type"), FALSE, NULL, NULL },
{ NULL }
};