|
|
@@ -24,6 +24,7 @@
|
|
|
#include "iridium-note.h"
|
|
|
#include "iridium-note-row.h"
|
|
|
#include "iridium-standard-file.h"
|
|
|
+#include "iridium-signin-dialog.h"
|
|
|
#include "iridium-tag-row.h"
|
|
|
#include "iridium-window.h"
|
|
|
|
|
|
@@ -190,6 +191,34 @@ on_standard_file_connected (GObject *object,
|
|
|
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
|
|
|
}
|
|
|
|
|
|
+static void
|
|
|
+on_show (IridiumWindow *self, gpointer user_data)
|
|
|
+{
|
|
|
+ GtkDialog *dialog;
|
|
|
+ const gchar *server;
|
|
|
+ const gchar *email;
|
|
|
+ gchar *password;
|
|
|
+ GError *error = NULL;
|
|
|
+
|
|
|
+ dialog = iridium_signin_dialog_new ();
|
|
|
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self));
|
|
|
+ gtk_dialog_run (dialog);
|
|
|
+
|
|
|
+ server = iridium_signin_dialog_get_server (IRIDIUM_SIGNIN_DIALOG (dialog));
|
|
|
+ email = iridium_signin_dialog_get_email (IRIDIUM_SIGNIN_DIALOG (dialog));
|
|
|
+ password = secret_password_lookup_sync (STANDARD_FILE_SCHEMA, NULL, &error,
|
|
|
+ "email", email, "server", server, NULL);
|
|
|
+
|
|
|
+ gtk_revealer_set_reveal_child (self->notification_revealer, TRUE);
|
|
|
+
|
|
|
+ iridium_standard_file_connect_async (self->client, server, email, password, NULL,
|
|
|
+ on_standard_file_connected, self);
|
|
|
+
|
|
|
+ secret_password_free (password);
|
|
|
+
|
|
|
+ gtk_widget_destroy (GTK_WIDGET (dialog));
|
|
|
+}
|
|
|
+
|
|
|
static void
|
|
|
on_notification_close_clicked (IridiumWindow *self,
|
|
|
GtkButton *button)
|
|
|
@@ -238,6 +267,7 @@ iridium_window_class_init (IridiumWindowClass *klass)
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_note_selected);
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_search_changed);
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_notification_close_clicked);
|
|
|
+ gtk_widget_class_bind_template_callback (widget_class, on_show);
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
@@ -247,16 +277,13 @@ iridium_window_init (IridiumWindow *self)
|
|
|
GtkStyleProvider *provider;
|
|
|
GtkSourceBuffer *buffer;
|
|
|
GSimpleAction *action;
|
|
|
- const gchar *server;
|
|
|
- const gchar *email;
|
|
|
- gchar *password;
|
|
|
- GError *error = NULL;
|
|
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
|
|
|
|
self->title_binding = NULL;
|
|
|
self->content_binding = NULL;
|
|
|
self->markdown = iridium_markdown_new ();
|
|
|
+ self->client = iridium_standard_file_new ();
|
|
|
|
|
|
action = g_simple_action_new ("search", NULL);
|
|
|
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
|
|
|
@@ -276,25 +303,11 @@ iridium_window_init (IridiumWindow *self)
|
|
|
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/net/bloerg/Iridium/iridium.css");
|
|
|
gtk_style_context_add_provider_for_screen (gtk_window_get_screen (GTK_WINDOW (self)), provider, GTK_STYLE_PROVIDER_PRIORITY_USER);
|
|
|
|
|
|
- self->client = iridium_standard_file_new ();
|
|
|
- server = "https://sf.bloerg.net";
|
|
|
- email = "matthias.vogelgesang@gmail.com";
|
|
|
-
|
|
|
- /* TODO: add dialog */
|
|
|
- password = secret_password_lookup_sync (STANDARD_FILE_SCHEMA, NULL, &error,
|
|
|
- "email", email, "server", server, NULL);
|
|
|
-
|
|
|
- gtk_revealer_set_reveal_child (self->notification_revealer, TRUE);
|
|
|
-
|
|
|
- iridium_standard_file_connect_async (self->client, server, email, password, NULL,
|
|
|
- on_standard_file_connected, self);
|
|
|
-
|
|
|
- secret_password_free (password);
|
|
|
-
|
|
|
gtk_list_box_set_filter_func (self->note_list, (GtkListBoxFilterFunc) note_visible, self, NULL);
|
|
|
|
|
|
gtk_list_box_set_sort_func (self->note_list, (GtkListBoxSortFunc) note_date_cmp, NULL, NULL);
|
|
|
|
|
|
gtk_widget_show_all (GTK_WIDGET (self->tag_list));
|
|
|
gtk_widget_show_all (GTK_WIDGET (self->note_list));
|
|
|
+
|
|
|
}
|