return FALSE;
}
+static void
+set_homogeneous (GtkWidget *widget,
+ gpointer data)
+{
+ gtk_tool_item_set_expand (GTK_TOOL_ITEM (widget), TRUE);
+ gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (widget), TRUE);
+}
+
static GtkWidget*
get_toolbar (ModestMainWindow *self)
{
menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolbarReplyContextMenu");
gtk_widget_tap_and_hold_setup (GTK_WIDGET (reply_button), menu, NULL, 0);
+ /* Set homogeneous toolbar */
+ gtk_container_foreach (GTK_CONTAINER (toolbar), set_homogeneous, NULL);
+
return toolbar;
}
return modest_singletons_get_platform_factory (_singletons);
}
-
-
-
ModestTnySendQueue*
modest_runtime_get_send_queue (TnyTransportAccount *account)
{
return MODEST_TNY_SEND_QUEUE(send_queue);
}
-
-
+ModestWindowMgr *
+modest_runtime_get_window_mgr (void)
+{
+ g_return_val_if_fail (_singletons, NULL);
+ return modest_singletons_get_window_mgr (_singletons);
+}
/* http://primates.ximian.com/~federico/news-2006-04.html#memory-debugging-infrastructure*/
ModestRuntimeDebugFlags
#include <modest-tny-account-store.h>
#include <modest-tny-send-queue.h>
#include <tny-platform-factory.h>
+#include "widgets/modest-window-mgr.h"
G_BEGIN_DECLS
ModestTnySendQueue* modest_runtime_get_send_queue (TnyTransportAccount *account);
+/**
+ * modest_runtime_get_window_mgr:
+ *
+ * get the #ModestWindowMgr singleton instance
+ *
+ * Returns: the #ModestWindowMgr singleton. This should NOT be unref'd.
+ **/
+ModestWindowMgr* modest_runtime_get_window_mgr (void);
/**
* modest_runtime_verify_object_death
ModestMailOperationQueue *mail_op_queue;
TnyPlatformFactory *platform_fact;
TnyDevice *device;
+ ModestWindowMgr *window_mgr;
};
#define MODEST_SINGLETONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
MODEST_TYPE_SINGLETONS, \
priv->mail_op_queue = NULL;
priv->platform_fact = NULL;
priv->device = NULL;
+ priv->window_mgr = NULL;
priv->conf = modest_conf_new ();
if (!priv->conf) {
if (!priv->mail_op_queue) {
g_printerr ("modest: cannot create modest mail operation queue instance\n");
return;
- }
+ }
+
+ priv->window_mgr = modest_window_mgr_new ();
+ if (!priv->window_mgr) {
+ g_printerr ("modest: cannot create modest window manager instance\n");
+ return;
+ }
}
static void
g_return_val_if_fail (self, NULL);
return MODEST_SINGLETONS_GET_PRIVATE(self)->platform_fact;
}
+
+ModestWindowMgr*
+modest_singletons_get_window_mgr (ModestSingletons *self)
+{
+ g_return_val_if_fail (self, NULL);
+ return MODEST_SINGLETONS_GET_PRIVATE(self)->window_mgr;
+}
#include <modest-mail-operation-queue.h>
#include <modest-cache-mgr.h>
#include <modest-tny-platform-factory.h>
+#include "widgets/modest-window-mgr.h"
G_BEGIN_DECLS
**/
ModestMailOperationQueue* modest_singletons_get_mail_operation_queue (ModestSingletons *self);
-
+/**
+ * modest_singletons_get_window_mgr:
+ * @self:
+ *
+ * Gets the #ModestWindowMgr singleton instance. Don't use this
+ * function directly, use the modest-runtime function instead.
+ *
+ * Return value: the singleton instance of #ModestWindowMgr
+ **/
+ModestWindowMgr* modest_singletons_get_window_mgr (ModestSingletons *self);
G_END_DECLS
modest-tny-stream-gtkhtml.c \
modest-tny-stream-gtkhtml.h \
modest-window.c \
- modest-window.h
+ modest-window.h \
+ modest-window-mgr.h \
+ modest-window-mgr.c
LDADD = \
$(MODEST_GSTUFF_LIBS) \
--- /dev/null
+/* 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.
+ */
+
+#include "modest-window-mgr.h"
+/* include other impl specific header files */
+
+/* 'private'/'protected' functions */
+static void modest_window_mgr_class_init (ModestWindowMgrClass *klass);
+static void modest_window_mgr_init (ModestWindowMgr *obj);
+static void modest_window_mgr_finalize (GObject *obj);
+/* list my signals */
+enum {
+ /* MY_SIGNAL_1, */
+ /* MY_SIGNAL_2, */
+ LAST_SIGNAL
+};
+
+typedef struct _ModestWindowMgrPrivate ModestWindowMgrPrivate;
+struct _ModestWindowMgrPrivate {
+ GList *window_list;
+};
+#define MODEST_WINDOW_MGR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
+ MODEST_TYPE_WINDOW_MGR, \
+ ModestWindowMgrPrivate))
+/* globals */
+static GObjectClass *parent_class = NULL;
+
+/* uncomment the following if you have defined any signals */
+/* static guint signals[LAST_SIGNAL] = {0}; */
+
+GType
+modest_window_mgr_get_type (void)
+{
+ static GType my_type = 0;
+ if (!my_type) {
+ static const GTypeInfo my_info = {
+ sizeof(ModestWindowMgrClass),
+ NULL, /* base init */
+ NULL, /* base finalize */
+ (GClassInitFunc) modest_window_mgr_class_init,
+ NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof(ModestWindowMgr),
+ 1, /* n_preallocs */
+ (GInstanceInitFunc) modest_window_mgr_init,
+ NULL
+ };
+ my_type = g_type_register_static (G_TYPE_OBJECT,
+ "ModestWindowMgr",
+ &my_info, 0);
+ }
+ return my_type;
+}
+
+static void
+modest_window_mgr_class_init (ModestWindowMgrClass *klass)
+{
+ GObjectClass *gobject_class;
+ gobject_class = (GObjectClass*) klass;
+
+ parent_class = g_type_class_peek_parent (klass);
+ gobject_class->finalize = modest_window_mgr_finalize;
+
+ g_type_class_add_private (gobject_class, sizeof(ModestWindowMgrPrivate));
+}
+
+static void
+modest_window_mgr_init (ModestWindowMgr *obj)
+{
+ ModestWindowMgrPrivate *priv = MODEST_WINDOW_MGR_GET_PRIVATE(obj);
+
+ priv->window_list = NULL;
+}
+
+static void
+modest_window_mgr_finalize (GObject *obj)
+{
+ ModestWindowMgrPrivate *priv = MODEST_WINDOW_MGR_GET_PRIVATE(obj);
+
+ if (priv->window_list) {
+ GList *iter = priv->window_list;
+ /* unregister pending windows */
+ while (iter) {
+ modest_window_mgr_unregister_window (MODEST_WINDOW_MGR (obj),
+ MODEST_WINDOW (iter->data));
+ iter = g_list_next (iter);
+ }
+ g_list_free (priv->window_list);
+ priv->window_list = NULL;
+ }
+
+ G_OBJECT_CLASS(parent_class)->finalize (obj);
+}
+
+ModestWindowMgr*
+modest_window_mgr_new (void)
+{
+ return MODEST_WINDOW_MGR(g_object_new(MODEST_TYPE_WINDOW_MGR, NULL));
+}
+
+void
+modest_window_mgr_register_window (ModestWindowMgr *self,
+ ModestWindow *window)
+{
+ GList *win;
+ ModestWindowMgrPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
+ g_return_if_fail (MODEST_IS_WINDOW (window));
+
+ priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
+
+ win = g_list_find (priv->window_list, window);
+ if (win) {
+ g_warning ("Trying to register an already registered window");
+ return;
+ }
+
+ /* Add to list. Keep a reference to the window */
+ g_object_ref (window);
+ priv->window_list = g_list_prepend (priv->window_list, window);
+}
+
+void
+modest_window_mgr_unregister_window (ModestWindowMgr *self,
+ ModestWindow *window)
+{
+ GList *win;
+ ModestWindowMgrPrivate *priv;
+
+ g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
+ g_return_if_fail (MODEST_IS_WINDOW (window));
+
+ priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
+
+ win = g_list_find (priv->window_list, window);
+ if (!win) {
+ g_warning ("Trying to unregister a window that has not being registered yet");
+ return;
+ }
+
+ /* Remove from list. Remove the reference to the window */
+ g_object_unref (win->data);
+ priv->window_list = g_list_remove_link (priv->window_list, win);
+}
+
+ModestWindow *
+modest_window_mgr_find_window_for_msgid (ModestWindowMgr *self,
+ gchar *msgid,
+ GType modest_window_type)
+{
+ /* TODO */
+
+ return NULL;
+}
--- /dev/null
+/* 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_WINDOW_MGR_H__
+#define __MODEST_WINDOW_MGR_H__
+
+#include <glib-object.h>
+#include "widgets/modest-window.h"
+
+G_BEGIN_DECLS
+
+/* convenience macros */
+#define MODEST_TYPE_WINDOW_MGR (modest_window_mgr_get_type())
+#define MODEST_WINDOW_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgr))
+#define MODEST_WINDOW_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_WINDOW_MGR,GObject))
+#define MODEST_IS_WINDOW_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_WINDOW_MGR))
+#define MODEST_IS_WINDOW_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_WINDOW_MGR))
+#define MODEST_WINDOW_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_WINDOW_MGR,ModestWindowMgrClass))
+
+typedef struct _ModestWindowMgr ModestWindowMgr;
+typedef struct _ModestWindowMgrClass ModestWindowMgrClass;
+
+struct _ModestWindowMgr {
+ GObject parent;
+ /* insert public members, if any */
+};
+
+struct _ModestWindowMgrClass {
+ GObjectClass parent_class;
+ /* insert signal callback declarations, eg. */
+ /* void (* my_event) (ModestWindowMgr* obj); */
+};
+
+/* member functions */
+GType modest_window_mgr_get_type (void) G_GNUC_CONST;
+
+/* typical parameter-less _new function */
+ModestWindowMgr* modest_window_mgr_new (void);
+
+
+/**
+ * modest_window_mgr_register_window:
+ * @self: the #ModestWindowMgr
+ * @window: a #ModestWindow
+ *
+ * Registers a new window in the window manager. The window manager
+ * will keep a reference.
+ **/
+void modest_window_mgr_register_window (ModestWindowMgr *self,
+ ModestWindow *window);
+
+/**
+ * modest_window_mgr_unregister_window:
+ * @self: the #ModestWindowMgr
+ * @window: a #ModestWindow
+ *
+ * Unegisters a given window from the window manager. The window
+ * manager will free its reference to it.
+ **/
+void modest_window_mgr_unregister_window (ModestWindowMgr *self,
+ ModestWindow *window);
+
+
+/**
+ * modest_window_mgr_find_window_for_msgid:
+ * @self: the #ModestWindowMgr
+ * @msgid: the message id
+ * @modest_window_type: the type of the #ModestWindow we're looking for
+ *
+ * Looks for a window of a given type that have a relationship with
+ * the message specified by the message id passed as argument
+ *
+ * Return value: the #ModestWindow if found, else NULL
+ **/
+ModestWindow* modest_window_mgr_find_window_for_msgid (ModestWindowMgr *self,
+ gchar *msgid,
+ GType modest_window_type);
+
+G_END_DECLS
+
+#endif /* __MODEST_WINDOW_MGR_H__ */
+