static void update_style (ModestFolderView *self);
static void on_notify_style (GObject *obj, GParamSpec *spec, gpointer userdata);
static gint get_cmp_pos (TnyFolderType t, TnyFolder *folder_store);
+static gboolean inbox_is_special (TnyFolderStore *folder_store);
static gboolean get_inner_models (ModestFolderView *self,
GtkTreeModel **filter_model,
}
if (type == TNY_FOLDER_TYPE_INBOX) {
- g_free (fname);
- fname = g_strdup (_("mcen_me_folder_inbox"));
+ if (inbox_is_special (TNY_FOLDER_STORE (instance))) {
+ g_free (fname);
+ fname = g_strdup (_("mcen_me_folder_inbox"));
+ }
}
/* note: we cannot reliably get the counts from the tree model, we need
/* Set icon and text render function */
renderer = gtk_cell_renderer_pixbuf_new();
+#ifdef MODEST_TOOLKIT_HILDON2
+ g_object_set (renderer,
+ "xpad", MODEST_MARGIN_DEFAULT,
+ "ypad", MODEST_MARGIN_DEFAULT,
+ NULL);
+#endif
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_cell_data_func(column, renderer,
icon_cell_data, treeview, NULL);
g_object_set (renderer,
#ifdef MODEST_TOOLKIT_HILDON2
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
+ "ypad", MODEST_MARGIN_DEFAULT,
#else
"ellipsize", PANGO_ELLIPSIZE_END,
#endif
priv->messages_renderer = gtk_cell_renderer_text_new ();
g_object_set (priv->messages_renderer,
+#ifdef MODEST_TOOLKIT_HILDON2
+ "yalign", 0.0,
+ "ypad", MODEST_MARGIN_DEFAULT,
+ "xpad", MODEST_MARGIN_DOUBLE,
+#else
"scale", PANGO_SCALE_X_SMALL,
"scale-set", TRUE,
+#endif
"alignment", PANGO_ALIGN_RIGHT,
"align-set", TRUE,
"xalign", 1.0,
}
}
+static gboolean
+inbox_is_special (TnyFolderStore *folder_store)
+{
+ gboolean is_special = TRUE;
+
+ if (TNY_IS_FOLDER (folder_store)) {
+ const gchar *id;
+ gchar *downcase;
+ gchar *last_bar;
+ gchar *last_inbox_bar;
+
+ id = tny_folder_get_id (TNY_FOLDER (folder_store));
+ downcase = g_utf8_strdown (id, -1);
+ last_bar = g_strrstr (downcase, "/");
+ if (last_bar) {
+ last_inbox_bar = g_strrstr (downcase, "inbox/");
+ if ((last_inbox_bar == NULL) || (last_inbox_bar + 5 != last_bar))
+ is_special = FALSE;
+ }
+ g_free (downcase);
+ }
+ return is_special;
+}
+
static gint
get_cmp_pos (TnyFolderType t, TnyFolder *folder_store)
{
* inbox of the account, or if it's a submailbox inbox. To do
* this we'll apply an heuristic rule: Find last "/" and check
* if it's preceeded by another Inbox */
- if (is_special && TNY_IS_FOLDER (folder_store)) {
- const gchar *id;
- gchar *downcase;
- gchar *last_bar;
- gchar *last_inbox_bar;
-
- id = tny_folder_get_id (TNY_FOLDER (folder_store));
- downcase = g_utf8_strdown (id, -1);
- last_bar = g_strrstr (downcase, "/");
- if (last_bar) {
- last_inbox_bar = g_strrstr (downcase, "inbox/");
- if ((last_inbox_bar == NULL) || (last_inbox_bar + 5 != last_bar))
- is_special = FALSE;
- }
- g_free (downcase);
- }
-
+ is_special = is_special && inbox_is_special (TNY_FOLDER_STORE (folder_store));
g_object_unref (account);
return is_special?0:4;
}
{
ModestFolderViewPrivate *priv;
GdkColor style_color;
+ PangoAttrList *attr_list;
+ GtkStyle *style;
+ PangoAttribute *attr;
g_return_if_fail (MODEST_IS_FOLDER_VIEW (self));
priv = MODEST_FOLDER_VIEW_GET_PRIVATE (self);
+ /* Set color */
+
+ attr_list = pango_attr_list_new ();
if (!gtk_style_lookup_color (GTK_WIDGET (self)->style, "SecondaryTextColor", &style_color)) {
gdk_color_parse ("grey", &style_color);
}
+ attr = pango_attr_foreground_new (style_color.red, style_color.green, style_color.blue);
+ pango_attr_list_insert (attr_list, attr);
+
+ /* set font */
+ style = gtk_rc_get_style_by_paths (gtk_widget_get_settings
+ (GTK_WIDGET(self)),
+ "SmallSystemFont", NULL,
+ G_TYPE_NONE);
+ attr = pango_attr_font_desc_new (pango_font_description_copy
+ (style->font_desc));
+ pango_attr_list_insert (attr_list, attr);
g_object_set (G_OBJECT (priv->messages_renderer),
"foreground-gdk", &style_color,
"foreground-set", TRUE,
+ "attributes", attr_list,
NULL);
+ pango_attr_list_unref (attr_list);
}
static void