[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 01/04: remove method for unsetting the color

noreply at xfce.org noreply at xfce.org
Sun Mar 19 21:02:15 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 b599029ec656584efe6b247cc0301eb0de70b806
Author: Fabian <timystery at arcor.de>
Date:   Sun Mar 19 20:39:30 2017 +0100

    remove method for unsetting the color
---
 include/tacho.h |  6 ------
 lib/tacho.c     | 22 +++++-----------------
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/include/tacho.h b/include/tacho.h
index d698eab..9eedaf5 100644
--- a/include/tacho.h
+++ b/include/tacho.h
@@ -87,12 +87,6 @@ void gtk_sensorstacho_unset_text (GtkSensorsTacho *ptr_sensorstacho);
 void gtk_sensorstacho_set_color (GtkSensorsTacho *ptr_sensorstacho, gchar *ptr_colorstring);
 
 /**
- * Remove the color of the text
- * @param ptr_sensorstacho: Pointer to SensorsTacho structure
- */
-void gtk_sensorstacho_unset_color (GtkSensorsTacho *ptr_sensorstacho);
-
-/**
  * Paint the SensorsTacho widget
  * @param ptr_widget: Pointer to SensorsTacho structure; hidden behind the
  *                    widget interface
diff --git a/lib/tacho.c b/lib/tacho.c
index 19783c8..ee1fce3 100644
--- a/lib/tacho.c
+++ b/lib/tacho.c
@@ -111,26 +111,13 @@ gtk_sensorstacho_set_color (GtkSensorsTacho *ptr_sensorstacho, gchar *color)
     g_return_if_fail (ptr_sensorstacho != NULL);
 
     if (color == NULL) {
-        gtk_sensorstacho_unset_color(ptr_sensorstacho);
+        color = "#000000";
     }
-    else {
-        if (ptr_sensorstacho->color != NULL)
-            g_free(ptr_sensorstacho->color);
-
-        ptr_sensorstacho->color = g_strdup(color);
-    }
-}
-
-/* -------------------------------------------------------------------------- */
-void
-gtk_sensorstacho_unset_color (GtkSensorsTacho *ptr_sensorstacho)
-{
-    g_return_if_fail (ptr_sensorstacho != NULL);
 
     if (ptr_sensorstacho->color != NULL)
-        g_free (ptr_sensorstacho->color);
+        g_free(ptr_sensorstacho->color);
 
-    ptr_sensorstacho->color = g_strdup("#000000");
+    ptr_sensorstacho->color = g_strdup(color);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -168,7 +155,7 @@ gtk_sensorstacho_init (GtkSensorsTacho *ptr_sensorstacho)
 
     gtk_sensorstacho_unset_text(ptr_sensorstacho);
 
-    gtk_sensorstacho_unset_color(ptr_sensorstacho);
+    gtk_sensorstacho_set_color(ptr_sensorstacho, NULL);
 
     TRACE("leave gtk_sensorstacho_init\n");
 }
@@ -376,6 +363,7 @@ gtk_sensorstacho_paint (GtkWidget *widget,
     if (GTK_SENSORSTACHO(widget)->text != NULL) {
         PangoContext *ptr_style_context = gtk_widget_get_pango_context (widget);
         PangoLayout *ptr_layout = pango_layout_new (ptr_style_context);
+        /* TODO: Delete the pango layout when removing the widget? */
 
         pango_layout_set_alignment(ptr_layout, PANGO_ALIGN_CENTER);
         pango_layout_set_width (ptr_layout, width);

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


More information about the Xfce4-commits mailing list