[Xfce4-commits] [panel-plugins/xfce4-diskperf-plugin] 04/05: Rework set-mode callback

noreply at xfce.org noreply at xfce.org
Sun Feb 19 12:40:58 CET 2017


This is an automated email from the git hooks/post-receive script.

landry pushed a commit to branch master
in repository panel-plugins/xfce4-diskperf-plugin.

commit 93c399dd94931ff9b44d002bc9dbf92e017b3cbc
Author: Landry Breuil <landry at xfce.org>
Date:   Sun Feb 19 12:38:45 2017 +0100

    Rework set-mode callback
    
    Instead of removing/readding the timer and re-creating again the pbars, update
    their orientation (and the corresponding container box)
---
 panel-plugin/main.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/panel-plugin/main.c b/panel-plugin/main.c
index 32f73bc..bccbbcf 100644
--- a/panel-plugin/main.c
+++ b/panel-plugin/main.c
@@ -1117,23 +1117,25 @@ static void diskperf_set_mode (XfcePanelPlugin *plugin,
 	/* Invoked when the panel changes mode */
 {
     struct monitor_t *poMonitor = &(poPlugin->oMonitor);
+    int i;
+    Widget_t       *pwBar;
     GtkOrientation    p_iOrientation;
 
-    DBG ("!");
+    DBG ("%d", p_iMode);
 
     p_iOrientation =
       (p_iMode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
       GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
 
+    gtk_orientable_set_orientation(GTK_ORIENTABLE(poMonitor->wBox), p_iOrientation);
 
-    if (poPlugin->iTimerId) {
-	g_source_remove (poPlugin->iTimerId);
-	poPlugin->iTimerId = 0;
+    for (i = 0; i < 2; i++) {
+	pwBar = poPlugin->oMonitor.awProgressBar + i;
+	gtk_orientable_set_orientation (GTK_ORIENTABLE(*pwBar), !p_iOrientation);
+	gtk_progress_bar_set_inverted (GTK_PROGRESS_BAR(*pwBar),
+					   (p_iOrientation ==
+					    GTK_ORIENTATION_HORIZONTAL));
     }
-    gtk_container_remove (GTK_CONTAINER (poMonitor->wEventBox),
-			  GTK_WIDGET (poMonitor->wBox));
-    CreateMonitorBars (poPlugin, p_iOrientation);
-    SetTimer (poPlugin);
     gtk_label_set_angle (GTK_LABEL (poMonitor->wTitle),
                          (p_iMode != XFCE_PANEL_PLUGIN_MODE_VERTICAL) ?
                          0 : 270);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list