From 9c94517108b677e2f1d71e1bd332ee70210720f6 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Tue, 19 Apr 2011 00:18:17 +0000 Subject: [PATCH] LinGui: remember user window size changes window size gets stored in prefs when changed and restored whenever ghb starts. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3939 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/callbacks.c | 26 ++++++++++++++++++++++++++ gtk/src/ghb.ui | 5 +++-- gtk/src/internal_defaults.xml | 4 ++++ gtk/src/main.c | 8 ++++++-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index b27f1a824..7c1bde5ad 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -4912,3 +4912,29 @@ ghb_notify_done(signal_user_data_t *ud) "Cancel", (GSourceFunc)quit_cb, ud, 60); } } + +G_MODULE_EXPORT gboolean +window_configure_cb( + GtkWidget *widget, + GdkEventConfigure *event, + signal_user_data_t *ud) +{ + //g_message("preview_configure_cb()"); + if (gtk_widget_get_visible(widget)) + { + gint w, h; + w = ghb_settings_get_int(ud->settings, "window_width"); + h = ghb_settings_get_int(ud->settings, "window_height"); + + if ( w != event->width || h != event->height ) + { + ghb_settings_set_int(ud->settings, "window_width", event->width); + ghb_settings_set_int(ud->settings, "window_height", event->height); + ghb_pref_set(ud->settings, "window_width"); + ghb_pref_set(ud->settings, "window_height"); + ghb_prefs_store(); + } + } + return FALSE; +} + diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 7d70370b3..b5f6cfc14 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -538,7 +538,7 @@ - True + False True HandBrake 500 @@ -548,6 +548,7 @@ + vertical @@ -3373,7 +3374,7 @@ The deblocking filter has two adjustable parameters, "strength" (Alpha) and "thr - True + False 0 diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index 21e293892..c4792efa3 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -201,6 +201,10 @@ notify SrtDir + window_width + 1 + window_height + 1 XlatPresets diff --git a/gtk/src/main.c b/gtk/src/main.c index 11aae0697..2534dc449 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -948,7 +948,7 @@ main (int argc, char *argv[]) // Ugly hack to keep subtitle table from bouncing around as I change // which set of controls are visible GtkRequisition req; - gint height; + gint width, height; widget = GHB_WIDGET(ud->builder, "SrtCodeset"); gtk_widget_size_request( widget, &req ); @@ -962,11 +962,15 @@ main (int argc, char *argv[]) widget = GHB_WIDGET (ud->builder, "hb_window"); GdkGeometry geo = { - -1, -1, 1024, 768, 200, 200, 10, 10, 0, 0, GDK_GRAVITY_NORTH_WEST + -1, -1, 1024, 768, -1, -1, 10, 10, 0, 0, GDK_GRAVITY_NORTH_WEST }; GdkWindowHints geo_mask; geo_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE; gtk_window_set_geometry_hints( GTK_WINDOW(widget), widget, &geo, geo_mask); + width = ghb_settings_get_int(ud->settings, "window_width"); + height = ghb_settings_get_int(ud->settings, "window_height"); + gtk_window_resize(GTK_WINDOW(widget), width, height); + gtk_widget_show(widget); // Everything should be go-to-go. Lets rock! -- 2.40.0