[gnome-builder/wip/greeter] context: store langauge groups to recent info
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/greeter] context: store langauge groups to recent info
- Date: Sun, 10 May 2015 22:53:15 +0000 (UTC)
commit 29bb81509a8326abf2c70dfbd948a68f609d40dd
Author: Christian Hergert <christian hergert me>
Date: Sun May 10 15:53:10 2015 -0700
context: store langauge groups to recent info
I don't like that this is placed here, but gotta keep making progress.
I'm starting to think that we should have a way to either:
1) use the project info to create the context
2) use the project info to register as recently used
3) both
libide/ide-context.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-context.c b/libide/ide-context.c
index e1143fb..355d151 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -1311,7 +1311,7 @@ ide_context_init_add_recent (gpointer source_object,
{
IdeContext *self = source_object;
GtkRecentData recent_data = { 0 };
- const gchar *groups[] = { "X-GNOME-Builder-Project", NULL };
+ g_autoptr(GPtrArray) groups = NULL;
g_autoptr(GTask) task = NULL;
g_autofree gchar *uri = NULL;
g_autofree gchar *app_exec = NULL;
@@ -1331,12 +1331,30 @@ ide_context_init_add_recent (gpointer source_object,
recent_data.mime_type = "application/x-builder-project";
recent_data.app_name = (gchar *)ide_get_program_name ();
recent_data.app_exec = app_exec;
- recent_data.groups = (gchar **)groups;
recent_data.is_private = FALSE;
+ /* attach project description to recent info */
if (self->doap != NULL)
recent_data.description = (gchar *)ide_doap_get_shortdesc (self->doap);
+ /* attach discovered languages to recent info */
+ groups = g_ptr_array_new_with_free_func (g_free);
+ g_ptr_array_add (groups, g_strdup ("X-GNOME-Builder-Project"));
+ if (self->doap != NULL)
+ {
+ gchar **languages;
+ gsize i;
+
+ if ((languages = ide_doap_get_languages (self->doap)))
+ {
+ for (i = 0; languages [i]; i++)
+ g_ptr_array_add (groups,
+ g_strdup_printf ("X-GNOME-Builder-Language:%s", languages [i]));
+ }
+ }
+ g_ptr_array_add (groups, NULL);
+ recent_data.groups = (gchar **)groups->pdata;
+
IDE_TRACE_MSG ("Registering %s as recent project.", uri);
if (!gtk_recent_manager_add_full (self->recent_manager, uri, &recent_data))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]