anjuta r4338 - in trunk: . libanjuta libanjuta/interfaces plugins/document-manager



Author: jhs
Date: Tue Oct 14 17:02:51 2008
New Revision: 4338
URL: http://svn.gnome.org/viewvc/anjuta?rev=4338&view=rev

Log:
2008-10-14  Johannes Schmid  <jhs gnome org>

	* configure.in: Use correct libgda version (3.99.6)

	* libanjuta/Makefile.am:
	* libanjuta/anjuta-vcs-status-tree-view.h:
	* libanjuta/anjuta-vcs-status.h (added):
	* libanjuta/interfaces/libanjuta.idl:
	Updated IAnjutaVCS to use GCancellable and move AnjutaVcsStatus
	enum to it's own file.

	* plugins/document-manager/anjuta-docman.c
	(on_notebook_page_close_button_click), (on_document_destroy),
	(anjuta_docman_remove_document), (anjuta_docman_get_current_page),
	(anjuta_docman_get_current_document),
	(anjuta_docman_set_current_document):
	Always dynamically obtain the current document (#556053)

Added:
   trunk/libanjuta/anjuta-vcs-status.h
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libanjuta/Makefile.am
   trunk/libanjuta/anjuta-vcs-status-tree-view.h
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/plugins/document-manager/anjuta-docman.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Oct 14 17:02:51 2008
@@ -45,7 +45,7 @@
 GTKSOURCEVIEW_REQUIRED=2.4.0
 BINUTILS_REQUIRED=2.15.92
 LIBWNCK_REQUIRED=2.12
-GDA_REQUIRED=3.99.4
+GDA_REQUIRED=3.99.6
 
 dnl LIBGTODO_REQUIRED=0.15
 
@@ -990,6 +990,7 @@
 plugins/symbol-browser/Makefile
 plugins/symbol-browser/images/Makefile
 plugins/symbol-db/Makefile
+plugins/symbol-db/test/Makefile
 plugins/cvs-plugin/Makefile
 plugins/project-wizard/Makefile
 plugins/macro/Makefile

Modified: trunk/libanjuta/Makefile.am
==============================================================================
--- trunk/libanjuta/Makefile.am	(original)
+++ trunk/libanjuta/Makefile.am	Tue Oct 14 17:02:51 2008
@@ -60,6 +60,7 @@
 	e-splash.c \
 	anjuta-error.c \
 	anjuta-error.h \
+	anjuta-vcs-status.h
 	anjuta-vcs-status-tree-view.c \
 	anjuta-vcs-status-tree-view.h \
 	anjuta-widgets.c \
@@ -122,6 +123,7 @@
 	anjuta-error.h \
 	resources.h \
 	anjuta-vcs-status-tree-view.h \
+	anjuta-vcs-status.h \
 	anjuta-command.h \
 	anjuta-async-command.h \
 	anjuta-sync-command.h \
@@ -129,7 +131,8 @@
 
 libanjutainclude_HEADERS = \
 	$(libanjuta_include) \
-	anjuta-enum-types.h
+	anjuta-enum-types.h \
+	anjuta-vcs-status.h
 
 BUILT_SOURCES=anjuta-marshal.c anjuta-marshal.h  anjuta-enum-types.h anjuta-enum-types.c
 

Modified: trunk/libanjuta/anjuta-vcs-status-tree-view.h
==============================================================================
--- trunk/libanjuta/anjuta-vcs-status-tree-view.h	(original)
+++ trunk/libanjuta/anjuta-vcs-status-tree-view.h	Tue Oct 14 17:02:51 2008
@@ -28,6 +28,7 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 #include "anjuta-enum-types.h"
+#include <libanjuta/anjuta-vcs-status.h>
 
 G_BEGIN_DECLS
 
@@ -60,19 +61,6 @@
 	AnjutaVcsStatusTreeViewPriv *priv;
 };
 
-typedef enum
-{
-	/* Unversioned, ignored, or uninteresting items */
-	ANJUTA_VCS_STATUS_NONE = 0, /*< skip >*/
-	
-	ANJUTA_VCS_STATUS_MODIFIED = 1 << 0,
-	ANJUTA_VCS_STATUS_ADDED = 1 << 1,
-	ANJUTA_VCS_STATUS_DELETED = 1 << 2,
-	ANJUTA_VCS_STATUS_CONFLICTED = 1 << 3,
-	ANJUTA_VCS_STATUS_MISSING = 1 << 4,
-	ANJUTA_VCS_STATUS_UNVERSIONED = 1 << 5
-} AnjutaVcsStatus;
-
 GType anjuta_vcs_status_tree_view_get_type (void) G_GNUC_CONST;
 GtkWidget *anjuta_vcs_status_tree_view_new (void);
 void anjuta_vcs_status_tree_view_destroy (AnjutaVcsStatusTreeView *self);

Added: trunk/libanjuta/anjuta-vcs-status.h
==============================================================================
--- (empty file)
+++ trunk/libanjuta/anjuta-vcs-status.h	Tue Oct 14 17:02:51 2008
@@ -0,0 +1,52 @@
+/*
+ * 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 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 Library 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., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+ 
+#ifndef ANJUTA_VCS_STATUS_H
+#define ANJUTA_VCS_STATUS_H
+
+/**
+ * IAnjutaVcsStatus:
+ * @IANJUTA_VCS_STATUS_NONE: File has unknown status
+ * @IANJUTA_VCS_STATUS_MODIFIED: File was modified locally
+ * @IANJUTA_VCS_STATUS_ADDED: File was added
+ * @IANJUTA_VCS_STATUS_DELETED: File was deleted
+ * @IANJUTA_VCS_STATUS_CONFLICTED: File has unresolved conflict
+ * @IANJUTA_VCS_STATUS_OUTDATED: File is not up-to-date
+ * @IANJUTA_VCS_STATUS_LOCKED: File is locked
+ * @IANJUTA_VCS_STATUS_MISSING: File is missing 
+ * @IANJUTA_VCS_STATUS_UNVERSIONED: File is ignored by VCS system
+ *
+ * This enumeration is used to specify the status of a file. A file can
+ * have multiple status flags assigned (MODIFIED and CONFLICT, for example)
+ */
+typedef enum
+{
+	/* Unversioned, ignored, or uninteresting items */
+	ANJUTA_VCS_STATUS_NONE = 0, /*< skip >*/
+	ANJUTA_VCS_STATUS_MODIFIED = 1 << 0,
+	ANJUTA_VCS_STATUS_ADDED = 1 << 1,
+	ANJUTA_VCS_STATUS_DELETED = 1 << 2,
+	ANJUTA_VCS_STATUS_CONFLICTED = 1 << 3,
+	ANJUTA_VCS_STATUS_OUTDATED = 1 << 4,
+	ANJUTA_VCS_STATUS_LOCKED = 1 << 5,
+	ANJUTA_VCS_STATUS_MISSING = 1 << 6,
+	ANJUTA_VCS_STATUS_UNVERSIONED = 1 << 7
+} AnjutaVcsStatus;
+
+#endif // ANJUTA_VCS_STATUS_H
+
+ 
+ 
\ No newline at end of file

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Tue Oct 14 17:02:51 2008
@@ -4465,6 +4465,7 @@
 interface IAnjutaVcs
 {
 	#include <gio/gio.h>
+	#include <libanjuta/anjuta-vcs-status.h>
 
   /**
 	 * IAnjutaVcsError:
@@ -4477,32 +4478,6 @@
 	  UNKOWN_ERROR
 	}
 
-  /**
-	 * IAnjutaVcsStatus:
-	 * @IANJUTA_VCS_STATUS_NONE: File has unknown status
-	 * @IANJUTA_VCS_STATUS_MODIFIED: File was modified locally
-	 * @IANJUTA_VCS_STATUS_CONFLICT: File has unresolved conflict
-	 * @IANJUTA_VCS_STATUS_OUTDATED: File is not up-to-date
-	 * @IANJUTA_VCS_STATUS_LOCKED: File is locked
-	 * @IANJUTA_VCS_STATUS_ADDED: File was added
-	 * @IANJUTA_VCS_STATUS_DELETED: File was deleted
-	 * @IANJUTA_VCS_STATUS_IGNORED: File is ignored by VCS system
- 	 *
- 	 * These enumeration is used to specify the status of a file. A file can
- 	 * have multiple status flags assigned (MODIFIED and CONFLICT, for example)
-	 */
-	enum Status
-	{
-	  STATUS_NONE = 0x00,
-	  STATUS_MODIFIED = 0x01,
-	  STATUS_CONFLICT = 0x02,
-	  STATUS_OUTDATED = 0x04,
-	  STATUS_LOCKED = 0x08,
-	  STATUS_ADDED = 0x10,
-	  STATUS_DELETED = 0x20,	  
-	  STATUS_IGNORED = 0x40	  
-	}
-
 	/**
 	 * ianjuta_vcs_add:
 	 * @files: List of GFiles* to add
@@ -4534,7 +4509,7 @@
 	 */
 	void update(GFile* file, gboolean recurse);
 	
-	typedef void (*StatusCallback) (GFile* file, IAnjutaVcsStatus status, gpointer user_data);
+	typedef void (*StatusCallback) (GFile* file, AnjutaVcsStatus status, gpointer user_data);
   
   /**
    * ianjuta_vcs_query_status:
@@ -4542,30 +4517,21 @@
    * @files: List of GFiles* to query
    * @callback: callback to call when data for a particular file is available
    * @user_data: Userdata passed to callback
+   * @cancel: A #GCancellable object to cancel the operation
    * @err: Error propagation and reporting
    *
    * Querys the status of the files asyncronously and calls callback once the data
    * is available. On error, -1 is returned and err is set.
    *
-   * Returns: Id to cancel this query
-   */
-  gint query_status (List<GFile*> files, StatusCallback callback, gpointer user_data);
-  
-  /**
-   * ianjuta_vcs_query_status_cancel:
-   * @obj: Self
-   * @id: Id of the query to cancel
-   * @err: Error propagation and reporting
-   *
-   * Cancels a query when the data is no longer needed
    */
-  void query_status_cancel (gint id);
-   
-  typedef void (*DiffCallback) (GFile* file, IAnjutaVcsStatus status, const gchar* diff, gpointer user_data);
+  void query_status (List<GFile*> files, StatusCallback callback, gpointer user_data, GCancellable* cancel);
+     
+  typedef void (*DiffCallback) (GFile* file, AnjutaVcsStatus status, const gchar* diff, gpointer user_data);
    /**
     * ianjuta_vcs_diff:
     * @obj: Self
     * @file: GFile* to diff
+    * @cancel: A #GCancellable object to cancel the operation
     * @err: Error propagation and reporting
     *
     * Asyncronous request for a unified diff between the repository and the file. callback
@@ -4573,17 +4539,7 @@
     *
     * Returns: Id to cancel the request
     */
-  gint ianjuta_vcs_diff(GFile* file, DiffCallback callback, gpointer user_data);
-
-	/**
-   * ianjuta_vcs_diff_cancel:
-   * @obj: Self
-   * @id: Id of the query to cancel
-   * @err: Error propagation and reporting
-   *
-   * Cancels a query when the data is no longer needed
-   */
-   void ianjuta_vcs_diff_cancel (gint id);
+  void ianjuta_vcs_diff(GFile* file, DiffCallback callback, gpointer user_data, GCancellable* cancel);
 }
 
 /**

Modified: trunk/plugins/document-manager/anjuta-docman.c
==============================================================================
--- trunk/plugins/document-manager/anjuta-docman.c	(original)
+++ trunk/plugins/document-manager/anjuta-docman.c	Tue Oct 14 17:02:51 2008
@@ -59,8 +59,6 @@
 	DocmanPlugin *plugin;
 	AnjutaPreferences *preferences;
 	GList *pages;		/* list of AnjutaDocmanPage's */
-	AnjutaDocmanPage *cur_page;
-	IAnjutaDocument *current_document; /* normally == IANJUTA_DOCUMENT (cur_page->doc) */
 	
 	GtkWidget *fileselection;
 	
@@ -102,6 +100,9 @@
 static AnjutaDocmanPage *
 anjuta_docman_get_nth_page (AnjutaDocman *docman, gint page_num);
 
+static AnjutaDocmanPage *
+anjuta_docman_get_current_page (AnjutaDocman *docman);
+
 static void
 on_document_toggled (GtkAction* action,
 					 AnjutaDocman* docman)
@@ -240,7 +241,7 @@
 {
 	AnjutaDocmanPage *page;
 
-	page = docman->priv->cur_page;
+	page = anjuta_docman_get_current_page (docman);
 	if (page == NULL || page->close_button != GTK_WIDGET (button))
 	{
 		/* the close function works only on the current document */
@@ -907,8 +908,6 @@
 	
 	if (!docman->priv->shutingdown)
 	{
-		if (page == docman->priv->cur_page)
-			docman->priv->cur_page = NULL;
 		if (GTK_NOTEBOOK (docman)->children == NULL)
 			anjuta_docman_set_current_document (docman, NULL);
 		else
@@ -977,7 +976,6 @@
 	
 	g_object_ref (doc);
 	
-	g_signal_emit (G_OBJECT (docman), docman_signals[DOC_ADDED], 0, doc);
 	anjuta_docman_set_current_document (docman, doc);
 	anjuta_shell_present_widget (docman->shell, GTK_WIDGET (docman->priv->plugin->vbox), NULL);
 	anjuta_docman_update_documents_menu (docman);
@@ -1005,11 +1003,9 @@
 		g_signal_handlers_unblock_by_func (G_OBJECT (docman),
 										  (gpointer) on_notebook_switch_page,
 										  (gpointer) docman);
-		if (page == docman->priv->cur_page)
-			docman->priv->cur_page = NULL;
 		docman->priv->pages = g_list_remove (docman->priv->pages, (gpointer)page);
 		if (!g_list_length (docman->priv->pages))
-				g_signal_emit (G_OBJECT (docman), docman_signals[DOC_CHANGED], 0, NULL);
+				g_signal_emit (G_OBJECT (docman), docman_signals[DOC_CHANGED], 0, NULL);			
 		g_free (page);
 	}
 	anjuta_docman_update_documents_menu(docman);
@@ -1086,10 +1082,22 @@
 	return NULL;
 }
 
+static AnjutaDocmanPage*
+anjuta_docman_get_current_page (AnjutaDocman* docman)
+{
+	AnjutaDocmanPage* page = anjuta_docman_get_nth_page (docman,
+														 gtk_notebook_get_current_page(GTK_NOTEBOOK(docman)));
+	return page;
+}
+
 IAnjutaDocument *
 anjuta_docman_get_current_document (AnjutaDocman *docman)
 {
-	return docman->priv->current_document;
+	AnjutaDocmanPage* page = anjuta_docman_get_current_page (docman);
+	if (page)
+		return page->doc;
+	else
+		return NULL;
 }
 
 void
@@ -1098,9 +1106,7 @@
 	AnjutaDocmanPage *page;
 	IAnjutaDocument *defdoc;
 
-	defdoc = docman->priv->current_document;
-	if (defdoc == doc)
-		return;
+	defdoc = anjuta_docman_get_current_document(docman);
 
 	if (doc != NULL)
 	{
@@ -1113,7 +1119,7 @@
 			if (defdoc != NULL)
 			{
 				AnjutaDocmanPage *oldpage;
-				oldpage = docman->priv->cur_page;
+				oldpage = anjuta_docman_get_page_for_document (docman, defdoc);
 				if (oldpage)
 				{
 					oldpage->is_current = FALSE;
@@ -1126,9 +1132,6 @@
 				}
 			}
 
-			docman->priv->current_document = doc;
-			docman->priv->cur_page = page;
-
 			page->is_current = TRUE;
 			if (page->close_button != NULL)
 			{
@@ -1159,7 +1162,7 @@
 	{
 		if (defdoc != NULL)
 		{
-			page = docman->priv->cur_page;
+			page = anjuta_docman_get_current_page (docman);
 			if (page)
 			{
 				page->is_current = FALSE;
@@ -1171,8 +1174,6 @@
 				}
 			}
 		}
-		docman->priv->current_document = NULL;
-		docman->priv->cur_page = NULL;
 	}
 	g_signal_emit (G_OBJECT (docman), docman_signals[DOC_CHANGED], 0, doc);
 }



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