[gnome-builder] object: fix type check and be more flexible



commit 248d73a39fff01f3d4db4eacfacf411c679c2d85
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jan 6 02:24:39 2018 -0800

    object: fix type check and be more flexible

 src/libide/ide-object.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/ide-object.c b/src/libide/ide-object.c
index 956f1c5..042530f 100644
--- a/src/libide/ide-object.c
+++ b/src/libide/ide-object.c
@@ -782,17 +782,18 @@ ide_object_message (gpointer     instance,
                     ...)
 {
   g_autofree gchar *str = NULL;
-  IdeContext *context;
+  IdeContext *context = NULL;
   va_list args;
 
   g_return_if_fail (IDE_IS_MAIN_THREAD ());
-  g_return_if_fail (GTK_IS_WIDGET (instance));
+  g_return_if_fail (!instance || IDE_IS_OBJECT (instance));
 
   va_start (args, format);
   str = g_strdup_vprintf (format, args);
   va_end (args);
 
-  context = ide_object_get_context (instance);
+  if (instance != NULL)
+    context = ide_object_get_context (instance);
 
   if (context != NULL)
     ide_context_emit_log (context, G_LOG_LEVEL_MESSAGE, str, -1);
@@ -806,17 +807,18 @@ ide_object_warning (gpointer     instance,
                     ...)
 {
   g_autofree gchar *str = NULL;
-  IdeContext *context;
+  IdeContext *context = NULL;
   va_list args;
 
   g_return_if_fail (IDE_IS_MAIN_THREAD ());
-  g_return_if_fail (GTK_IS_WIDGET (instance));
+  g_return_if_fail (!instance || IDE_IS_OBJECT (instance));
 
   va_start (args, format);
   str = g_strdup_vprintf (format, args);
   va_end (args);
 
-  context = ide_object_get_context (instance);
+  if (instance != NULL)
+    context = ide_object_get_context (instance);
 
   if (context != NULL)
     ide_context_emit_log (context, G_LOG_LEVEL_WARNING, str, -1);


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