diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 16 | ||||
-rw-r--r-- | shell/e-shell-settings-dialog.c | 78 | ||||
-rw-r--r-- | shell/e-shell-settings-dialog.h | 6 | ||||
-rw-r--r-- | shell/e-shell-view-menu.c | 7 |
4 files changed, 97 insertions, 10 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 4a1755ce63..8e4276c7eb 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,19 @@ +2002-04-06 JP Rosevear <jpr@ximian.com> + + * e-shell-settings-dialog.c (page_new): set type + (load_pages): get the oaf property for type and track the page + number of the highest priority for each type + (destroy_type_entry): destroy hash func + (impl_destroy): destroy the hash table + (init): create private struct and hash table + (e_shell_settings_dialog_show_type): show the page of the given + type + + * e-shell-view-menu.c (command_settings): show the page for the + current folder type by default + + * e-shell-settings-dialog.h: new proto + 2002-04-06 Ettore Perazzoli <ettore@ximian.com> * e-shell-settings-dialog.c (init): Set the title of the dialog. diff --git a/shell/e-shell-settings-dialog.c b/shell/e-shell-settings-dialog.c index 64783babd9..1fc2655066 100644 --- a/shell/e-shell-settings-dialog.c +++ b/shell/e-shell-settings-dialog.c @@ -44,12 +44,19 @@ static EMultiConfigDialogClass *parent_class = NULL; + +struct _EShellSettingsDialogPrivate { + GHashTable *types; +}; + + /* Page handling. */ struct _Page { char *title; char *description; GdkPixbuf *icon; + OAF_Property *type; int priority; EConfigPage *page_widget; }; @@ -59,6 +66,7 @@ static Page * page_new (const char *title, const char *description, GdkPixbuf *icon, + OAF_Property *type, int priority, EConfigPage *page_widget) { @@ -71,6 +79,7 @@ page_new (const char *title, page->title = g_strdup (title); page->description = g_strdup (description); page->icon = icon; + page->type = type; page->priority = priority; page->page_widget = page_widget; @@ -114,13 +123,16 @@ sort_page_list (GList *list) static void load_pages (EShellSettingsDialog *dialog) { + EShellSettingsDialogPrivate *priv; OAF_ServerInfoList *control_list; CORBA_Environment ev; GSList *language_list; GList *page_list; GList *p; - int i; + int i, j; + priv = dialog->priv; + CORBA_exception_init (&ev); control_list = oaf_query ("defined(evolution:config_item:title)", NULL, &ev); @@ -140,6 +152,7 @@ load_pages (EShellSettingsDialog *dialog) const char *description; const char *icon_path; const char *priority_string; + OAF_Property *type; int priority; GdkPixbuf *icon; @@ -148,6 +161,7 @@ load_pages (EShellSettingsDialog *dialog) title = oaf_server_info_prop_lookup (info, "evolution:config_item:title", language_list); description = oaf_server_info_prop_lookup (info, "evolution:config_item:description", language_list); icon_path = oaf_server_info_prop_lookup (info, "evolution:config_item:icon_name", NULL); + type = oaf_server_info_prop_find (info, "evolution:config_item:type"); priority_string = oaf_server_info_prop_lookup (info, "evolution:config_item:priority", NULL); if (icon_path == NULL) { @@ -164,6 +178,8 @@ load_pages (EShellSettingsDialog *dialog) } } + if (type != NULL && type->v._d != OAF_P_STRINGV) + type = NULL; if (priority_string == NULL) priority = 0xffff; else @@ -174,7 +190,7 @@ load_pages (EShellSettingsDialog *dialog) if (! BONOBO_EX (&ev)) { Page *page; - page = page_new (title, description, icon, priority, + page = page_new (title, description, icon, type, priority, E_CONFIG_PAGE (e_corba_config_page_new_from_objref (corba_object))); page_list = g_list_prepend (page_list, page); @@ -187,7 +203,7 @@ load_pages (EShellSettingsDialog *dialog) } page_list = sort_page_list (page_list); - for (p = page_list; p != NULL; p = p->next) { + for (p = page_list, i = 0; p != NULL; p = p->next, i++) { Page *page; page = (Page *) p->data; @@ -198,6 +214,17 @@ load_pages (EShellSettingsDialog *dialog) page->icon, page->page_widget); + if (page->type != NULL) { + GNOME_stringlist list = page->type->v._u.value_stringv; + + for (j = 0; j < list._length; j++) { + if (g_hash_table_lookup (priv->types, list._buffer[j]) == NULL) + g_hash_table_insert (priv->types, g_strdup (list._buffer[j]), + GINT_TO_POINTER (i)); + } + } + + page_free (page); } @@ -211,15 +238,28 @@ load_pages (EShellSettingsDialog *dialog) /* GtkObject methods. */ +static gboolean +destroy_type_entry (gpointer key, gpointer value, gpointer data) +{ + g_free (key); + + return TRUE; +} + static void impl_destroy (GtkObject *object) { EShellSettingsDialog *dialog; + EShellSettingsDialogPrivate *priv; dialog = E_SHELL_SETTINGS_DIALOG (object); + priv = dialog->priv; + + g_hash_table_foreach_remove (priv->types, destroy_type_entry, NULL); + g_hash_table_destroy (priv->types); - /* (Really nothing to do here for now.) */ - + g_free (priv); + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -238,6 +278,13 @@ class_init (EShellSettingsDialog *class) static void init (EShellSettingsDialog *dialog) { + EShellSettingsDialogPrivate *priv; + + priv = g_new (EShellSettingsDialogPrivate, 1); + priv->types = g_hash_table_new (g_str_hash, g_str_equal); + + dialog->priv = priv; + load_pages (dialog); gtk_window_set_title (GTK_WINDOW (dialog), _("Evolution Settings")); @@ -246,7 +293,7 @@ init (EShellSettingsDialog *dialog) GtkWidget * -e_shell_settings_dialog_new (void) +e_shell_settings_dialog_new () { EShellSettingsDialog *new; @@ -255,6 +302,25 @@ e_shell_settings_dialog_new (void) return GTK_WIDGET (new); } +void +e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, const char *type) +{ + EShellSettingsDialogPrivate *priv; + gpointer value; + int page; + + g_return_if_fail (dialog != NULL); + g_return_if_fail (E_IS_SHELL_SETTINGS_DIALOG (dialog)); + g_return_if_fail (type != NULL); + + priv = dialog->priv; + + value = g_hash_table_lookup (priv->types, type); + page = GPOINTER_TO_INT (value); + + e_multi_config_dialog_show_page (E_MULTI_CONFIG_DIALOG (dialog), page); +} + E_MAKE_TYPE (e_shell_settings_dialog, "EShellSettingsDialog", EShellSettingsDialog, class_init, init, PARENT_TYPE) diff --git a/shell/e-shell-settings-dialog.h b/shell/e-shell-settings-dialog.h index 93d136ac0f..f01ba36855 100644 --- a/shell/e-shell-settings-dialog.h +++ b/shell/e-shell-settings-dialog.h @@ -57,8 +57,10 @@ struct _EShellSettingsDialogClass { }; -GtkType e_shell_settings_dialog_get_type (void); -GtkWidget *e_shell_settings_dialog_new (void); +GtkType e_shell_settings_dialog_get_type (void); +GtkWidget *e_shell_settings_dialog_new (void); +void e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, + const char *type); #ifdef __cplusplus } diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index f460d427e8..236044ae0c 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -589,11 +589,14 @@ command_settings (BonoboUIComponent *uih, { EShellView *shell_view; GtkWidget *dialog; - + const char *type; + shell_view = E_SHELL_VIEW (data); + type = e_shell_view_get_current_folder_type (shell_view); dialog = e_shell_settings_dialog_new (); - + e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (dialog), type); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (shell_view)); gtk_widget_show (dialog); |