From: Jean-Philippe Orsini Date: Fri, 17 Feb 2017 23:19:47 +0000 (+0100) Subject: Fixed restoration of the panel divider position. X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=c1e20f2631a1249720e9c75d753eacfcb0f6c7b9 Fixed restoration of the panel divider position. Moved the restoration of the divider position in the ui_window_show function. The ui_window_update function does not be called after closing the preference window or in check_ui_visible, it was causing a restoration of the divider position to the old setting. Based on patch of LP #1642034 (Francis Chin) --- diff --git a/NEWS b/NEWS index 69fae41..2100f3a 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ v1.2.1 * Fresh install of 1.2.0 complains about missing sensor config keys. (LP: #1650378) * Fixed hide on startup preference (Francis Chin). (LP: #1642029). +* Fixed restoration of the panel divider position (Francis Chin). v1.2.0 ------ diff --git a/src/main.c b/src/main.c index 764355d..69df91b 100644 --- a/src/main.c +++ b/src/main.c @@ -334,8 +334,6 @@ static gboolean check_ui_visible(gpointer data) if (!is_appindicator_supported() && !is_status_supported()) ui_window_show(ui); - ui_window_update(ui); - return FALSE; } diff --git a/src/ui.c b/src/ui.c index c503800..1ce84ea 100644 --- a/src/ui.c +++ b/src/ui.c @@ -398,20 +398,6 @@ void ui_window_create(struct ui_psensor *ui) log_debug("ui_window_create() ends"); } -void ui_window_update(struct ui_psensor *ui) -{ - struct config *cfg; - - log_debug("ui_window_update()"); - - cfg = ui->config; - - if (cfg->window_restore_enabled) - gtk_paned_set_position(GTK_PANED(w_sensor_box), - cfg->window_divider_pos); - -} - void ui_window_show(struct ui_psensor *ui) { struct config *cfg; @@ -419,12 +405,13 @@ void ui_window_show(struct ui_psensor *ui) log_debug("ui_window_show()"); cfg = ui->config; - if (cfg->window_restore_enabled) + if (cfg->window_restore_enabled) { + gtk_paned_set_position(GTK_PANED(w_sensor_box), + cfg->window_divider_pos); gtk_window_move(GTK_WINDOW(ui->main_window), cfg->window_x, cfg->window_y); - - ui_window_update(ui); + } gtk_window_present(GTK_WINDOW(ui->main_window)); } diff --git a/src/ui.h b/src/ui.h index 95135d6..426f29c 100644 --- a/src/ui.h +++ b/src/ui.h @@ -51,16 +51,6 @@ struct ui_psensor { int graph_update_interval; }; -/* - * Update the window according to the configuration. - * - * Creates or re-creates the sensor_box according to the position of - * the list of sensors in the configuration. - * - * Show or hide the menu bar. - */ -void ui_window_update(struct ui_psensor *); - /* Show the main psensor window. */ void ui_window_show(struct ui_psensor *); diff --git a/src/ui_pref.c b/src/ui_pref.c index 8d2c8ab..bbc8927 100644 --- a/src/ui_pref.c +++ b/src/ui_pref.c @@ -398,8 +398,6 @@ void ui_pref_dialog_run(struct ui_psensor *ui) pxdg_set_autostart(gtk_toggle_button_get_active(w_autostart)); pthread_mutex_unlock(&ui->sensors_mutex); - - ui_window_update(ui); } g_object_unref(G_OBJECT(builder)); gtk_widget_destroy(GTK_WIDGET(diag));