From cb77522523ade8e21c76f22887bb16d41ddfe08e Mon Sep 17 00:00:00 2001 From: None Date: Sat, 30 May 2015 18:23:45 +0200 Subject: [PATCH] Add scrollbars to preferences dialog, when monitor is too small. --- data/weather-settings.ui | 1035 +++++++++++++++++++------------------- src/prefs.js | 22 + 2 files changed, 550 insertions(+), 507 deletions(-) diff --git a/data/weather-settings.ui b/data/weather-settings.ui index e7c7744..6c0e7e4 100644 --- a/data/weather-settings.ui +++ b/data/weather-settings.ui @@ -295,536 +295,557 @@ - - False - 10 - 10 + + 910 + 710 + True + True + 20 - + True False - vertical - - - True - True - in - 200 - 250 - - - True - True - tree-liststore - False - False - 12 - - - - - - - - True - True - 0 - - + natural + natural + none - + True False - icons - 1 - - - False - True - False - list-add - - - False - True - - - - False + True False - list-remove + True + True + vertical + + + True + True + in + 200 + 250 + + + True + True + tree-liststore + False + 0 + False + 12 + + + + + + + + True + True + 0 + + + + + True + False + icons + 1 + + + False + True + False + list-add + + + False + True + + + + + False + True + False + list-remove + + + False + True + + + + + False + True + False + gtk-edit + + + False + True + + + + + False + True + 1 + + - False - True + True + True + 0 - - False + True False - gtk-edit + True + True + 5 + 5 + True + + + True + False + Chose weather provider + + + 0 + 0 + + + + + True + False + Temperature Unit + + + 0 + 1 + + + + + True + False + Wind Speed Unit + + + 0 + 2 + + + + + True + False + Pressure Unit + + + 0 + 3 + + + + + True + False + Position in Panel + + + 0 + 4 + + + + + True + False + Wind Direction by Arrows + + + 0 + 5 + + + + + True + False + Translate Conditions + + + 0 + 6 + + + + + True + False + Symbolic Icons + + + 0 + 7 + + + + + True + False + Text on buttons + + + 0 + 8 + + + + + True + False + Temperature in Panel + + + 0 + 9 + + + + + True + False + Conditions in Panel + + + 0 + 10 + + + + + True + False + Conditions in Forecast + + + 0 + 11 + + + + + True + False + Center forecast + + + 0 + 12 + + + + + True + False + Number of days in forecast + + + 0 + 13 + + + + + True + False + Maximal number of digits after the decimal point + + + 0 + 14 + + + + + True + False + Personal Api key from openweathermap.org + + + 0 + 15 + + + + + True + False + Personal Api key from forecast.io + + + 0 + 16 + + + + + True + False + + http://openweathermap.org + http://forecast.io + + + + 1 + 0 + + + + + True + False + + °C + °F + K + °Ra + °Ré + °Rø + °De + °N + + + + 1 + 1 + + + + + True + False + + km/h + mph + m/s + kn + ft/s + Beaufort + + + + 1 + 2 + + + + + True + False + + hPa + inHg + bar + Pa + kPa + atm + at + Torr + psi + + + + 1 + 3 + + + + + True + False + + Center + Right + Left + + + + 1 + 4 + + + + + True + True + center + + + 1 + 5 + + + + + True + True + center + + + 1 + 6 + + + + + True + True + center + + + 1 + 7 + + + + + True + True + center + + + 1 + 8 + + + + + True + True + center + + + 1 + 9 + + + + + True + True + center + + + 1 + 10 + + + + + True + True + center + + + 1 + 11 + + + + + True + True + center + + + 1 + 12 + + + + + True + False + + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + 1 + 13 + + + + + True + False + + 0 + 1 + 2 + 3 + + + + 1 + 14 + + + + + True + True + 32 + 32 + + + 1 + 15 + + + + + True + True + True + 32 + + + 1 + 16 + + - False - True + True + True + 1 - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 10 - 5 - 5 - True - - - True - False - Chose weather provider - - - 0 - 0 - - - - - True - False - Temperature Unit - - - 0 - 1 - - - - - True - False - Wind Speed Unit - - - 0 - 2 - - - - - True - False - Pressure Unit - - - 0 - 3 - - - - - True - False - Position in Panel - - - 0 - 4 - - - - - True - False - Wind Direction by Arrows - - - 0 - 5 - - - - - True - False - Translate Conditions - - - 0 - 6 - - - - - True - False - Symbolic Icons - - - 0 - 7 - - - - - True - False - Text on buttons - - - 0 - 8 - - - - - True - False - Temperature in Panel - - - 0 - 9 - - - - - True - False - Conditions in Panel - - - 0 - 10 - - - - - True - False - Conditions in Forecast - - - 0 - 11 - - - - - True - False - Center forecast - - - 0 - 12 - - - - - True - False - Number of days in forecast - - - 0 - 13 - - - - - True - False - Maximal number of digits after the decimal point - - - 0 - 14 - - - - - True - False - Personal Api key from openweathermap.org - - - 0 - 15 - - - - - True - False - Personal Api key from forecast.io - - - 0 - 16 - - - - - True - False - - http://openweathermap.org - http://forecast.io - - - - 1 - 0 - - - - - True - False - - °C - °F - K - °Ra - °Ré - °Rø - °De - °N - - - - 1 - 1 - - - - - True - False - - km/h - mph - m/s - kn - ft/s - Beaufort - - - - 1 - 2 - - - - - True - False - - hPa - inHg - bar - Pa - kPa - atm - at - Torr - psi - - - - 1 - 3 - - - - - True - False - - Center - Right - Left - - - - 1 - 4 - - - - - True - True - center - - - 1 - 5 - - - - - True - True - center - - - 1 - 6 - - - - - True - True - center - - - 1 - 7 - - - - - True - True - center - - - 1 - 8 - - - - - True - True - center - - - 1 - 9 - - - - - True - True - center - - - 1 - 10 - - - - - True - True - center - - - 1 - 11 - - - - - True - True - center - - - 1 - 12 - - - - - True - False - - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - - - 1 - 13 - - - - - True - False - - 0 - 1 - 2 - 3 - - - - 1 - 14 - - - - - True - True - 32 - 32 - - - 1 - 15 - - - - - True - True - True - 32 - - - 1 - 16 - - - False - True - 1 - diff --git a/src/prefs.js b/src/prefs.js index 6018895..d0c4d6a 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -73,6 +73,10 @@ let _httpSession; let mCities = null; +let inRealize = false; + +let defaultSize = [-1,-1]; + const WeatherPrefsWidget = new GObject.Class({ Name: 'OpenWeatherExtension.Prefs.Widget', GTypeName: 'OpenWeatherExtensionPrefsWidget', @@ -83,9 +87,27 @@ const WeatherPrefsWidget = new GObject.Class({ this.initWindow(); + defaultSize = this.MainWidget.get_size_request(); + var borderWidth = this.MainWidget.get_border_width(); + + defaultSize[0] += 2 * borderWidth; + defaultSize[1] += 2 * borderWidth; + + this.MainWidget.set_size_request(-1, -1); + this.MainWidget.set_border_width(0); + this.refreshUI(); this.add(this.MainWidget); + this.MainWidget.connect('realize', Lang.bind(this, function() { + if ( inRealize ) + return; + inRealize = true; + + this.MainWidget.get_toplevel().set_default_size(defaultSize[0], defaultSize[1]); + this.MainWidget.get_toplevel().reshow_with_initial_size(); + inRealize = false; + })); }, Window: new Gtk.Builder(),