[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 02/04: Get font color in stadalone app already at very first adding of sensors feature

noreply at xfce.org noreply at xfce.org
Wed Mar 8 23:06:47 CET 2017


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

timystery pushed a commit to branch master
in repository panel-plugins/xfce4-sensors-plugin.

commit 5b786af4abb05868b6bccf83ee0fbb445e893583
Author: Fabian <timystery at arcor.de>
Date:   Wed Mar 8 22:18:17 2017 +0100

    Get font color in stadalone app already at very first adding of sensors feature
---
 src/actions.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index 7f821d7..abab088 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -148,8 +148,11 @@ refresh_tacho_view (t_sensors_dialog *ptr_sensors_dialog_structure)
                       //g_free(GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->color);
                 }
                 if (ptr_sensors_structure->tachos[idx_chip][idx_feature] == NULL)
+                {
                   ptr_sensors_structure->tachos[idx_chip][idx_feature] = gtk_sensorstacho_new(ptr_sensors_structure->orientation, 48);
 
+                }
+
                 val_fill_degree = (ptr_chipfeature_structure->raw_value - ptr_chipfeature_structure->min_value) / ( ptr_chipfeature_structure->max_value - ptr_chipfeature_structure->min_value);
                 if (val_fill_degree<0.0)
                     val_fill_degree=0.0;
@@ -163,19 +166,20 @@ refresh_tacho_view (t_sensors_dialog *ptr_sensors_dialog_structure)
                 if (GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->text == NULL)
                   GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->text = g_strdup(ptr_chipfeature_structure->name);
 
-                if (GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->color == NULL)
-                  GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->color = g_strdup(ptr_chipfeature_structure->color);
+                if (GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->color)
+                  g_free(GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->color);
+
+                GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->color = g_strdup(ptr_chipfeature_structure->color);
+
 
                 //gtk_widget_set_size_request(ptr_sensors_structure->tachos [idx_chip][idx_feature], 64, 64);
 
-                if ( !gtk_widget_get_realized(GTK_WIDGET(ptr_sensors_structure->tachos [idx_chip][idx_feature])) )
+                if ( gtk_widget_get_parent(GTK_WIDGET(ptr_sensors_structure->tachos [idx_chip][idx_feature])) == NULL )
                 {
                   gtk_grid_attach(GTK_GRID(ptr_wdgt_table), ptr_sensors_structure->tachos [idx_chip][idx_feature], col_tacho_table, row_tacho_table, 1, 1);
                   gtk_widget_show (ptr_sensors_structure->tachos [idx_chip][idx_feature]);
                 }
-                else {
-                  //gtk_sensorstacho_set_value(GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature]), val_fill_degree);
-                }
+
 
                 if (col_tacho_table>=3) {
                     row_tacho_table++;
@@ -184,11 +188,11 @@ refresh_tacho_view (t_sensors_dialog *ptr_sensors_dialog_structure)
                 else
                     col_tacho_table++;
 
-                if (row_tacho_table>=5)
+                if (row_tacho_table>=5) /* TODO: free sensorstacho again */
                     return; /* or resize the table after reading the property n-rows of GtkTableClass*/
             }
             else if ( GTK_WIDGET(ptr_sensors_structure->tachos [idx_chip][idx_feature]) &&
-             gtk_widget_get_realized(GTK_WIDGET(ptr_sensors_structure->tachos [idx_chip][idx_feature])) )
+             gtk_widget_get_parent(GTK_WIDGET(ptr_sensors_structure->tachos [idx_chip][idx_feature])) != NULL )
             {
                     gtk_container_remove(GTK_CONTAINER(ptr_wdgt_table), ptr_sensors_structure->tachos [idx_chip][idx_feature]);
                     if (GTK_SENSORSTACHO(ptr_sensors_structure->tachos [idx_chip][idx_feature])->text)

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


More information about the Xfce4-commits mailing list