[xdg-desktop-portal-gnome/gbsneto/post-restore-screencast-cleanups: 13/17] screencastwindow: Simplify destruction code
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [xdg-desktop-portal-gnome/gbsneto/post-restore-screencast-cleanups: 13/17] screencastwindow: Simplify destruction code
- Date: Mon, 22 Nov 2021 14:32:03 +0000 (UTC)
commit 06c371108979069ff9a217ad13318269f330b97a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Nov 14 00:59:07 2021 -0300
screencastwindow: Simplify destruction code
Tighten these while loops.
src/screencastwidget.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/src/screencastwidget.c b/src/screencastwidget.c
index 6e2cd99..73cb07a 100644
--- a/src/screencastwidget.c
+++ b/src/screencastwidget.c
@@ -177,14 +177,8 @@ update_windows_list (ScreenCastWidget *widget)
GList *windows;
GList *l;
- child = gtk_widget_get_first_child (GTK_WIDGET (window_list));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_list_box_remove (window_list, child);
- child = next;
- }
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (window_list))) != NULL)
+ gtk_list_box_remove (window_list, child);
toplevel = gtk_widget_get_ancestor (GTK_WIDGET (widget), GTK_TYPE_WINDOW);
if (!toplevel)
@@ -212,14 +206,8 @@ update_monitors_list (ScreenCastWidget *widget)
GList *logical_monitors;
GList *l;
- child = gtk_widget_get_first_child (GTK_WIDGET (monitor_list));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_list_box_remove (monitor_list, child);
- child = next;
- }
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (monitor_list))) != NULL)
+ gtk_list_box_remove (monitor_list, child);
logical_monitors =
display_state_tracker_get_logical_monitors (widget->display_state_tracker);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]