Fixed restoration of the panel divider position.
authorJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 17 Feb 2017 23:19:47 +0000 (00:19 +0100)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 17 Feb 2017 23:19:47 +0000 (00:19 +0100)
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)

NEWS
src/main.c
src/ui.c
src/ui.h
src/ui_pref.c

diff --git a/NEWS b/NEWS
index 69fae41..2100f3a 100644 (file)
--- 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).
 * 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
 ------
 
 v1.2.0
 ------
index 764355d..69df91b 100644 (file)
@@ -334,8 +334,6 @@ static gboolean check_ui_visible(gpointer data)
        if (!is_appindicator_supported() && !is_status_supported())
                ui_window_show(ui);
 
        if (!is_appindicator_supported() && !is_status_supported())
                ui_window_show(ui);
 
-       ui_window_update(ui);
-
        return FALSE;
 }
 
        return FALSE;
 }
 
index c503800..1ce84ea 100644 (file)
--- 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");
 }
 
        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;
 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;
        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);
                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));
 }
 
        gtk_window_present(GTK_WINDOW(ui->main_window));
 }
index 95135d6..426f29c 100644 (file)
--- a/src/ui.h
+++ b/src/ui.h
@@ -51,16 +51,6 @@ struct ui_psensor {
        int graph_update_interval;
 };
 
        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 *);
 
 /* Show the main psensor window. */
 void ui_window_show(struct ui_psensor *);
 
index 8d2c8ab..bbc8927 100644 (file)
@@ -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);
                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));
        }
        g_object_unref(G_OBJECT(builder));
        gtk_widget_destroy(GTK_WIDGET(diag));