aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-19 04:00:29 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-19 04:00:29 +0800
commita133df0caffc738bb0db8e0f23c3eb628eac12a1 (patch)
tree3ae34c3440418424aae018e248067e2725873e3c /mail
parentf261f288c8dee85c36ff1b199f71a7730870ae47 (diff)
downloadgsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.tar
gsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.tar.gz
gsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.tar.bz2
gsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.tar.lz
gsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.tar.xz
gsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.tar.zst
gsoc2013-evolution-a133df0caffc738bb0db8e0f23c3eb628eac12a1.zip
Add an "ellipsize" property to EMFolderTree.
So we don't have to access GConf directly from EMFolderTree. The property gets bound to an EShellSettings property, which is in turn bound to the "no_folder_dots" GConf key by way of a transform function.
Diffstat (limited to 'mail')
-rw-r--r--mail/em-folder-tree.c63
-rw-r--r--mail/em-folder-tree.h4
2 files changed, 57 insertions, 10 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);