[gedit] Added public API for document saving
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Subject: [gedit] Added public API for document saving
- Date: Thu, 21 May 2009 22:03:37 -0400 (EDT)
commit 1fe34288479ca6b73368a3074f58a21a437e4fee
Author: Jesse van den Kieboom <jesse icecrew nl>
Date: Thu May 21 22:10:48 2009 +0200
Added public API for document saving
This adds gedit_commands_save_document and gedit_commands_save_all_documents
to be used in plugins.
---
gedit/gedit-commands-file.c | 27 ++++++++++++++++++-
gedit/gedit-commands.h | 5 +++
plugin-loaders/python/bindings/geditcommands.defs | 17 ++++++++++++
.../python/bindings/geditcommands.override | 1 +
4 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 18b713e..a5669d5 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -1019,10 +1019,11 @@ _gedit_cmd_file_save_documents_list (GeditWindow *window,
}
void
-_gedit_cmd_file_save_all (GtkAction *action,
- GeditWindow *window)
+gedit_commands_save_all_documents (GeditWindow *window)
{
GList *docs;
+
+ g_return_if_fail (GEDIT_IS_WINDOW (window));
gedit_debug (DEBUG_COMMANDS);
@@ -1033,6 +1034,28 @@ _gedit_cmd_file_save_all (GtkAction *action,
g_list_free (docs);
}
+void
+_gedit_cmd_file_save_all (GtkAction *action,
+ GeditWindow *window)
+{
+ gedit_commands_save_all_documents (window);
+}
+
+void
+gedit_commands_save_document (GeditWindow *window,
+ GeditDocument *document)
+{
+ GeditTab *tab;
+
+ g_return_if_fail (GEDIT_IS_WINDOW (window));
+ g_return_if_fail (GEDIT_IS_DOCUMENT (document));
+
+ gedit_debug (DEBUG_COMMANDS);
+
+ tab = gedit_tab_get_from_document (document);
+ file_save (tab, window);
+}
+
/* File revert */
static void
do_revert (GeditWindow *window,
diff --git a/gedit/gedit-commands.h b/gedit/gedit-commands.h
index c86e602..8ef5aec 100644
--- a/gedit/gedit-commands.h
+++ b/gedit/gedit-commands.h
@@ -51,6 +51,11 @@ gint gedit_commands_load_uris (GeditWindow *window,
const GeditEncoding *encoding,
gint line_pos);
+void gedit_commands_save_document (GeditWindow *window,
+ GeditDocument *document);
+
+void gedit_commands_save_all_documents (GeditWindow *window);
+
/*
* Non-exported functions
*/
diff --git a/plugin-loaders/python/bindings/geditcommands.defs b/plugin-loaders/python/bindings/geditcommands.defs
index 9dec3a8..3808fa4 100644
--- a/plugin-loaders/python/bindings/geditcommands.defs
+++ b/plugin-loaders/python/bindings/geditcommands.defs
@@ -26,3 +26,20 @@
'("gint" "line_pos")
)
)
+
+(define-function save_document
+ (c-name "gedit_commands_save_document")
+ (return-type "none")
+ (parameters
+ '("GeditWindow*" "window")
+ '("GeditDocument*" "document")
+ )
+)
+
+(define-function save_all_documents
+ (c-name "gedit_commands_save_all_documents")
+ (return-type "none")
+ (parameters
+ '("GeditWindow*" "window")
+ )
+)
diff --git a/plugin-loaders/python/bindings/geditcommands.override b/plugin-loaders/python/bindings/geditcommands.override
index 090800e..a81f918 100644
--- a/plugin-loaders/python/bindings/geditcommands.override
+++ b/plugin-loaders/python/bindings/geditcommands.override
@@ -15,6 +15,7 @@ void pygeditcommands_add_constants (PyObject *module, const gchar *strip_prefix)
modulename gedit.commands
%%
import gedit.Window as PyGeditWindow_Type
+import gedit.Document as PyGeditDocument_Type
%%
ignore-glob
_*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]