diff options
author | jstebbins <[email protected]> | 2011-04-19 00:18:17 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-04-19 00:18:17 +0000 |
commit | 9c94517108b677e2f1d71e1bd332ee70210720f6 (patch) | |
tree | b95aaefb15a1e0884519926c0c457e8839e49848 /gtk | |
parent | d0d06731c765a1a4c43558639405533d2af088b7 (diff) |
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
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 26 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 5 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 4 | ||||
-rw-r--r-- | 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 @@ </object> <object class="GtkWindow" id="hb_window"> - <property name="visible">True</property> + <property name="visible">False</property> <property name="resizable">True</property> <property name="title" translatable="yes">HandBrake</property> <property name="default_width">500</property> @@ -548,6 +548,7 @@ <signal handler="hb_visibility_event_cb" name="visibility_notify_event"/> <signal handler="window_destroy_event_cb" name="destroy_event"/> <signal handler="window_delete_event_cb" name="delete_event"/> + <signal handler="window_configure_cb" name="configure-event"/> <child> <object class="GtkVBox" id="vbox48"> <property name="orientation">vertical</property> @@ -3373,7 +3374,7 @@ The deblocking filter has two adjustable parameters, "strength" (Alpha) and "thr </child> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="position">0</property> </packing> </child> 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 @@ <string>notify</string> <key>SrtDir</key> <string></string> + <key>window_width</key> + <integer>1</integer> + <key>window_height</key> + <integer>1</integer> </dict> <key>XlatPresets</key> <dict> 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! |