[gnome-builder: 116/139] recent: add recent tracking plugin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder: 116/139] recent: add recent tracking plugin
- Date: Thu, 10 Jan 2019 04:27:04 +0000 (UTC)
commit 07d3658752c6cf4a9b284c43ef6c3b59670122d1
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 9 17:35:42 2019 -0800
recent: add recent tracking plugin
This extracts recent tracking for the greeter into a plugin to be more
self contained.
src/plugins/recent/gbp-recent-project-row.c | 3 +-
src/plugins/recent/gbp-recent-project-row.h | 2 +-
src/plugins/recent/gbp-recent-section.c | 119 ++++++++++--
src/plugins/recent/gbp-recent-section.ui | 2 +
src/plugins/recent/gbp-recent-workbench-addin.c | 248 ++++++++++++++++++++++++
src/plugins/recent/gbp-recent-workbench-addin.h | 31 +++
src/plugins/recent/meson.build | 20 +-
src/plugins/recent/recent-plugin.c | 15 +-
src/plugins/recent/recent.gresource.xml | 4 +-
src/plugins/recent/recent.plugin | 11 +-
10 files changed, 416 insertions(+), 39 deletions(-)
---
diff --git a/src/plugins/recent/gbp-recent-project-row.c b/src/plugins/recent/gbp-recent-project-row.c
index 4adfa172b..cf035b990 100644
--- a/src/plugins/recent/gbp-recent-project-row.c
+++ b/src/plugins/recent/gbp-recent-project-row.c
@@ -336,8 +336,7 @@ gbp_recent_project_row_class_init (GbpRecentProjectRowClass *klass)
object_class->get_property = gbp_recent_project_row_get_property;
object_class->set_property = gbp_recent_project_row_set_property;
- gtk_widget_class_set_template_from_resource (widget_class,
-
"/org/gnome/builder/plugins/recent-plugin/gbp-recent-project-row.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/plugins/recent/gbp-recent-project-row.ui");
gtk_widget_class_bind_template_child (widget_class, GbpRecentProjectRow, checkbox);
gtk_widget_class_bind_template_child (widget_class, GbpRecentProjectRow, date_label);
gtk_widget_class_bind_template_child (widget_class, GbpRecentProjectRow, description_label);
diff --git a/src/plugins/recent/gbp-recent-project-row.h b/src/plugins/recent/gbp-recent-project-row.h
index 0b3e13705..87cf92d8d 100644
--- a/src/plugins/recent/gbp-recent-project-row.h
+++ b/src/plugins/recent/gbp-recent-project-row.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-projects.h>
G_BEGIN_DECLS
diff --git a/src/plugins/recent/gbp-recent-section.c b/src/plugins/recent/gbp-recent-section.c
index 5d0daac40..0a375e919 100644
--- a/src/plugins/recent/gbp-recent-section.c
+++ b/src/plugins/recent/gbp-recent-section.c
@@ -20,7 +20,8 @@
#define G_LOG_DOMAIN "gbp-recent-section"
-#include <ide.h>
+#include <glib/gi18n.h>
+#include <libide-greeter.h>
#include "gbp-recent-project-row.h"
#include "gbp-recent-section.h"
@@ -243,6 +244,8 @@ static gboolean
can_purge_project_directory (GFile *directory)
{
g_autoptr(GFile) projects_dir = NULL;
+ g_autoptr(GFile) home_dir = NULL;
+ g_autoptr(GFile) downloads_dir = NULL;
g_autofree gchar *uri = NULL;
GFileType file_type;
@@ -257,8 +260,9 @@ can_purge_project_directory (GFile *directory)
return FALSE;
}
- projects_dir = ide_application_get_projects_directory (IDE_APPLICATION_DEFAULT);
- g_assert (G_IS_FILE (projects_dir));
+ projects_dir = g_file_new_for_path (ide_get_projects_dir ());
+ home_dir = g_file_new_for_path (g_get_home_dir ());
+ downloads_dir = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD));
/* Refuse to delete anything outside of projects dir to be paranoid */
if (!g_file_has_prefix (directory, projects_dir))
@@ -267,9 +271,11 @@ can_purge_project_directory (GFile *directory)
return FALSE;
}
- if (g_file_equal (directory, projects_dir))
+ if (g_file_equal (directory, projects_dir) ||
+ g_file_equal (directory, home_dir) ||
+ g_file_equal (directory, downloads_dir))
{
- g_critical ("Refusing to purge the projects directory");
+ g_critical ("Refusing to purge the project's directory");
return FALSE;
}
@@ -307,6 +313,35 @@ gbp_recent_section_reap_cb (GObject *object,
IDE_EXIT;
}
+static void
+gbp_recent_section_remove_file (DzlDirectoryReaper *reaper,
+ GFile *file,
+ GtkTextBuffer *buffer)
+{
+ GtkTextIter iter;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (DZL_IS_DIRECTORY_REAPER (reaper));
+ g_assert (G_IS_FILE (file));
+ g_assert (GTK_IS_TEXT_BUFFER (buffer));
+
+ gtk_text_buffer_get_end_iter (buffer, &iter);
+
+ if (g_file_is_native (file))
+ {
+ /* translators: %s is replaced with the path of the file to be deleted and \n for a new line */
+ g_autofree gchar *formatted = g_strdup_printf (_("Removing %s\n"), g_file_peek_path (file));
+ gtk_text_buffer_insert (buffer, &iter, formatted, -1);
+ }
+ else
+ {
+ /* translators: %s is replaced with the path of the file to be deleted and \n for a new line */
+ g_autofree gchar *uri = g_file_get_uri (file);
+ g_autofree gchar *formatted = g_strdup_printf (_("Removing %s\n"), uri);
+ gtk_text_buffer_insert (buffer, &iter, formatted, -1);
+ }
+}
+
static void
gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
gboolean purge_sources)
@@ -315,16 +350,19 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
g_autoptr(DzlDirectoryReaper) reaper = NULL;
g_autoptr(GPtrArray) directories = NULL;
IdeRecentProjects *projects;
+ GtkWidget *workspace;
GList *infos = NULL;
g_assert (GBP_IS_RECENT_SECTION (self));
+ workspace = gtk_widget_get_toplevel (GTK_WIDGET (section));
+
gtk_container_foreach (GTK_CONTAINER (self->listbox),
gbp_recent_section_collect_selected_cb,
&infos);
/* Remove the projects from the list of recent projects */
- projects = ide_application_get_recent_projects (IDE_APPLICATION_DEFAULT);
+ projects = ide_recent_projects_get_default ();
ide_recent_projects_remove (projects, infos);
/* Now asynchronously remove all the project files */
@@ -343,6 +381,18 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
g_assert (G_IS_FILE (directory) || G_IS_FILE (file));
+ /* If the IdeProjectInfo:file is a directory, refuse to delete the
+ * pre-stated directory as it might be a parent which is really Home, or
+ * something like that. This just helps ensure we're a bit safer when
+ * dealing with user data.
+ */
+ if (file != NULL &&
+ g_file_query_file_type (file, 0, NULL) == G_FILE_TYPE_DIRECTORY)
+ {
+ if (directory == NULL || g_file_has_prefix (file, directory))
+ directory = file;
+ }
+
if (directory == NULL)
{
if (g_file_query_file_type (file, 0, NULL) == G_FILE_TYPE_DIRECTORY)
@@ -368,7 +418,7 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
* might expect to be reomved.
*/
- id = ide_project_create_id (name);
+ id = ide_create_project_id (name);
if (name != NULL)
{
@@ -391,6 +441,48 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
clear_settings_with_path ("org.gnome.builder.project", path);
}
+ if (purge_sources)
+ {
+ GtkDialog *dialog;
+ GtkWidget *scroller;
+ GtkWidget *view;
+ GtkWidget *content_area;
+ GtkTextBuffer *buffer;
+
+ dialog = GTK_DIALOG (gtk_dialog_new ());
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Removing Files…"));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (workspace));
+ gtk_dialog_add_button (dialog, _("Close"), GTK_RESPONSE_CLOSE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 700, 500);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 12);
+ gtk_box_set_spacing (GTK_BOX (content_area), 12);
+
+ scroller = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_set_vexpand (scroller, TRUE);
+ gtk_container_add (GTK_CONTAINER (content_area), scroller);
+ gtk_widget_show (scroller);
+
+ view = gtk_text_view_new ();
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+ gtk_container_add (GTK_CONTAINER (scroller), view);
+ gtk_widget_show (view);
+
+ g_signal_connect_object (reaper,
+ "remove-file",
+ G_CALLBACK (gbp_recent_section_remove_file),
+ buffer,
+ 0);
+
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
+ gtk_window_present (GTK_WINDOW (dialog));
+ }
+
dzl_directory_reaper_execute_async (reaper,
NULL,
gbp_recent_section_reap_cb,
@@ -495,7 +587,7 @@ gbp_recent_section_constructed (GObject *object)
G_OBJECT_CLASS (gbp_recent_section_parent_class)->constructed (object);
- projects = ide_application_get_recent_projects (IDE_APPLICATION_DEFAULT);
+ projects = ide_recent_projects_get_default ();
gtk_list_box_bind_model (self->listbox,
G_LIST_MODEL (projects),
@@ -538,8 +630,7 @@ gbp_recent_section_class_init (GbpRecentSectionClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_css_name (widget_class, "recent");
- gtk_widget_class_set_template_from_resource (widget_class,
-
"/org/gnome/builder/plugins/recent-plugin/gbp-recent-section.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/plugins/recent/gbp-recent-section.ui");
gtk_widget_class_bind_template_child (widget_class, GbpRecentSection, listbox);
gtk_widget_class_bind_template_callback (widget_class, gbp_recent_section_row_activated);
@@ -558,10 +649,10 @@ on_button_press_event_cb (GtkListBox *listbox,
if (ev->button == GDK_BUTTON_SECONDARY)
{
- dzl_gtk_widget_action (GTK_WIDGET (self),
- "greeter",
- "state",
- g_variant_new_string ("selection"));
+ GtkWidget *workspace;
+
+ workspace = gtk_widget_get_ancestor (GTK_WIDGET (self), IDE_TYPE_GREETER_WORKSPACE);
+ ide_greeter_workspace_set_selection_mode (IDE_GREETER_WORKSPACE (workspace), TRUE);
if ((row = gtk_list_box_get_row_at_y (listbox, ev->y)))
{
diff --git a/src/plugins/recent/gbp-recent-section.ui b/src/plugins/recent/gbp-recent-section.ui
index bbe07d2a6..0a6e84bd5 100644
--- a/src/plugins/recent/gbp-recent-section.ui
+++ b/src/plugins/recent/gbp-recent-section.ui
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GbpRecentSection" parent="GtkBin">
+ <property name="halign">center</property>
<child>
<object class="GtkBox">
+ <property name="hexpand">true</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="visible">true</property>
diff --git a/src/plugins/recent/gbp-recent-workbench-addin.c b/src/plugins/recent/gbp-recent-workbench-addin.c
new file mode 100644
index 000000000..927a8c6ea
--- /dev/null
+++ b/src/plugins/recent/gbp-recent-workbench-addin.c
@@ -0,0 +1,248 @@
+/* gbp-recent-workbench-addin.c
+ *
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-recent-workbench-addin"
+
+#include "config.h"
+
+#include <libide-projects.h>
+#include <libide-gui.h>
+
+#include "gbp-recent-workbench-addin.h"
+
+struct _GbpRecentWorkbenchAddin
+{
+ GObject parent_instance;
+ IdeWorkbench *workbench;
+};
+
+static gboolean
+directory_is_ignored (GFile *file)
+{
+ g_autofree gchar *relative_path = NULL;
+ g_autoptr(GFile) downloads_dir = NULL;
+ g_autoptr(GFile) home_dir = NULL;
+ GFileType file_type;
+
+ g_assert (G_IS_FILE (file));
+
+ home_dir = g_file_new_for_path (g_get_home_dir ());
+ relative_path = g_file_get_relative_path (home_dir, file);
+ file_type = g_file_query_file_type (file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL);
+
+ if (!g_file_has_prefix (file, home_dir))
+ return TRUE;
+
+ downloads_dir = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD));
+
+ if (downloads_dir != NULL &&
+ (g_file_equal (file, downloads_dir) ||
+ g_file_has_prefix (file, downloads_dir)))
+ return TRUE;
+
+ /* realtive_path should be valid here because we are within the home_prefix. */
+ g_assert (relative_path != NULL);
+
+ /*
+ * Ignore dot directories, except .local.
+ * We've had too many bug reports with people creating things
+ * like gnome-shell extensions in their .local directory.
+ */
+ if (relative_path[0] == '.' &&
+ !g_str_has_prefix (relative_path, ".local"G_DIR_SEPARATOR_S))
+ return TRUE;
+
+ if (file_type != G_FILE_TYPE_DIRECTORY)
+ {
+ g_autoptr(GFile) parent = g_file_get_parent (file);
+
+ if (g_file_equal (home_dir, parent))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+gbp_recent_workbench_addin_add_recent (GbpRecentWorkbenchAddin *self,
+ IdeProjectInfo *project_info)
+{
+ g_autofree gchar *recent_projects_path = NULL;
+ g_autoptr(GBookmarkFile) projects_file = NULL;
+ g_autoptr(GPtrArray) groups = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *uri = NULL;
+ g_autofree gchar *app_exec = NULL;
+ g_autofree gchar *dir = NULL;
+ IdeBuildSystem *build_system;
+ IdeDoap *doap;
+ GFile *file;
+ GFile *directory;
+
+ g_assert (GBP_IS_RECENT_WORKBENCH_ADDIN (self));
+ g_assert (IDE_IS_WORKBENCH (self->workbench));
+ g_assert (IDE_IS_PROJECT_INFO (project_info));
+
+ IDE_ENTRY;
+
+ if (!(file = ide_project_info_get_file (project_info)) ||
+ directory_is_ignored (file))
+ IDE_EXIT;
+
+ recent_projects_path = g_build_filename (g_get_user_data_dir (),
+ ide_get_program_name (),
+ IDE_RECENT_PROJECTS_BOOKMARK_FILENAME,
+ NULL);
+
+ projects_file = g_bookmark_file_new ();
+
+ if (!g_bookmark_file_load_from_file (projects_file, recent_projects_path, &error))
+ {
+ /*
+ * If there was an error loading the file and the error is not "File does not
+ * exist" then stop saving operation
+ */
+ if (error != NULL &&
+ !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+ {
+ g_warning ("Unable to open recent projects \"%s\" file: %s",
+ recent_projects_path, error->message);
+ IDE_EXIT;
+ }
+ }
+
+ uri = g_file_get_uri (file);
+ app_exec = g_strdup_printf ("%s -p %%p", ide_get_program_name ());
+
+ g_bookmark_file_set_title (projects_file, uri, ide_project_info_get_name (project_info));
+ g_bookmark_file_set_mime_type (projects_file, uri, "application/x-builder-project");
+ g_bookmark_file_add_application (projects_file, uri, ide_get_program_name (), app_exec);
+ g_bookmark_file_set_is_private (projects_file, uri, FALSE);
+
+ doap = ide_project_info_get_doap (project_info);
+
+ /* attach project description to recent info */
+ if (doap != NULL)
+ g_bookmark_file_set_description (projects_file, uri, ide_doap_get_shortdesc (doap));
+
+ /* attach discovered languages to recent info */
+ groups = g_ptr_array_new_with_free_func (g_free);
+ g_ptr_array_add (groups, g_strdup (IDE_RECENT_PROJECTS_GROUP));
+ if (doap != NULL)
+ {
+ gchar **languages;
+
+ if ((languages = ide_doap_get_languages (doap)))
+ {
+ for (guint i = 0; languages[i]; i++)
+ g_ptr_array_add (groups,
+ g_strdup_printf ("%s%s",
+ IDE_RECENT_PROJECTS_LANGUAGE_GROUP_PREFIX,
+ languages[i]));
+ }
+ }
+
+ g_bookmark_file_set_groups (projects_file, uri, (const gchar **)groups->pdata, groups->len);
+
+ build_system = ide_workbench_get_build_system (self->workbench);
+
+ if (build_system != NULL)
+ {
+ g_autofree gchar *build_system_name = NULL;
+ g_autofree gchar *build_system_group = NULL;
+
+ build_system_name = ide_build_system_get_display_name (build_system);
+ build_system_group = g_strdup_printf ("%s%s", IDE_RECENT_PROJECTS_BUILD_SYSTEM_GROUP_PREFIX,
build_system_name);
+ g_bookmark_file_add_group (projects_file, uri, build_system_group);
+ }
+
+ if ((directory = ide_project_info_get_directory (project_info)))
+ {
+ g_autofree gchar *dir_group = NULL;
+ g_autofree gchar *diruri = g_file_get_uri (directory);
+
+ dir_group = g_strdup_printf ("%s%s", IDE_RECENT_PROJECTS_DIRECTORY, diruri);
+ g_bookmark_file_add_group (projects_file, uri, dir_group);
+ }
+
+ IDE_TRACE_MSG ("Registering %s as recent project.", uri);
+
+ /* ensure the containing directory exists */
+ dir = g_path_get_dirname (recent_projects_path);
+ g_mkdir_with_parents (dir, 0750);
+
+ if (!g_bookmark_file_to_file (projects_file, recent_projects_path, &error))
+ {
+ g_warning ("Unable to save recent projects %s file: %s",
+ recent_projects_path, error->message);
+ g_clear_error (&error);
+ }
+
+ IDE_EXIT;
+}
+
+
+static void
+gbp_recent_workbench_addin_project_loaded (IdeWorkbenchAddin *addin,
+ IdeProjectInfo *project_info)
+{
+ GbpRecentWorkbenchAddin *self = (GbpRecentWorkbenchAddin *)addin;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (GBP_IS_RECENT_WORKBENCH_ADDIN (self));
+ g_assert (IDE_IS_PROJECT_INFO (project_info));
+
+ gbp_recent_workbench_addin_add_recent (self, project_info);
+}
+
+static void
+gbp_recent_workbench_addin_load (IdeWorkbenchAddin *addin,
+ IdeWorkbench *workbench)
+{
+ GBP_RECENT_WORKBENCH_ADDIN (addin)->workbench = workbench;
+}
+
+static void
+gbp_recent_workbench_addin_unload (IdeWorkbenchAddin *addin,
+ IdeWorkbench *workbench)
+{
+ GBP_RECENT_WORKBENCH_ADDIN (addin)->workbench = NULL;
+}
+
+static void
+workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface)
+{
+ iface->load = gbp_recent_workbench_addin_load;
+ iface->unload = gbp_recent_workbench_addin_unload;
+ iface->project_loaded = gbp_recent_workbench_addin_project_loaded;
+}
+
+G_DEFINE_TYPE_WITH_CODE (GbpRecentWorkbenchAddin, gbp_recent_workbench_addin, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN, workbench_addin_iface_init))
+
+static void
+gbp_recent_workbench_addin_class_init (GbpRecentWorkbenchAddinClass *klass)
+{
+}
+
+static void
+gbp_recent_workbench_addin_init (GbpRecentWorkbenchAddin *self)
+{
+}
diff --git a/src/plugins/recent/gbp-recent-workbench-addin.h b/src/plugins/recent/gbp-recent-workbench-addin.h
new file mode 100644
index 000000000..8023ea4f8
--- /dev/null
+++ b/src/plugins/recent/gbp-recent-workbench-addin.h
@@ -0,0 +1,31 @@
+/* gbp-recent-workbench-addin.h
+ *
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_RECENT_WORKBENCH_ADDIN (gbp_recent_workbench_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpRecentWorkbenchAddin, gbp_recent_workbench_addin, GBP, RECENT_WORKBENCH_ADDIN,
GObject)
+
+G_END_DECLS
diff --git a/src/plugins/recent/meson.build b/src/plugins/recent/meson.build
index e8501df05..382b996ab 100644
--- a/src/plugins/recent/meson.build
+++ b/src/plugins/recent/meson.build
@@ -1,16 +1,14 @@
-recent_resources = gnome.compile_resources(
+plugins_sources += files([
+ 'recent-plugin.c',
+ 'gbp-recent-project-row.c',
+ 'gbp-recent-section.c',
+ 'gbp-recent-workbench-addin.c',
+])
+
+plugin_recent_resources = gnome.compile_resources(
'recent-resources',
'recent.gresource.xml',
c_name: 'gbp_recent',
)
-recent_sources = [
- 'recent-plugin.c',
- 'gbp-recent-project-row.c',
- 'gbp-recent-project-row.h',
- 'gbp-recent-section.c',
- 'gbp-recent-section.h',
-]
-
-gnome_builder_plugins_sources += files(recent_sources)
-gnome_builder_plugins_sources += recent_resources[0]
+plugins_sources += plugin_recent_resources[0]
diff --git a/src/plugins/recent/recent-plugin.c b/src/plugins/recent/recent-plugin.c
index 6e7b44c1c..47ae53258 100644
--- a/src/plugins/recent/recent-plugin.c
+++ b/src/plugins/recent/recent-plugin.c
@@ -18,15 +18,24 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+#define G_LOG_DOMAIN "recent-plugin"
+
+#include "config.h"
+
#include <libpeas/peas.h>
-#include <ide.h>
+#include <libide-greeter.h>
+#include <libide-gui.h>
#include "gbp-recent-section.h"
+#include "gbp-recent-workbench-addin.h"
-void
-gbp_recent_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_recent_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_GREETER_SECTION,
GBP_TYPE_RECENT_SECTION);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_WORKBENCH_ADDIN,
+ GBP_TYPE_RECENT_WORKBENCH_ADDIN);
}
diff --git a/src/plugins/recent/recent.gresource.xml b/src/plugins/recent/recent.gresource.xml
index 587e695a1..d875645e8 100644
--- a/src/plugins/recent/recent.gresource.xml
+++ b/src/plugins/recent/recent.gresource.xml
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/builder/plugins">
+ <gresource prefix="/plugins/recent">
<file>recent.plugin</file>
- </gresource>
- <gresource prefix="/org/gnome/builder/plugins/recent-plugin">
<file>gbp-recent-project-row.ui</file>
<file>gbp-recent-section.ui</file>
</gresource>
diff --git a/src/plugins/recent/recent.plugin b/src/plugins/recent/recent.plugin
index d5c3385d3..a721610e3 100644
--- a/src/plugins/recent/recent.plugin
+++ b/src/plugins/recent/recent.plugin
@@ -1,9 +1,10 @@
[Plugin]
-Module=recent-plugin
-Name=Recent Projects
-Description=Shows recent projects in the greeter
Authors=Christian Hergert <christian hergert me>
-Copyright=Copyright © 2017 Christian Hergert
Builtin=true
+Copyright=Copyright © 2017-2018 Christian Hergert
+Description=Shows recent projects in the greeter
+Embedded=_gbp_recent_register_types
Hidden=true
-Embedded=gbp_recent_register_types
+Module=recent
+Depends=greeter;
+Name=Recent Projects
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]