#
# Makefile.am
-# Time-stamp: <2007-01-13 14:46:41 (djcb)>
+# Time-stamp: <2007-01-13 23:06:05 (djcb)>
SUBDIRS=$(MODEST_PLATFORM) widgets
DIST_SUBDIRS = widgets gtk maemo
modest
modest_SOURCES=\
- modest-main.c\
- modest-conf-keys.h\
- modest-conf.h \
- modest-conf.c\
- modest-pair.h\
- modest-pair.c\
- modest-widget-factory.h \
- modest-widget-factory.c \
- modest-widget-memory.h\
- modest-widget-memory.c\
modest-account-keys.h\
- modest-account-mgr.h\
modest-account-mgr.c\
+ modest-account-mgr.h\
+ modest-conf-keys.h\
+ modest-conf.c\
+ modest-conf.h \
modest-debug.c\
modest-debug.h\
+ modest-error.h \
+ modest-formatter.c \
+ modest-formatter.h \
modest-icon-factory.c\
modest-icon-factory.h\
- modest-tny-account-store.h\
- modest-tny-account-store.c\
- modest-tny-msg-actions.h\
- modest-tny-msg-actions.c\
+ modest-mail-operation-queue.c \
+ modest-mail-operation-queue.h \
+ modest-mail-operation.c \
+ modest-mail-operation.h \
+ modest-main.c\
+ modest-marshal.c \
+ modest-marshal.h \
+ modest-pair.c\
+ modest-pair.h\
modest-presets.c\
modest-presets.h\
- modest-protocol-mgr.h\
- modest-protocol-mgr.c\
- modest-proto.h\
modest-proto.c\
- modest-ui.c\
- modest-ui.h\
- modest-text-utils.h\
+ modest-proto.h\
+ modest-protocol-mgr.c\
+ modest-protocol-mgr.h\
modest-text-utils.c\
- modest-tny-stream-gtkhtml.h\
- modest-tny-stream-gtkhtml.c\
- modest-marshal.c \
- modest-marshal.h \
- modest-mail-operation.c \
- modest-mail-operation.h \
- modest-mail-operation-queue.c \
- modest-mail-operation-queue.h \
+ modest-text-utils.h\
+ modest-tny-account-store.c\
+ modest-tny-account-store.h\
+ modest-tny-folder.c \
+ modest-tny-folder.h \
+ modest-tny-msg-actions.c\
+ modest-tny-msg-actions.h\
modest-tny-platform-factory.c \
modest-tny-platform-factory.h \
- modest-formatter.c \
- modest-formatter.h \
- modest-error.h
+ modest-ui.c\
+ modest-ui.h\
+ modest-widget-factory.c \
+ modest-widget-factory.h \
+ modest-widget-memory.c\
+ modest-widget-memory.h
modest_LDADD = \
$(MODEST_GSTUFF_LIBS) \
--- /dev/null
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <string.h>
+#include <modest-tny-folder.h>
+
+TnyFolderType
+modest_tny_folder_guess_folder_type_from_name (const gchar* name)
+{
+ gint type;
+ gchar *folder;
+
+ g_return_val_if_fail (name, TNY_FOLDER_TYPE_UNKNOWN);
+
+ type = TNY_FOLDER_TYPE_UNKNOWN;
+ folder = g_utf8_strdown (name, strlen(name));
+
+ if (strcmp (folder, "inbox") == 0 ||
+ strcmp (folder, _("inbox")) == 0)
+ type = TNY_FOLDER_TYPE_INBOX;
+ else if (strcmp (folder, "outbox") == 0 ||
+ strcmp (folder, _("outbox")) == 0)
+ type = TNY_FOLDER_TYPE_OUTBOX;
+ else if (g_str_has_prefix(folder, "junk") ||
+ g_str_has_prefix(folder, _("junk")))
+ type = TNY_FOLDER_TYPE_JUNK;
+ else if (g_str_has_prefix(folder, "trash") ||
+ g_str_has_prefix(folder, _("trash")))
+ type = TNY_FOLDER_TYPE_TRASH;
+ else if (g_str_has_prefix(folder, "sent") ||
+ g_str_has_prefix(folder, _("sent")))
+ type = TNY_FOLDER_TYPE_SENT;
+ else if (g_str_has_prefix(folder, "draft") ||
+ g_str_has_prefix(folder, _("draft")))
+ type = TNY_FOLDER_TYPE_DRAFTS;
+ else if (g_str_has_prefix(folder, "notes") ||
+ g_str_has_prefix(folder, _("notes")))
+ type = TNY_FOLDER_TYPE_NOTES;
+ else if (g_str_has_prefix(folder, "contacts") ||
+ g_str_has_prefix(folder, _("contacts")))
+ type = TNY_FOLDER_TYPE_CONTACTS;
+ else if (g_str_has_prefix(folder, "calendar") ||
+ g_str_has_prefix(folder, _("calendar")))
+ type = TNY_FOLDER_TYPE_CALENDAR;
+
+ g_free (folder);
+ return type;
+}
+
+
+
+TnyFolderType
+modest_tny_folder_guess_folder_type (const TnyFolder *folder)
+{
+ TnyFolderType type;
+
+ g_return_val_if_fail (folder, TNY_FOLDER_TYPE_UNKNOWN);
+
+ type = tny_folder_get_folder_type ((TnyFolder*)folder); /* FIXME: cast tinymail */
+
+ if (type == TNY_FOLDER_TYPE_UNKNOWN)
+ type = modest_tny_folder_guess_folder_type_from_name (tny_folder_get_name (folder));
+
+ return type;
+}
+
+
+ModestTnyFolderRules
+modest_tny_folder_get_folder_rules (const TnyFolder *folder)
+{
+ g_return_val_if_fail (folder, 0);
+
+ /* FIXME -- implement this */
+ return 0;
+}
--- /dev/null
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * TnyFolder Decorator
+ */
+
+#ifndef __MODEST_TNY_FOLDER_H__
+#define __MODEST_TNY_FOLDER_H__
+
+#include <tny-folder.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ MODEST_FOLDER_RULES_FOLDER_READ_ONLY = 0 << 1,
+ MODEST_FOLDER_RULES_FOLDER_DELETABLE
+} ModestTnyFolderRules;
+
+
+
+/**
+ * modest_tny_folder_guess_type:
+ * @folder: a valid tnymail folder
+ *
+ * determine the type of the folder. first, we see if tinymail
+ * can give a specific type. if it cannot, we try to guess the
+ * type, using modest_tny_folder_guess_type_from_name
+ *
+ * Returns: the folder type, or TNY_FOLDER_TYPE_UNKNOWN
+ */
+TnyFolderType modest_tny_folder_guess_folder_type (const TnyFolder *folder);
+
+/**
+ * modest_tny_folder_guess_type_from_name:
+ * @folder_name: a folder name
+ *
+ * determine the type of the folder. first, we see if tinymail
+ * can give a specific type. if it cannot, we try to guess the
+ * type, based on the name of the folder
+ *
+ * Note: this is a Class function, there does not require a tnyfolder instance
+ *
+ * Returns: the folder type, or TNY_FOLDER_TYPE_UNKNOWN
+ */
+TnyFolderType modest_tny_folder_guess_folder_type_from_name (const gchar *folder_name);
+
+
+/**
+ * modest_tny_folder_get_rules:
+ * @folder: a valid tnymail folder
+ *
+ * get the rules for this folder; can messages be put in it,
+ * can the folder be deleted, etc.
+ *
+ * Returns: the ModestTnyFolderRules rules (bitwise-OR) for this
+ * folder
+ */
+ModestTnyFolderRules modest_tny_folder_get_rules (const TnyFolder *folder);
+
+
+G_END_DECLS
+
+#endif /* __MODEST_TNY_FOLDER_H__*/
#include "modest-widget-memory.h"
#include <modest-tny-platform-factory.h>
+#include <modest-tny-folder.h>
#include <widgets/modest-header-view.h>
#include <widgets/modest-msg-view.h>
#include <widgets/modest-folder-view.h>
if (!folder)
return TRUE; /* no folder: no settings */
- type = modest_folder_view_guess_folder_type (folder);
+ type = modest_tny_folder_guess_folder_type (folder);
key = get_keyname_with_type (conf, name, type, PARAM_COLUMN_WIDTH);
cursor = cols = modest_header_view_get_columns (header_view);
if (!folder)
return TRUE; /* no folder: no settings */
- type = modest_folder_view_guess_folder_type (folder);
+ type = modest_tny_folder_guess_folder_type (folder);
key = get_keyname_with_type (conf, name, type, PARAM_COLUMN_WIDTH);
if (modest_conf_key_exists (conf, key, NULL)) {
#include <tny-account-store.h>
#include <tny-account.h>
#include <tny-folder.h>
+#include <modest-tny-folder.h>
#include <modest-marshal.h>
#include <modest-icon-names.h>
#include <modest-icon-factory.h>
}
-
static void
text_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
}
-/* guess the folder type based on the name, or -1 in case of error */
-static TnyFolderType
-guess_type_from_name (const gchar* name)
-{
- gint type;
- gchar *folder;
-
- if (!name)
- return -1;
-
- type = TNY_FOLDER_TYPE_NORMAL;
- folder = g_utf8_strdown (name, strlen(name));
-
- if (strcmp (folder, "inbox") == 0 ||
- strcmp (folder, _("inbox")) == 0)
- type = TNY_FOLDER_TYPE_INBOX;
- else if (strcmp (folder, "outbox") == 0 ||
- strcmp (folder, _("outbox")) == 0)
- type = TNY_FOLDER_TYPE_OUTBOX;
- else if (g_str_has_prefix(folder, "junk") ||
- g_str_has_prefix(folder, _("junk")))
- type = TNY_FOLDER_TYPE_JUNK;
- else if (g_str_has_prefix(folder, "trash") ||
- g_str_has_prefix(folder, _("trash")))
- type = TNY_FOLDER_TYPE_JUNK;
- else if (g_str_has_prefix(folder, "sent") ||
- g_str_has_prefix(folder, _("sent")))
- type = TNY_FOLDER_TYPE_SENT;
-
- /* these are not *really* TNY_ types */
- else if (g_str_has_prefix(folder, "draft") ||
- g_str_has_prefix(folder, _("draft")))
- type = TNY_FOLDER_TYPE_DRAFTS;
- else if (g_str_has_prefix(folder, "notes") ||
- g_str_has_prefix(folder, _("notes")))
- type = TNY_FOLDER_TYPE_NOTES;
- else if (g_str_has_prefix(folder, "contacts") ||
- g_str_has_prefix(folder, _("contacts")))
- type = TNY_FOLDER_TYPE_CONTACTS;
- else if (g_str_has_prefix(folder, "calendar") ||
- g_str_has_prefix(folder, _("calendar")))
- type = TNY_FOLDER_TYPE_CALENDAR;
-
- g_free (folder);
- return type;
-}
-
-
-
-TnyFolderType
-modest_folder_view_guess_folder_type (TnyFolder *folder)
-{
- TnyFolderType type;
-
- g_return_val_if_fail (folder, -1);
-
- type = tny_folder_get_folder_type (folder);
- if (type == TNY_FOLDER_TYPE_NORMAL)
- type = guess_type_from_name (tny_folder_get_name (folder));
-
- return type;
-}
-
static void
icon_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, &unread, -1);
rendobj = G_OBJECT(renderer);
- if (type == TNY_FOLDER_TYPE_NORMAL)
- type = guess_type_from_name (fname);
-
- if (fname)
- g_free (fname);
+ if (type == TNY_FOLDER_TYPE_NORMAL || type == TNY_FOLDER_TYPE_UNKNOWN)
+ type = modest_tny_folder_guess_folder_type_from_name (fname);
+ g_free (fname);
switch (type) {
case TNY_FOLDER_TYPE_ROOT:
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
priv->sig2 = g_signal_connect (sel, "changed",
G_CALLBACK(on_selection_changed), self);
-
+
return GTK_WIDGET(self);
}
void modest_folder_view_set_title (ModestFolderView *self, const gchar *title);
-
-/**
- * modest_folder_view_is_empty:
- * @self: a ModestFolderView instance
- *
- * check to see of the view is empty. Note that when it is empty,
- * there will still be one item, telling "(empty)" or similar
- *
- * Returns: TRUE if the tree view is empty, FALSE otherwise
- */
-gboolean modest_folder_view_is_empty (ModestFolderView *self);
-
-
-/**
- * modest_folder_view_guess_folder_type:
- * @folder: a tnymail folder
- *
- * guess the type of the folder, this is a class method so it does not need
- * an ModestFolderView instance
- *
- * Returns: the folder type, or -1 in case of error
- */
-TnyFolderType modest_folder_view_guess_folder_type (TnyFolder *folder);
-
-
-
/* FIXME: this is ugly */
const gchar* modest_folder_view_get_selected_account (ModestFolderView *self);