[easytag/wip/application-window: 56/69] Track main window state
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 56/69] Track main window state
- Date: Tue, 22 Jul 2014 20:17:25 +0000 (UTC)
commit 14db2162fb1447bc1a7a76c79eccf9c772aac766
Author: David King <amigadave amigadave com>
Date: Wed Jul 16 07:33:17 2014 +0100
Track main window state
This will be used to save and restore the window dimensions, and whether
the window is maximized.
src/application_window.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index d938723..8ea4b89 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -89,6 +89,10 @@ struct _EtApplicationWindowPrivate
GtkWidget *track_sequence_button;
GtkWidget *track_number_button;
GtkToolItem *apply_image_toolitem;
+
+ gboolean is_maximized;
+ gint height;
+ gint width;
};
/* Used to force to hide the msgbox when deleting file */
@@ -113,6 +117,49 @@ on_main_window_delete_event (GtkWidget *window,
return TRUE;
}
+static gboolean
+on_configure_event (GtkWidget *window,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ EtApplicationWindow *self;
+ EtApplicationWindowPrivate *priv;
+ GdkEventConfigure *configure_event;
+
+ self = ET_APPLICATION_WINDOW (window);
+ priv = et_application_window_get_instance_private (self);
+ configure_event = (GdkEventConfigure *)event;
+
+ if (!priv->is_maximized)
+ {
+ priv->width = configure_event->width;
+ priv->height = configure_event->height;
+ }
+
+ return GDK_EVENT_PROPAGATE;
+}
+
+static gboolean
+on_window_state_event (GtkWidget *window,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ EtApplicationWindow *self;
+ EtApplicationWindowPrivate *priv;
+ GdkEventWindowState *state_event;
+
+ self = ET_APPLICATION_WINDOW (window);
+ priv = et_application_window_get_instance_private (self);
+ state_event = (GdkEventWindowState *)event;
+
+ if (state_event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED)
+ {
+ priv->is_maximized = (state_event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
+ }
+
+ return GDK_EVENT_PROPAGATE;
+}
+
static void
Convert_P20_And_Underscore_Into_Spaces (GtkWidget *entry)
{
@@ -2975,8 +3022,16 @@ et_application_window_init (EtApplicationWindow *self)
gtk_window_set_icon_name (window, PACKAGE_TARNAME);
gtk_window_set_title (window, PACKAGE_NAME);
+ priv->is_maximized = FALSE;
+ priv->height = 0;
+ priv->width = 0;
+
+ g_signal_connect (self, "configure-event",
+ G_CALLBACK (on_configure_event), NULL);
g_signal_connect (self, "delete-event",
G_CALLBACK (on_main_window_delete_event), NULL);
+ g_signal_connect (self, "window-state-event",
+ G_CALLBACK (on_window_state_event), NULL);
/* Mainvbox for Menu bar + Tool bar + "Browser Area & FileArea & TagArea" + Log Area + "Status bar &
Progress bar" */
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]