[gedit] Remove sample plugin



commit 946c90386c9710863758185092eededb02dd45d1
Author: Paolo Borelli <porelli gnome org>
Date:   Sun May 17 15:39:10 2009 +0200

    Remove sample plugin
    
    Remove the sample plugin: it's too trivial and not very useful for the
    end users to be distributed with gedit. Inserting the username is better
    done with a snippet or an external tool.
---
 configure.ac                                  |   11 +-
 plugins/Makefile.am                           |    2 -
 plugins/sample/Makefile.am                    |   34 ----
 plugins/sample/gedit-sample-plugin.c          |  257 -------------------------
 plugins/sample/gedit-sample-plugin.h          |   78 --------
 plugins/sample/sample.gedit-plugin.desktop.in |    8 -
 6 files changed, 5 insertions(+), 385 deletions(-)

diff --git a/configure.ac b/configure.ac
index 74db60a..587c63b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -426,25 +426,24 @@ plugin-loaders/Makefile
 plugin-loaders/c/Makefile
 plugin-loaders/python/Makefile
 plugin-loaders/python/bindings/Makefile
+plugins/Makefile
 plugins/changecase/Makefile
 plugins/docinfo/Makefile
-plugins/externaltools/Makefile
-plugins/externaltools/tools/Makefile
 plugins/externaltools/data/Makefile
+plugins/externaltools/Makefile
 plugins/externaltools/scripts/Makefile
+plugins/externaltools/tools/Makefile
 plugins/filebrowser/Makefile
 plugins/indent/Makefile
-plugins/Makefile
 plugins/modelines/Makefile
 plugins/pythonconsole/Makefile
 plugins/pythonconsole/pythonconsole/Makefile
 plugins/quickopen/Makefile
 plugins/quickopen/quickopen/Makefile
-plugins/sample/Makefile
+plugins/snippets/data/lang/Makefile
+plugins/snippets/data/Makefile
 plugins/snippets/Makefile
 plugins/snippets/snippets/Makefile
-plugins/snippets/data/Makefile
-plugins/snippets/data/lang/Makefile
 plugins/sort/Makefile
 plugins/spell/Makefile
 plugins/taglist/Makefile
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 7069b03..f5cbbfe 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -4,7 +4,6 @@ DIST_SUBDIRS =		\
 	filebrowser 	\
 	indent 		\
 	modelines	\
-	sample 		\
 	sort 		\
 	spell 		\
 	taglist 	\
@@ -16,7 +15,6 @@ SUBDIRS = 		\
 	filebrowser	\
 	indent		\
 	modelines	\
-	sample		\
 	sort		\
 	taglist		\
 	time		\
diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
deleted file mode 100644
index d5e4753..0000000
--- a/plugins/sample/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# Sample plugin
-plugindir = $(GEDIT_PLUGINS_LIBS_DIR)
-
-INCLUDES = \
-	-I$(top_srcdir) 				\
-	$(GEDIT_CFLAGS) 				\
-	$(WARN_CFLAGS)					\
-	$(DISABLE_DEPRECATED_CFLAGS)
-
-plugin_LTLIBRARIES = libsample.la
-
-libsample_la_SOURCES = \
-	gedit-sample-plugin.h	\
-	gedit-sample-plugin.c
-	
-libsample_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
-libsample_la_LIBADD  = $(GEDIT_LIBS)
-
-uidir = $(GEDIT_PLUGINS_DATA_DIR)/sample
-ui_DATA =
-
-plugin_in_files = sample.gedit-plugin.desktop.in
-
-%.gedit-plugin: %.gedit-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-
-plugin_DATA = $(plugin_in_files:.gedit-plugin.desktop.in=.gedit-plugin)
-
-EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
-
-CLEANFILES = $(plugin_DATA)
-DISTCLEANFILES = $(plugin_DATA)
-
-
--include $(top_srcdir)/git.mk
diff --git a/plugins/sample/gedit-sample-plugin.c b/plugins/sample/gedit-sample-plugin.c
deleted file mode 100644
index b27cae5..0000000
--- a/plugins/sample/gedit-sample-plugin.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * gedit-sample-plugin.h
- * 
- * Copyright (C) 2002-2005 - Paolo Maggi
- *
- * 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 2, 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h> /* For strlen */
-
-#include "gedit-sample-plugin.h"
-
-#include <glib/gi18n-lib.h>
-#include <gmodule.h>
-
-#include <gtk/gtk.h>
-
-#include <gedit/gedit-debug.h>
-#include <gedit/gedit-window.h>
-
-#define WINDOW_DATA_KEY "GeditSamplePluginWindowData"
-#define MENU_PATH "/MenuBar/EditMenu/EditOps_4"
-
-#define GEDIT_SAMPLE_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_SAMPLE_PLUGIN, GeditSamplePluginPrivate))
-
-struct _GeditSamplePluginPrivate
-{
-	gpointer dummy;
-};
-
-GEDIT_PLUGIN_REGISTER_TYPE(GeditSamplePlugin, gedit_sample_plugin)
-
-typedef struct
-{
-	GtkActionGroup *action_group;
-	guint           ui_id;
-} WindowData;
-
-static void sample_cb (GtkAction *action, GeditWindow *window);
-
-static const GtkActionEntry action_entries[] =
-{
-	{ "UserName",
-	  NULL,
-	  N_("Insert User Na_me"),
-	  NULL,
-	  N_("Insert the user name at the cursor position"),
-	  G_CALLBACK (sample_cb) },
-};
-
-static void
-gedit_sample_plugin_init (GeditSamplePlugin *plugin)
-{
-	plugin->priv = GEDIT_SAMPLE_PLUGIN_GET_PRIVATE (plugin);
-
-	gedit_debug_message (DEBUG_PLUGINS, "GeditSamplePlugin initialising");
-}
-
-static void
-gedit_sample_plugin_finalize (GObject *object)
-{
-/*
-	GeditSamplePlugin *plugin = GEDIT_SAMPLE_PLUGIN (object);
-*/
-	gedit_debug_message (DEBUG_PLUGINS, "GeditSamplePlugin finalising");
-
-	G_OBJECT_CLASS (gedit_sample_plugin_parent_class)->finalize (object);
-}
-
-static void 
-sample_cb (GtkAction   *action,
-	   GeditWindow *window)
-{
-	GeditDocument *doc;
-	gchar *user_name;
-	gchar *user_name_utf8;
-	const gchar *temp;
-
-	gedit_debug (DEBUG_PLUGINS);
-
-	doc = gedit_window_get_active_document (window);
-	g_return_if_fail (doc != NULL);
-
-	temp = g_get_real_name ();
-	g_return_if_fail (temp != NULL);
-
-	if (strlen (temp) <= 0)
-	{
-		temp = g_get_user_name ();
-		g_return_if_fail (temp != NULL);
-	}
-
-	user_name = g_strdup_printf ("%s ", temp);
-	g_return_if_fail (user_name != NULL);
-
-	if (g_utf8_validate (user_name, -1, NULL))
-		user_name_utf8 = user_name;
-	else
-	{
-		user_name_utf8 = g_locale_to_utf8 (user_name,
-						   -1,
-						   NULL,
-						   NULL,
-						   NULL);
-		g_free (user_name);
-
-		if (user_name_utf8 == NULL)
-			user_name_utf8 = g_strdup (" ");
-	}
-
-	gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (doc));
-
-	gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (doc),
-					  user_name_utf8,
-					  -1);
-
-	gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (doc));
-
-	g_free (user_name_utf8);
-}
-
-static void
-free_window_data (WindowData *data)
-{
-	g_return_if_fail (data != NULL);
-
-	g_object_unref (data->action_group);
-	g_free (data);
-}
-
-static void
-update_ui_real (GeditWindow  *window,
-		WindowData   *data)
-{
-	GeditView *view;
-	GtkAction *action;
-
-	gedit_debug (DEBUG_PLUGINS);
-
-	view = gedit_window_get_active_view (window);
-
-	gedit_debug_message (DEBUG_PLUGINS, "View: %p", view);
-	
-	action = gtk_action_group_get_action (data->action_group,
-					      "UserName");
-	gtk_action_set_sensitive (action,
-				  (view != NULL) &&
-				  gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
-}
-
-static void
-impl_activate (GeditPlugin *plugin,
-	       GeditWindow *window)
-{
-	GtkUIManager *manager;
-	WindowData *data;
-
-	gedit_debug (DEBUG_PLUGINS);
-
-	data = g_new (WindowData, 1);
-
-	manager = gedit_window_get_ui_manager (window);
-
-	data->action_group = gtk_action_group_new ("GeditSamplePluginActions");
-	gtk_action_group_set_translation_domain (data->action_group, 
-						 GETTEXT_PACKAGE);
-	gtk_action_group_add_actions (data->action_group, 
-				      action_entries,
-				      G_N_ELEMENTS (action_entries), 
-				      window);
-
-	gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
-
-	data->ui_id = gtk_ui_manager_new_merge_id (manager);
-
-	g_object_set_data_full (G_OBJECT (window), 
-				WINDOW_DATA_KEY, 
-				data,
-				(GDestroyNotify) free_window_data);
-
-	gtk_ui_manager_add_ui (manager, 
-			       data->ui_id, 
-			       MENU_PATH,
-			       "UserName", 
-			       "UserName",
-			       GTK_UI_MANAGER_MENUITEM, 
-			       TRUE);
-
-	update_ui_real (window, data);
-}
-
-static void
-impl_deactivate	(GeditPlugin *plugin,
-		 GeditWindow *window)
-{
-	GtkUIManager *manager;
-	WindowData *data;
-
-	gedit_debug (DEBUG_PLUGINS);
-
-	manager = gedit_window_get_ui_manager (window);
-
-	data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
-	g_return_if_fail (data != NULL);
-
-	gtk_ui_manager_remove_ui (manager, data->ui_id);
-	gtk_ui_manager_remove_action_group (manager, data->action_group);
-
-	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);	
-}
-		 
-static void
-impl_update_ui	(GeditPlugin *plugin,
-		 GeditWindow *window)
-{
-	WindowData   *data;
-
-	gedit_debug (DEBUG_PLUGINS);
-
-	data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
-	g_return_if_fail (data != NULL);
-
-	update_ui_real (window, data);
-}
-
-static void
-gedit_sample_plugin_class_init (GeditSamplePluginClass *klass)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	GeditPluginClass *plugin_class = GEDIT_PLUGIN_CLASS (klass);
-
-	object_class->finalize = gedit_sample_plugin_finalize;
-
-	plugin_class->activate = impl_activate;
-	plugin_class->deactivate = impl_deactivate;
-	plugin_class->update_ui = impl_update_ui;
-	
-	g_type_class_add_private (object_class, sizeof (GeditSamplePluginPrivate));
-}
diff --git a/plugins/sample/gedit-sample-plugin.h b/plugins/sample/gedit-sample-plugin.h
deleted file mode 100644
index 390b074..0000000
--- a/plugins/sample/gedit-sample-plugin.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * gedit-sample-plugin.h
- * 
- * Copyright (C) 2002-2005 - Paolo Maggi
- *
- * 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 2, 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#ifndef __GEDIT_SAMPLE_PLUGIN_H__
-#define __GEDIT_SAMPLE_PLUGIN_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gedit/gedit-plugin.h>
-
-G_BEGIN_DECLS
-
-/*
- * Type checking and casting macros
- */
-#define GEDIT_TYPE_SAMPLE_PLUGIN		(gedit_sample_plugin_get_type ())
-#define GEDIT_SAMPLE_PLUGIN(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GEDIT_TYPE_SAMPLE_PLUGIN, GeditSamplePlugin))
-#define GEDIT_SAMPLE_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GEDIT_TYPE_SAMPLE_PLUGIN, GeditSamplePluginClass))
-#define GEDIT_IS_SAMPLE_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GEDIT_TYPE_SAMPLE_PLUGIN))
-#define GEDIT_IS_SAMPLE_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE ((k), GEDIT_TYPE_SAMPLE_PLUGIN))
-#define GEDIT_SAMPLE_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GEDIT_TYPE_SAMPLE_PLUGIN, GeditSamplePluginClass))
-
-/* Private structure type */
-typedef struct _GeditSamplePluginPrivate	GeditSamplePluginPrivate;
-
-/*
- * Main object structure
- */
-typedef struct _GeditSamplePlugin		GeditSamplePlugin;
-
-struct _GeditSamplePlugin
-{
-	GeditPlugin parent_instance;
-
-	/*< private >*/
-	GeditSamplePluginPrivate *priv;
-};
-
-/*
- * Class definition
- */
-typedef struct _GeditSamplePluginClass	GeditSamplePluginClass;
-
-struct _GeditSamplePluginClass
-{
-	GeditPluginClass parent_class;
-};
-
-/*
- * Public methods
- */
-GType	gedit_sample_plugin_get_type		(void) G_GNUC_CONST;
-
-/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_gedit_plugin (GTypeModule *module);
-
-G_END_DECLS
-
-#endif /* __GEDIT_SAMPLE_PLUGIN_H__ */
diff --git a/plugins/sample/sample.gedit-plugin.desktop.in b/plugins/sample/sample.gedit-plugin.desktop.in
deleted file mode 100644
index f528d1f..0000000
--- a/plugins/sample/sample.gedit-plugin.desktop.in
+++ /dev/null
@@ -1,8 +0,0 @@
-[Gedit Plugin]
-Module=sample
-IAge=2
-_Name=User name
-_Description=Inserts the user name at the cursor position.
-Authors=Paolo Maggi <paolo gnome org>
-Copyright=Copyright © 2002-2005 Paolo Maggi
-Website=http://www.gedit.org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]