+
+
+static void on_item_not_found (ModestHeaderView* header_view, ModestItemType type,
+ ModestWidgetFactory *self)
+{
+ /* FIXME ==> ask from UI... */
+ GtkWidget *dialog;
+ gchar *txt;
+ gboolean online;
+ gchar *item = type == MODEST_ITEM_TYPE_FOLDER ? "folder" : "message";
+
+ TnyDeviceIface *device;
+ ModestWidgetFactoryPrivate *priv;
+
+ priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
+ device = tny_account_store_iface_get_device
+ (TNY_ACCOUNT_STORE_IFACE(priv->account_store));
+
+ online = tny_device_iface_is_online (device);
+ if (online) {
+ /* already online -- the item is simply not there... */
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("The %s you selected cannot be found"),
+ item);
+ gtk_dialog_run (GTK_DIALOG(dialog));
+ } else {
+
+ dialog = gtk_dialog_new_with_buttons (_("Connection requested"),
+ NULL,
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ txt = g_strdup_printf (_("This %s is not available in offline mode.\n"
+ "Do you want to get online?"), item);
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
+ gtk_label_new (txt), FALSE, FALSE, 0);
+ gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
+ g_free (txt);
+
+ gtk_window_set_default_size (GTK_WINDOW(dialog), 300, 300);
+ if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ tny_device_iface_force_online (device);
+ }
+ gtk_widget_destroy (dialog);
+}
+
+
+static void
+on_main_toolbar_button_clicked (ModestToolbar *toolbar, ModestToolbarButton button_id,
+ ModestWidgetFactory *self)
+{
+ g_printerr ("modest: button %d clicked\n", button_id);
+}
+
+
+static void
+on_password_requested (ModestTnyAccountStore *account_store, const gchar* account_name,
+ gchar **password, gboolean *cancel, ModestWidgetFactory *self)
+{
+ gchar *txt;
+ GtkWidget *dialog, *entry;
+
+ dialog = gtk_dialog_new_with_buttons (_("Password requested"),
+ NULL,
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ txt = g_strdup_printf (_("Please enter your password for %s"), account_name);
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
+ FALSE, FALSE, 0);
+ g_free (txt);
+
+ entry = gtk_entry_new_with_max_length (40);
+ gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
+ gtk_entry_set_invisible_char (GTK_ENTRY(entry), 0x2022); /* bullet unichar */
+
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
+ TRUE, FALSE, 0);
+
+ gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
+
+ if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+ *password = g_strdup(gtk_entry_get_text (GTK_ENTRY(entry)));
+ *cancel = FALSE;
+ } else {
+ *password = NULL;
+ *cancel = TRUE;
+ }
+ gtk_widget_destroy (dialog);
+}
+