|
@@ -33,7 +33,11 @@ struct _IridiumWindow
|
|
|
{
|
|
{
|
|
|
GtkApplicationWindow parent_instance;
|
|
GtkApplicationWindow parent_instance;
|
|
|
|
|
|
|
|
|
|
+ gint width;
|
|
|
|
|
+ gint height;
|
|
|
|
|
+
|
|
|
GSettings *preferences;
|
|
GSettings *preferences;
|
|
|
|
|
+ GSettings *window_state;
|
|
|
|
|
|
|
|
GtkHeaderBar *header_bar;
|
|
GtkHeaderBar *header_bar;
|
|
|
GtkListBox *tag_list;
|
|
GtkListBox *tag_list;
|
|
@@ -331,6 +335,22 @@ on_show (IridiumWindow *self, gpointer user_data)
|
|
|
g_free (email);
|
|
g_free (email);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void
|
|
|
|
|
+on_size_allocate (IridiumWindow *self,
|
|
|
|
|
+ GtkAllocation *allocation,
|
|
|
|
|
+ gpointer user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ gtk_window_get_size (GTK_WINDOW (self), &self->width, &self->height);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
+on_destroy (IridiumWindow *self,
|
|
|
|
|
+ gpointer user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ g_settings_set_int (self->window_state, "width", self->width);
|
|
|
|
|
+ g_settings_set_int (self->window_state, "height", self->height);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void
|
|
static void
|
|
|
on_notification_close_clicked (IridiumWindow *self,
|
|
on_notification_close_clicked (IridiumWindow *self,
|
|
|
GtkButton *button)
|
|
GtkButton *button)
|
|
@@ -338,6 +358,17 @@ on_notification_close_clicked (IridiumWindow *self,
|
|
|
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
|
|
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void
|
|
|
|
|
+iridium_window_constructed (GObject *object)
|
|
|
|
|
+{
|
|
|
|
|
+ IridiumWindow *self;
|
|
|
|
|
+
|
|
|
|
|
+ self = IRIDIUM_WINDOW (object);
|
|
|
|
|
+ gtk_window_set_default_size (GTK_WINDOW (self), self->width, self->height);
|
|
|
|
|
+
|
|
|
|
|
+ G_OBJECT_CLASS (iridium_window_parent_class)->constructed (object);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void
|
|
static void
|
|
|
iridium_window_dispose (GObject *object)
|
|
iridium_window_dispose (GObject *object)
|
|
|
{
|
|
{
|
|
@@ -361,6 +392,7 @@ iridium_window_class_init (IridiumWindowClass *klass)
|
|
|
oclass = G_OBJECT_CLASS (klass);
|
|
oclass = G_OBJECT_CLASS (klass);
|
|
|
widget_class = GTK_WIDGET_CLASS (klass);
|
|
widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
|
|
|
|
|
+ oclass->constructed = iridium_window_constructed;
|
|
|
oclass->dispose = iridium_window_dispose;
|
|
oclass->dispose = iridium_window_dispose;
|
|
|
|
|
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/net/bloerg/Iridium/iridium-window.ui");
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/net/bloerg/Iridium/iridium-window.ui");
|
|
@@ -380,6 +412,8 @@ iridium_window_class_init (IridiumWindowClass *klass)
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_search_changed);
|
|
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_notification_close_clicked);
|
|
|
gtk_widget_class_bind_template_callback (widget_class, on_show);
|
|
gtk_widget_class_bind_template_callback (widget_class, on_show);
|
|
|
|
|
+ gtk_widget_class_bind_template_callback (widget_class, on_size_allocate);
|
|
|
|
|
+ gtk_widget_class_bind_template_callback (widget_class, on_destroy);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -401,6 +435,10 @@ iridium_window_init (IridiumWindow *self)
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
|
|
|
|
|
|
self->preferences = g_settings_new ("net.bloerg.iridium.preferences");
|
|
self->preferences = g_settings_new ("net.bloerg.iridium.preferences");
|
|
|
|
|
+ self->window_state = g_settings_new ("net.bloerg.iridium.window-state");
|
|
|
|
|
+ self->width = g_settings_get_int (self->window_state, "width");
|
|
|
|
|
+ self->height = g_settings_get_int (self->window_state, "height");
|
|
|
|
|
+
|
|
|
self->title_binding = NULL;
|
|
self->title_binding = NULL;
|
|
|
self->content_binding = NULL;
|
|
self->content_binding = NULL;
|
|
|
self->markdown = iridium_markdown_new ();
|
|
self->markdown = iridium_markdown_new ();
|