[gnome-todo] plugin-dialog: protect against placeholder widget



commit 7e55da0346147d53c18e208b3a39706cffa8bbc4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed May 10 18:13:01 2017 -0300

    plugin-dialog: protect against placeholder widget
    
    The listbox now reports the placeholder widget as one
    of its children, so protect against that.

 src/gtd-plugin-dialog.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/gtd-plugin-dialog.c b/src/gtd-plugin-dialog.c
index ac0800e..9ae0887 100644
--- a/src/gtd-plugin-dialog.c
+++ b/src/gtd-plugin-dialog.c
@@ -131,12 +131,14 @@ plugin_loaded (GtdPluginManager *manager,
 
   for (l = children; l != NULL; l = l->next)
     {
-      if (gtd_plugin_dialog_row_get_info (l->data) == info)
-        {
-          gtd_plugin_dialog_row_set_plugin (l->data, activatable);
-          contains_plugin = TRUE;
-          break;
-        }
+      GtdPluginDialogRow *row = l->data;
+
+      if (!GTD_IS_PLUGIN_DIALOG_ROW (row) || gtd_plugin_dialog_row_get_info (row) != info)
+        continue;
+
+      gtd_plugin_dialog_row_set_plugin (l->data, activatable);
+      contains_plugin = TRUE;
+      break;
     }
 
   g_list_free (children);
@@ -165,11 +167,13 @@ plugin_unloaded (GtdPluginManager *manager,
 
   for (l = children; l != NULL; l = l->next)
     {
-      if (gtd_plugin_dialog_row_get_info (l->data) == info)
-        {
-          gtd_plugin_dialog_row_set_plugin (l->data, NULL);
-          break;
-        }
+      GtdPluginDialogRow *row = l->data;
+
+      if (!GTD_IS_PLUGIN_DIALOG_ROW (row) || gtd_plugin_dialog_row_get_info (row) != info)
+        continue;
+
+      gtd_plugin_dialog_row_set_plugin (l->data, NULL);
+      break;
     }
 
   g_list_free (children);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]