* all:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Tue, 6 Feb 2007 16:13:42 +0000 (16:13 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Tue, 6 Feb 2007 16:13:42 +0000 (16:13 +0000)
  - beginnings of the msg-view-window

pmo-trunk-r792

src/gtk/Makefile.am
src/gtk/modest-msg-view-window.c [new file with mode: 0644]
src/gtk/ui/modest-msg-view-window-ui.xml [new file with mode: 0644]
src/modest-ui.c
src/widgets/Makefile.am
src/widgets/modest-msg-view-window.h [new file with mode: 0644]
src/widgets/modest-msg-view.h

index 1348e0e..3ec1471 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile.am
-# Time-stamp: <2007-01-09 17:04:51 (djcb)>
+# Time-stamp: <2007-02-06 17:27:20 (djcb)>
 #
 #
 # use Automake 'trick' ==> convenience static libraries, which
@@ -33,6 +33,8 @@ libmodest_ui_la_SOURCES=              \
        modest-icon-names.h           \
        modest-main-window.c          \
        modest-main-window-ui.h       \
+       modest-msg-view-window.c      \
+       modest-msg-view-window.h      \
        modest-store-widget.c         \
        modest-store-widget.h         \
        modest-transport-widget.c     \
@@ -47,7 +49,9 @@ pixmap_DATA = $(PIXMAP_FILES)
 
 UI_FILES=\
        ui/modest-ui.xml \
-       ui/modest-edit-msg-window-ui.xml
+       ui/modest-edit-msg-window-ui.xml \
+       ui/modest-msg-view-window-ui.xml 
+
 
 uidir = $(datadir)/modest/ui
 ui_DATA = $(UI_FILES)
diff --git a/src/gtk/modest-msg-view-window.c b/src/gtk/modest-msg-view-window.c
new file mode 100644 (file)
index 0000000..e80f700
--- /dev/null
@@ -0,0 +1,226 @@
+/* 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/gi18n.h>
+#include <string.h>
+#include <tny-account-store.h>
+#include <tny-simple-list.h>
+#include <modest-tny-msg.h>
+#include <modest-msg-view-window.h>
+#include <modest-main-window-ui.h>
+#include <modest-widget-memory.h>
+#include <modest-runtime.h>
+#include <modest-window-priv.h>
+
+static void  modest_msg_view_window_class_init   (ModestMsgViewWindowClass *klass);
+static void  modest_msg_view_window_init         (ModestMsgViewWindow *obj);
+static void  modest_msg_view_window_finalize     (GObject *obj);
+
+/* list my signals */
+enum {
+       /* MY_SIGNAL_1, */
+       /* MY_SIGNAL_2, */
+       LAST_SIGNAL
+};
+
+typedef struct _ModestMsgViewWindowPrivate ModestMsgViewWindowPrivate;
+struct _ModestMsgViewWindowPrivate {
+
+       GtkWidget   *toolbar;
+       GtkWidget   *menubar;
+       GtkWidget   *msg_view;
+};
+
+#define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
+                                                    MODEST_TYPE_MSG_VIEW_WINDOW, \
+                                                    ModestMsgViewWindowPrivate))
+/* globals */
+static GtkWindowClass *parent_class = NULL;
+
+/* uncomment the following if you have defined any signals */
+/* static guint signals[LAST_SIGNAL] = {0}; */
+
+GType
+modest_msg_view_window_get_type (void)
+{
+       static GType my_type = 0;
+       if (!my_type) {
+               static const GTypeInfo my_info = {
+                       sizeof(ModestMsgViewWindowClass),
+                       NULL,           /* base init */
+                       NULL,           /* base finalize */
+                       (GClassInitFunc) modest_msg_view_window_class_init,
+                       NULL,           /* class finalize */
+                       NULL,           /* class data */
+                       sizeof(ModestMsgViewWindow),
+                       1,              /* n_preallocs */
+                       (GInstanceInitFunc) modest_msg_view_window_init,
+                       NULL
+               };
+               my_type = g_type_register_static (MODEST_TYPE_WINDOW,
+                                                 "ModestMsgViewWindow",
+                                                 &my_info, 0);
+       }
+       return my_type;
+}
+
+static void
+modest_msg_view_window_class_init (ModestMsgViewWindowClass *klass)
+{
+       GObjectClass *gobject_class;
+       gobject_class = (GObjectClass*) klass;
+
+       parent_class            = g_type_class_peek_parent (klass);
+       gobject_class->finalize = modest_msg_view_window_finalize;
+
+       g_type_class_add_private (gobject_class, sizeof(ModestMsgViewWindowPrivate));
+}
+
+static void
+modest_msg_view_window_init (ModestMsgViewWindow *obj)
+{
+       ModestMsgViewWindowPrivate *priv;
+       priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
+
+       priv->toolbar       = NULL;
+       priv->menubar       = NULL;
+       priv->msg_view      = NULL;
+}
+
+static void
+save_settings (ModestMsgViewWindow *self)
+{
+       modest_widget_memory_save (modest_runtime_get_conf (),
+                                   G_OBJECT(self), "modest-msg-view-window");
+}
+
+
+static void
+restore_settings (ModestMsgViewWindow *self)
+{
+       modest_widget_memory_restore (modest_runtime_get_conf (),
+                                     G_OBJECT(self), "modest-msg-view-window");
+}
+
+
+static void
+init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
+{
+       GtkWidget *main_vbox;
+       ModestMsgViewWindowPrivate *priv;
+       ModestWindowPrivate *parent_priv;
+       
+       priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
+       parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
+
+       priv->msg_view = modest_msg_view_new (NULL);
+       main_vbox = gtk_vbox_new  (FALSE, 6);
+       
+       gtk_box_pack_start (GTK_BOX(main_vbox), priv->menubar, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX(main_vbox), priv->toolbar, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_view, TRUE, TRUE, 6);
+
+       gtk_widget_show_all (GTK_WIDGET(main_vbox));
+       gtk_container_add   (GTK_CONTAINER(obj), main_vbox);
+}
+
+
+static void
+modest_msg_view_window_finalize (GObject *obj)
+{
+       G_OBJECT_CLASS(parent_class)->finalize (obj);
+}
+
+
+
+static gboolean
+on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self)
+{
+       save_settings (self);
+       return FALSE;
+}
+
+
+ModestWindow *
+modest_msg_view_window_new (TnyMsg *msg)
+{
+       GObject *obj;
+       ModestMsgViewWindowPrivate *priv;
+       ModestWindowPrivate *parent_priv;
+       GtkActionGroup *action_group;
+       GError *error = NULL;
+
+       g_return_val_if_fail (msg, NULL);
+       
+       obj = g_object_new(MODEST_TYPE_MSG_VIEW_WINDOW, NULL);
+       priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
+       parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
+       
+       parent_priv->ui_manager = gtk_ui_manager_new();
+       action_group = gtk_action_group_new ("ModestMsgViewWindowActions");
+
+       /* Add common actions */
+       gtk_action_group_add_actions (action_group,
+                                     modest_action_entries,
+                                     G_N_ELEMENTS (modest_action_entries),
+                                     obj);
+       gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0);
+       g_object_unref (action_group);
+
+       /* Load the UI definition */
+       gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager, MODEST_UIDIR "modest-msg-view-window-ui.xml",
+                                        &error);
+       if (error) {
+               g_printerr ("modest: could not merge modest-edit-msg-window-ui.xml: %s\n", error->message);
+               g_error_free (error);
+               error = NULL;
+       }
+       /* ****** */
+
+       /* Add accelerators */
+       gtk_window_add_accel_group (GTK_WINDOW (obj), 
+                                   gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
+
+       /* Toolbar / Menubar */
+       priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
+       priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
+
+       gtk_toolbar_set_tooltips (GTK_TOOLBAR (priv->toolbar), TRUE);
+
+       /* Init window */
+       init_window (MODEST_MSG_VIEW_WINDOW(obj), msg);
+       restore_settings (MODEST_MSG_VIEW_WINDOW(obj));
+       
+       gtk_window_set_title (GTK_WINDOW(obj), "Modest");
+       gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
+
+       g_signal_connect (G_OBJECT(obj), "delete-event",
+                         G_CALLBACK(on_delete_event), obj);
+
+       return (ModestWindow *) (obj);
+}
diff --git a/src/gtk/ui/modest-msg-view-window-ui.xml b/src/gtk/ui/modest-msg-view-window-ui.xml
new file mode 100644 (file)
index 0000000..a41a32b
--- /dev/null
@@ -0,0 +1,66 @@
+<!--
+ * 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.
+-->
+
+<ui>
+  <menubar name="MenuBar">
+    <menu name="EditMenu" action="Edit">
+      <menuitem name="EditUndoMenu" action="EditUndo"/>
+      <menuitem name="EditRedoMenu" action="EditRedo"/>
+      <separator/>
+      <menuitem name="EditCutMenu" action="EditCut"/>
+      <menuitem name="EditCopyMenu" action="EditCopy"/>
+      <menuitem name="EditPasteMenu" action="EditPaste"/>
+      <menuitem name="EditDeleteMenu" action="EditDelete"/>
+      <separator/>
+      <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
+      <menuitem name="EditDeselectAllMenu" action="EditDeselectAll"/>
+    </menu>
+
+    <menu name="ActionsMenu" action="Actions">
+      <menuitem name="ActionsNewMenu" action="ActionsNew"/>
+      <menuitem name="ActionsReplyMenu" action="ActionsReply"/>
+      <menuitem name="ActionsForwardMenu" action="ActionsForward"/>
+      <menuitem name="ActionsBounceMenu" action="ActionsBounce"/>
+      <separator/>
+      <menuitem name="ActionsFolderNewMenu" action="ActionsFolderNew"/>
+      <menuitem name="ActionsFolderDeleteMenu" action="ActionsFolderDelete"/>
+      <menuitem name="ActionsFolderRenameMenu" action="ActionsFolderRename"/>
+      <menuitem name="ActionsFolderMoveToTrashMenu" action="ActionsFolderMoveToTrash"/>
+    </menu>
+  </menubar>
+
+  <toolbar name="ToolBar">
+    <toolitem action="ActionsNew"/>
+    <separator/>
+    <toolitem action="ActionsReply"/>
+    <toolitem action="ActionsReplyAll"/>
+    <toolitem action="ActionsForward"/>
+  </toolbar>
+</ui>
index d82e223..6aaea80 100644 (file)
@@ -499,6 +499,16 @@ _modest_ui_actions_on_new_msg (GtkWidget *widget,
        gtk_widget_show_all (GTK_WIDGET (msg_win));
 }
 
+
+void
+_modest_ui_actions_on_open (GtkWidget *widget,
+                           ModestMainWindow *main_window)
+{
+       /* FIXME */
+       
+}
+
+
 static void
 reply_forward_func (gpointer data, gpointer user_data)
 {
index 24ce3bc..2a4bb9e 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile.am
-# Time-stamp: <2007-01-16 14:57:35 (djcb)>
+# Time-stamp: <2007-02-06 17:27:49 (djcb)>
 
 INCLUDES=\
        $(MODEST_GSTUFF_CFLAGS) \
@@ -23,6 +23,7 @@ libmodest_widgets_la_SOURCES=       \
        modest-combo-box.h          \
        modest-edit-msg-window.h    \
        modest-edit-msg-window-ui.h \
+       modest-msg-view-window.h    \
        modest-folder-view.c        \
        modest-folder-view.h        \
        modest-header-view.c        \
diff --git a/src/widgets/modest-msg-view-window.h b/src/widgets/modest-msg-view-window.h
new file mode 100644 (file)
index 0000000..8c92129
--- /dev/null
@@ -0,0 +1,79 @@
+/* Copyright (c) 2006,2007 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_MSG_VIEW_WINDOW_H__
+#define __MODEST_MSG_VIEW_WINDOW_H__
+
+#include <tny-msg.h>
+#include <modest-window.h>
+
+G_BEGIN_DECLS
+
+/* convenience macros */
+#define MODEST_TYPE_MSG_VIEW_WINDOW             (modest_msg_view_window_get_type())
+#define MODEST_MSG_VIEW_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
+#define MODEST_MSG_VIEW_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
+#define MODEST_IS_MSG_VIEW_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
+#define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
+#define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
+
+
+typedef struct {
+        ModestWindow parent;
+} ModestMsgViewWindow;
+       
+typedef struct {
+       ModestWindowClass parent_class;
+       /* insert signal callback declarations, eg. */
+       /* void (* my_event) (ModestEditMsgWindow* obj); */
+} ModestMsgViewWindowClass;
+
+/**
+ * modest_msg_view_window_get_type:
+ * 
+ * get the GType for the #ModestMsgViewWindow class
+ *
+ * Returns: a GType for #ModestMsgViewWindow
+ */
+GType        modest_msg_view_window_get_type    (void) G_GNUC_CONST;
+       
+
+/**
+ * modest_msg_view_window_new:
+ * 
+ * instantiates a new #ModestMsgViewWindow widget
+ *
+ * Returns: a new #ModestMsgViewWindow, or NULL in case of error
+ */
+ModestWindow*   modest_msg_view_window_new         (TnyMsg *msg);
+
+G_END_DECLS
+
+#endif /* __MODEST_MSG_VIEW_WINDOW_H__ */
+
index fd83a5b..73a9232 100644 (file)
@@ -65,6 +65,7 @@ struct _ModestMsgViewClass {
 
 
 /**
+ *
  * modest_msg_view_get_type
  *
  * get the GType for the this class