#include "widgets/modest-account-settings-dialog.h"
#include "gnome/modest-account-assistant.h"
#include "gnome/modest-gnome-sort-dialog.h"
+#include "widgets/modest-details-dialog.h"
gboolean
modest_platform_init (int argc, char *argv[])
g_debug ("%s not implemented", __FUNCTION__);
return FALSE;
}
+
+void
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_details_dialog_new_with_folder (parent_window, folder);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+void
+modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_details_dialog_new_with_header (parent_window, header);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
modest-main-window.c \
modest-main-window-ui.h \
modest-hildon-includes.h \
- modest-hildon-sort-dialog.c \
- modest-hildon-sort-dialog.h \
+ modest-hildon2-details-dialog.h \
+ modest-hildon2-details-dialog.c \
+ modest-hildon2-sort-dialog.c \
+ modest-hildon2-sort-dialog.h \
modest-platform.c \
modest-signature-editor-dialog.c \
modest-signature-editor-dialog.h \
+++ /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 "modest-defs.h"
-#include "modest-text-utils.h"
-#include "modest-hildon-sort-dialog.h"
-#include "widgets/modest-sort-criterium-view.h"
-
-
-static gint modest_hildon_sort_dialog_add_sort_key (ModestSortCriteriumView *self, const gchar *sort_key);
-static void modest_hildon_sort_dialog_set_sort_key (ModestSortCriteriumView *self, gint key);
-static void modest_hildon_sort_dialog_set_sort_order (ModestSortCriteriumView *self, GtkSortType sort_type);
-static gint modest_hildon_sort_dialog_get_sort_key (ModestSortCriteriumView *self);
-static GtkSortType modest_hildon_sort_dialog_get_sort_order (ModestSortCriteriumView *self);
-static void modest_sort_criterium_view_init (gpointer g_iface, gpointer iface_data);
-
-G_DEFINE_TYPE_EXTENDED (ModestHildonSortDialog,
- modest_hildon_sort_dialog,
- HILDON_TYPE_PICKER_DIALOG,
- 0,
- G_IMPLEMENT_INTERFACE (MODEST_TYPE_SORT_CRITERIUM_VIEW, modest_sort_criterium_view_init));
-
-typedef struct _ModestHildonSortDialogPrivate ModestHildonSortDialogPrivate;
-struct _ModestHildonSortDialogPrivate {
- gint id;
- GtkSortType sort_type;
-};
-
-#define MODEST_HILDON_SORT_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_HILDON_SORT_DIALOG, \
- ModestHildonSortDialogPrivate))
-
-enum {
- MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ,
- MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA,
- MODEST_HILDON_SORT_DIALOG_DATE_NEWEST,
- MODEST_HILDON_SORT_DIALOG_DATE_OLDEST,
- MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ,
- MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA,
- MODEST_HILDON_SORT_DIALOG_ATTACHMENT,
- MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST,
- MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST,
- MODEST_HILDON_SORT_DIALOG_PRIORITY,
- MODEST_HILDON_SORT_DIALOG_NUM_SORT_CRITERIUM
-};
-
-enum {
- NAME_COLUMN,
- ID_COLUMN,
- NUM_COLUMS
-};
-
-static void
-modest_hildon_sort_dialog_finalize (GObject *object)
-{
- G_OBJECT_CLASS (modest_hildon_sort_dialog_parent_class)->finalize (object);
-}
-
-static void
-modest_hildon_sort_dialog_class_init (ModestHildonSortDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = modest_hildon_sort_dialog_finalize;
-
- g_type_class_add_private (object_class, sizeof(ModestHildonSortDialogClass));
-}
-
-static void
-modest_hildon_sort_dialog_init (ModestHildonSortDialog *self)
-{
- ModestHildonSortDialogPrivate *priv;
-
- priv = MODEST_HILDON_SORT_DIALOG_GET_PRIVATE(self);
- priv->id = 0;
- priv->sort_type = GTK_SORT_ASCENDING;
-}
-
-static gint
-modest_hildon_sort_dialog_add_sort_key (ModestSortCriteriumView *self, const gchar *sort_key)
-{
- ModestHildonSortDialogPrivate *priv;
-
- priv = MODEST_HILDON_SORT_DIALOG_GET_PRIVATE(self);
-
- /* We return a different ID each time, it does not really
- matter which one we return, we just want them to be
- different */
- return priv->id++;
-}
-
-static void
-modest_hildon_sort_dialog_set_sort_key (ModestSortCriteriumView *self, gint key)
-{
- HildonTouchSelector *selector;
- ModestHildonSortDialogPrivate *priv;
- gint active;
-
- g_return_if_fail (MODEST_IS_HILDON_SORT_DIALOG (self));
-
- priv = MODEST_HILDON_SORT_DIALOG_GET_PRIVATE(self);
- selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
-
- /* Map to our selector */
- switch (key) {
- case 0:
- if (priv->sort_type == GTK_SORT_ASCENDING)
- active = MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ;
- else
- active = MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA;
- break;
- case 1:
- if (priv->sort_type == GTK_SORT_ASCENDING)
- active = MODEST_HILDON_SORT_DIALOG_DATE_OLDEST;
- else
- active = MODEST_HILDON_SORT_DIALOG_DATE_NEWEST;
- break;
- case 2:
- if (priv->sort_type == GTK_SORT_ASCENDING)
- active = MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ;
- else
- active = MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA;
- break;
- case 3:
- active = MODEST_HILDON_SORT_DIALOG_ATTACHMENT;
- break;
- case 4:
- if (priv->sort_type == GTK_SORT_ASCENDING)
- active = MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST;
- else
- active = MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST;
- break;
- case 5:
- active = MODEST_HILDON_SORT_DIALOG_PRIORITY;
- break;
- default:
- g_warning ("%s, no valid key found... falling back to default (0)", __FUNCTION__);
- active = 0;
- }
- hildon_touch_selector_set_active (selector, 0, active);
-}
-
-static void
-modest_hildon_sort_dialog_set_sort_order (ModestSortCriteriumView *self,
- GtkSortType sort_type)
-{
- HildonTouchSelector *selector;
- gint active, new;
- ModestHildonSortDialogPrivate *priv;
-
- g_return_if_fail (MODEST_IS_HILDON_SORT_DIALOG (self));
-
- priv = MODEST_HILDON_SORT_DIALOG_GET_PRIVATE(self);
- selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
- active = hildon_touch_selector_get_active (selector, 0);
-
- /* Map to our selector, we need to check the current selected
- key because this way we allow to select the order first and
- then the key */
- switch (active) {
- case MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ:
- case MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA:
- if (sort_type == GTK_SORT_ASCENDING)
- new = MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA;
- else
- new = MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ;
- break;
- case MODEST_HILDON_SORT_DIALOG_DATE_NEWEST:
- case MODEST_HILDON_SORT_DIALOG_DATE_OLDEST:
- if (sort_type == GTK_SORT_ASCENDING)
- new = MODEST_HILDON_SORT_DIALOG_DATE_NEWEST;
- else
- new = MODEST_HILDON_SORT_DIALOG_DATE_OLDEST;
- break;
- case MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ:
- case MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA:
- if (sort_type == GTK_SORT_ASCENDING)
- new = MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA;
- else
- new = MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ;
- break;
- case MODEST_HILDON_SORT_DIALOG_ATTACHMENT:
- new = MODEST_HILDON_SORT_DIALOG_ATTACHMENT;
- break;
- case MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST:
- case MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST:
- if (sort_type == GTK_SORT_ASCENDING)
- new = MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST;
- else
- new = MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST;
- break;
- case MODEST_HILDON_SORT_DIALOG_PRIORITY:
- new = MODEST_HILDON_SORT_DIALOG_PRIORITY;
- break;
- default:
- g_warning ("%s, no valid key found... falling back to current (%d)", __FUNCTION__, active);
- new = active;
- }
-
- /* Activate the proper index */
- hildon_touch_selector_set_active (selector, 0, new);
- priv->sort_type = sort_type;
-}
-
-static gint
-modest_hildon_sort_dialog_get_sort_key (ModestSortCriteriumView *self)
-{
- HildonTouchSelector *selector;
- gint active;
-
- g_return_val_if_fail (MODEST_IS_HILDON_SORT_DIALOG (self), 0);
-
- selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
- active = hildon_touch_selector_get_active (selector, 0);
-
- switch (active) {
- case MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ:
- case MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA:
- return 0;
- case MODEST_HILDON_SORT_DIALOG_DATE_NEWEST:
- case MODEST_HILDON_SORT_DIALOG_DATE_OLDEST:
- return 1;
- case MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ:
- case MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA:
- return 2;
- case MODEST_HILDON_SORT_DIALOG_ATTACHMENT:
- return 3;
- case MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST:
- case MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST:
- return 4;
- case MODEST_HILDON_SORT_DIALOG_PRIORITY:
- return 5;
- default:
- /* Default is order by ascending date */
- g_return_val_if_reached (1);
- return 1;
- }
-}
-
-static GtkSortType
-modest_hildon_sort_dialog_get_sort_order (ModestSortCriteriumView *self)
-{
- HildonTouchSelector *selector;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gint id;
-
- g_return_val_if_fail (MODEST_IS_HILDON_SORT_DIALOG (self), GTK_SORT_ASCENDING);
-
- selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
- hildon_touch_selector_get_selected (selector, 0, &iter);
-
- model = hildon_touch_selector_get_model (selector, 0);
- gtk_tree_model_get (model, &iter, ID_COLUMN, &id, -1);
-
- switch (id) {
- case MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ:
- case MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ:
- case MODEST_HILDON_SORT_DIALOG_DATE_OLDEST:
- case MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST:
- return GTK_SORT_ASCENDING;
- case MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA:
- case MODEST_HILDON_SORT_DIALOG_DATE_NEWEST:
- case MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA:
- case MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST:
- case MODEST_HILDON_SORT_DIALOG_ATTACHMENT:
- case MODEST_HILDON_SORT_DIALOG_PRIORITY:
- return GTK_SORT_DESCENDING;
- default:
- /* Default is order by ascending date */
- g_return_val_if_reached (GTK_SORT_ASCENDING);
- return GTK_SORT_ASCENDING;
- }
-}
-
-static void
-modest_sort_criterium_view_init (gpointer g_iface,
- gpointer iface_data)
-{
- ModestSortCriteriumViewIface *iface = (ModestSortCriteriumViewIface *) g_iface;
-
- iface->add_sort_key_func = modest_hildon_sort_dialog_add_sort_key;
- iface->get_sort_key_func = modest_hildon_sort_dialog_get_sort_key;
- iface->set_sort_key_func = modest_hildon_sort_dialog_set_sort_key;
- iface->get_sort_order_func = modest_hildon_sort_dialog_get_sort_order;
- iface->set_sort_order_func = modest_hildon_sort_dialog_set_sort_order;
-}
-
-static void
-modest_hildon_sort_dialog_fill (ModestHildonSortDialog *self)
-{
- GtkListStore *names_list;
- GtkWidget *selector;
- GtkTreeIter iter;
- HildonTouchSelectorColumn *column;
-
- /* Fill in model */
- names_list = gtk_list_store_new (NUM_COLUMS, G_TYPE_STRING, G_TYPE_INT);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_sender_recipient_az"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_RECIPIENT_AZ, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_sender_recipient_za"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_RECIPIENT_ZA, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_date_newest"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_DATE_NEWEST, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_date_oldest"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_DATE_OLDEST, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_subject_az"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_SUBJECT_AZ, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_subject_za"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_SUBJECT_ZA, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_attachment"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_ATTACHMENT, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_size_largest"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_SIZE_LARGEST, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_size_smallest"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_SIZE_SMALLEST, -1);
- gtk_list_store_append (names_list, &iter);
- gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_priority"),
- ID_COLUMN, MODEST_HILDON_SORT_DIALOG_PRIORITY, -1);
-
- /* Add columns */
- selector = hildon_touch_selector_new ();
- column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
- GTK_TREE_MODEL (names_list), TRUE);
- g_object_set (G_OBJECT (column), "text-column", NAME_COLUMN, NULL);
-
- /* Set the selector */
- hildon_picker_dialog_set_selector (HILDON_PICKER_DIALOG (self), HILDON_TOUCH_SELECTOR (selector));
-}
-
-GtkWidget*
-modest_hildon_sort_dialog_new (GtkWindow *parent)
-{
- GtkWidget *result = g_object_new (MODEST_TYPE_HILDON_SORT_DIALOG, NULL);
-
- modest_hildon_sort_dialog_fill (MODEST_HILDON_SORT_DIALOG (result));
-
- if (parent)
- gtk_window_set_transient_for(GTK_WINDOW(result), parent);
-
- /* Set title */
- gtk_window_set_title (GTK_WINDOW (result), _CS("ckdg_ti_sort"));
-
- return result;
-}
+++ /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.
- */
-
-#ifndef __MODEST_HILDON_SORT_DIALOG
-#define __MODEST_HILDON_SORT_DIALOG
-
-#include <glib.h>
-#include <hildon/hildon-picker-dialog.h>
-#include <widgets/modest-sort-criterium-view.h>
-
-G_BEGIN_DECLS
-
-#define MODEST_TYPE_HILDON_SORT_DIALOG modest_hildon_sort_dialog_get_type()
-
-#define MODEST_HILDON_SORT_DIALOG(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MODEST_TYPE_HILDON_SORT_DIALOG, ModestHildonSortDialog))
-
-#define MODEST_HILDON_SORT_DIALOG_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MODEST_TYPE_HILDON_SORT_DIALOG, ModestHildonSortDialogClass))
-
-#define MODEST_IS_HILDON_SORT_DIALOG(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MODEST_TYPE_HILDON_SORT_DIALOG))
-
-#define MODEST_IS_HILDON_SORT_DIALOG_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MODEST_TYPE_HILDON_SORT_DIALOG))
-
-#define MODEST_HILDON_SORT_DIALOG_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MODEST_TYPE_HILDON_SORT_DIALOG, ModestHildonSortDialogClass))
-
-typedef struct {
- HildonPickerDialog parent;
-
-} ModestHildonSortDialog;
-
-typedef struct {
- HildonPickerDialogClass parent_class;
-
-} ModestHildonSortDialogClass;
-
-GType modest_hildon_sort_dialog_get_type (void);
-
-GtkWidget* modest_hildon_sort_dialog_new (GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* __MODEST_HILDON_SORT_DIALOG */
--- /dev/null
+/* Copyright (c) 2008, 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 "modest-details-dialog.h"
+
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtktable.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtklabel.h>
+#include <tny-msg.h>
+#include <tny-header.h>
+#include <tny-header-view.h>
+#include <tny-folder-store.h>
+#include <modest-tny-folder.h>
+#include <modest-tny-account.h>
+#include <modest-text-utils.h>
+#include "modest-hildon2-details-dialog.h"
+#include <hildon/hildon-pannable-area.h>
+
+static void modest_hildon2_details_dialog_create_container_default (ModestDetailsDialog *self);
+
+
+G_DEFINE_TYPE (ModestHildon2DetailsDialog,
+ modest_hildon2_details_dialog,
+ MODEST_TYPE_DETAILS_DIALOG);
+
+#define MODEST_HILDON2_DETAILS_DIALOG_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_DETAILS_DIALOG, ModestHildon2DetailsDialogPrivate))
+
+
+typedef struct _ModestHildon2DetailsDialogPrivate ModestHildon2DetailsDialogPrivate;
+
+struct _ModestHildon2DetailsDialogPrivate
+{
+ GtkWidget *props_table;
+};
+
+static void
+modest_hildon2_details_dialog_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (modest_hildon2_details_dialog_parent_class)->finalize (object);
+}
+
+static void
+modest_hildon2_details_dialog_class_init (ModestHildon2DetailsDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ModestHildon2DetailsDialogPrivate));
+ object_class->finalize = modest_hildon2_details_dialog_finalize;
+
+ MODEST_DETAILS_DIALOG_CLASS (klass)->create_container_func =
+ modest_hildon2_details_dialog_create_container_default;
+}
+
+static void
+modest_hildon2_details_dialog_init (ModestHildon2DetailsDialog *self)
+{
+}
+
+GtkWidget*
+modest_hildon2_details_dialog_new_with_header (GtkWindow *parent,
+ TnyHeader *header)
+{
+ ModestDetailsDialog *dialog;
+
+ g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
+ g_return_val_if_fail (TNY_IS_HEADER (header), NULL);
+
+ dialog = (ModestDetailsDialog *) (g_object_new (MODEST_TYPE_HILDON2_DETAILS_DIALOG,
+ "transient-for", parent,
+ NULL));
+
+ MODEST_DETAILS_DIALOG_GET_CLASS (dialog)->set_header_func (dialog, header);
+
+ return GTK_WIDGET (dialog);
+}
+
+GtkWidget*
+modest_hildon2_details_dialog_new_with_folder (GtkWindow *parent,
+ TnyFolder *folder)
+{
+ ModestDetailsDialog *dialog;
+
+ g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
+ g_return_val_if_fail (TNY_IS_FOLDER (folder), NULL);
+
+ dialog = (ModestDetailsDialog *) (g_object_new (MODEST_TYPE_HILDON2_DETAILS_DIALOG,
+ "transient-for", parent,
+ NULL));
+
+ MODEST_DETAILS_DIALOG_GET_CLASS (dialog)->set_folder_func (dialog, folder);
+
+ return GTK_WIDGET (dialog);
+}
+
+
+static void
+modest_hildon2_details_dialog_create_container_default (ModestDetailsDialog *self)
+{
+ ModestHildon2DetailsDialogPrivate *priv;
+ GtkWidget *pannable;
+
+ priv = MODEST_HILDON2_DETAILS_DIALOG_GET_PRIVATE (self);
+
+ gtk_window_set_default_size (GTK_WINDOW (self), 400, 220);
+
+ priv->props_table = gtk_table_new (0, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (priv->props_table), 12);
+ gtk_table_set_row_spacings (GTK_TABLE (priv->props_table), 1);
+
+ pannable = g_object_new (HILDON_TYPE_PANNABLE_AREA, "initial-hint", TRUE, NULL);
+ hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (pannable),
+ GTK_WIDGET (priv->props_table));
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), pannable);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+}
--- /dev/null
+/* Copyright (c) 2008, 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.
+ */
+
+#ifndef __MODEST_HILDON2_DETAILS_DIALOG
+#define __MODEST_HILDON2_DETAILS_DIALOG
+
+#include <glib.h>
+#include <gtk/gtkdialog.h>
+#include <tny-header.h>
+#include "widgets/modest-details-dialog.h"
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_HILDON2_DETAILS_DIALOG modest_hildon2_details_dialog_get_type()
+
+#define MODEST_HILDON2_DETAILS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MODEST_TYPE_HILDON2_DETAILS_DIALOG, ModestHildon2DetailsDialog))
+
+#define MODEST_HILDON2_DETAILS_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MODEST_TYPE_HILDON2_DETAILS_DIALOG, ModestHildon2DetailsDialogClass))
+
+#define MODEST_IS_HILDON2_DETAILS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MODEST_TYPE_HILDON2_DETAILS_DIALOG))
+
+#define MODEST_IS_HILDON2_DETAILS_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MODEST_TYPE_HILDON2_DETAILS_DIALOG))
+
+#define MODEST_HILDON2_DETAILS_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MODEST_TYPE_HILDON2_DETAILS_DIALOG, ModestHildon2DetailsDialogClass))
+
+typedef struct {
+ ModestDetailsDialog parent;
+
+} ModestHildon2DetailsDialog;
+
+typedef struct {
+ ModestDetailsDialogClass parent_class;
+
+} ModestHildon2DetailsDialogClass;
+
+GType modest_hildon2_details_dialog_get_type (void);
+
+GtkWidget* modest_hildon2_details_dialog_new_with_header (GtkWindow *parent,
+ TnyHeader *header);
+
+GtkWidget* modest_hildon2_details_dialog_new_with_folder (GtkWindow *parent,
+ TnyFolder *folder);
+
+G_END_DECLS
+
+#endif /* __MODEST_HILDON2_DETAILS_DIALOG */
--- /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 "modest-defs.h"
+#include "modest-text-utils.h"
+#include "modest-hildon2-sort-dialog.h"
+#include "widgets/modest-sort-criterium-view.h"
+
+
+static gint modest_hildon2_sort_dialog_add_sort_key (ModestSortCriteriumView *self, const gchar *sort_key);
+static void modest_hildon2_sort_dialog_set_sort_key (ModestSortCriteriumView *self, gint key);
+static void modest_hildon2_sort_dialog_set_sort_order (ModestSortCriteriumView *self, GtkSortType sort_type);
+static gint modest_hildon2_sort_dialog_get_sort_key (ModestSortCriteriumView *self);
+static GtkSortType modest_hildon2_sort_dialog_get_sort_order (ModestSortCriteriumView *self);
+static void modest_sort_criterium_view_init (gpointer g_iface, gpointer iface_data);
+
+G_DEFINE_TYPE_EXTENDED (ModestHildon2SortDialog,
+ modest_hildon2_sort_dialog,
+ HILDON_TYPE_PICKER_DIALOG,
+ 0,
+ G_IMPLEMENT_INTERFACE (MODEST_TYPE_SORT_CRITERIUM_VIEW, modest_sort_criterium_view_init));
+
+typedef struct _ModestHildon2SortDialogPrivate ModestHildon2SortDialogPrivate;
+struct _ModestHildon2SortDialogPrivate {
+ gint id;
+ GtkSortType sort_type;
+};
+
+#define MODEST_HILDON2_SORT_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
+ MODEST_TYPE_HILDON2_SORT_DIALOG, \
+ ModestHildon2SortDialogPrivate))
+
+enum {
+ MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ,
+ MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA,
+ MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST,
+ MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST,
+ MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ,
+ MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA,
+ MODEST_HILDON2_SORT_DIALOG_ATTACHMENT,
+ MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST,
+ MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST,
+ MODEST_HILDON2_SORT_DIALOG_PRIORITY,
+ MODEST_HILDON2_SORT_DIALOG_NUM_SORT_CRITERIUM
+};
+
+enum {
+ NAME_COLUMN,
+ ID_COLUMN,
+ NUM_COLUMS
+};
+
+static void
+modest_hildon2_sort_dialog_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (modest_hildon2_sort_dialog_parent_class)->finalize (object);
+}
+
+static void
+modest_hildon2_sort_dialog_class_init (ModestHildon2SortDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = modest_hildon2_sort_dialog_finalize;
+
+ g_type_class_add_private (object_class, sizeof(ModestHildon2SortDialogClass));
+}
+
+static void
+modest_hildon2_sort_dialog_init (ModestHildon2SortDialog *self)
+{
+ ModestHildon2SortDialogPrivate *priv;
+
+ priv = MODEST_HILDON2_SORT_DIALOG_GET_PRIVATE(self);
+ priv->id = 0;
+ priv->sort_type = GTK_SORT_ASCENDING;
+}
+
+static gint
+modest_hildon2_sort_dialog_add_sort_key (ModestSortCriteriumView *self, const gchar *sort_key)
+{
+ ModestHildon2SortDialogPrivate *priv;
+
+ priv = MODEST_HILDON2_SORT_DIALOG_GET_PRIVATE(self);
+
+ /* We return a different ID each time, it does not really
+ matter which one we return, we just want them to be
+ different */
+ return priv->id++;
+}
+
+static void
+modest_hildon2_sort_dialog_set_sort_key (ModestSortCriteriumView *self, gint key)
+{
+ HildonTouchSelector *selector;
+ ModestHildon2SortDialogPrivate *priv;
+ gint active;
+
+ g_return_if_fail (MODEST_IS_HILDON2_SORT_DIALOG (self));
+
+ priv = MODEST_HILDON2_SORT_DIALOG_GET_PRIVATE(self);
+ selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
+
+ /* Map to our selector */
+ switch (key) {
+ case 0:
+ if (priv->sort_type == GTK_SORT_ASCENDING)
+ active = MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ;
+ else
+ active = MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA;
+ break;
+ case 1:
+ if (priv->sort_type == GTK_SORT_ASCENDING)
+ active = MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST;
+ else
+ active = MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST;
+ break;
+ case 2:
+ if (priv->sort_type == GTK_SORT_ASCENDING)
+ active = MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ;
+ else
+ active = MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA;
+ break;
+ case 3:
+ active = MODEST_HILDON2_SORT_DIALOG_ATTACHMENT;
+ break;
+ case 4:
+ if (priv->sort_type == GTK_SORT_ASCENDING)
+ active = MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST;
+ else
+ active = MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST;
+ break;
+ case 5:
+ active = MODEST_HILDON2_SORT_DIALOG_PRIORITY;
+ break;
+ default:
+ g_warning ("%s, no valid key found... falling back to default (0)", __FUNCTION__);
+ active = 0;
+ }
+ hildon_touch_selector_set_active (selector, 0, active);
+}
+
+static void
+modest_hildon2_sort_dialog_set_sort_order (ModestSortCriteriumView *self,
+ GtkSortType sort_type)
+{
+ HildonTouchSelector *selector;
+ gint active, new;
+ ModestHildon2SortDialogPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_HILDON2_SORT_DIALOG (self));
+
+ priv = MODEST_HILDON2_SORT_DIALOG_GET_PRIVATE(self);
+ selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
+ active = hildon_touch_selector_get_active (selector, 0);
+
+ /* Map to our selector, we need to check the current selected
+ key because this way we allow to select the order first and
+ then the key */
+ switch (active) {
+ case MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ:
+ case MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA:
+ if (sort_type == GTK_SORT_ASCENDING)
+ new = MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA;
+ else
+ new = MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ;
+ break;
+ case MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST:
+ case MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST:
+ if (sort_type == GTK_SORT_ASCENDING)
+ new = MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST;
+ else
+ new = MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST;
+ break;
+ case MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ:
+ case MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA:
+ if (sort_type == GTK_SORT_ASCENDING)
+ new = MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA;
+ else
+ new = MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ;
+ break;
+ case MODEST_HILDON2_SORT_DIALOG_ATTACHMENT:
+ new = MODEST_HILDON2_SORT_DIALOG_ATTACHMENT;
+ break;
+ case MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST:
+ case MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST:
+ if (sort_type == GTK_SORT_ASCENDING)
+ new = MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST;
+ else
+ new = MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST;
+ break;
+ case MODEST_HILDON2_SORT_DIALOG_PRIORITY:
+ new = MODEST_HILDON2_SORT_DIALOG_PRIORITY;
+ break;
+ default:
+ g_warning ("%s, no valid key found... falling back to current (%d)", __FUNCTION__, active);
+ new = active;
+ }
+
+ /* Activate the proper index */
+ hildon_touch_selector_set_active (selector, 0, new);
+ priv->sort_type = sort_type;
+}
+
+static gint
+modest_hildon2_sort_dialog_get_sort_key (ModestSortCriteriumView *self)
+{
+ HildonTouchSelector *selector;
+ gint active;
+
+ g_return_val_if_fail (MODEST_IS_HILDON2_SORT_DIALOG (self), 0);
+
+ selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
+ active = hildon_touch_selector_get_active (selector, 0);
+
+ switch (active) {
+ case MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ:
+ case MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA:
+ return 0;
+ case MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST:
+ case MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST:
+ return 1;
+ case MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ:
+ case MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA:
+ return 2;
+ case MODEST_HILDON2_SORT_DIALOG_ATTACHMENT:
+ return 3;
+ case MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST:
+ case MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST:
+ return 4;
+ case MODEST_HILDON2_SORT_DIALOG_PRIORITY:
+ return 5;
+ default:
+ /* Default is order by ascending date */
+ g_return_val_if_reached (1);
+ return 1;
+ }
+}
+
+static GtkSortType
+modest_hildon2_sort_dialog_get_sort_order (ModestSortCriteriumView *self)
+{
+ HildonTouchSelector *selector;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint id;
+
+ g_return_val_if_fail (MODEST_IS_HILDON2_SORT_DIALOG (self), GTK_SORT_ASCENDING);
+
+ selector = hildon_picker_dialog_get_selector (HILDON_PICKER_DIALOG (self));
+ hildon_touch_selector_get_selected (selector, 0, &iter);
+
+ model = hildon_touch_selector_get_model (selector, 0);
+ gtk_tree_model_get (model, &iter, ID_COLUMN, &id, -1);
+
+ switch (id) {
+ case MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ:
+ case MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ:
+ case MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST:
+ case MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST:
+ return GTK_SORT_ASCENDING;
+ case MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA:
+ case MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST:
+ case MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA:
+ case MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST:
+ case MODEST_HILDON2_SORT_DIALOG_ATTACHMENT:
+ case MODEST_HILDON2_SORT_DIALOG_PRIORITY:
+ return GTK_SORT_DESCENDING;
+ default:
+ /* Default is order by ascending date */
+ g_return_val_if_reached (GTK_SORT_ASCENDING);
+ return GTK_SORT_ASCENDING;
+ }
+}
+
+static void
+modest_sort_criterium_view_init (gpointer g_iface,
+ gpointer iface_data)
+{
+ ModestSortCriteriumViewIface *iface = (ModestSortCriteriumViewIface *) g_iface;
+
+ iface->add_sort_key_func = modest_hildon2_sort_dialog_add_sort_key;
+ iface->get_sort_key_func = modest_hildon2_sort_dialog_get_sort_key;
+ iface->set_sort_key_func = modest_hildon2_sort_dialog_set_sort_key;
+ iface->get_sort_order_func = modest_hildon2_sort_dialog_get_sort_order;
+ iface->set_sort_order_func = modest_hildon2_sort_dialog_set_sort_order;
+}
+
+static void
+modest_hildon2_sort_dialog_fill (ModestHildon2SortDialog *self)
+{
+ GtkListStore *names_list;
+ GtkWidget *selector;
+ GtkTreeIter iter;
+ HildonTouchSelectorColumn *column;
+
+ /* Fill in model */
+ names_list = gtk_list_store_new (NUM_COLUMS, G_TYPE_STRING, G_TYPE_INT);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_sender_recipient_az"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_RECIPIENT_AZ, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_sender_recipient_za"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_RECIPIENT_ZA, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_date_newest"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_DATE_NEWEST, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_date_oldest"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_DATE_OLDEST, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_subject_az"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_SUBJECT_AZ, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_subject_za"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_SUBJECT_ZA, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_attachment"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_ATTACHMENT, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_size_largest"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_SIZE_LARGEST, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_size_smallest"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_SIZE_SMALLEST, -1);
+ gtk_list_store_append (names_list, &iter);
+ gtk_list_store_set (names_list, &iter, NAME_COLUMN, _("mcen_li_sort_priority"),
+ ID_COLUMN, MODEST_HILDON2_SORT_DIALOG_PRIORITY, -1);
+
+ /* Add columns */
+ selector = hildon_touch_selector_new ();
+ column = hildon_touch_selector_append_text_column (HILDON_TOUCH_SELECTOR (selector),
+ GTK_TREE_MODEL (names_list), TRUE);
+ g_object_set (G_OBJECT (column), "text-column", NAME_COLUMN, NULL);
+
+ /* Set the selector */
+ hildon_picker_dialog_set_selector (HILDON_PICKER_DIALOG (self), HILDON_TOUCH_SELECTOR (selector));
+}
+
+GtkWidget*
+modest_hildon2_sort_dialog_new (GtkWindow *parent)
+{
+ GtkWidget *result = g_object_new (MODEST_TYPE_HILDON2_SORT_DIALOG, NULL);
+
+ modest_hildon2_sort_dialog_fill (MODEST_HILDON2_SORT_DIALOG (result));
+
+ if (parent)
+ gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
+ /* Set title */
+ gtk_window_set_title (GTK_WINDOW (result), _CS("ckdg_ti_sort"));
+
+ return result;
+}
--- /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.
+ */
+
+#ifndef __MODEST_HILDON2_SORT_DIALOG
+#define __MODEST_HILDON2_SORT_DIALOG
+
+#include <glib.h>
+#include <hildon/hildon-picker-dialog.h>
+#include <widgets/modest-sort-criterium-view.h>
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_HILDON2_SORT_DIALOG modest_hildon2_sort_dialog_get_type()
+
+#define MODEST_HILDON2_SORT_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MODEST_TYPE_HILDON2_SORT_DIALOG, ModestHildon2SortDialog))
+
+#define MODEST_HILDON2_SORT_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MODEST_TYPE_HILDON2_SORT_DIALOG, ModestHildon2SortDialogClass))
+
+#define MODEST_IS_HILDON2_SORT_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MODEST_TYPE_HILDON2_SORT_DIALOG))
+
+#define MODEST_IS_HILDON2_SORT_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MODEST_TYPE_HILDON2_SORT_DIALOG))
+
+#define MODEST_HILDON2_SORT_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MODEST_TYPE_HILDON2_SORT_DIALOG, ModestHildon2SortDialogClass))
+
+typedef struct {
+ HildonPickerDialog parent;
+
+} ModestHildon2SortDialog;
+
+typedef struct {
+ HildonPickerDialogClass parent_class;
+
+} ModestHildon2SortDialogClass;
+
+GType modest_hildon2_sort_dialog_get_type (void);
+
+GtkWidget* modest_hildon2_sort_dialog_new (GtkWindow *parent);
+
+G_END_DECLS
+
+#endif /* __MODEST_HILDON2_SORT_DIALOG */
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include <modest-account-settings-dialog.h>
#include <modest-easysetup-wizard-dialog.h>
-#include "modest-hildon-sort-dialog.h"
+#include "modest-hildon2-sort-dialog.h"
#include <hildon/hildon-sound.h>
#include <osso-mem.h>
+#include "hildon2/modest-hildon2-details-dialog.h"
#ifdef MODEST_HAVE_MCE
#include <mce/dbus-names.h>
{
GtkWidget *dialog;
- dialog = modest_hildon_sort_dialog_new (parent_window);
+ dialog = modest_hildon2_sort_dialog_new (parent_window);
hildon_help_dialog_help_enable (GTK_DIALOG(dialog),
"applications_email_sort",
return lowmem;
}
+
+void
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_hildon2_details_dialog_new_with_folder (parent_window, folder);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+void
+modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_hildon2_details_dialog_new_with_header (parent_window, header);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
#include "modest-hildon-sort-dialog.h"
#include <hildon/hildon-sound.h>
#include <osso-mem.h>
+#include "widgets/modest-details-dialog.h"
#ifdef MODEST_HAVE_MCE
#include <mce/dbus-names.h>
return retval;
}
-
-
gboolean
modest_platform_check_memory_low (ModestWindow *win,
gboolean visuals)
return lowmem;
}
+
+void
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_details_dialog_new_with_folder (parent_window, folder);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+void
+modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_details_dialog_new_with_header (parent_window, header);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
gboolean visuals);
+/**
+ * modest_platform_run_folder_details_dialog:
+ * @parent_window: the parent #GtkWindow for the new dialog
+ * @folder: the #TnyFolder whose details will be shown
+ *
+ * Shows the folder details dialog
+ **/
+void modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder);
+
+/**
+ * modest_platform_run_header_details_dialog:
+ * @parent_window: the parent #GtkWindow for the new dialog
+ * @header: the #TnyHeader whose details will be shown
+ *
+ * Shows the header details dialog
+ **/
+void modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header);
+
+
G_END_DECLS
#endif /* __MODEST_PLATFORM_UTILS_H__ */
gpointer user_data)
{
- GtkWidget *dialog;
-
- /* Create dialog */
- dialog = modest_details_dialog_new_with_header (GTK_WINDOW (window), header);
-
- /* Run dialog */
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), (GtkWindow *) window);
- gtk_widget_show_all (dialog);
-
- g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-}
-
-/*
- * Show the folder details in a ModestDetailsDialog widget
- */
-static void
-show_folder_details (TnyFolder *folder,
- GtkWindow *window)
-{
- GtkWidget *dialog;
-
- /* Create dialog */
- dialog = modest_details_dialog_new_with_folder (window, folder);
-
- /* Run dialog */
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_widget_show_all (dialog);
- gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
+ modest_platform_run_header_details_dialog (GTK_WINDOW (window), header);
}
/*
/* This function should not be called for account items,
* because we dim the menu item for them. */
if (TNY_IS_FOLDER (folder_store)) {
- show_folder_details (TNY_FOLDER (folder_store), GTK_WINDOW (win));
+ modest_platform_run_folder_details_dialog (GTK_WINDOW (win),
+ TNY_FOLDER (folder_store));
}
g_object_unref (folder_store);
MODEST_DETAILS_DIALOG_GET_CLASS (dialog)->set_header_func (dialog, header);
+ /* Add close button */
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_close"), GTK_RESPONSE_CLOSE);
+
return GTK_WIDGET (dialog);
}
MODEST_DETAILS_DIALOG_GET_CLASS (dialog)->set_folder_func (dialog, folder);
+ /* Add close button */
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_close"), GTK_RESPONSE_CLOSE);
+
return GTK_WIDGET (dialog);
}
#define DATE_TIME_BUFFER_SIZE 128
gchar date_time_buffer [DATE_TIME_BUFFER_SIZE];
- /* Set window title & Add close button */
+ /* Set window title */
gtk_window_set_title (GTK_WINDOW (self), _("mcen_ti_message_properties"));
- gtk_dialog_add_button (GTK_DIALOG (self), _("mcen_bd_close"), GTK_RESPONSE_CLOSE);
folder = tny_header_get_folder (header);
folder_type = modest_tny_folder_guess_folder_type (folder);
/* Set window title */
gtk_window_set_title (GTK_WINDOW (self), _("mcen_ti_folder_properties"));
- gtk_dialog_add_button (GTK_DIALOG (self), _("mcen_bd_close"), GTK_RESPONSE_CLOSE);
/* Get data. We use our function because it's recursive */
count = tny_folder_get_all_count (TNY_FOLDER (folder));