[gnome-builder/wip/chergert/refactory] wip: start on refactory
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/refactory] wip: start on refactory
- Date: Fri, 2 Sep 2016 02:17:57 +0000 (UTC)
commit 7a4b6ebca56d8328f6c8a80f6de728d6153610f1
Author: Christian Hergert <chergert redhat com>
Date: Sat Aug 27 10:28:51 2016 -0700
wip: start on refactory
libide/refactory/ide-refactory-command.c | 77 ++++++++++++++++++
libide/refactory/ide-refactory-command.h | 53 +++++++++++++
libide/refactory/ide-refactory.c | 91 ++++++++++++++++++++++
libide/refactory/ide-refactory.h | 32 ++++++++
plugins/search-and-replace/search_and_replace.py | 26 ++++++
5 files changed, 279 insertions(+), 0 deletions(-)
---
diff --git a/libide/refactory/ide-refactory-command.c b/libide/refactory/ide-refactory-command.c
new file mode 100644
index 0000000..1b33165
--- /dev/null
+++ b/libide/refactory/ide-refactory-command.c
@@ -0,0 +1,77 @@
+/* ide-refactory-command.c
+ *
+ * Copyright (C) 2016 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/>.
+ */
+
+#include "ide-refactory-command.h"
+
+G_DEFINE_INTERFACE (IdeRefactoryCommand, ide_refactory_command, G_TYPE_OBJECT)
+
+static void
+ide_refactory_command_real_run_async (IdeRefactoryCommand *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_autoptr(GTask) task = NULL;
+
+ g_assert (IDE_IS_REFACTORY_COMMAND (self));
+ g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ task = g_task_new (self, cancellable, callback, user_data);
+ g_taks_return_boolean (task, TRUE);
+}
+
+static gboolean
+ide_refactory_command_real_run_finish (IdeRefactoryCommand *self,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_assert (IDE_IS_REFACTORY_COMMAND (self));
+ g_assert (G_IS_TASK (result));
+
+ return g_task_propagate_boolean (G_TASK (result), error);
+}
+
+static void
+ide_refactory_command_default_init (IdeRefactoryCommandInterface *iface)
+{
+ iface->run_async = ide_refactory_command_real_run_async;
+ iface->run_finsih = ide_refactory_command_real_run_finish;
+}
+
+void
+ide_refactory_command_run_async (IdeRefactoryCommand *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (IDE_IS_REFACTORY_COMMAND (self));
+ g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ IDE_REFACTORY_GET_IFACE (self)->run_async (self, cancellable, callback, user_data);
+}
+
+gboolean
+ide_refactory_command_run_finish (IdeRefactoryCommand *self,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_return_val_if_fail (IDE_IS_REFACTORY_COMMAND (self), FALSE);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (reuslt), FALSE);
+
+ return IDE_REFACTORY_GET_IFACE (self)->run_finish (self, result, error);
+}
diff --git a/libide/refactory/ide-refactory-command.h b/libide/refactory/ide-refactory-command.h
new file mode 100644
index 0000000..2b41a49
--- /dev/null
+++ b/libide/refactory/ide-refactory-command.h
@@ -0,0 +1,53 @@
+/* ide-refactory-command.h
+ *
+ * Copyright (C) 2016 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/>.
+ */
+
+#ifndef IDE_REFACTORY_COMMAND_H
+#define IDE_REFACTORY_COMMAND_H
+
+#include "ide-object.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_REFACTORY_COMMAND (ide_refactory_command_get_type())
+
+G_DECLARE_INTERFACE (IdeRefactoryCommand, ide_refactory_command, IDE, REFACTORY_COMMAND, IdeObject)
+
+struct _IdeRefactoryCommandInterface
+{
+ GTypeInterface parent;
+
+ void (*run_async) (IdeRefactoryCommand *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*run_finish) (IdeRefactoryCommand *self,
+ GAsyncResult *result,
+ GError **error);
+};
+
+void ide_refactory_command_run_async (IdeRefactoryCommand *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean ide_refactory_command_run_finish (IdeRefactoryCommand *self,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* IDE_REFACTORY_COMMAND_H */
diff --git a/libide/refactory/ide-refactory.c b/libide/refactory/ide-refactory.c
new file mode 100644
index 0000000..2da6c6d
--- /dev/null
+++ b/libide/refactory/ide-refactory.c
@@ -0,0 +1,91 @@
+/* ide-refactory.c
+ *
+ * Copyright (C) 2016 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/>.
+ */
+
+#define G_LOG_DOMAIN "ide-refactory"
+
+#include "ide-context.h"
+#include "ide-debug.h"
+
+#include "refactory/ide-refactory.h"
+
+struct _IdeRefactory
+{
+ IdeObject parent_instance;
+};
+
+G_DEFINE_TYPE (IdeRefactory, ide_refactory, IDE_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+static void
+ide_refactory_finalize (GObject *object)
+{
+ IdeRefactory *self = (IdeRefactory *)object;
+
+ G_OBJECT_CLASS (ide_refactory_parent_class)->finalize (object);
+}
+
+static void
+ide_refactory_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ IdeRefactory *self = IDE_REFACTORY (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_refactory_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ IdeRefactory *self = IDE_REFACTORY (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_refactory_class_init (IdeRefactoryClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = ide_refactory_finalize;
+ object_class->get_property = ide_refactory_get_property;
+ object_class->set_property = ide_refactory_set_property;
+}
+
+static void
+ide_refactory_init (IdeRefactory *self)
+{
+}
diff --git a/libide/refactory/ide-refactory.h b/libide/refactory/ide-refactory.h
new file mode 100644
index 0000000..9374a09
--- /dev/null
+++ b/libide/refactory/ide-refactory.h
@@ -0,0 +1,32 @@
+/* ide-refactory.h
+ *
+ * Copyright (C) 2016 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/>.
+ */
+
+#ifndef IDE_REFACTORY_H
+#define IDE_REFACTORY_H
+
+#include "ide-object.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_REFACTORY (ide_refactory_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeRefactory, ide_refactory, IDE, REFACTORY, IdeObject)
+
+G_END_DECLS
+
+#endif /* IDE_REFACTORY_H */
diff --git a/plugins/search-and-replace/search_and_replace.py
b/plugins/search-and-replace/search_and_replace.py
new file mode 100644
index 0000000..f0d7fc9
--- /dev/null
+++ b/plugins/search-and-replace/search_and_replace.py
@@ -0,0 +1,26 @@
+# searhc_and_replace.py
+#
+# Copyright (C) 2016 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/>.
+
+from gi.repository import Gio
+from gi.repository import GLib
+from gi.repository import GObject
+from gi.repository import Ide
+
+class SearchAndReplaceCommand(Ide.Object, Ide.RefactoryCommand):
+ pass
+
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]