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
This commit is contained in:
Ettore Perazzoli
2001-08-20 04:42:04 +00:00
parent 5ab5cd2560
commit d9ed7a6a63
19 changed files with 216 additions and 42 deletions

View File

@ -1,3 +1,8 @@
2001-08-19 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-component.c: Update the folder list to
include a display name and a description.
2001-08-19 Damon Chaplin <damon@ximian.com>
* gui/component/addressbook.c: use new Cut/Copy/Paste/Save/Search

View File

@ -65,7 +65,8 @@ static char *accepted_dnd_types[] = {
};
static const EvolutionShellComponentFolderType folder_types[] = {
{ "contacts", "evolution-contacts.png", TRUE, accepted_dnd_types, NULL },
{ "contacts", "evolution-contacts.png", N_("Contacts"), N_("Folder containing contact information"),
TRUE, accepted_dnd_types, NULL },
{ NULL, NULL, FALSE, NULL, NULL }
};

View File

@ -1,3 +1,8 @@
2001-08-19 Ettore Perazzoli <ettore@ximian.com>
* gui/component-factory.c: Update the folder list to include a
display name and a description.
2001-08-20 Damon Chaplin <damon@ximian.com>
* gui/dialogs/comp-editor.c (pixmaps): use new delete icon for toolbar.

View File

@ -52,8 +52,8 @@ static BonoboGenericFactory *factory = NULL;
char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png", TRUE, NULL, NULL },
{ "tasks", "evolution-tasks.png", TRUE, NULL, NULL },
{ "calendar", "evolution-calendar.png", N_("Calendar"), N_("Folder containing appointments and events"), TRUE, NULL, NULL },
{ "tasks", "evolution-tasks.png", N_("Tasks"), N_("Folder containing to-do items"), TRUE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -52,8 +52,8 @@ static BonoboGenericFactory *factory = NULL;
char *evolution_dir;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "calendar", "evolution-calendar.png", TRUE, NULL, NULL },
{ "tasks", "evolution-tasks.png", TRUE, NULL, NULL },
{ "calendar", "evolution-calendar.png", N_("Calendar"), N_("Folder containing appointments and events"), TRUE, NULL, NULL },
{ "tasks", "evolution-tasks.png", N_("Tasks"), N_("Folder containing to-do items"), TRUE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -1,3 +1,8 @@
2001-08-19 Ettore Perazzoli <ettore@ximian.com>
* component-factory.c: Update the folder list to include a display
name and a description.
2001-08-19 Jeffrey Stedfast <fejj@ximian.com>
* mail-mt.c (do_op_status): Allow the activity to be NULL if there

View File

@ -93,10 +93,10 @@ static char *exported_dnd_types[] = {
};
static const EvolutionShellComponentFolderType folder_types[] = {
{ "mail", "evolution-inbox.png", TRUE, accepted_dnd_types, exported_dnd_types },
{ "mailstorage", "evolution-inbox.png", FALSE, NULL, NULL },
{ "vtrash", "evolution-trash.png", FALSE, accepted_dnd_types, exported_dnd_types },
{ NULL, NULL, FALSE, NULL, NULL }
{ "mail", "evolution-inbox.png", N_("Mail"), N_("Folder containing mail"), TRUE, accepted_dnd_types, exported_dnd_types },
{ "mailstorage", "evolution-inbox.png", N_(""), N_(""), FALSE, NULL, NULL },
{ "vtrash", "evolution-trash.png", N_(""), N_(""), FALSE, accepted_dnd_types, exported_dnd_types },
{ NULL, NULL, NULL, NULL, FALSE, NULL, NULL }
};
static const char *schema_types[] = {

View File

@ -27,7 +27,7 @@
static gint running_objects = 0;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "summary", "evolution-today.png", FALSE, NULL, NULL },
{ "summary", "evolution-today.png", N_("Summary"), N_("Folder containing the Evolution Summary"), FALSE, NULL, NULL },
{ NULL, NULL }
};

View File

@ -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
ID
Makefile
Makefile.in
evolution
evolution-test-component
evolution.pure
libeshell.la

View File

@ -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

View File

@ -18,6 +18,9 @@ module Evolution {
string name;
string icon_name;
string display_name;
string description;
boolean user_creatable;
sequence<string> accepted_dnd_types;

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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. */

View File

@ -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 }
};