[anjuta] search: Added filter filter command
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] search: Added filter filter command
- Date: Sun, 12 Feb 2012 12:27:40 +0000 (UTC)
commit e07a231ff2ac4d3a5802e29420c0648e94c1b172
Author: Johannes Schmid <jhs gnome org>
Date: Sun Feb 12 11:43:40 2012 +0100
search: Added filter filter command
plugins/document-manager/Makefile.am | 4 +-
.../document-manager/search-filter-file-command.c | 154 ++++++++++++++++++++
.../document-manager/search-filter-file-command.h | 55 +++++++
3 files changed, 212 insertions(+), 1 deletions(-)
---
diff --git a/plugins/document-manager/Makefile.am b/plugins/document-manager/Makefile.am
index b962516..b670d71 100644
--- a/plugins/document-manager/Makefile.am
+++ b/plugins/document-manager/Makefile.am
@@ -50,7 +50,9 @@ libanjuta_document_manager_la_SOURCES= \
search-files.c \
search-files.h \
search-file-command.c \
- search-file-command.h
+ search-file-command.h \
+ search-filter-file-command.c \
+ search-filter-file-command.h
gsettings_in_file = org.gnome.anjuta.document-manager.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
diff --git a/plugins/document-manager/search-filter-file-command.c b/plugins/document-manager/search-filter-file-command.c
new file mode 100644
index 0000000..44cad55
--- /dev/null
+++ b/plugins/document-manager/search-filter-file-command.c
@@ -0,0 +1,154 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) Johannes Schmid 2012 <jhs Obelix>
+ *
+ * anjuta 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.
+ *
+ * anjuta 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 "search-filter-file-command.h"
+
+struct _SearchFileFilterCommandPrivate
+{
+ GFile* file,
+ const gchar* mime_types;
+}
+
+enum
+{
+ PROP_0,
+
+ PROP_FILE,
+ PROP_MIME_TYPES
+};
+
+
+
+static guint
+search_filter_file_command_run (void)
+{
+ /* TODO: Add private function implementation here */
+}
+
+G_DEFINE_TYPE (SearchFilterFileCommand, search_filter_file_command, ANJUTA_TYPE_ASYNC_COMMAND);
+
+static void
+search_filter_file_command_init (SearchFilterFileCommand *cmd)
+{
+ cmd->priv = G_TYPE_INSTANCE_GET_PRIVATE (cmd,
+ SEARCH_TYPE_FILE_COMMAND,
+ SearchFileCommandPrivate);
+}
+
+static void
+search_filter_file_command_finalize (GObject *object)
+{
+ SearchFilterFileCommand* cmd = SEARCH_FILTER_FILE_COMMAND(object);
+
+ if (cmd->priv->file)
+ g_object_unref (cmd->priv->file);
+ g_free (cmd->priv->mime_types);
+
+ G_OBJECT_CLASS (search_filter_file_command_parent_class)->finalize (object);
+}
+
+static void
+search_filter_file_command_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ SearchFilterFileCommand* cmd;
+
+ g_return_if_fail (SEARCH_IS_FILTER_FILE_COMMAND (object));
+
+ cmd = SEARCH_FILTER_FILE_COMMAND(object);
+
+ switch (prop_id)
+ {
+ case PROP_FILE:
+ if (cmd->priv->file)
+ g_object_unref (cmd->priv->file);
+ cmd->priv->file = G_FILE(g_value_get_object (value));
+ break;
+ case PROP_MIME_TYPES:
+ g_free (cmd->priv->mime_types);
+ cmd->priv->mime_types = g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+search_filter_file_command_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ SearchFilterFileCommand* cmd;
+
+ g_return_if_fail (SEARCH_IS_FILTER_FILE_COMMAND (object));
+
+ cmd = SEARCH_FILTER_FILE_COMMAND(object);
+
+ switch (prop_id)
+ {
+ case PROP_FILE:
+ g_value_set_object (value, cmd->priv->file);
+ break;
+ case PROP_MIME_TYPES:
+ g_value_set_string (value, cmd->priv->mime_types);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+search_filter_file_command_class_init (SearchFilterFileCommandClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ AnjutaAsyncCommandClass* parent_class = ANJUTA_ASYNC_COMMAND_CLASS (klass);
+
+ object_class->finalize = search_filter_file_command_finalize;
+ object_class->set_property = search_filter_file_command_set_property;
+ object_class->get_property = search_filter_file_command_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_FILE,
+ g_param_spec_object ("file",
+ "",
+ "",
+ G_TYPE_FILE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class,
+ PROP_MIME_TYPES,
+ g_param_spec_pointer ("mime-types",
+ "",
+ "",
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_type_class_add_private (klass, sizeof (SearchFilterFileCommandPrivate));
+}
+
+
+SearchFilterFileCommand*
+search_filter_file_command_new (GFile* file, const gchar* mime_types)
+{
+ SearchFilterFileCommand* cmd;
+
+ cmd = SEARCH_FILTER_FILE_COMMAND (g_object_new (SEARCH_TYPE_FILE_COMMAND,
+ "file", file,
+ "mime-types", mime_types,
+ NULL));
+ return cmd;
+}
diff --git a/plugins/document-manager/search-filter-file-command.h b/plugins/document-manager/search-filter-file-command.h
new file mode 100644
index 0000000..92bb2dc
--- /dev/null
+++ b/plugins/document-manager/search-filter-file-command.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) Johannes Schmid 2012 <jhs Obelix>
+ *
+ * anjuta 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.
+ *
+ * anjuta 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 _SEARCH_FILTER_FILE_COMMAND_H_
+#define _SEARCH_FILTER_FILE_COMMAND_H_
+
+#include <libanjuta/anjuta-async-command.h>
+
+G_BEGIN_DECLS
+
+#define SEARCH_TYPE_FILTER_FILE_COMMAND (search_filter_file_command_get_type ())
+#define SEARCH_FILTER_FILE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEARCH_TYPE_FILTER_FILE_COMMAND, SearchFilterFileCommand))
+#define SEARCH_FILTER_FILE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEARCH_TYPE_FILTER_FILE_COMMAND, SearchFilterFileCommandClass))
+#define SEARCH_IS_FILTER_FILE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEARCH_TYPE_FILTER_FILE_COMMAND))
+#define SEARCH_IS_FILTER_FILE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEARCH_TYPE_FILTER_FILE_COMMAND))
+#define SEARCH_FILTER_FILE_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEARCH_TYPE_FILTER_FILE_COMMAND, SearchFilterFileCommandClass))
+
+typedef struct _SearchFilterFileCommandClass SearchFilterFileCommandClass;
+typedef struct _SearchFilterFileCommand SearchFilterFileCommand;
+typedef struct _SearchFilterFileCommandPrivate SearchFilterFileCommandPrivate;
+
+struct _SearchFilterFileCommandClass
+{
+ AnjutaAsyncCommandClass parent_class;
+};
+
+struct _SearchFilterFileCommand
+{
+ AnjutaAsyncCommand parent_instance;
+
+ SearchFilterFileCommandPrivate* priv;
+};
+
+GType search_filter_file_command_get_type (void) G_GNUC_CONST;
+SearchFilterFileCommand* search_filter_file_command_new (GFile* file, const gchar* mime_types);
+
+G_END_DECLS
+
+#endif /* _SEARCH_FILTER_FILE_COMMAND_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]