[PATCH 4/4] clock: binary: remove redundant code

Felipe Contreras felipe.contreras at gmail.com
Thu Aug 4 00:30:35 CEST 2022


The code does exactly the same whether or not the insensitive flag is
set, so there's no point in checking it.

Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
---
 plugins/clock/clock-binary.c | 48 +++++++++---------------------------
 1 file changed, 12 insertions(+), 36 deletions(-)

diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c
index 10d69d03..7a9ce6a1 100644
--- a/plugins/clock/clock-binary.c
+++ b/plugins/clock/clock-binary.c
@@ -274,24 +274,12 @@ xfce_clock_binary_draw_true_binary (XfceClockBinary *binary,
 
   ctx = gtk_widget_get_style_context (GTK_WIDGET (binary));
 
-  if (G_UNLIKELY (gtk_widget_get_state_flags (GTK_WIDGET (binary)) & GTK_STATE_FLAG_INSENSITIVE))
-    {
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &inactive_rgba);
-      inactive_rgba.alpha = 0.2;
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &active_rgba);
-      active_rgba.alpha = 1.0;
-    }
-  else
-    {
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &inactive_rgba);
-      inactive_rgba.alpha = 0.2;
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &active_rgba);
-      active_rgba.alpha = 1.0;
-    }
+  gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
+                               &inactive_rgba);
+  inactive_rgba.alpha = 0.2;
+  gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
+                               &active_rgba);
+  active_rgba.alpha = 1.0;
 
   time = clock_time_get_time (binary->time);
 
@@ -371,24 +359,12 @@ xfce_clock_binary_draw_binary (XfceClockBinary *binary,
 
   ctx = gtk_widget_get_style_context (GTK_WIDGET (binary));
 
-  if (G_UNLIKELY (gtk_widget_get_state_flags (GTK_WIDGET (binary)) & GTK_STATE_FLAG_INSENSITIVE))
-    {
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &inactive_rgba);
-      inactive_rgba.alpha = 0.2;
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &active_rgba);
-      active_rgba.alpha = 1.0;
-    }
-  else
-    {
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &inactive_rgba);
-      inactive_rgba.alpha = 0.2;
-      gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                                   &active_rgba);
-      active_rgba.alpha = 1.0;
-    }
+  gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
+                               &inactive_rgba);
+  inactive_rgba.alpha = 0.2;
+  gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
+                               &active_rgba);
+  active_rgba.alpha = 1.0;
 
   time = clock_time_get_time (binary->time);
 
-- 
2.37.1.313.g01a229ef5e



More information about the Xfce4-dev mailing list