[anjuta] document-manager: bgo #586689 - close all but this
- From: Massimo Cora' <mcora src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] document-manager: bgo #586689 - close all but this
- Date: Sat, 17 Apr 2010 00:05:09 +0000 (UTC)
commit c27fc917750481756027c926803658315f7bd970
Author: Massimo Corà <mcora src gnome org>
Date: Sat Apr 17 02:01:16 2010 +0200
document-manager: bgo #586689 - close all but this
plugins/document-manager/action-callbacks.c | 37 ++++++++++++++++++++
plugins/document-manager/action-callbacks.h | 1 +
.../document-manager/anjuta-document-manager.xml | 1 +
plugins/document-manager/plugin.c | 3 ++
4 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/plugins/document-manager/action-callbacks.c b/plugins/document-manager/action-callbacks.c
index a4960b3..501b5ff 100644
--- a/plugins/document-manager/action-callbacks.c
+++ b/plugins/document-manager/action-callbacks.c
@@ -257,6 +257,43 @@ on_close_all_file_activate (GtkAction *action, gpointer user_data)
}
}
+void
+on_close_other_file_activate (GtkAction *action, gpointer user_data)
+{
+ GList *buffers;
+ AnjutaDocman *docman;
+ IAnjutaDocument *curr_doc;
+ DocmanPlugin *plugin;
+ plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
+ docman = ANJUTA_DOCMAN (plugin->docman);
+
+ /* Close all 'saved' files */
+ buffers = anjuta_docman_get_all_doc_widgets (docman);
+ if (buffers)
+ {
+ GList *node;
+ node = buffers;
+
+ curr_doc = anjuta_docman_get_current_document (docman);
+ while (node)
+ {
+ IAnjutaDocument *doc;
+ GList* next;
+ doc = IANJUTA_DOCUMENT (node->data);
+ next = g_list_next (node); /* grab it now, as we may change it. */
+ if (doc && doc != curr_doc)
+ {
+ if (!ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc), NULL))
+ {
+ anjuta_docman_remove_document (docman, doc);
+ }
+ }
+ node = next;
+ }
+ g_list_free (buffers);
+ }
+}
+
void
on_reload_file_activate (GtkAction *action, gpointer user_data)
{
diff --git a/plugins/document-manager/action-callbacks.h b/plugins/document-manager/action-callbacks.h
index 2c972a6..ccb408b 100644
--- a/plugins/document-manager/action-callbacks.h
+++ b/plugins/document-manager/action-callbacks.h
@@ -26,6 +26,7 @@ void on_save_all_activate (GtkAction *action, gpointer user_data);
void on_close_file_activate (GtkAction *action, gpointer user_data);
void on_reload_file_activate (GtkAction *action, gpointer user_data);
void on_close_all_file_activate (GtkAction *action, gpointer user_data);
+void on_close_other_file_activate (GtkAction *action, gpointer user_data);
void on_print_activate (GtkAction *action, gpointer user_data);
void on_print_preview_activate (GtkAction *action, gpointer user_data);
diff --git a/plugins/document-manager/anjuta-document-manager.xml b/plugins/document-manager/anjuta-document-manager.xml
index e69e189..3da2bc6 100644
--- a/plugins/document-manager/anjuta-document-manager.xml
+++ b/plugins/document-manager/anjuta-document-manager.xml
@@ -104,6 +104,7 @@
<menu name="Documents" action="ActionMenuDocuments">
<menuitem name="SaveAll" action="ActionFileSaveAll" />
<menuitem name="CloseAll" action="ActionFileCloseAll" />
+ <menuitem name="CloseOther" action="ActionFileCloseOther" />
<separator />
<menu name="DocumentsBookmarks" action="ActionMenuBookmark">
<menuitem name="AddBookmark" action="ActionBookmarkAdd" />
diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c
index 824ab11..0585b2e 100644
--- a/plugins/document-manager/plugin.c
+++ b/plugins/document-manager/plugin.c
@@ -161,6 +161,9 @@ static GtkActionEntry actions_file[] = {
{ "ActionFileCloseAll", GTK_STOCK_CLOSE, N_("Close All"), "<shift><control>w",
N_("Close all files"),
G_CALLBACK (on_close_all_file_activate)},
+ { "ActionFileCloseOther", GTK_STOCK_CLOSE, N_("Close Other"), "<shift><control>o",
+ N_("Close other documents"),
+ G_CALLBACK (on_close_other_file_activate)},
{ "ActionFileReload", GTK_STOCK_REVERT_TO_SAVED, N_("Reload F_ile"), NULL,
N_("Reload current file"),
G_CALLBACK (on_reload_file_activate)},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]