diff options
-rw-r--r-- | mail/em-folder-tree.c | 63 | ||||
-rw-r--r-- | mail/em-folder-tree.h | 4 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-settings.c | 50 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-sidebar.c | 7 |
4 files changed, 112 insertions, 12 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 46f08e06fa..15cf4a5f35 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -114,6 +114,7 @@ struct _EMFolderTreePrivate { gboolean skip_double_click; GtkCellRenderer *text_renderer; + PangoEllipsizeMode ellipsize; GtkWidget *selectable; /* an ESelectable, where to pass selectable calls */ @@ -123,6 +124,7 @@ struct _EMFolderTreePrivate { enum { PROP_0, + PROP_ELLIPSIZE, PROP_SESSION }; @@ -724,6 +726,12 @@ folder_tree_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_ELLIPSIZE: + em_folder_tree_set_ellipsize ( + EM_FOLDER_TREE (object), + g_value_get_enum (value)); + return; + case PROP_SESSION: folder_tree_set_session ( EM_FOLDER_TREE (object), @@ -741,6 +749,13 @@ folder_tree_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_ELLIPSIZE: + g_value_set_enum ( + value, + em_folder_tree_get_ellipsize ( + EM_FOLDER_TREE (object))); + return; + case PROP_SESSION: g_value_set_object ( value, @@ -1035,6 +1050,17 @@ folder_tree_class_init (EMFolderTreeClass *class) g_object_class_install_property ( object_class, + PROP_ELLIPSIZE, + g_param_spec_enum ( + "ellipsize", + NULL, + NULL, + PANGO_TYPE_ELLIPSIZE_MODE, + PANGO_ELLIPSIZE_NONE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, PROP_SESSION, g_param_spec_object ( "session", @@ -1257,10 +1283,6 @@ folder_tree_new (EMFolderTree *folder_tree) GtkTreeViewColumn *column; GtkCellRenderer *renderer; GtkWidget *tree; - GConfClient *client; - const gchar *key; - - client = gconf_client_get_default (); /* FIXME Gross hack */ tree = GTK_WIDGET (folder_tree); @@ -1280,15 +1302,16 @@ folder_tree_new (EMFolderTree *folder_tree) render_icon, NULL, NULL); renderer = gtk_cell_renderer_text_new (); - key = "/apps/evolution/mail/display/no_folder_dots"; - if (!gconf_client_get_bool (client, key, NULL)) - g_object_set ( - renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_set_cell_data_func ( column, renderer, render_display_name, NULL, NULL); folder_tree->priv->text_renderer = g_object_ref (renderer); + g_object_bind_property ( + folder_tree, "ellipsize", + renderer, "ellipsize", + G_BINDING_SYNC_CREATE); + g_signal_connect_swapped ( renderer, "edited", G_CALLBACK (folder_tree_cell_edited_cb), folder_tree); @@ -1302,8 +1325,6 @@ folder_tree_new (EMFolderTree *folder_tree) gtk_tree_view_set_search_column ((GtkTreeView *)tree, COL_STRING_DISPLAY_NAME); - g_object_unref (client); - return (GtkTreeView *) tree; } @@ -1533,6 +1554,28 @@ em_folder_tree_new (EMailSession *session) EM_TYPE_FOLDER_TREE, "session", session, NULL); } +PangoEllipsizeMode +em_folder_tree_get_ellipsize (EMFolderTree *folder_tree) +{ + g_return_val_if_fail (EM_IS_FOLDER_TREE (folder_tree), 0); + + return folder_tree->priv->ellipsize; +} + +void +em_folder_tree_set_ellipsize (EMFolderTree *folder_tree, + PangoEllipsizeMode ellipsize) +{ + g_return_if_fail (EM_IS_FOLDER_TREE (folder_tree)); + + if (ellipsize == folder_tree->priv->ellipsize) + return; + + folder_tree->priv->ellipsize = ellipsize; + + g_object_notify (G_OBJECT (folder_tree), "ellipsize"); +} + EMailSession * em_folder_tree_get_session (EMFolderTree *folder_tree) { diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index 4918bdc984..ecf0ddd29c 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -90,6 +90,10 @@ struct _EMFolderTreeClass { GType em_folder_tree_get_type (void); GtkWidget * em_folder_tree_new (EMailSession *session); +PangoEllipsizeMode + em_folder_tree_get_ellipsize (EMFolderTree *folder_tree); +void em_folder_tree_set_ellipsize (EMFolderTree *folder_tree, + PangoEllipsizeMode ellipsize); EMailSession * em_folder_tree_get_session (EMFolderTree *folder_tree); void em_folder_tree_enable_drag_and_drop (EMFolderTree *folder_tree); diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index 5452a1939a..503edaf121 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -31,6 +31,24 @@ #include <shell/e-shell.h> +static gboolean +transform_no_folder_dots_to_ellipsize (GBinding *binding, + const GValue *source_value, + GValue *target_value, + gpointer user_data) +{ + PangoEllipsizeMode ellipsize; + + if (g_value_get_boolean (source_value)) + ellipsize = PANGO_ELLIPSIZE_NONE; + else + ellipsize = PANGO_ELLIPSIZE_END; + + g_value_set_enum (target_value, ellipsize); + + return TRUE; +} + void e_mail_shell_settings_init (EShellBackend *shell_backend) { @@ -160,6 +178,11 @@ e_mail_shell_settings_init (EShellBackend *shell_backend) "mail-message-text-part-limit", "/apps/evolution/mail/display/message_text_part_limit"); + /* Do not bind to this. Use "mail-sidebar-ellipsize" instead. */ + e_shell_settings_install_property_for_key ( + "mail-no-folder-dots", + "/apps/evolution/mail/display/no_folder_dots"); + e_shell_settings_install_property_for_key ( "mail-only-local-photos", "/apps/evolution/mail/display/photo_local"); @@ -192,7 +215,7 @@ e_mail_shell_settings_init (EShellBackend *shell_backend) "/apps/evolution/mail/display/sender_photo"); e_shell_settings_install_property_for_key ( - "mail-side-bar-search", + "mail-sidebar-search", "/apps/evolution/mail/display/side_bar_search"); e_shell_settings_install_property_for_key ( @@ -276,4 +299,29 @@ e_mail_shell_settings_init (EShellBackend *shell_backend) e_shell_settings_install_property_for_key ( "composer-no-signature-delim", "/apps/evolution/mail/composer/no_signature_delim"); + + /* These properties use transform functions to convert + * GConf values to forms more useful to Evolution. We + * have to use separate properties because GConfBridge + * does not support transform functions. Much of this + * is backward-compatibility cruft for poorly designed + * GConf schemas. */ + + e_shell_settings_install_property ( + g_param_spec_enum ( + "mail-sidebar-ellipsize", + NULL, + NULL, + PANGO_TYPE_ELLIPSIZE_MODE, + PANGO_ELLIPSIZE_NONE, + G_PARAM_READWRITE)); + + g_object_bind_property_full ( + shell_settings, "mail-no-folder-dots", + shell_settings, "mail-sidebar-ellipsize", + G_BINDING_SYNC_CREATE, + transform_no_folder_dots_to_ellipsize, + NULL, + g_object_ref (shell_settings), + (GDestroyNotify) g_object_unref); } diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index f938b3fae1..2b24aae5e1 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -169,7 +169,12 @@ mail_shell_sidebar_constructed (GObject *object) G_BINDING_SYNC_CREATE); g_object_bind_property ( - shell_settings, "mail-side-bar-search", + shell_settings, "mail-sidebar-ellipsize", + widget, "ellipsize", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell_settings, "mail-sidebar-search", widget, "enable-search", G_BINDING_SYNC_CREATE); |