[gnome-builder/wip/chergert/debugger] debugger: add IdeDebugger::get_name() vfunc
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/debugger] debugger: add IdeDebugger::get_name() vfunc
- Date: Wed, 22 Mar 2017 22:32:36 +0000 (UTC)
commit 64b83e007670af5e1dbaecc674548b9b9f0d71eb
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 22 15:28:58 2017 -0700
debugger: add IdeDebugger::get_name() vfunc
libide/debugger/ide-debugger.c | 44 +++++++++++++++++++++++++++++++++++++--
libide/debugger/ide-debugger.h | 14 +++++++-----
2 files changed, 49 insertions(+), 9 deletions(-)
---
diff --git a/libide/debugger/ide-debugger.c b/libide/debugger/ide-debugger.c
index f86025e..f6016ee 100644
--- a/libide/debugger/ide-debugger.c
+++ b/libide/debugger/ide-debugger.c
@@ -25,9 +25,25 @@
G_DEFINE_INTERFACE (IdeDebugger, ide_debugger, IDE_TYPE_OBJECT)
+gchar *
+ide_debugger_real_get_name (IdeDebugger *self)
+{
+ return g_strdup (G_OBJECT_TYPE_NAME (self));
+}
+
+static gboolean
+ide_debugger_real_supports_runner (IdeDebugger *self,
+ IdeRunner *runner,
+ gint *priority)
+{
+ return FALSE;
+}
+
static void
ide_debugger_default_init (IdeDebuggerInterface *iface)
{
+ iface->get_name = ide_debugger_real_get_name;
+ iface->supports_runner = ide_debugger_real_supports_runner;
}
/**
@@ -47,7 +63,7 @@ ide_debugger_supports_runner (IdeDebugger *self,
IdeRunner *runner,
gint *priority)
{
- gboolean ret = FALSE;
+ gboolean ret;
g_return_val_if_fail (IDE_IS_DEBUGGER (self), FALSE);
g_return_val_if_fail (IDE_IS_RUNNER (runner), FALSE);
@@ -55,8 +71,7 @@ ide_debugger_supports_runner (IdeDebugger *self,
if (priority != NULL)
*priority = G_MAXINT;
- if (IDE_DEBUGGER_GET_IFACE (self)->supports_runner)
- ret = IDE_DEBUGGER_GET_IFACE (self)->supports_runner (self, runner, priority);
+ ret = IDE_DEBUGGER_GET_IFACE (self)->supports_runner (self, runner, priority);
IDE_TRACE_MSG ("Chceking if %s supports runner %s",
G_OBJECT_TYPE_NAME (self),
@@ -64,3 +79,26 @@ ide_debugger_supports_runner (IdeDebugger *self,
return ret;
}
+
+/**
+ * ide_debugger_get_name:
+ * @self: A #IdeDebugger
+ *
+ * Gets the proper name of the debugger to display to the user.
+ *
+ * Returns: (transfer full): the display name for the debugger.
+ */
+gchar *
+ide_debugger_get_name (IdeDebugger *self)
+{
+ gchar *ret = NULL;
+
+ g_return_val_if_fail (IDE_IS_DEBUGGER (self), NULL);
+
+ ret = IDE_DEBUGGER_GET_IFACE (self)->get_name (self);
+
+ if (ret == NULL)
+ ret = g_strdup (G_OBJECT_TYPE_NAME (self));
+
+ return ret;
+}
diff --git a/libide/debugger/ide-debugger.h b/libide/debugger/ide-debugger.h
index bd974a9..5b50365 100644
--- a/libide/debugger/ide-debugger.h
+++ b/libide/debugger/ide-debugger.h
@@ -31,14 +31,16 @@ struct _IdeDebuggerInterface
{
GTypeInterface parent_iface;
- gboolean (*supports_runner) (IdeDebugger *self,
- IdeRunner *runner,
- gint *priority);
+ gchar *(*get_name) (IdeDebugger *self);
+ gboolean (*supports_runner) (IdeDebugger *self,
+ IdeRunner *runner,
+ gint *priority);
};
-gboolean ide_debugger_supports_runner (IdeDebugger *self,
- IdeRunner *runner,
- gint *priority);
+gchar *ide_debugger_get_name (IdeDebugger *self);
+gboolean ide_debugger_supports_runner (IdeDebugger *self,
+ IdeRunner *runner,
+ gint *priority);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]