#include "../modest-tny-header-tree-view.h"
#include "../modest-tny-msg-view.h"
#include "../modest-tny-transport-actions.h"
+#include "../modest-tny-store-actions.h"
#include "../modest-text-utils.h"
#include "../modest-tny-msg-actions.h"
static void on_send_button_clicked (GtkWidget *widget, ModestUI *modest_ui);
+static void on_sendreceive_button_clicked (GtkWidget *widget, ModestUI *modest_ui);
+
static void register_toolbar_callbacks (ModestUI *modest_ui);
G_CALLBACK(on_delete_clicked), modest_ui);
gtk_widget_set_sensitive(button, FALSE);
}
+
+ button = glade_xml_get_widget (priv->glade_xml, "toolb_send_receive");
+ if (button) {
+ g_signal_connect (button, "clicked",
+ G_CALLBACK(on_sendreceive_button_clicked), modest_ui);
+ gtk_widget_set_sensitive(button, TRUE);
+ }
}
}
}
}
+
+static void
+on_sendreceive_button_clicked (GtkWidget *widget, ModestUI *modest_ui)
+{
+ ModestUIPrivate *priv;
+ ModestTnyStoreActions *store_actions;
+ TnyAccountStoreIface *account_store;
+ const GList *store_accounts;
+ const GList *iter;
+
+ g_return_if_fail (modest_ui);
+
+ store_actions = MODEST_TNY_STORE_ACTIONS (modest_tny_store_actions_new ());
+ priv = MODEST_UI_GET_PRIVATE(modest_ui);
+
+ account_store = priv->account_store;
+ store_accounts =
+ tny_account_store_iface_get_store_accounts (account_store);
+
+ for (iter = store_accounts; iter; iter = iter->next)
+ modest_tny_store_actions_update_folders (store_actions,
+ TNY_STORE_ACCOUNT_IFACE (iter->data));
+
+ /* TODO, lock, refresh display */
+
+ g_object_unref (store_actions);
+
+}
--- /dev/null
+/* modest-tny-store-actions.c */
+
+/* insert (c)/licensing information) */
+
+#include <tny-msg.h>
+#include <tny-msg-iface.h>
+#include <tny-msg-header.h>
+#include <tny-msg-header-iface.h>
+#include <tny-account-iface.h>
+#include <tny-account-store-iface.h>
+#include <tny-store-account-iface.h>
+#include <tny-store-account.h>
+#include <tny-stream-camel.h>
+#include <string.h>
+#include <camel/camel-folder.h>
+#include <camel/camel.h>
+#include <camel/camel-folder-summary.h>
+
+
+#include <glib.h>
+#include "modest-tny-store-actions.h"
+
+
+/* 'private'/'protected' functions */
+static void modest_tny_store_actions_class_init (ModestTnyStoreActionsClass *klass);
+static void modest_tny_store_actions_init (ModestTnyStoreActions *obj);
+static void modest_tny_store_actions_finalize (GObject *obj);
+
+/* list my signals */
+enum {
+ /* MY_SIGNAL_1, */
+ /* MY_SIGNAL_2, */
+ LAST_SIGNAL
+};
+
+typedef struct _ModestTnyStoreActionsPrivate ModestTnyStoreActionsPrivate;
+
+struct _ModestTnyStoreActionsPrivate {
+ gboolean active;
+};
+
+#define MODEST_TNY_STORE_ACTIONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
+ MODEST_TYPE_TNY_STORE_ACTIONS, \
+ ModestTnyStoreActionsPrivate))
+/* globals */
+static GObjectClass *parent_class = NULL;
+
+/* uncomment the following if you have defined any signals */
+/* static guint signals[LAST_SIGNAL] = {0}; */
+
+void
+modest_tny_store_actions_update_folders (ModestTnyStoreActions *self,
+ TnyStoreAccountIface *storage_account)
+{
+ const TnyListIface* folders;
+ TnyIteratorIface* ifolders;
+ gpointer *cur_folder;
+#if 0
+ folders = tny_store_account_iface_get_folders (storage_account,
+ TNY_STORE_ACCOUNT_FOLDER_TYPE_SUBSCRIBED);
+
+ ifolders = tny_list_iface_create_iterator (folders);
+
+ for (cur_folder = tny_iterator_iface_first (ifolders);
+ tny_iterator_iface_has_next (ifolders);
+ tny_iterator_iface_next (ifolders))
+ {
+ cur_folder = tny_iterator_iface_current (ifolders);
+// tny_msg_folder_iface_refresh (cur_folder);
+ }
+#endif
+}
+
+
+GType
+modest_tny_store_actions_get_type (void)
+{
+ static GType my_type = 0;
+ if (!my_type) {
+ static const GTypeInfo my_info = {
+ sizeof(ModestTnyStoreActionsClass),
+ NULL, /* base init */
+ NULL, /* base finalize */
+ (GClassInitFunc) modest_tny_store_actions_class_init,
+ NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof(ModestTnyStoreActions),
+ 1, /* n_preallocs */
+ (GInstanceInitFunc) modest_tny_store_actions_init,
+ };
+ my_type = g_type_register_static (G_TYPE_OBJECT,
+ "ModestTnyStoreActions",
+ &my_info, 0);
+ }
+ return my_type;
+}
+
+static void
+modest_tny_store_actions_class_init (ModestTnyStoreActionsClass *klass)
+{
+ GObjectClass *gobject_class;
+ gobject_class = (GObjectClass*) klass;
+
+ parent_class = g_type_class_peek_parent (klass);
+ gobject_class->finalize = modest_tny_store_actions_finalize;
+
+ g_type_class_add_private (gobject_class, sizeof(ModestTnyStoreActionsPrivate));
+
+ klass->update_folders = modest_tny_store_actions_update_folders;
+ /* signal definitions go here, e.g.: */
+/* signals[MY_SIGNAL_1] = */
+/* g_signal_new ("my_signal_1",....); */
+/* signals[MY_SIGNAL_2] = */
+/* g_signal_new ("my_signal_2",....); */
+/* etc. */
+}
+
+static void
+modest_tny_store_actions_init (ModestTnyStoreActions *obj)
+{
+/* uncomment the following if you init any of the private data */
+/* ModestTnyStoreActionsPrivate *priv = MODEST_TNY_STORE_ACTIONS_GET_PRIVATE(obj); */
+
+/* initialize this object, eg.: */
+/* priv->frobnicate_mode = FALSE; */
+}
+
+static void
+modest_tny_store_actions_finalize (GObject *obj)
+{
+/* free/unref instance resources here */
+}
+
+GObject*
+modest_tny_store_actions_new (void)
+{
+ return G_OBJECT(g_object_new(MODEST_TYPE_TNY_STORE_ACTIONS, NULL));
+}
+
--- /dev/null
+/* modest-tny-store-actions.h */
+/* insert (c)/licensing information) */
+
+#ifndef __MODEST_TNY_STORE_ACTIONS_H__
+#define __MODEST_TNY_STORE_ACTIONS_H__
+
+#include <glib-object.h>
+#include <tny-store-account-iface.h>
+
+G_BEGIN_DECLS
+
+/* standard convenience macros */
+#define MODEST_TYPE_TNY_STORE_ACTIONS (modest_tny_store_actions_get_type())
+#define MODEST_TNY_STORE_ACTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_TNY_STORE_ACTIONS,ModestTnyStoreActions))
+#define MODEST_TNY_STORE_ACTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_TNY_STORE_ACTIONS,ModestTnyStoreActionsClass))
+#define MODEST_IS_TNY_STORE_ACTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_TNY_STORE_ACTIONS))
+#define MODEST_IS_TNY_STORE_ACTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_TNY_STORE_ACTIONS))
+#define MODEST_TNY_STORE_ACTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_TNY_STORE_ACTIONS,ModestTnyStoreActionsClass))
+
+typedef struct _ModestTnyStoreActions ModestTnyStoreActions;
+typedef struct _ModestTnyStoreActionsClass ModestTnyStoreActionsClass;
+
+struct _ModestTnyStoreActions {
+ GObject parent;
+ /* insert public members, if any */
+};
+
+struct _ModestTnyStoreActionsClass {
+ GObjectClass parent_class;
+
+ void (* update_folders) (ModestTnyStoreActions *self,
+ TnyStoreAccountIface *storage_account);
+};
+
+/* member functions */
+GType modest_tny_store_actions_get_type (void) G_GNUC_CONST;
+
+GObject* modest_tny_store_actions_new (void);
+
+void modest_tny_store_actions_update_folders (ModestTnyStoreActions *self,
+ TnyStoreAccountIface *storage_account);
+
+
+G_END_DECLS
+
+#endif /* __MODEST_TNY_STORE_ACTIONS_H__ */
+