anjuta r4039 - in trunk: . libanjuta/interfaces plugins/build-basic-autotools plugins/class-gen plugins/class-inheritance plugins/cvs-plugin plugins/debug-manager plugins/devhelp plugins/document-manager plugins/editor plugins/file-loader plugins/file-manager plugins/file-wizard plugins/gdb plugins/glade plugins/gtodo plugins/language-support-cpp-java plugins/profiler plugins/project-import plugins/project-manager plugins/project-wizard plugins/search plugins/sourceview plugins/subversion plugins/symbol-browser plugins/symbol-db plugins/tools plugins/valgrind src
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4039 - in trunk: . libanjuta/interfaces plugins/build-basic-autotools plugins/class-gen plugins/class-inheritance plugins/cvs-plugin plugins/debug-manager plugins/devhelp plugins/document-manager plugins/editor plugins/file-loader plugins/file-manager plugins/file-wizard plugins/gdb plugins/glade plugins/gtodo plugins/language-support-cpp-java plugins/profiler plugins/project-import plugins/project-manager plugins/project-wizard plugins/search plugins/sourceview plugins/subversion plugins/symbol-browser plugins/symbol-db plugins/tools plugins/valgrind src
- Date: Wed, 2 Jul 2008 00:46:18 +0000 (UTC)
Author: jhs
Date: Wed Jul 2 00:46:18 2008
New Revision: 4039
URL: http://svn.gnome.org/viewvc/anjuta?rev=4039&view=rev
Log:
2008-07-02 Johannes Schmid <jhs gnome org>
* libanjuta/interfaces/anjuta-idl-compiler.pl:
* libanjuta/interfaces/libanjuta.idl:
Change (nearly) all interfaces to use GFile* instead of uris
Document all shell variables
* plugins/build-basic-autotools/build-basic-autotools.c
(on_build_mesg_parse), (value_added_fm_current_file),
(value_removed_fm_current_file), (value_added_pm_current_uri),
(value_added_project_root_uri), (value_added_current_editor),
(activate_plugin), (ifile_open), (ifile_get_file),
(ifile_iface_init), (ibuilder_is_built), (ibuilder_build):
* plugins/class-gen/plugin.c (activate_plugin),
(cg_plugin_generator_created_cb):
* plugins/class-inheritance/class-callbacks.c
(on_member_menuitem_clicked), (on_nodedata_expanded_event):
* plugins/class-inheritance/class-inherit.c
(class_inheritance_show_dynamic_class_popup_menu),
(cls_inherit_draw_expanded_node):
* plugins/class-inheritance/plugin.c (activate_plugin):
* plugins/cvs-plugin/plugin.c (value_added_fm_current_file),
(value_removed_fm_current_file), (value_added_current_editor),
(activate_plugin):
* plugins/debug-manager/breakpoints.c
(breakpoints_dbase_set_all_in_editor),
(breakpoints_dbase_add_breakpoint),
(breakpoints_dbase_edit_breakpoint),
(on_toggle_breakpoint_activate), (breakpoints_dbase_new):
* plugins/debug-manager/command.c (dma_command_run):
* plugins/debug-manager/plugin.c (set_program_counter),
(dma_plugin_location_changed), (on_run_to_cursor_action_activate),
(dma_plugin_activate):
* plugins/debug-manager/variable.c (on_program_stopped):
* plugins/devhelp/plugin.c (devhelp_activate):
* plugins/document-manager/Makefile.am:
* plugins/document-manager/action-callbacks.c
(on_close_file_activate), (on_reload_file_activate),
(get_swapped_filename), (on_swap_activate):
* plugins/document-manager/anjuta-docman.c
(anjuta_docman_page_init), (on_open_filesel_response),
(anjuta_docman_save_document_as), (anjuta_docman_save_document),
(anjuta_docman_add_editor), (anjuta_docman_add_document),
(anjuta_docman_set_current_document),
(anjuta_docman_goto_file_line),
(anjuta_docman_goto_file_line_mark), (anjuta_docman_get_file),
(anjuta_docman_update_page_label),
(anjuta_docman_delete_all_indicators),
(anjuta_docman_save_file_if_modified), (anjuta_docman_reload_file),
(anjuta_docman_get_document_for_file):
* plugins/document-manager/anjuta-docman.h:
* plugins/document-manager/editor-tooltips.c:
* plugins/document-manager/editor-tooltips.h:
* plugins/document-manager/file_history.c (an_file_history_back),
(an_file_history_forward):
* plugins/document-manager/plugin.c (get_directory_display_name),
(update_title), (value_added_project_root_uri),
(on_document_changed), (on_session_save), (on_save_prompt),
(on_docman_auto_save):
* plugins/editor/Makefile.am:
* plugins/editor/plugin.c (itext_editor_factory_new_editor):
* plugins/editor/print.c:
* plugins/file-loader/plugin.c (open_with_dialog), (open_file),
(open_file_with), (value_added_fm_current_file),
(value_removed_fm_current_file), (dnd_dropped), (on_session_load),
(activate_plugin), (iloader_load):
* plugins/file-manager/file-model.c (file_model_update_file),
(file_model_get_file):
* plugins/file-manager/file-model.h:
* plugins/file-manager/file-view-marshal.list:
* plugins/file-manager/file-view.c (file_view_get_selected),
(file_view_button_press_event), (file_view_selection_changed),
(file_view_class_init):
* plugins/file-manager/file-view.h:
* plugins/file-manager/plugin.c
(on_file_view_current_file_changed), (on_file_view_open_file),
(on_file_view_show_popup_menu), (file_manager_activate),
(ifile_manager_set_selected):
* plugins/file-wizard/file.c (on_new_file_okbutton_clicked):
* plugins/file-wizard/plugin.c (activate_plugin):
* plugins/gdb/plugin.c (idebugger_run_to):
* plugins/glade/anjuta-design-document.c (ifile_open),
(ifile_get_file), (ifile_iface_init):
* plugins/glade/plugin.c (value_added_current_editor),
(on_session_save), (activate_plugin), (ifile_open),
(ifile_get_file), (ifile_iface_init):
* plugins/gtodo/plugin.c (activate_plugin), (itodo_load):
* plugins/language-support-cpp-java/plugin.c
(cpp_java_plugin_activate_plugin):
* plugins/profiler/gprof-view.c (gprof_view_show_symbol_in_editor):
* plugins/profiler/plugin.c (register_stock_icons),
(profiler_activate), (ifile_open), (ifile_get_file),
(ifile_iface_init):
* plugins/project-import/plugin.c (ifile_open), (ifile_get_file),
(ifile_iface_init):
* plugins/project-import/project-import.c (on_import_apply):
* plugins/project-manager/plugin.c (confirm_removal),
(on_uri_activated), (on_treeview_selection_changed),
(value_added_fm_current_file), (value_removed_fm_current_file),
(value_added_current_editor), (project_manager_unload_gbf),
(project_manager_plugin_activate_plugin), (ifile_open),
(ifile_get_file), (ifile_iface_init):
* plugins/project-wizard/install.c (npw_open_action):
* plugins/search/search-replace.c (search_and_replace),
(on_message_clicked):
* plugins/search/search-replace_backend.c
(file_buffer_new_from_te), (file_buffer_new_from_path):
* plugins/sourceview/plugin.c (ieditor_factory_new_editor):
* plugins/sourceview/sourceview.c (on_reload_dialog_response),
(sourceview_new), (ifile_open), (ifile_get_file),
(ifile_savable_save_as), (ifile_iface_init):
* plugins/sourceview/sourceview.h:
* plugins/subversion/plugin.c (value_added_fm_current_file),
(value_removed_fm_current_file), (value_added_current_editor),
(activate_plugin):
* plugins/symbol-browser/an_symbol.c (isymbol_get_file),
(isymbol_iface_init):
* plugins/symbol-browser/plugin.c (goto_file_line),
(update_editor_symbol_model), (value_added_current_editor),
(activate_plugin):
* plugins/symbol-db/plugin.c
(on_editor_buffer_symbols_update_timeout),
(value_added_current_editor), (goto_file_line),
(symbol_db_activate):
* plugins/symbol-db/symbol-db-engine-iterator-node.c
(isymbol_get_file), (isymbol_iface_init):
* plugins/tools/editor.c (on_editor_response):
* plugins/tools/execute.c (on_message_buffer_click):
* plugins/tools/variable.c (atp_variable_get_editor_variable):
* plugins/valgrind/plugin.c (valgrind_activate):
* plugins/valgrind/vgdefaultview.c (custom_editor_cb):
* src/anjuta.c (anjuta_new):
* src/main.c (on_message_received), (main):
Adapt all plugins to the interface changes, port partly to gio
Patch from Yuriy Penkin:
* plugins/editor/text_editor.c (on_text_editor_uri_changed),
(text_editor_update_monitor), (text_editor_new),
(save_filtered_in_dos_mode), (load_from_file), (save_to_file),
(text_editor_save_file), (ifile_get_file), (ifile_open),
(isavable_save_as), (ifile_iface_init):
* plugins/editor/text_editor.h:
#540731 - Port editor to gio
Removed:
trunk/plugins/document-manager/editor-tooltips.c
trunk/plugins/document-manager/editor-tooltips.h
Modified:
trunk/ChangeLog
trunk/libanjuta/interfaces/anjuta-idl-compiler.pl
trunk/libanjuta/interfaces/libanjuta.idl
trunk/plugins/build-basic-autotools/build-basic-autotools.c
trunk/plugins/class-gen/plugin.c
trunk/plugins/class-inheritance/class-callbacks.c
trunk/plugins/class-inheritance/class-inherit.c
trunk/plugins/class-inheritance/plugin.c
trunk/plugins/cvs-plugin/plugin.c
trunk/plugins/debug-manager/breakpoints.c
trunk/plugins/debug-manager/command.c
trunk/plugins/debug-manager/plugin.c
trunk/plugins/debug-manager/variable.c
trunk/plugins/devhelp/plugin.c
trunk/plugins/document-manager/Makefile.am
trunk/plugins/document-manager/action-callbacks.c
trunk/plugins/document-manager/anjuta-docman.c
trunk/plugins/document-manager/anjuta-docman.h
trunk/plugins/document-manager/file_history.c
trunk/plugins/document-manager/plugin.c
trunk/plugins/editor/Makefile.am
trunk/plugins/editor/plugin.c
trunk/plugins/editor/print.c
trunk/plugins/editor/text_editor.c
trunk/plugins/editor/text_editor.h
trunk/plugins/file-loader/plugin.c
trunk/plugins/file-manager/file-model.c
trunk/plugins/file-manager/file-model.h
trunk/plugins/file-manager/file-view-marshal.list
trunk/plugins/file-manager/file-view.c
trunk/plugins/file-manager/file-view.h
trunk/plugins/file-manager/plugin.c
trunk/plugins/file-wizard/file.c
trunk/plugins/file-wizard/plugin.c
trunk/plugins/gdb/plugin.c
trunk/plugins/glade/anjuta-design-document.c
trunk/plugins/glade/plugin.c
trunk/plugins/gtodo/plugin.c
trunk/plugins/language-support-cpp-java/plugin.c
trunk/plugins/profiler/gprof-view.c
trunk/plugins/profiler/plugin.c
trunk/plugins/project-import/plugin.c
trunk/plugins/project-import/project-import.c
trunk/plugins/project-manager/plugin.c
trunk/plugins/project-wizard/install.c
trunk/plugins/search/search-replace.c
trunk/plugins/search/search-replace_backend.c
trunk/plugins/sourceview/plugin.c
trunk/plugins/sourceview/sourceview.c
trunk/plugins/sourceview/sourceview.h
trunk/plugins/subversion/plugin.c
trunk/plugins/symbol-browser/an_symbol.c
trunk/plugins/symbol-browser/plugin.c
trunk/plugins/symbol-db/plugin.c
trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
trunk/plugins/tools/editor.c
trunk/plugins/tools/execute.c
trunk/plugins/tools/variable.c
trunk/plugins/valgrind/plugin.c
trunk/plugins/valgrind/vgdefaultview.c
trunk/src/anjuta.c
trunk/src/main.c
Modified: trunk/libanjuta/interfaces/anjuta-idl-compiler.pl
==============================================================================
--- trunk/libanjuta/interfaces/anjuta-idl-compiler.pl (original)
+++ trunk/libanjuta/interfaces/anjuta-idl-compiler.pl Wed Jul 2 00:46:18 2008
@@ -132,6 +132,11 @@
"gtype" => "G_TYPE_OBJECT",
"assert" => "G_IS_OBJECT(__arg__)",
"fail_return" => "NULL"
+ },
+ "GFile*" => {
+ "gtype" => "G_TYPE_OBJECT",
+ "assert" => "G_IS_FILE(__arg__)",
+ "fail_return" => "NULL"
}
};
Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl (original)
+++ trunk/libanjuta/interfaces/libanjuta.idl Wed Jul 2 00:46:18 2008
@@ -34,26 +34,27 @@
*/
interface IAnjutaFile
{
+ #include <gio/gio.h>
/**
* ianjuta_file_open:
* @obj: Self
- * @uri: URI to open.
+ * @file: file to open.
* @err: Error propagation and reporting
*
* The implementor opens the given URI.
*/
- void open (const gchar *uri);
+ void open (GFile* file);
/**
* ianjuta_file_get_uri:
* @obj: Self
* @err: Error propagation and reporting
*
- * Returns the URI that was opened with ianjuta_file_open().
+ * Returns the file that was opened with ianjuta_file_open().
*
* Return value: The last URI opened.
*/
- gchar* get_uri ();
+ GFile* get_file ();
/**
* SECTION:ianjuta-file-savable
@@ -83,18 +84,18 @@
/**
* IAnjutaFileSavable::saved:
* @obj: Self
- * @uri: URI where the content is saved.
+ * @file: file where the content is saved.
*
* This signal is emitted when the content is saved.
*/
- void ::saved (const gchar *uri);
+ void ::saved (const gchar *file);
/**
* ianjuta_file_savable_save:
* @obj: Self
* @err: Error propagation and reporting
*
- * Saves the content to the original URI from which it was loaded.
+ * Saves the content to the original file from which it was loaded.
*/
void save ();
@@ -104,9 +105,9 @@
* @uri: URI to save the content.
* @err: Error propagation and reporting
*
- * Saves the content to a different URI.
+ * Saves the content to a different File.
*/
- void save_as (const gchar *uri);
+ void save_as (GFile* file);
/**
* ianjuta_file_savable_set_dirty:
@@ -846,10 +847,11 @@
*/
interface IAnjutaFileLoader
{
+ #include <gio/gio.h>
/**
* ianjuta_file_loader_load:
* @obj: Self
- * @uri: URI to load
+ * @file: File to load
* @readonly: Open in readonly mode.
* @err: Error propagation and reporting
*
@@ -858,12 +860,12 @@
*
* Return value: Plugin interface used to load the file.
*/
- GObject* load (const gchar *uri, gboolean readonly);
+ GObject* load (GFile* file, gboolean readonly);
/**
* ianjuta_loader_peek_interface:
* @obj: Self
- * @uri: Meta file to peek
+ * @file: Meta file to peek
* @err: Error propagation and reporting
*
* Peeks the file and determines the interface which can load
@@ -871,7 +873,7 @@
*
* Return value: Plugin interface name that can load the file.
*/
- gchar* peek_interface (const gchar *uri);
+ gchar* peek_interface (GFile* file);
}
/**
@@ -2274,11 +2276,12 @@
interface IAnjutaEditorFactory
{
#include "ianjuta-editor.h"
+ #include <gio/gio.h>
/**
* ianjuta_editor_factory_new_editor:
* @obj: Self
- * @uri: Uri to open
+ * @file: file to open
* @filename: filename to open
* @err: Error propagation and reporting
*
@@ -2286,7 +2289,7 @@
*
* Return value: An object implementing IAnjutaEditor
*/
- IAnjutaEditor* new_editor (const gchar* uri, const gchar* filename);
+ IAnjutaEditor* new_editor (GFile* file, const gchar* filename);
}
/**
@@ -2302,6 +2305,14 @@
{
#include "ianjuta-document.h"
#include "ianjuta-editor.h"
+ #include <gio/gio.h>
+
+ /**
+ * IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT
+ *
+ * Anjuta shell value set by document manager to the current document
+ */
+ #define CURRENT_DOCUMENT "document_manager_current_document"
enum Error
{
@@ -2309,7 +2320,7 @@
}
/**
- * ianjuta_document_manager_get_uri:
+ * ianjuta_document_manager_get_file:
* @obj: Self
* @file: short filename
* @err: Error propagation and reporting.
@@ -2318,12 +2329,12 @@
* editor that has it loaded is found. If there is no editor that has
* this file opened, returns NULL.
*
- * Return value: the URI of the file, if an editor is found for it.
+ * Return value: the GFile for the given short name
*/
- gchar* get_uri (const gchar *file);
+ GFile* get_file (const gchar *file);
/**
- * ianjuta_document_manager_find_document_with_uri:
+ * ianjuta_document_manager_find_document_with_file:
* @obj: Self
* @uri: the file uri.
* @err: Error propagation and reporting.
@@ -2334,12 +2345,12 @@
* Return value: the document that corresponds to given URI. NULL if
* there is no editor loaded with this URI.
*/
- IAnjutaDocument* find_document_with_uri (const gchar *uri);
+ IAnjutaDocument* find_document_with_file (GFile* file);
/**
* ianjuta_document_manager_goto_uri_line:
* @obj: Self
- * @uri: URI of the file to go to.
+ * @file: file to go to.
* @lineno: the line number in the file to go to.
* @err: Error propagation and reporting.
*
@@ -2348,12 +2359,12 @@
*
* Return value: the editor where the mark has been put. NULL if none.
*/
- IAnjutaEditor* goto_uri_line (const gchar *uri, gint lineno);
+ IAnjutaEditor* goto_file_line (GFile* file, gint lineno);
/**
- * ianjuta_document_manager_goto_uri_line_mark:
+ * ianjuta_document_manager_goto_file_line_mark:
* @obj: Self
- * @uri: URI of the file to go to.
+ * @file: file to go to.
* @lineno: the line number in the file to go to.
* @mark: TRUE if the line should be marked with a marker.
* @err: Error propagation and reporting
@@ -2364,7 +2375,7 @@
*
* Return value: the editor where the mark has been put. NULL if none.
*/
- IAnjutaEditor* goto_uri_line_mark (const gchar *uri, gint lineno, gboolean mark);
+ IAnjutaEditor* goto_file_line_mark (GFile* file, gint lineno, gboolean mark);
/**
* ianjuta_document_manager_get_current_document:
@@ -2675,7 +2686,15 @@
*/
interface IAnjutaFileManager
{
-
+ #include <gio/gio.h>
+
+ /**
+ * IANJUTA_FILE_MANAGER_SELECTED_FILE
+ *
+ * Anjuta shell value set by file manager to the selected uri.
+ */
+ #define SELECTED_FILE "file_manager_selected_file"
+
/**
* IAnjutaFileManager::section_changed:
* @obj: Self
@@ -2683,7 +2702,7 @@
*
* fixme
*/
- void ::section_changed (const gchar *uri);
+ void ::section_changed (GFile* file);
/**
* ianjuta_file_manager_set_root:
@@ -2702,17 +2721,17 @@
*
* fixme
*/
- gchar* get_selected ();
+ GFile* get_selected ();
/**
* ianjuta_file_manager_set_selected:
* @obj: Self
- * @uri: fixme
+ * @file: File to select
* @err: Error propagation and reporting.
*
* fixme.
*/
- void set_selected (const gchar *uri);
+ void set_selected (GFile* file);
}
/**
@@ -3016,7 +3035,7 @@
*/
interface IAnjutaTodo
{
-
+ #include <gio/gio.h>
/**
* ianjuta_to_do_load:
* @obj: Self
@@ -3025,7 +3044,7 @@
*
* fixme
*/
- void load(const gchar *uri);
+ void load(GFile *file);
}
/**
@@ -3064,6 +3083,7 @@
#include "ianjuta-message-view.h"
#include <libanjuta/anjuta-error.h>
#include <sys/types.h>
+ #include <gio/gio.h>
/* Types */
enum Error
@@ -3399,7 +3419,7 @@
/**
* ianjuta_debugger_run_to:
* @obj: Self
- * @uri: fixme
+ * @file: fixme
* @line: fixme
* @err: Error propagation and reporting.
*
@@ -3407,7 +3427,7 @@
*
* Returns: fixme
*/
- gboolean run_to (const gchar *uri, gint line);
+ gboolean run_to (GFile* file, gint line);
/**
* ianjuta_debugger_exit:
@@ -4261,7 +4281,8 @@
{
#include "ianjuta-debugger.h"
#include "ianjuta-debugger-breakpoint.h"
-
+ #include <gio/gio.h>
+
/* Signals */
/**
@@ -4381,14 +4402,14 @@
* IAnjutaDebugManager::location_changed:
* @obj: Self
* @address: program counter address, 0 when unknown
- * @uri: source file where is the program counter, NULL when unknown
+ * @file: source file where is the program counter, NULL when unknown
* @line: line number if file name above is not NULL
*
* This signal is emitted when the current location is changed. It is
* equal to the program location when the program stops but can be
* changed afterward by the user.
*/
- void ::location_changed (gulong address, const gchar* uri, guint line);
+ void ::location_changed (gulong address, GFile* file, guint line);
/**
* IAnjutaDebugManager::signal_received:
@@ -4504,6 +4525,7 @@
interface IAnjutaSymbol
{
#include <gdk/gdkpixbuf.h>
+ #include <gio/gio.h>
enum Type
{
@@ -4557,10 +4579,10 @@
const gchar *get_name ();
/**
- * ianjuta_symbol_get_uri:
+ * ianjuta_symbol_get_file:
* The uri of the symbol
*/
- const gchar *get_uri();
+ GFile *get_file();
/**
* ianjuta_symbol_get_line:
Modified: trunk/plugins/build-basic-autotools/build-basic-autotools.c
==============================================================================
--- trunk/plugins/build-basic-autotools/build-basic-autotools.c (original)
+++ trunk/plugins/build-basic-autotools/build-basic-autotools.c Wed Jul 2 00:46:18 2008
@@ -21,13 +21,14 @@
#include <config.h>
#include <ctype.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-launcher.h>
#include <libanjuta/anjuta-utils.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-plugin-manager.h>
#include <libanjuta/interfaces/ianjuta-file.h>
+#include <libanjuta/interfaces/ianjuta-file-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-file-loader.h>
#include <libanjuta/interfaces/ianjuta-buildable.h>
#include <libanjuta/interfaces/ianjuta-builder.h>
@@ -859,7 +860,7 @@
if (parse_error_line (line, &filename, &lineno))
{
IAnjutaDocumentManager *docman;
- gchar *uri;
+ GFile* file;
/* Go to file and line number */
docman = anjuta_shell_get_interface (context->plugin->shell,
@@ -867,13 +868,10 @@
NULL);
/* Full path is detected from parse_error_line() */
- uri = gnome_vfs_get_uri_from_local_path(filename);
- g_free(filename);
- if (uri)
- {
- ianjuta_document_manager_goto_uri_line_mark(docman, uri, lineno, TRUE, NULL);
- g_free(uri);
- }
+ file = g_file_new_for_path(filename);
+
+ ianjuta_document_manager_goto_file_line_mark(docman, file, lineno, TRUE, NULL);
+ g_object_unref (file);
}
}
@@ -2007,17 +2005,19 @@
}
static void
-value_added_fm_current_uri (AnjutaPlugin *plugin, const char *name,
+value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
AnjutaUI *ui;
GtkAction *action;
- const gchar *uri;
- gchar *dirname, *filename;
+ GFile* file;
+ GFileInfo* file_info;
+ gchar* filename;
+ gchar* dirname;
gboolean makefile_exists, is_dir;
- uri = g_value_get_string (value);
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ file = g_value_get_object (value);
+ filename = g_file_get_path (file);
g_return_if_fail (filename != NULL);
BasicAutotoolsPlugin *ba_plugin = ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin);
@@ -2027,7 +2027,9 @@
g_free (ba_plugin->fm_current_filename);
ba_plugin->fm_current_filename = filename;
- is_dir = g_file_test (filename, G_FILE_TEST_IS_DIR);
+ file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ is_dir = (g_file_info_get_file_type(file_info) == G_FILE_TYPE_DIRECTORY);
if (is_dir)
dirname = g_strdup (filename);
else
@@ -2049,7 +2051,7 @@
}
static void
-value_removed_fm_current_uri (AnjutaPlugin *plugin,
+value_removed_fm_current_file (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
AnjutaUI *ui;
@@ -2074,9 +2076,12 @@
const gchar *uri;
gchar *dirname, *filename;
gboolean makefile_exists, is_dir;
+ GFile* file;
uri = g_value_get_string (value);
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ file = g_file_new_for_uri (uri);
+ filename = g_file_get_path (file);
+ g_object_unref (file);
g_return_if_fail (filename != NULL);
/*
@@ -2146,8 +2151,10 @@
root_uri = g_value_get_string (value);
if (root_uri)
{
+ GFile* file = g_file_new_for_uri (root_uri);
bb_plugin->project_root_dir =
- gnome_vfs_get_local_path_from_uri (root_uri);
+ g_file_get_path(file);
+ g_object_unref (file);
if (bb_plugin->project_root_dir)
{
update_project_ui (bb_plugin);
@@ -2253,7 +2260,7 @@
const GValue *value, gpointer data)
{
AnjutaUI *ui;
- gchar *uri;
+ GFile* file;
GObject *editor;
editor = g_value_get_object (value);
@@ -2280,13 +2287,13 @@
G_CALLBACK (on_editor_changed), plugin);
}
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
- if (uri)
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ if (file)
{
gchar *filename;
- filename = gnome_vfs_get_local_path_from_uri (uri);
- g_free (uri);
+ filename = g_file_get_path(file);
+ g_object_unref (file);
g_return_if_fail (filename != NULL);
ba_plugin->current_editor_filename = filename;
update_module_ui (ba_plugin);
@@ -2355,19 +2362,19 @@
/* Add watches */
ba_plugin->fm_watch_id =
- anjuta_plugin_add_watch (plugin, "file_manager_current_uri",
- value_added_fm_current_uri,
- value_removed_fm_current_uri, NULL);
+ anjuta_plugin_add_watch (plugin, IANJUTA_FILE_MANAGER_SELECTED_FILE,
+ value_added_fm_current_file,
+ value_removed_fm_current_file, NULL);
ba_plugin->pm_watch_id =
- anjuta_plugin_add_watch (plugin, "project_manager_current_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_CURRENT_URI,
value_added_pm_current_uri,
value_removed_pm_current_uri, NULL);
ba_plugin->project_watch_id =
- anjuta_plugin_add_watch (plugin, "project_root_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
value_added_project_root_uri,
value_removed_project_root_uri, NULL);
ba_plugin->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
initialized = TRUE;
@@ -2608,14 +2615,16 @@
}
static void
-ifile_open (IAnjutaFile *manager, const gchar *uri,
+ifile_open (IAnjutaFile *manager, GFile* file,
GError **err)
{
+ gchar* uri = g_file_get_uri (file);
ianjuta_buildable_execute (IANJUTA_BUILDABLE (manager), uri, NULL);
+ g_free(file);
}
-static gchar*
-ifile_get_uri (IAnjutaFile *manager, GError **err)
+static GFile*
+ifile_get_file (IAnjutaFile *manager, GError **err)
{
DEBUG_PRINT ("Unsupported operation");
return NULL;
@@ -2625,7 +2634,7 @@
ifile_iface_init (IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
@@ -2643,8 +2652,10 @@
gchar *target;
gchar *dirname;
gchar *cmd;
+ GFile* file = g_file_new_for_uri (uri);
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ filename = g_file_get_path (file);
+ g_object_unref (file);
if (filename == NULL) return NULL;
target = g_path_get_basename (filename);
dirname = g_path_get_dirname (filename);
@@ -2672,8 +2683,10 @@
gchar *target;
gchar *dirname;
gchar *cmd;
+ GFile* file = g_file_new_for_uri (uri);
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ filename = g_file_get_path (file);
+ g_object_unref (file);
if (filename == NULL) return NULL;
target = g_path_get_basename (filename);
dirname = g_path_get_dirname (filename);
Modified: trunk/plugins/class-gen/plugin.c
==============================================================================
--- trunk/plugins/class-gen/plugin.c (original)
+++ trunk/plugins/class-gen/plugin.c Wed Jul 2 00:46:18 2008
@@ -105,7 +105,7 @@
/* set up project directory watch */
cg_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
@@ -322,8 +322,12 @@
if (cg_window_get_add_to_project (plugin->window))
{
- ianjuta_file_loader_load (loader, header_file, FALSE, NULL);
- ianjuta_file_loader_load (loader, source_file, FALSE, NULL);
+ GFile* header = g_file_new_for_path (header_file);
+ GFile* source = g_file_new_for_path (source_file);
+ ianjuta_file_loader_load (loader, header, FALSE, NULL);
+ ianjuta_file_loader_load (loader, source, FALSE, NULL);
+ g_object_unref (header);
+ g_object_unref (source);
}
else
{
Modified: trunk/plugins/class-inheritance/class-callbacks.c
==============================================================================
--- trunk/plugins/class-inheritance/class-callbacks.c (original)
+++ trunk/plugins/class-inheritance/class-callbacks.c Wed Jul 2 00:46:18 2008
@@ -93,13 +93,13 @@
on_member_menuitem_clicked (GtkMenuItem *menuitem, gpointer data)
{
NodeData *node;
- const gchar *uri;
+ GFile* file;
gint line;
node = (NodeData*)data;
- uri = g_object_get_data (G_OBJECT (menuitem), "__uri");
+ file = g_object_get_data (G_OBJECT (menuitem), "__file");
line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), "__line"));
- if (uri)
+ if (file)
{
/* Goto uri line */
IAnjutaDocumentManager *dm;
@@ -107,7 +107,7 @@
IAnjutaDocumentManager, NULL);
if (dm)
{
- ianjuta_document_manager_goto_uri_line (dm, uri, line, NULL);
+ ianjuta_document_manager_goto_file_line (dm, file, line, NULL);
}
}
}
@@ -144,18 +144,18 @@
}
else { /* it's a class member. Take line && uri of definition
* and reach them */
- const gchar* uri;
+ GFile* file;
gint line;
- uri = g_object_get_data (G_OBJECT (item), "__uri");
+ file = g_object_get_data (G_OBJECT (item), "__file");
line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "__line"));
- if (uri) {
+ if (file) {
/* Goto uri line */
IAnjutaDocumentManager *dm;
dm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
IAnjutaDocumentManager, NULL);
if (dm) {
- ianjuta_document_manager_goto_uri_line (dm, uri, line, NULL);
+ ianjuta_document_manager_goto_file_line (dm, file, line, NULL);
}
}
}
Modified: trunk/plugins/class-inheritance/class-inherit.c
==============================================================================
--- trunk/plugins/class-inheritance/class-inherit.c (original)
+++ trunk/plugins/class-inheritance/class-inherit.c Wed Jul 2 00:46:18 2008
@@ -136,7 +136,7 @@
if (file)
{
- g_object_set_data_full (G_OBJECT (item), "__file",
+ g_object_set_data_full (G_OBJECT (item), "__file_path",
g_strdup (file), g_free);
g_object_set_data (G_OBJECT (item), "__line",
GINT_TO_POINTER (line));
@@ -585,11 +585,11 @@
/* go on with the icons */
if (symbol_iter && ianjuta_iterable_get_length (symbol_iter, NULL) > 0) {
const GdkPixbuf *pixbuf;
- const gchar* uri;
+ GFile* file;
gint line;
IAnjutaSymbol *symbol = IANJUTA_SYMBOL (symbol_iter);
- uri = ianjuta_symbol_get_uri (symbol, NULL);
+ file = ianjuta_symbol_get_file (symbol, NULL);
line = ianjuta_symbol_get_line (symbol, NULL);
pixbuf = ianjuta_symbol_get_icon (symbol, NULL);
@@ -607,9 +607,9 @@
/* set now the object properties on node_data. We still have a
* reference to it so we can access its canvas_item */
- if (uri) {
- g_object_set_data_full (G_OBJECT (node_data->canvas_item), "__uri",
- g_strdup (uri), g_free);
+ if (file) {
+ g_object_set_data_full (G_OBJECT (node_data->canvas_item), "__file",
+ file, g_object_unref);
g_object_set_data (G_OBJECT (node_data->canvas_item), "__line",
GINT_TO_POINTER (line));
}
Modified: trunk/plugins/class-inheritance/plugin.c
==============================================================================
--- trunk/plugins/class-inheritance/plugin.c (original)
+++ trunk/plugins/class-inheritance/plugin.c Wed Jul 2 00:46:18 2008
@@ -119,7 +119,7 @@
/* set up project directory watch */
class_inheritance->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
Modified: trunk/plugins/cvs-plugin/plugin.c
==============================================================================
--- trunk/plugins/cvs-plugin/plugin.c (original)
+++ trunk/plugins/cvs-plugin/plugin.c Wed Jul 2 00:46:18 2008
@@ -26,6 +26,8 @@
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-file.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-file-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-preferences.h>
#include <libanjuta/interfaces/ianjuta-vcs.h>
@@ -165,12 +167,12 @@
};
static void
-value_added_fm_current_uri (AnjutaPlugin *plugin, const char *name,
+value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
AnjutaUI *ui;
GtkAction *cvs_menu_action;
- const gchar *uri;
+ gchar *uri;
GnomeVFSURI *cvs_uri = NULL;
gchar *cvs_text_uri = NULL;
gchar *cvs_dir;
@@ -179,7 +181,8 @@
GnomeVFSFileInfo info;
GnomeVFSResult result;
- uri = g_value_get_string (value);
+ GFile* file = G_FILE (g_value_get_object (value));
+ uri = g_file_get_uri (file);
filename = gnome_vfs_get_local_path_from_uri (uri);
g_return_if_fail (filename != NULL);
@@ -226,10 +229,11 @@
g_object_set (G_OBJECT (cvs_menu_action), "sensitive", FALSE, NULL);
}
g_free (cvs_dir);
+ g_free (uri);
}
static void
-value_removed_fm_current_uri (AnjutaPlugin *plugin,
+value_removed_fm_current_file (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
AnjutaUI *ui;
@@ -292,7 +296,7 @@
const GValue *value, gpointer data)
{
AnjutaUI *ui;
- gchar *uri;
+ GFile* file;
GObject *editor;
editor = g_value_get_object (value);
@@ -307,16 +311,15 @@
g_free (cvs_plugin->current_editor_filename);
cvs_plugin->current_editor_filename = NULL;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
- if (uri)
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ if (file)
{
gchar *filename;
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ filename = g_file_get_path (file);
g_return_if_fail (filename != NULL);
cvs_plugin->current_editor_filename = filename;
- g_free (uri);
- // update_module_ui (cvs_plugin);
+ g_object_unref (file);
}
}
@@ -362,15 +365,15 @@
/* Add watches */
cvs_plugin->fm_watch_id =
- anjuta_plugin_add_watch (plugin, "file_manager_current_uri",
- value_added_fm_current_uri,
- value_removed_fm_current_uri, NULL);
+ anjuta_plugin_add_watch (plugin, IANJUTA_FILE_MANAGER_SELECTED_FILE,
+ value_added_fm_current_file,
+ value_removed_fm_current_file, NULL);
cvs_plugin->project_watch_id =
- anjuta_plugin_add_watch (plugin, "project_root_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
value_added_project_root_uri,
value_removed_project_root_uri, NULL);
cvs_plugin->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
return TRUE;
Modified: trunk/plugins/debug-manager/breakpoints.c
==============================================================================
--- trunk/plugins/debug-manager/breakpoints.c (original)
+++ trunk/plugins/debug-manager/breakpoints.c Wed Jul 2 00:46:18 2008
@@ -557,14 +557,14 @@
{
GtkTreeModel *model;
GtkTreeIter iter;
- gchar *uri;
+ GFile* file;
g_return_if_fail (te != NULL);
g_return_if_fail (bd != NULL);
g_return_if_fail (bd->treeview != NULL);
- uri = ianjuta_file_get_uri (IANJUTA_FILE (te), NULL);
- if (uri == NULL)
+ file = ianjuta_file_get_file (IANJUTA_FILE (te), NULL);
+ if (file == NULL)
return;
if (!IANJUTA_IS_MARKABLE (te))
@@ -577,6 +577,7 @@
if (gtk_tree_model_get_iter_first (model, &iter))
{
+ gchar* uri = g_file_get_uri (file);
do
{
BreakpointItem *bi;
@@ -595,8 +596,9 @@
breakpoints_dbase_set_in_editor (bd, bi);
}
} while (gtk_tree_model_iter_next (model, &iter));
+ g_free(uri);
}
- g_free (uri);
+ g_object_unref(file);
}
static void
@@ -1008,9 +1010,11 @@
ed = dma_get_current_editor (ANJUTA_PLUGIN(bd->plugin));
if ((ed != NULL) && IANJUTA_IS_MARKABLE (ed))
{
- gchar *uri;
+ GFile* file;
+ gchar* uri;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (ed), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (ed), NULL);
+ uri = g_file_get_uri (file);
if ((uri != NULL) && (bi->uri != NULL) && (strcmp (uri, bi->uri) == 0))
{
bi->editor = ed;
@@ -1019,6 +1023,7 @@
breakpoints_dbase_connect_to_editor (bd, ed);
}
g_free (uri);
+ g_object_unref (file);
}
if (bd->debugger != NULL)
@@ -1452,8 +1457,10 @@
te = dma_get_current_editor (ANJUTA_PLUGIN(bd->plugin));
if (te != NULL)
{
- uri = ianjuta_file_get_uri (IANJUTA_FILE (te), NULL);
+ GFile* file = ianjuta_file_get_file (IANJUTA_FILE(te), NULL);
+ uri = g_file_get_uri (file);
line = ianjuta_editor_get_lineno (te, NULL);
+ g_object_unref (file);
}
//NULL uri is ok here
bi = breakpoint_item_new_from_uri (bd, uri, line, TRUE);
@@ -1593,16 +1600,20 @@
{
IAnjutaEditor *te;
BreakpointItem *bi;
+ GFile* file;
gchar *uri;
guint line;
/* Get current editor and line */
te = dma_get_current_editor (ANJUTA_PLUGIN (bd->plugin));
if (te == NULL) return; /* Missing editor */
- uri = ianjuta_file_get_uri (IANJUTA_FILE (te), NULL);
- if (uri == NULL) return; /* File not saved yet, it's not possible to put a breakpoint in it */
+ file = ianjuta_file_get_file (IANJUTA_FILE (te), NULL);
+ if (file == NULL) return; /* File not saved yet, it's not possible to put a breakpoint in it */
line = ianjuta_editor_get_lineno (te, NULL);
-
+
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
/* Find corresponding breakpoint
* Try to find right mark (it could have moved) first */
bi = breakpoints_dbase_find_breakpoint_from_mark (bd, te, line);
@@ -2007,7 +2018,7 @@
g_signal_connect_swapped (bd->plugin, "debugger-stopped", G_CALLBACK (on_debugger_stopped), bd);
bd->editor_watch =
- anjuta_plugin_add_watch (ANJUTA_PLUGIN(bd->plugin), "document_manager_current_editor",
+ anjuta_plugin_add_watch (ANJUTA_PLUGIN(bd->plugin), IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
on_added_current_editor,
on_removed_current_editor, bd);
Modified: trunk/plugins/debug-manager/command.c
==============================================================================
--- trunk/plugins/debug-manager/command.c (original)
+++ trunk/plugins/debug-manager/command.c Wed Jul 2 00:46:18 2008
@@ -36,6 +36,8 @@
#include <libanjuta/interfaces/ianjuta-debugger-instruction.h>
#include <libanjuta/interfaces/ianjuta-debugger-variable.h>
+#include <gio/gio.h>
+
#include <stdarg.h>
/* Contants defintion
@@ -1133,7 +1135,7 @@
gboolean ret = FALSE;
DmaDebuggerCommandType type = cmd->type & COMMAND_MASK;
IAnjutaDebuggerCallback callback = cmd->callback == NULL ? NULL : dma_debugger_queue_command_callback;
-
+ GFile* file;
switch (type)
{
case EMPTY_COMMAND:
@@ -1170,7 +1172,9 @@
ret = ianjuta_debugger_run (debugger, err);
break;
case RUN_TO_COMMAND:
- ret = ianjuta_debugger_run_to (debugger, cmd->data.pos.file, cmd->data.pos.line, err);
+ file = g_file_new_for_uri (cmd->data.pos.file);
+ ret = ianjuta_debugger_run_to (debugger, file, cmd->data.pos.line, err);
+ g_object_unref (file);
break;
case STEP_IN_COMMAND:
ret = ianjuta_debugger_step_in (debugger, err);
Modified: trunk/plugins/debug-manager/plugin.c
==============================================================================
--- trunk/plugins/debug-manager/plugin.c (original)
+++ trunk/plugins/debug-manager/plugin.c Wed Jul 2 00:46:18 2008
@@ -189,10 +189,10 @@
}
static void
-set_program_counter(DebugManagerPlugin *self, const gchar* file, guint line, gulong address)
+set_program_counter(DebugManagerPlugin *self, const gchar* filename, guint line, gulong address)
{
IAnjutaDocumentManager *docman = NULL;
- gchar *file_uri;
+ GFile* file;
/* Remove previous marker */
hide_program_counter_in_editor (self);
@@ -203,15 +203,15 @@
}
self->pc_address = address;
- if (file != NULL)
+ if (filename != NULL)
{
+ file = g_file_new_for_path (filename);
docman = anjuta_shell_get_interface (ANJUTA_PLUGIN (self)->shell, IAnjutaDocumentManager, NULL);
- file_uri = gnome_vfs_get_uri_from_local_path(file);
if (docman)
{
IAnjutaEditor* editor;
- editor = ianjuta_document_manager_goto_uri_line(docman, file_uri, line, NULL);
+ editor = ianjuta_document_manager_goto_file_line(docman, file, line, NULL);
if (editor != NULL)
{
@@ -221,7 +221,7 @@
show_program_counter_in_editor (self);
}
}
- g_free (file_uri);
+ g_object_unref (file);
}
}
@@ -570,7 +570,9 @@
docman = anjuta_shell_get_interface (ANJUTA_PLUGIN(self)->shell, IAnjutaDocumentManager, NULL);
if (docman)
{
- ianjuta_document_manager_goto_uri_line (docman, uri, line, NULL);
+ GFile* file = g_file_new_for_uri (uri);
+ ianjuta_document_manager_goto_file_line (docman, file, line, NULL);
+ g_object_unref (file);
}
}
}
@@ -671,23 +673,23 @@
else
{
IAnjutaEditor *editor;
- gchar *uri;
- gchar *file;
+ GFile* file;
+ gchar *filename;
gint line;
editor = dma_get_current_editor (ANJUTA_PLUGIN (plugin));
if (editor == NULL)
return;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
- if (uri == NULL)
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ if (file == NULL)
return;
- file = gnome_vfs_get_local_path_from_uri (uri);
+ filename = g_file_get_path (file);
line = ianjuta_editor_get_lineno (editor, NULL);
- dma_queue_run_to (plugin->queue, file, line);
- g_free (uri);
- g_free (file);
+ dma_queue_run_to (plugin->queue, filename, line);
+ g_free (filename);
+ g_object_unref (file);
}
}
}
@@ -1131,11 +1133,11 @@
/* Add watches */
this->project_watch_id =
- anjuta_plugin_add_watch (plugin, "project_root_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
value_added_project_root_uri,
value_removed_project_root_uri, NULL);
this->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
Modified: trunk/plugins/debug-manager/variable.c
==============================================================================
--- trunk/plugins/debug-manager/variable.c (original)
+++ trunk/plugins/debug-manager/variable.c Wed Jul 2 00:46:18 2008
@@ -36,6 +36,7 @@
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-editor-hover.h>
#include <libanjuta/interfaces/ianjuta-editor-selection.h>
+#include <libanjuta/interfaces/ianjuta-document-manager.h>
/* Constants
*---------------------------------------------------------------------------*/
@@ -218,7 +219,7 @@
if (self->editor_watch == -1)
{
/* set editor watch */
- self->editor_watch = anjuta_plugin_add_watch (ANJUTA_PLUGIN(self->plugin), "document_manager_current_editor",
+ self->editor_watch = anjuta_plugin_add_watch (ANJUTA_PLUGIN(self->plugin), IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
on_added_current_editor, on_removed_current_editor, self);
}
}
Modified: trunk/plugins/devhelp/plugin.c
==============================================================================
--- trunk/plugins/devhelp/plugin.c (original)
+++ trunk/plugins/devhelp/plugin.c Wed Jul 2 00:46:18 2008
@@ -392,7 +392,7 @@
/* Add watches */
devhelp->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor,
devhelp);
Modified: trunk/plugins/document-manager/Makefile.am
==============================================================================
--- trunk/plugins/document-manager/Makefile.am (original)
+++ trunk/plugins/document-manager/Makefile.am Wed Jul 2 00:46:18 2008
@@ -43,8 +43,6 @@
action-callbacks.h\
file_history.c \
file_history.h \
- editor-tooltips.c \
- editor-tooltips.h \
search-box.h \
search-box.c
Modified: trunk/plugins/document-manager/action-callbacks.c
==============================================================================
--- trunk/plugins/document-manager/action-callbacks.c (original)
+++ trunk/plugins/document-manager/action-callbacks.c Wed Jul 2 00:46:18 2008
@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
#include <libanjuta/anjuta-ui.h>
#include <libanjuta/anjuta-utils.h>
@@ -185,18 +184,21 @@
{
GtkWidget *parent;
gchar *uri;
+ GFile* file;
AnjutaSavePrompt *save_prompt;
parent = gtk_widget_get_toplevel (GTK_WIDGET (doc));
/* Prompt for unsaved data */
save_prompt = anjuta_save_prompt_new (GTK_WINDOW (parent));
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ uri = g_file_get_uri (file);
/* NULL uri ok */
anjuta_save_prompt_add_item (save_prompt,
ianjuta_document_get_filename (doc, NULL),
uri, doc, on_save_prompt_save_editor,
docman);
g_free (uri);
+ g_free (file);
switch (gtk_dialog_run (GTK_DIALOG (save_prompt)))
{
@@ -279,13 +281,12 @@
GTK_RESPONSE_NO);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
{
- gchar* uri;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (uri)
+ GFile* file;
+ file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ if (file)
{
- ianjuta_file_open (IANJUTA_FILE (doc), uri, NULL);
- /* FIXME: anjuta_update_title (); */
- g_free (uri);
+ ianjuta_file_open (IANJUTA_FILE (doc), file, NULL);
+ g_object_unref(file);
}
}
gtk_widget_destroy (dialog);
@@ -877,102 +878,10 @@
}
/* Gets the swapped (c/h) file names */
-static gchar*
-get_swapped_filename (const gchar* filename)
+static GFile*
+get_swapped_filename (GFile* file)
{
- size_t len;
- gchar *newfname;
- GnomeVFSURI *vfs_uri;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- len = strlen (filename);
- newfname = g_malloc (len+5); /* to be on the safer side */
- while (len)
- {
- if (filename[len] == '.')
- break;
- len--;
- }
- len++;
- strcpy (newfname, filename);
- if (strncasecmp (&filename[len], "h", 1) == 0)
- {
- strcpy (&newfname[len], "cc");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
-
- strcpy (&newfname[len], "cpp");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
-
- strcpy (&newfname[len], "cxx");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
-
- strcpy (&newfname[len], "c");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
- }
- else if (strncasecmp (&filename[len], "c", 1)==0 )
- {
- strcpy (&newfname[len], "h");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
-
- strcpy (&newfname[len], "hh");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
-
- strcpy (&newfname[len], "hxx");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
-
- strcpy (&newfname[len], "hpp");
- vfs_uri = gnome_vfs_uri_new (newfname);
- if (gnome_vfs_uri_exists (vfs_uri))
- {
- gnome_vfs_uri_unref (vfs_uri);
- return newfname;
- }
- gnome_vfs_uri_unref (vfs_uri);
- }
- g_free (newfname);
+ // TODO!
return NULL;
}
@@ -988,18 +897,18 @@
doc = anjuta_docman_get_current_document (docman);
if (doc)
{
- gchar *uri;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (uri)
- {
- gchar *newfname;
- newfname = get_swapped_filename (uri);
- g_free (uri);
- if (newfname)
+ GFile* file;
+ file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ if (file)
+ {
+ GFile* new_file;
+ new_file = get_swapped_filename (file);
+ if (new_file)
{
- anjuta_docman_goto_uri_line (docman, newfname, -1);
- g_free (newfname);
+ anjuta_docman_goto_file_line (docman, new_file, -1);
+ g_object_unref (new_file);
}
+ g_object_unref (file);
}
}
}
Modified: trunk/plugins/document-manager/anjuta-docman.c
==============================================================================
--- trunk/plugins/document-manager/anjuta-docman.c (original)
+++ trunk/plugins/document-manager/anjuta-docman.c Wed Jul 2 00:46:18 2008
@@ -38,7 +38,6 @@
#include "file_history.h"
#include "plugin.h"
#include "action-callbacks.h"
-#include "editor-tooltips.h"
#define MENU_PLACEHOLDER "/MenuMain/PlaceHolderDocumentsMenus/Documents/PlaceholderDocuments"
@@ -329,7 +328,7 @@
static void
anjuta_docman_page_init (AnjutaDocman *docman, IAnjutaDocument *doc,
- const gchar *uri, AnjutaDocmanPage *page)
+ GFile* file, AnjutaDocmanPage *page)
{
GtkWidget *close_button;
GtkWidget *close_pixmap;
@@ -337,13 +336,10 @@
GtkWidget *vbox, *box, *menu_box;
GtkWidget *event_hbox;
GtkWidget *event_box;
-#if !GTK_CHECK_VERSION (2,12,0)
- static GtkTooltips *tooltips = NULL;
-#endif
gint h, w;
GdkColor color;
const gchar *filename;
- gchar *uuri, *ruri;
+ gchar *ruri;
g_return_if_fail (IANJUTA_IS_DOCUMENT (doc));
@@ -361,14 +357,8 @@
gtk_widget_set_name (close_button, "anjuta-tab-close-button");
gtk_widget_set_size_request (close_button, w, h);
-#if GTK_CHECK_VERSION (2,12,0)
gtk_widget_set_tooltip_text (close_button, _("Close file"));
-#else
- if (tooltips == NULL)
- tooltips = gtk_tooltips_new ();
- gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), close_button, _("Close file"),
- NULL);
-#endif
+
filename = ianjuta_document_get_filename (doc, NULL);
label = gtk_label_new (filename);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -397,42 +387,55 @@
event_hbox = gtk_hbox_new (FALSE, 2);
- uuri = (uri) ? (gchar *)uri : ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (uuri != NULL)
+ if (file != NULL)
{
/* add a nice mime-type icon if we can */
- GdlIcons *icons;
- GdkPixbuf *pixbuf;
- icons = gdl_icons_new (16);
- pixbuf = gdl_icons_get_uri_icon (icons, uuri);
- if (pixbuf != NULL)
- {
- GtkWidget *image, *menu_image;
- image = gtk_image_new_from_pixbuf (pixbuf);
- menu_image = gtk_image_new_from_pixbuf (pixbuf);
- gtk_box_pack_start (GTK_BOX (event_hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (menu_box), menu_image, FALSE, FALSE, 0);
- page->mime_icon = image;
- g_object_unref (G_OBJECT (pixbuf));
- }
- g_object_unref (G_OBJECT (icons));
- ruri = gnome_vfs_format_uri_for_display (uuri);
- if (uuri != uri)
- g_free (uuri);
+ const gchar** icon_names;
+ GtkIconInfo* icon_info;
+ GIcon* icon;
+ GdkPixbuf* pixbuf;
+ GFileInfo* file_info;
+ GError* err = NULL;
+
+ file_info = g_file_query_info (file,
+ "standard::*",
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &err);
+ if (err)
+ DEBUG_PRINT ("GFile-Error %s", err->message);
+
+ if (file_info != NULL)
+ {
+ icon = g_file_info_get_icon (file_info);
+ g_object_get (icon, "names", &icon_names, NULL);
+ icon_info = gtk_icon_theme_choose_icon (gtk_icon_theme_get_default(),
+ icon_names,
+ GTK_ICON_SIZE_MENU,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
+ gtk_icon_info_free(icon_info);
+ g_object_unref (icon);
+
+ if (pixbuf != NULL)
+ {
+ GtkWidget *image, *menu_image;
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ menu_image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_box_pack_start (GTK_BOX (event_hbox), image, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (menu_box), menu_image, FALSE, FALSE, 0);
+ page->mime_icon = image;
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+ }
+ ruri = g_file_get_parse_name (file);
if (ruri != NULL)
{
/* set the tab-tooltip */
gchar *tip;
-#if !GTK_CHECK_VERSION (2,12,0)
- EditorTooltips *tooltips;
- tooltips = editor_tooltips_new (); /*CHECKME is this ever cleaned ?*/
-#endif
tip = g_markup_printf_escaped ("<b>%s</b> %s", _("Path:"), ruri);
-#if GTK_CHECK_VERSION (2,12,0)
gtk_widget_set_tooltip_markup (event_box, tip);
-#else
- editor_tooltips_set_tip (tooltips, event_box, tip, NULL);
-#endif
+
g_free (ruri);
g_free (tip);
}
@@ -530,7 +533,9 @@
uri = g_slist_nth_data (list, i);
if (uri)
{
- anjuta_docman_goto_uri_line (docman, uri, -1);
+ GFile* file = g_file_new_for_uri (uri);
+ anjuta_docman_goto_file_line (docman, file, -1);
+ g_object_unref (file);
g_free (uri);
}
}
@@ -599,8 +604,7 @@
GtkWidget *parent_window)
{
gchar* uri;
- GnomeVFSURI* vfs_uri;
- gchar* file_uri;
+ GFile* file;
const gchar* filename;
GtkWidget *parent;
GtkWidget *dialog;
@@ -621,10 +625,12 @@
dialog = create_file_save_dialog_gui (GTK_WINDOW (parent), docman);
- if ((file_uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL)) != NULL)
+ if ((file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL)) != NULL)
{
+ gchar* file_uri = g_file_get_uri (file);
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), file_uri);
g_free (file_uri);
+ g_object_unref (file);
}
else if ((filename = ianjuta_document_get_filename (doc, NULL)) != NULL)
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);
@@ -639,10 +645,11 @@
}
uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
- vfs_uri = gnome_vfs_uri_new(uri);
- if (gnome_vfs_uri_exists(vfs_uri))
+ file = g_file_new_for_uri (uri);
+ if (g_file_query_exists (file, NULL))
{
GtkWidget *msg_dialog;
+ gchar* parse_uri = g_file_get_parse_name (file);
msg_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
@@ -650,7 +657,8 @@
_("The file '%s' already exists.\n"
"Do you want to replace it with the"
" one you are saving?"),
- uri);
+ parse_uri);
+ g_free (parse_uri);
gtk_dialog_add_button (GTK_DIALOG (msg_dialog),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
@@ -659,7 +667,7 @@
GTK_STOCK_REFRESH,
GTK_RESPONSE_YES);
if (gtk_dialog_run (GTK_DIALOG (msg_dialog)) == GTK_RESPONSE_YES)
- ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (doc), uri,
+ ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (doc), file,
NULL);
else
file_saved = FALSE;
@@ -667,7 +675,7 @@
}
else
{
- ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (doc), uri, NULL);
+ ianjuta_file_savable_save_as (IANJUTA_FILE_SAVABLE (doc), file, NULL);
}
if (anjuta_preferences_get_int (ANJUTA_PREFERENCES (docman->priv->preferences),
@@ -676,7 +684,7 @@
gtk_widget_destroy (dialog);
g_free (uri);
- gnome_vfs_uri_unref (vfs_uri);
+ g_object_unref (file);
return file_saved;
}
@@ -684,21 +692,21 @@
anjuta_docman_save_document (AnjutaDocman *docman, IAnjutaDocument *doc,
GtkWidget *parent_window)
{
- gchar *uri;
+ GFile* file;
gboolean ret;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
- if (uri == NULL)
+ if (file == NULL)
{
anjuta_docman_set_current_document (docman, doc);
ret = anjuta_docman_save_document_as (docman, doc, parent_window);
}
else
{
- /* TODO: Error checking */
+ /* Error checking must be done by the IAnjutaFile */
ianjuta_file_savable_save (IANJUTA_FILE_SAVABLE (doc), NULL);
- g_free (uri);
+ g_object_unref (file);
ret = TRUE;
}
return ret;
@@ -929,87 +937,33 @@
* Return value: the editor
*/
IAnjutaEditor *
-anjuta_docman_add_editor (AnjutaDocman *docman, const gchar *uri,
+anjuta_docman_add_editor (AnjutaDocman *docman, GFile* file,
const gchar *name)
{
- gchar *freeme;
- const gchar *_uri, *_name;
IAnjutaEditor *te;
IAnjutaEditorFactory* factory;
- freeme = NULL;
factory = anjuta_shell_get_interface (docman->shell, IAnjutaEditorFactory, NULL);
- if (uri == NULL)
- {
- if (name == NULL)
- {
- _uri = "";
- _name = _uri;
- }
- else
- {
-checkpath:
- /* the editor-backends work better with uri's */
- if (g_path_is_absolute (name))
- {
- gchar *canonical_path;
-
- canonical_path = anjuta_util_get_real_path (name);
- if (canonical_path != NULL)
- {
- freeme = gnome_vfs_get_uri_from_local_path (canonical_path);
- g_free (canonical_path);
- _uri = freeme;
- }
- else
- _uri = "";
-
- _name = "";
- }
- else
- {
- _uri = "";
- _name = name;
- }
- }
- }
- else /* uri != NULL */
- {
- if (name == NULL)
- {
- _uri = uri;
- _name = "";
- }
- else
- {
- if (*uri == '\0')
- goto checkpath;
- _uri = uri;
- _name = name;
- }
- }
-
- te = ianjuta_editor_factory_new_editor (factory, _uri, _name, NULL);
+ te = ianjuta_editor_factory_new_editor (factory, file, name, NULL);
/* if file cannot be loaded, text-editor brings up an error dialog ? */
if (te != NULL)
{
if (IANJUTA_IS_EDITOR (te))
ianjuta_editor_set_popup_menu (te, docman->priv->popup_menu, NULL);
- anjuta_docman_add_document (docman, IANJUTA_DOCUMENT (te), _uri);
+ anjuta_docman_add_document (docman, IANJUTA_DOCUMENT (te), file);
}
- g_free (freeme);
return te;
}
void
anjuta_docman_add_document (AnjutaDocman *docman, IAnjutaDocument *doc,
- const gchar *uri)
+ GFile* file)
{
AnjutaDocmanPage *page;
page = anjuta_docman_page_new ();
- anjuta_docman_page_init (docman, doc, uri, page); /* NULL uri is ok */
+ anjuta_docman_page_init (docman, doc, file, page);
/* list order matches pages in book, initially at least */
docman->priv->pages = g_list_prepend (docman->priv->pages, (gpointer)page);
@@ -1194,33 +1148,6 @@
gtk_widget_grab_focus (GTK_WIDGET (doc));
anjuta_docman_grab_text_focus (docman);
ianjuta_document_grab_focus (IANJUTA_DOCUMENT (doc), NULL);
-
- if (IANJUTA_IS_FILE (doc))
- {
- gchar *uri;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (uri)
- {
- gchar *hostname;
- gchar *filename;
-
- filename = g_filename_from_uri (uri, &hostname, NULL);
- if (hostname == NULL && filename != NULL)
- {
- gchar *dir;
- dir = g_path_get_dirname (filename);
- if (dir)
- {
- chdir (dir); /* CHECKME why is CWD relevant at all ?
- Anything else might change CWD at any time */
- g_free (dir);
- }
- }
- g_free (hostname);
- g_free (filename);
- g_free (uri);
- }
- }
}
}
else /* doc == NULL */
@@ -1280,92 +1207,43 @@
}
IAnjutaEditor *
-anjuta_docman_goto_uri_line (AnjutaDocman *docman, const gchar *uri, gint lineno)
+anjuta_docman_goto_file_line (AnjutaDocman *docman, GFile* file, gint lineno)
{
- return anjuta_docman_goto_uri_line_mark (docman, uri, lineno, FALSE);
+ return anjuta_docman_goto_file_line_mark (docman, file, lineno, FALSE);
}
-/* file_uri must be an escaped URI string such as returned by
- gnome_vfs_get_uri_from_local_path() */
IAnjutaEditor *
-anjuta_docman_goto_uri_line_mark (AnjutaDocman *docman, const gchar *file_uri,
+anjuta_docman_goto_file_line_mark (AnjutaDocman *docman, GFile* file,
gint line, gboolean mark)
-{
- GnomeVFSURI* vfs_uri;
- gchar *uri;
- const gchar *fragment;
- gint lineno;
-
+{
IAnjutaDocument *doc;
IAnjutaEditor *te;
- g_return_val_if_fail (file_uri != NULL, NULL);
+ g_return_val_if_fail (file != NULL, NULL);
- vfs_uri = gnome_vfs_uri_new (file_uri);
- g_return_val_if_fail (vfs_uri != NULL, NULL);
-
- /* Extract linenum which sometimes comes as an appended uri fragment
- e.g. when loading a file at session start or later */
- fragment = gnome_vfs_uri_get_fragment_identifier (vfs_uri);
- if (fragment)
- {
- const gchar *numstart;
- gchar *numend;
- gulong converted;
-
- DEBUG_PRINT ("uri fragment provided for %s line %d", file_uri, line);
- /* the real uri may have fragment(s) for vfs as well as for line-number */
- numstart = strrchr (fragment, '#');
- if (numstart == NULL)
- numstart = fragment;
- else
- numstart++;
- converted = strtoul (numstart, &numend, 10);
- if (*numstart == '\0' || numend == numstart || *numend != '\0')
- {
- lineno = line;
- uri = g_strdup (file_uri);
- }
- else /* the number is valid */
- {
- lineno = (gint) converted;
-
- /* Restore URI without fragment identifier (linenum) */
- uri = gnome_vfs_uri_to_string (vfs_uri,
- GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER);
- if (uri != NULL && numstart != fragment)
- {
- gchar *freeme, *freeme2;
- freeme = uri;
- freeme2 = g_strndup (fragment, numstart-fragment);
- uri = g_strconcat (uri, "#", freeme2, NULL);
- g_free (freeme);
- g_free (freeme2);
- }
- }
+ gchar* uri = g_file_get_uri (file);
+ const gchar* line_str;
+ GFile* real_file;
+
+ if ((line_str = strstr(uri, "#")) && line <= 0)
+ {
+ line = atoi (line_str + 1);
+ gchar* new_uri = g_strndup (uri, line_str - uri);
+ real_file = g_file_new_for_uri(new_uri);
+ g_free (new_uri);
}
else
- {
- lineno = line;
- uri = g_strdup (file_uri);
- }
+ real_file = g_file_dup (file);
- gnome_vfs_uri_unref (vfs_uri);
- g_return_val_if_fail (uri != NULL, NULL);
-
- DEBUG_PRINT("get document %s", uri);
/* if possible, use a document that's already open */
- doc = anjuta_docman_get_document_for_uri (docman, uri);
+ doc = anjuta_docman_get_document_for_file (docman, real_file);
if (doc == NULL)
{
- DEBUG_PRINT("open new %s", uri);
- /* no deal, open a new document */
- te = anjuta_docman_add_editor (docman, uri, NULL); /* CHECKME NULL if not IANJUTA_IS_EDITOR () ? */
+ te = anjuta_docman_add_editor (docman, real_file, NULL);
doc = IANJUTA_DOCUMENT (te);
}
else if (IANJUTA_IS_EDITOR (doc))
{
- DEBUG_PRINT("get te");
te = IANJUTA_EDITOR (doc);
}
else
@@ -1373,23 +1251,23 @@
doc = NULL;
te = NULL;
}
- g_free (uri);
if (te != NULL)
{
- gchar *te_uri = ianjuta_file_get_uri (IANJUTA_FILE (te), NULL);
- an_file_history_push (te_uri, lineno);
+ GFile *te_file = ianjuta_file_get_file (IANJUTA_FILE (te), NULL);
+ gchar* te_uri = g_file_get_uri (te_file);
+ an_file_history_push (te_uri, line);
g_free (te_uri);
- if (lineno >= 0)
+ if (line >= 0)
{
- ianjuta_editor_goto_line (te, lineno, NULL);
+ ianjuta_editor_goto_line (te, line, NULL);
if (mark && IANJUTA_IS_MARKABLE (doc))
{
ianjuta_markable_delete_all_markers (IANJUTA_MARKABLE (doc),
IANJUTA_MARKABLE_LINEMARKER,
NULL);
- ianjuta_markable_mark (IANJUTA_MARKABLE (doc), lineno,
+ ianjuta_markable_mark (IANJUTA_MARKABLE (doc), line,
IANJUTA_MARKABLE_LINEMARKER, NULL);
}
}
@@ -1399,12 +1277,13 @@
anjuta_docman_present_notebook_page (docman, doc);
ianjuta_document_grab_focus (IANJUTA_DOCUMENT (doc), NULL);
}
-
+
+ g_object_unref (real_file);
return te;
}
-gchar *
-anjuta_docman_get_uri (AnjutaDocman *docman, const gchar *fn)
+GFile*
+anjuta_docman_get_file (AnjutaDocman *docman, const gchar *fn)
{
IAnjutaDocument *doc;
GList *node;
@@ -1418,23 +1297,13 @@
go further, even if the file is not found*/
if (fn[0] == '/')
{
- gchar *uri;
-
- uri = gnome_vfs_get_uri_from_local_path(real_path);
- g_free (real_path);
-
- return uri;
+ return g_file_new_for_path (fn);
}
/* First, check if we can get the file straightaway */
if (g_file_test (real_path, G_FILE_TEST_IS_REGULAR))
{
- gchar *uri;
-
- uri = gnome_vfs_get_uri_from_local_path(real_path);
- g_free (real_path);
-
- return uri;
+ return g_file_new_for_path (real_path);
}
g_free(real_path);
@@ -1447,7 +1316,7 @@
if (strcmp(ianjuta_document_get_filename(doc, NULL), fname) == 0)
{
g_free (fname);
- return ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
+ return ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
}
}
/* Next, see if the name matches any of the opened files */
@@ -1459,7 +1328,7 @@
if (strcmp (fname, ianjuta_document_get_filename (page->doc, NULL)) == 0)
{
g_free (fname);
- return ianjuta_file_get_uri (IANJUTA_FILE (page->doc), NULL);
+ return ianjuta_file_get_file (IANJUTA_FILE (page->doc), NULL);
}
}
g_free (fname);
@@ -1503,7 +1372,7 @@
{
AnjutaDocmanPage *page;
gchar *basename;
- gchar *uri;
+ GFile* file;
const gchar* doc_filename;
gchar* dirty_char;
gchar* label;
@@ -1524,16 +1393,16 @@
dirty_char = "*";
}
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (uri)
+ file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ if (file)
{
- basename = g_path_get_basename (uri);
+ basename = g_file_get_basename (file);
label = g_strconcat(dirty_char, basename, NULL);
gtk_label_set_text (GTK_LABEL (page->label), label);
gtk_label_set_text (GTK_LABEL (page->menu_label), label);
g_free (label);
g_free (basename);
- g_free (uri);
+ g_object_unref (file);
}
else if ((doc_filename = ianjuta_document_get_filename (doc, NULL)) != NULL)
{
@@ -1583,14 +1452,7 @@
page = (AnjutaDocmanPage *) node->data;
if (IANJUTA_IS_EDITOR (page->doc))
{
- gchar *uri;
-
- uri = ianjuta_file_get_uri (IANJUTA_FILE (page->doc), NULL);
- if (uri)
- {
- g_free (uri);
- ianjuta_markable_unmark (IANJUTA_MARKABLE (page->doc), -1, -1, NULL);
- }
+ ianjuta_markable_unmark (IANJUTA_MARKABLE (page->doc), -1, -1, NULL);
}
}
}
@@ -1598,13 +1460,13 @@
/* Saves a file to keep it synchronized with external programs */
/* CHECKME unused */
void
-anjuta_docman_save_file_if_modified (AnjutaDocman *docman, const gchar *uri)
+anjuta_docman_save_file_if_modified (AnjutaDocman *docman, GFile* file)
{
IAnjutaDocument *doc;
- g_return_if_fail (uri != NULL);
-
- doc = anjuta_docman_get_document_for_uri (docman, uri);
+ g_return_if_fail (file != NULL);
+
+ doc = anjuta_docman_get_document_for_file (docman, file);
if (doc)
{
if(ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc), NULL))
@@ -1617,19 +1479,19 @@
/* If an external program changed the file, we must reload it */
/* CHECKME unused */
void
-anjuta_docman_reload_file (AnjutaDocman *docman, const gchar *uri)
+anjuta_docman_reload_file (AnjutaDocman *docman, GFile* file)
{
IAnjutaDocument *doc;
- g_return_if_fail (uri != NULL);
+ g_return_if_fail (file != NULL);
- doc = anjuta_docman_get_document_for_uri (docman, uri);
+ doc = anjuta_docman_get_document_for_file (docman, file);
if (doc && IANJUTA_IS_EDITOR (doc))
{
IAnjutaEditor *te;
te = IANJUTA_EDITOR (doc);
glong nNowPos = ianjuta_editor_get_lineno (te, NULL);
- ianjuta_file_open (IANJUTA_FILE (doc), uri, NULL);
+ ianjuta_file_open (IANJUTA_FILE (doc), file, NULL);
ianjuta_editor_goto_line (te, nNowPos, NULL);
}
}
@@ -1689,44 +1551,14 @@
anjuta_docman_update_documents_menu(docman);
}
-
-gboolean
-anjuta_docman_set_editor_properties (AnjutaDocman *docman)
-{
- /* FIXME:
- TextEditor *te = IANJUTA_EDITOR (docman->priv->current_document);
- if (te)
- {
- gchar *word;
- // FIXME: anjuta_set_file_properties (app->current_text_editor->uri);
- word = text_editor_get_current_word (te);
- prop_set_with_key (te->props_base, "current.file.selection", word?word:"");
- if (word)
- g_free(word);
- prop_set_int_with_key (te->props_base, "current.file.lineno",
- text_editor_get_current_lineno (te));
- return TRUE;
- }
- else
- return FALSE; */
- return TRUE;
-}
-
IAnjutaDocument *
-anjuta_docman_get_document_for_uri (AnjutaDocman *docman, const gchar *file_uri)
+anjuta_docman_get_document_for_file (AnjutaDocman *docman, GFile* file)
{
- gchar *local_path;
- gchar *normalized_path;
GList *node;
- g_return_val_if_fail (file_uri != NULL, NULL);
-
- local_path = gnome_vfs_get_local_path_from_uri (file_uri);
- /* grab a normalized file path for effective comparision */
- normalized_path = anjuta_util_get_real_path (local_path);
- g_free (local_path);
+ g_return_val_if_fail (file != NULL, NULL);
- if (normalized_path != NULL)
+ if (file)
{
for (node = docman->priv->pages; node != NULL; node = g_list_next (node))
{
@@ -1736,59 +1568,18 @@
if (page && page->widget && IANJUTA_IS_DOCUMENT (page->doc))
{
IAnjutaDocument *doc;
- gchar *te_uri;
+ GFile* doc_file;
doc = page->doc;
- te_uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (te_uri)
- {
- gchar *te_path;
-
- te_path = gnome_vfs_get_local_path_from_uri (te_uri);
- if (te_path)
- {
- /* editor uri is local too */
- gchar *normalized_te_path;
-
- normalized_te_path = anjuta_util_get_real_path (te_path);
- g_free (te_path);
- if ((normalized_te_path != NULL) &&
- strcmp (normalized_te_path, normalized_path) == 0)
- {
- g_free (normalized_path);
- g_free (te_uri);
- g_free (normalized_te_path);
- return doc;
- }
- g_free (normalized_te_path);
- }
- g_free (te_uri);
- }
- }
- }
- g_free (normalized_path);
- }
- else
- {
- /* not a local uri, too bad about any links etc */
- for (node = docman->priv->pages; node != NULL; node = g_list_next (node))
- {
- AnjutaDocmanPage *page;
- page = (AnjutaDocmanPage *) node->data;
-
- if (page && page->doc && IANJUTA_IS_DOCUMENT (page->doc))
- {
- gchar *te_uri;
-
- te_uri = ianjuta_file_get_uri (IANJUTA_FILE (page->doc), NULL);
- if (te_uri)
+ doc_file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ if (doc_file)
{
- if (strcmp (te_uri, file_uri) == 0)
+ if (g_file_equal (file, doc_file))
{
- g_free (te_uri);
- return page->doc;
+ g_object_unref (doc_file);
+ return doc;
}
- g_free (te_uri);
+ g_object_unref (doc_file);
}
}
}
Modified: trunk/plugins/document-manager/anjuta-docman.h
==============================================================================
--- trunk/plugins/document-manager/anjuta-docman.h (original)
+++ trunk/plugins/document-manager/anjuta-docman.h Wed Jul 2 00:46:18 2008
@@ -26,6 +26,7 @@
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/interfaces/ianjuta-editor.h>
#include <libanjuta/interfaces/ianjuta-document.h>
+#include <gio/gio.h>
#include "plugin.h"
@@ -58,16 +59,16 @@
void anjuta_docman_set_popup_menu (AnjutaDocman *docman, GtkWidget *menu);
-IAnjutaEditor *anjuta_docman_add_editor (AnjutaDocman *docman, const gchar *uri,
- const gchar *name);
+IAnjutaEditor *anjuta_docman_add_editor (AnjutaDocman *docman, GFile* file,
+ const gchar *name);
void anjuta_docman_add_document (AnjutaDocman *docman, IAnjutaDocument *doc,
- const gchar* uri);
+ GFile* file);
void anjuta_docman_remove_document (AnjutaDocman *docman, IAnjutaDocument *doc);
IAnjutaDocument *anjuta_docman_get_current_document (AnjutaDocman *docman);
-IAnjutaDocument *anjuta_docman_get_document_for_uri (AnjutaDocman *docman,
- const gchar *file_uri);
+IAnjutaDocument *anjuta_docman_get_document_for_file (AnjutaDocman *docman,
+ GFile* file);
GtkWidget *anjuta_docman_get_current_focus_widget (AnjutaDocman *docman);
@@ -78,11 +79,11 @@
void anjuta_docman_set_message_area (AnjutaDocman *docman, IAnjutaDocument *doc,
GtkWidget *message_area);
-IAnjutaEditor *anjuta_docman_goto_uri_line (AnjutaDocman *docman,
- const gchar *uri,
+IAnjutaEditor *anjuta_docman_goto_file_line (AnjutaDocman *docman,
+ GFile* file,
gint lineno);
-IAnjutaEditor *anjuta_docman_goto_uri_line_mark (AnjutaDocman *docman,
- const gchar *uri,
+IAnjutaEditor *anjuta_docman_goto_file_line_mark (AnjutaDocman *docman,
+ GFile* file,
gint lineno,
gboolean mark);
void anjuta_docman_present_notebook_page (AnjutaDocman *docman, IAnjutaDocument *doc);
@@ -91,12 +92,11 @@
void anjuta_docman_delete_all_indicators (AnjutaDocman *docman);
void anjuta_docman_save_file_if_modified (AnjutaDocman *docman,
- const gchar *uri);
-void anjuta_docman_reload_file (AnjutaDocman *docman, const gchar *uri);
+ GFile* file);
+void anjuta_docman_reload_file (AnjutaDocman *docman, GFile* file);
-gboolean anjuta_docman_set_editor_properties (AnjutaDocman *docman);
-gchar *anjuta_docman_get_uri (AnjutaDocman *docman, const gchar *filename);
+GFile *anjuta_docman_get_file (AnjutaDocman *docman, const gchar *filename);
GList *anjuta_docman_get_all_doc_widgets (AnjutaDocman *docman);
Modified: trunk/plugins/document-manager/file_history.c
==============================================================================
--- trunk/plugins/document-manager/file_history.c (original)
+++ trunk/plugins/document-manager/file_history.c Wed Jul 2 00:46:18 2008
@@ -119,27 +119,33 @@
void an_file_history_back(AnjutaDocman *docman)
{
AnHistFile *h_file;
+ GFile* file;
if (!(s_history && s_history->current && s_history->current->next))
return;
s_history->current = s_history->current->next;
h_file = (AnHistFile *) s_history->current->data;
- anjuta_docman_goto_uri_line_mark (docman, h_file->uri,
+ file = g_file_new_for_uri (h_file->uri);
+ anjuta_docman_goto_file_line_mark (docman, file,
h_file->line, FALSE);
+ g_object_unref (file);
}
void an_file_history_forward(AnjutaDocman *docman)
{
AnHistFile *h_file;
+ GFile* file;
if (!(s_history && s_history->current && s_history->current->prev))
return;
s_history->current = s_history->current->prev;
h_file = (AnHistFile *) s_history->current->data;
- anjuta_docman_goto_uri_line_mark(docman, h_file->uri,
+ file = g_file_new_for_uri (h_file->uri);
+ anjuta_docman_goto_file_line_mark(docman, file,
h_file->line, FALSE);
+ g_object_unref (file);
}
void an_file_history_dump(void)
Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c (original)
+++ trunk/plugins/document-manager/plugin.c Wed Jul 2 00:46:18 2008
@@ -19,12 +19,12 @@
*/
#include <config.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-encodings.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-file.h>
#include <libanjuta/interfaces/ianjuta-editor.h>
#include <libanjuta/interfaces/ianjuta-editor-selection.h>
@@ -453,10 +453,10 @@
static gchar*
get_directory_display_name (DocmanPlugin* plugin,
- const gchar* uri)
+ GFile* file)
{
gchar* dir;
- gchar* display_uri = display_uri = gnome_vfs_format_uri_for_display (uri);
+ gchar* display_uri = g_file_get_parse_name (file);
gchar* display_dir;
dir = anjuta_util_uri_get_dirname (display_uri);
@@ -480,12 +480,19 @@
{
gchar* real_filename;
gchar *dir;
- gchar *uri;
const gchar *filename;
filename = ianjuta_document_get_filename (doc, NULL);
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- dir = get_directory_display_name (doc_plugin, uri);
- g_free (uri);
+ GFile* file;
+ file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ if (file)
+ {
+ dir = get_directory_display_name (doc_plugin, file);
+ g_object_unref (file);
+ }
+ else
+ {
+ dir = NULL;
+ }
if (ianjuta_file_savable_is_dirty(IANJUTA_FILE_SAVABLE (doc), NULL))
{
gchar* dirty_name = g_strconcat ("*", filename, NULL);
@@ -542,16 +549,17 @@
root_uri = g_value_get_string (value);
if (root_uri)
{
- gchar* path =
- gnome_vfs_get_local_path_from_uri (root_uri);
+ GFile* file = g_file_new_for_uri (root_uri);
+ gchar* path = g_file_get_path (file);
- doc_plugin->project_name = g_path_get_basename(path);
+ doc_plugin->project_name = g_file_get_basename (file);
doc_plugin->project_path = path;
if (doc_plugin->project_name)
{
update_title (doc_plugin);
}
+ g_object_unref (file);
}
}
@@ -1187,13 +1195,13 @@
g_value_init (&value, G_TYPE_OBJECT);
g_value_set_object (&value, doc);
anjuta_shell_add_value (plugin->shell,
- "document_manager_current_editor",
+ IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
&value, NULL);
g_value_unset(&value);
}
else
{
- anjuta_shell_remove_value (plugin->shell, "document_manager_current_editor",
+ anjuta_shell_remove_value (plugin->shell, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
NULL);
}
@@ -1408,18 +1416,19 @@
if (IANJUTA_IS_EDITOR (node->data))
{
IAnjutaEditor *te;
- gchar *te_uri;
+ GFile* file;
te = IANJUTA_EDITOR (node->data);
- te_uri = ianjuta_file_get_uri (IANJUTA_FILE (te), NULL);
- if (te_uri)
+ file = ianjuta_file_get_file (IANJUTA_FILE (te), NULL);
+ if (file)
{
gchar *uri;
+ gchar* file_uri = g_file_get_uri (file);
/* Save line locations also */
- uri = g_strdup_printf ("%s#%d", te_uri,
+ uri = g_strdup_printf ("%s#%d", file_uri,
ianjuta_editor_get_lineno (te, NULL));
files = g_list_prepend (files, uri);
- g_free (te_uri);
+ g_free (file_uri);
}
}
}
@@ -1461,12 +1470,15 @@
{
const gchar *name;
gchar *uri;
+ GFile* file;
name = ianjuta_document_get_filename (IANJUTA_DOCUMENT (editor), NULL);
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ uri = g_file_get_uri (file);
anjuta_save_prompt_add_item (save_prompt, name, uri, editor,
on_save_prompt_save_editor, plugin);
g_free (uri);
+ g_object_unref (file);
}
}
g_list_free (buffers);
@@ -1548,13 +1560,12 @@
doc = IANJUTA_DOCUMENT (node->data);
if (ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc), NULL))
{
- gchar *uri;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
- if (uri)
+ GFile* file = ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
+ if (file)
{
GError *err = NULL;
+ g_object_unref (file);
- g_free (uri);
ianjuta_file_savable_save (IANJUTA_FILE_SAVABLE (doc), &err);
if (err)
{
@@ -1748,7 +1759,8 @@
"AnjutaDocumentManager", _("Documents"),
"editor-plugin-icon",
ANJUTA_SHELL_PLACEMENT_CENTER,
- TRUE, NULL);
+ TRUE, NULL);
+ anjuta_shell_present_widget (plugin->shell, dplugin->vbox, NULL);
ui_states_init(plugin);
ui_give_shorter_names (plugin);
@@ -1775,7 +1787,7 @@
G_CALLBACK (on_save_prompt), plugin);
dplugin->project_watch_id =
- anjuta_plugin_add_watch (plugin, "project_root_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
value_added_project_root_uri,
value_removed_project_root_uri, NULL);
dplugin->project_name = NULL;
@@ -1882,22 +1894,22 @@
}
/* Implement IAnjutaDocumentManager interfaces */
-static gchar*
-ianjuta_docman_get_uri (IAnjutaDocumentManager *plugin,
+static GFile*
+ianjuta_docman_get_file (IAnjutaDocumentManager *plugin,
const gchar *filename, GError **e)
{
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
- return anjuta_docman_get_uri (docman, filename);
+ return anjuta_docman_get_file (docman, filename);
}
static IAnjutaDocument*
-ianjuta_docman_get_document_for_uri (IAnjutaDocumentManager *plugin,
- const gchar *file_uri, GError **e)
+ianjuta_docman_get_document_for_file (IAnjutaDocumentManager *plugin,
+ GFile* file, GError **e)
{
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
- return anjuta_docman_get_document_for_uri (docman, file_uri);
+ return anjuta_docman_get_document_for_file (docman, file);
}
static IAnjutaDocument*
@@ -1937,21 +1949,21 @@
}
static IAnjutaEditor*
-ianjuta_docman_goto_uri_line (IAnjutaDocumentManager *plugin,
- const gchar *uri, gint linenum, GError **e)
+ianjuta_docman_goto_file_line (IAnjutaDocumentManager *plugin,
+ GFile* file, gint linenum, GError **e)
{
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
- return anjuta_docman_goto_uri_line (docman, uri, linenum);
+ return anjuta_docman_goto_file_line (docman, file, linenum);
}
static IAnjutaEditor*
-ianjuta_docman_goto_uri_line_mark (IAnjutaDocumentManager *plugin,
- const gchar *uri, gint linenum, gboolean mark, GError **e)
+ianjuta_docman_goto_file_line_mark (IAnjutaDocumentManager *plugin,
+ GFile* file, gint linenum, gboolean mark, GError **e)
{
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
- return anjuta_docman_goto_uri_line_mark (docman, uri, linenum, mark);
+ return anjuta_docman_goto_file_line_mark (docman, file, linenum, mark);
}
/**
@@ -1965,7 +1977,7 @@
*/
static IAnjutaEditor*
ianjuta_docman_add_buffer (IAnjutaDocumentManager *plugin,
- const gchar *filename, const gchar *content,
+ const gchar* filename, const gchar *content,
GError **e)
{
AnjutaDocman *docman;
@@ -2022,12 +2034,12 @@
{
iface->add_buffer = ianjuta_docman_add_buffer;
iface->add_document = ianjuta_docman_add_document;
- iface->find_document_with_uri = ianjuta_docman_get_document_for_uri;
+ iface->find_document_with_file = ianjuta_docman_get_document_for_file;
iface->get_current_document = ianjuta_docman_get_current_document;
iface->get_doc_widgets = ianjuta_docman_get_doc_widgets;
- iface->get_uri = ianjuta_docman_get_uri;
- iface->goto_uri_line = ianjuta_docman_goto_uri_line;
- iface->goto_uri_line_mark = ianjuta_docman_goto_uri_line_mark;
+ iface->get_file = ianjuta_docman_get_file;
+ iface->goto_file_line = ianjuta_docman_goto_file_line;
+ iface->goto_file_line_mark = ianjuta_docman_goto_file_line_mark;
iface->remove_document = ianjuta_docman_remove_document;
iface->set_current_document = ianjuta_docman_set_current_document;
iface->set_message_area = ianjuta_docman_set_message_area;
@@ -2035,16 +2047,16 @@
/* Implement IAnjutaFile interface */
static void
-ifile_open (IAnjutaFile* plugin, const gchar* uri, GError** e)
+ifile_open (IAnjutaFile* plugin, GFile* file, GError** e)
{
AnjutaDocman *docman;
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
- anjuta_docman_goto_uri_line_mark (docman, uri, -1, FALSE);
+ anjuta_docman_goto_file_line (docman, file, -1);
}
-static gchar*
-ifile_get_uri (IAnjutaFile* plugin, GError** e)
+static GFile*
+ifile_get_file (IAnjutaFile* plugin, GError** e)
{
AnjutaDocman *docman;
IAnjutaDocument *doc;
@@ -2052,11 +2064,7 @@
docman = ANJUTA_DOCMAN ((ANJUTA_PLUGIN_DOCMAN (plugin)->docman));
doc = anjuta_docman_get_current_document (docman);
if (doc != NULL)
- return ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
-/* bad to call this func with NULL arg
- else if (ianjuta_document_get_filename (doc, NULL))
- return gnome_vfs_get_uri_from_local_path (ianjuta_document_get_filename(editor, NULL));
-*/
+ return ianjuta_file_get_file (IANJUTA_FILE (doc), NULL);
else
return NULL;
}
@@ -2065,7 +2073,7 @@
ifile_iface_init (IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
/* Implement IAnjutaFileSavable interface */
@@ -2096,7 +2104,7 @@
}
static void
-isavable_save_as (IAnjutaFileSavable* plugin, const gchar* uri, GError** e)
+isavable_save_as (IAnjutaFileSavable* plugin, GFile* file, GError** e)
{
DEBUG_PRINT("save_as: Not implemented in DocmanPlugin");
}
Modified: trunk/plugins/editor/Makefile.am
==============================================================================
--- trunk/plugins/editor/Makefile.am (original)
+++ trunk/plugins/editor/Makefile.am Wed Jul 2 00:46:18 2008
@@ -23,7 +23,7 @@
AM_CPPFLAGS = \
$(GNOME_PRINT_UI_CFLAGS) \
- $(GNOME_VFS_CFLAGS) \
+ $(GIO_CFLAGS) \
$(LIBANJUTA_CFLAGS) \
$(PLUGIN_SCINTILLA_CFLAGS) \
-I$(srcdir)/scintilla/include \
@@ -33,7 +33,7 @@
libanjuta_editor_la_LIBADD = \
$(GNOME_PRINT_UI_LIBS) \
- $(GNOME_VFS_LIBS) \
+ $(GIO_LIBS) \
$(LIBANJUTA_LIBS) \
$(PLUGIN_SCINTILLA_LIBS) \
$(GLADE_LIBS) \
Modified: trunk/plugins/editor/plugin.c
==============================================================================
--- trunk/plugins/editor/plugin.c (original)
+++ trunk/plugins/editor/plugin.c Wed Jul 2 00:46:18 2008
@@ -19,7 +19,6 @@
*/
#include <config.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-encodings.h>
@@ -97,15 +96,17 @@
static IAnjutaEditor*
itext_editor_factory_new_editor(IAnjutaEditorFactory* factory,
- const gchar* uri,
+ GFile* file,
const gchar* filename,
GError** error)
{
AnjutaShell *shell = ANJUTA_PLUGIN (factory)->shell;
AnjutaPreferences *prefs = anjuta_shell_get_preferences (shell, NULL);
AnjutaStatus *status = anjuta_shell_get_status (shell, NULL);
+ gchar* uri = g_file_get_uri (file);
IAnjutaEditor* editor = IANJUTA_EDITOR(text_editor_new(status, prefs,
uri, filename));
+ g_free(uri);
return editor;
}
Modified: trunk/plugins/editor/print.c
==============================================================================
--- trunk/plugins/editor/print.c (original)
+++ trunk/plugins/editor/print.c Wed Jul 2 00:46:18 2008
@@ -27,7 +27,6 @@
#include <string.h>
#include <gnome.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-job.h>
#include <libgnomeprintui/gnome-print-dialog.h>
Modified: trunk/plugins/editor/text_editor.c
==============================================================================
--- trunk/plugins/editor/text_editor.c (original)
+++ trunk/plugins/editor/text_editor.c Wed Jul 2 00:46:18 2008
@@ -26,8 +26,8 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
+#include <gio/gio.h>
#include <gnome.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <errno.h>
#include <libanjuta/resources.h>
@@ -360,18 +360,18 @@
}
static void
-on_text_editor_uri_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
+on_text_editor_uri_changed (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
gpointer user_data)
{
TextEditor *te = TEXT_EDITOR (user_data);
/* DEBUG_PRINT ("File changed!!!"); */
- if (!(event_type == GNOME_VFS_MONITOR_EVENT_CHANGED ||
- event_type == GNOME_VFS_MONITOR_EVENT_CREATED))
+ if (!(event_type == G_FILE_MONITOR_EVENT_CHANGED ||
+ event_type == G_FILE_MONITOR_EVENT_CREATED))
return;
if (!anjuta_util_diff (te->uri, te->last_saved_content))
@@ -383,9 +383,6 @@
return;
}
- if (strcmp (monitor_uri, info_uri) != 0)
- return;
-
/* If the file modified dialog is already shown, don't bother showing it
* again.
*/
@@ -405,23 +402,31 @@
if (te->monitor)
{
/* Shutdown existing monitor */
- gnome_vfs_monitor_cancel (te->monitor);
+ g_file_monitor_cancel (te->monitor);
te->monitor = NULL;
}
if (te->uri && !disable_it)
{
- GnomeVFSResult res;
+ GFile *gio_uri;
+ GError *error = NULL;
/* DEBUG_PRINT ("Setting up Monitor for %s", te->uri); */
- res = gnome_vfs_monitor_add (&te->monitor, te->uri,
- GNOME_VFS_MONITOR_FILE,
- on_text_editor_uri_changed, te);
- /*
- if (res != GNOME_VFS_OK)
+
+ gio_uri = g_file_new_for_uri (te->uri);
+ te->monitor = g_file_monitor_file (gio_uri,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ g_signal_connect (te->monitor, "changed",
+ G_CALLBACK (on_text_editor_uri_changed), te);
+ g_object_unref (gio_uri);
+
+ if (error != NULL)
{
DEBUG_PRINT ("Error while setting up file monitor: %s",
- gnome_vfs_result_to_string (res));
+ error->message);
+ g_error_free (error);
}
- */
+
}
}
@@ -441,21 +446,19 @@
else
te->filename = g_strdup_printf ("Newfile#%d", ++new_file_count);
if (uri && strlen(uri) > 0)
- {
- GnomeVFSResult result;
- GnomeVFSURI* vfs_uri;
- GnomeVFSFileInfo info = {0,0};
-
+ {
new_file_count--;
if (te->filename)
g_free (te->filename);
if (te->uri)
g_free (te->uri);
- vfs_uri = gnome_vfs_uri_new(uri);
- result = gnome_vfs_get_file_info_uri(vfs_uri, &info, GNOME_VFS_SET_FILE_INFO_NONE);
- gnome_vfs_uri_unref(vfs_uri);
- te->filename = g_strdup(info.name);
- te->uri = g_strdup(uri);
+
+ GFile *gio_uri;
+ gio_uri = g_file_new_for_uri (uri);
+ te->filename = g_file_get_basename (gio_uri);
+ g_object_unref (gio_uri);
+
+ te->uri = g_strdup (uri);
}
text_editor_prefs_init (te);
@@ -1105,12 +1108,12 @@
/*
* save buffer. filter chars and set dos-like CR/LF if dos_text is set.
*/
-static GnomeVFSResult
-save_filtered_in_dos_mode(GnomeVFSHandle* vfs_write, gchar *data_,
- GnomeVFSFileSize size)
+static gboolean
+save_filtered_in_dos_mode(GFileOutputStream* stream, gchar *data_,
+ gsize size)
{
- GnomeVFSResult result;
- size_t i, j;
+ gboolean result;
+ gsize i, j;
unsigned char *data;
unsigned char *tr_map;
int k;
@@ -1123,34 +1126,46 @@
tr_map[tr_dos[k].c] = tr_dos[k].b;
data = (unsigned char*)data_;
- i = 0; j = 0;
+ i = 0;
+ j = 0;
while ( i < size )
{
- if (data[i]>=128) {
+ if (data[i]>=128)
+ {
/* convert dos-text */
if ( tr_map[data[i]] != 0 )
{
- GnomeVFSFileSize bytes_written;
- result = gnome_vfs_write (vfs_write, &tr_map[data[i]], 1, &bytes_written);
+ gsize bytes_written;
+ result = g_output_stream_write_all (G_OUTPUT_STREAM (stream),
+ &tr_map[data[i]], 1,
+ &bytes_written,
+ NULL, NULL);
+
j += bytes_written;
}
else
{
/* char not found, skip transform */
- GnomeVFSFileSize bytes_written;
- result = gnome_vfs_write (vfs_write, &data[i], 1, &bytes_written);
+ gsize bytes_written;
+ result = g_output_stream_write_all (G_OUTPUT_STREAM (stream),
+ &data[i], 1,
+ &bytes_written,
+ NULL, NULL);
j += bytes_written;
}
i++;
}
else
{
- GnomeVFSFileSize bytes_written;
- result = gnome_vfs_write (vfs_write, &data[i], 1, &bytes_written);
+ gsize bytes_written;
+ result = g_output_stream_write_all (G_OUTPUT_STREAM (stream),
+ &data[i], 1,
+ &bytes_written,
+ NULL, NULL);
j += bytes_written;
i++;
}
- if (result != GNOME_VFS_OK)
+ if (!result)
break;
}
@@ -1246,57 +1261,72 @@
static gboolean
load_from_file (TextEditor *te, gchar *uri, gchar **err)
{
- GnomeVFSURI* vfs_uri;
- GnomeVFSHandle* vfs_read;
- GnomeVFSResult result;
- GnomeVFSFileInfo info;
- GnomeVFSFileSize nchars;
+ GFile *gio_uri;
+ GFileInputStream *stream;
+ gboolean result;
+ GFileInfo *info;
+ gsize nchars;
gint dos_filter, editor_mode;
gchar *file_content = NULL;
gchar *buffer = NULL;
+ guint64 size;
scintilla_send_message (SCINTILLA (te->scintilla), SCI_CLEARALL,
0, 0);
- vfs_uri = gnome_vfs_uri_new(uri);
- result = gnome_vfs_get_file_info_uri (vfs_uri,
- &info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result != GNOME_VFS_OK)
+ gio_uri = g_file_new_for_uri (uri);
+ info = g_file_query_info (gio_uri,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+
+ if (info == NULL)
{
*err = g_strdup (_("Could not get file info"));
+ g_object_unref (gio_uri);
+
return FALSE;
}
- buffer = g_malloc (info.size + 1);
- if (buffer == NULL && info.size != 0)
+ size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
+ g_object_unref (info);
+
+ buffer = g_malloc (size + 1);
+ if (buffer == NULL && size != 0)
{
/* DEBUG_PRINT ("This file is too big. Unable to allocate memory."); */
*err = g_strdup (_("This file is too big. Unable to allocate memory."));
+ g_object_unref (gio_uri);
+
return FALSE;
}
- result = gnome_vfs_open_uri(&vfs_read, vfs_uri, GNOME_VFS_OPEN_READ);
- if (result != GNOME_VFS_OK)
+ stream = g_file_read (gio_uri, NULL, NULL);
+ if (stream == NULL)
{
*err = g_strdup (_("Could not open file"));
+ g_object_unref (gio_uri);
+
return FALSE;
}
/* Crude way of loading, but faster */
- result = gnome_vfs_read (vfs_read, buffer, info.size, &nchars);
- if (result != GNOME_VFS_OK && !(result == GNOME_VFS_ERROR_EOF && info.size == 0))
+ result = g_input_stream_read_all (G_INPUT_STREAM (stream),
+ buffer, size, &nchars, NULL, NULL);
+ if (!result)
{
g_free(buffer);
*err = g_strdup (_("Error while reading from file"));
+ g_object_unref (gio_uri);
+
return FALSE;
}
if (buffer)
{
- buffer[info.size] = '\0';
+ buffer[size] = '\0';
file_content = g_strdup (buffer);
}
- if (info.size != nchars)
+ if (size != nchars)
{
/* DEBUG_PRINT ("File size and loaded size not matching"); */
}
@@ -1333,7 +1363,8 @@
*err = g_strdup (_("The file does not look like a text file or the file encoding is not supported."
" Please check if the encoding of file is in the supported encodings list."
" If not, add it from the preferences."));
- gnome_vfs_close(vfs_read);
+ g_object_unref (gio_uri);
+
return FALSE;
}
g_free (buffer);
@@ -1354,23 +1385,28 @@
g_free (te->last_saved_content);
te->last_saved_content = file_content;
- gnome_vfs_close(vfs_read);
+ g_object_unref (gio_uri);
+
return TRUE;
}
-static GnomeVFSResult
-save_to_file (TextEditor *te, gchar * uri)
+static gboolean
+save_to_file (TextEditor *te, gchar *uri, GError **error)
{
- GnomeVFSHandle* vfs_write;
- GnomeVFSResult result;
- GnomeVFSFileSize nchars, size;
+ GFileOutputStream *stream;
+ GFile *gio_uri;
+ gsize nchars, size;
gint strip;
gchar *data;
+ gboolean result;
+
+ gio_uri = g_file_new_for_uri (uri);
+ stream = g_file_replace (gio_uri, NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL);
+
+ if (stream == NULL)
+ return FALSE;
- result = gnome_vfs_create (&vfs_write, uri, GNOME_VFS_OPEN_WRITE,
- FALSE, 0664);
- if (result != GNOME_VFS_OK)
- return result;
+ result = TRUE;
nchars = scintilla_send_message (SCINTILLA (te->scintilla),
SCI_GETLENGTH, 0, 0);
@@ -1438,11 +1474,13 @@
if (editor_mode == SC_EOL_CRLF && dos_filter)
{
/* DEBUG_PRINT ("Filtering Extrageneous DOS characters in dos mode [Unix => Dos]"); */
- size = save_filtered_in_dos_mode (vfs_write, data, size);
+ size = save_filtered_in_dos_mode (stream, data, size);
}
else
{
- result = gnome_vfs_write(vfs_write, data, size, &nchars);
+ result = g_output_stream_write_all (G_OUTPUT_STREAM (stream),
+ data, size,
+ &nchars, NULL, error);
}
}
@@ -1450,10 +1488,12 @@
g_free (te->last_saved_content);
te->last_saved_content = data;
- if (result == GNOME_VFS_OK)
- result = gnome_vfs_close(vfs_write);
+ if (result)
+ result = g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, error);
else
- gnome_vfs_close (vfs_write);
+ g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
+
+ g_object_unref (gio_uri);
return result;
}
@@ -1505,8 +1545,9 @@
{
gboolean ret = FALSE;
gchar *save_uri;
- GnomeVFSResult result;
+ gboolean result;
GtkWindow *parent;
+ GError *error = NULL;
if (te == NULL)
return FALSE;
@@ -1521,91 +1562,93 @@
text_editor_update_monitor (te, TRUE);
save_uri = g_strconcat (te->uri, "~", NULL);
- result = save_to_file (te, save_uri);
- if (result != GNOME_VFS_OK)
+ result = save_to_file (te, save_uri, &error);
+ if (!result)
{
- GList *sources = NULL;
- GnomeVFSURI *vfs_uri;
+ GFile *gio_uri;
text_editor_thaw (te);
anjuta_util_dialog_error (parent,
_("Could not save intermediate file %s: %s"),
save_uri,
- gnome_vfs_result_to_string (result));
+ error->message);
+
+ gio_uri = g_file_new_for_uri (save_uri);
+ g_file_delete (gio_uri, NULL, NULL);
- vfs_uri = gnome_vfs_uri_new (save_uri);
- sources = g_list_append (sources, vfs_uri);
- gnome_vfs_xfer_delete_list (sources, GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_DELETE_ITEMS |
- GNOME_VFS_XFER_REMOVESOURCE, NULL, NULL);
- g_list_free (sources);
- gnome_vfs_uri_unref (vfs_uri);
+ g_object_unref (gio_uri);
+ g_error_free (error);
}
else
{
- GnomeVFSURI *src_uri;
- GnomeVFSURI *dest_uri;
- GnomeVFSFileInfo info;
+ GFile *src_gio;
+ GFile *dest_gio;
+ GFileInfo *info;
gboolean have_info;
+ char *dest_uri;
+
+ dest_uri = te->uri;
- src_uri = gnome_vfs_uri_new (save_uri);
- dest_uri = gnome_vfs_uri_new (te->uri);
-
/* have_info is FALSE on newly created file */
- have_info = gnome_vfs_get_file_info_uri (dest_uri,
- &info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS) == GNOME_VFS_OK;
+ DEBUG_PRINT ("MY_TEST dest_uri: %s", dest_uri);
+
+ src_gio = g_file_new_for_uri (save_uri);
+ dest_gio = g_file_new_for_uri (te->uri);
+
+ have_info = g_file_query_exists (dest_gio, NULL);
if (have_info)
{
- if (info.flags & GNOME_VFS_FILE_FLAGS_SYMLINK &&
- info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME)
+ info = g_file_info_new ();
+ g_file_info_set_name (info, dest_uri);
+ g_file_info_get_is_symlink (info);
{
- gnome_vfs_uri_unref (dest_uri);
- dest_uri = gnome_vfs_uri_new (info.symlink_name);
+ dest_uri = g_file_info_get_symlink_target (info);
+ g_object_unref (dest_gio);
+ dest_gio = g_file_new_for_uri (dest_uri);
}
+ g_object_unref (info);
}
+
/* Move 'file~' to 'file' */
- result = gnome_vfs_xfer_uri (src_uri, dest_uri,
- GNOME_VFS_XFER_DELETE_ITEMS |
- GNOME_VFS_XFER_REMOVESOURCE,
- GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- NULL, NULL);
+
+ result = g_file_move (src_gio, dest_gio, G_FILE_COPY_OVERWRITE,
+ NULL, NULL, NULL, &error);
+
/* we need to update UI with the call to scintilla */
text_editor_thaw (te);
- if (result != GNOME_VFS_OK)
+ if (!result)
{
anjuta_util_dialog_error (parent,
_("Could not save file %s: %s."),
te->uri,
- gnome_vfs_result_to_string (result));
- }
- else
- {
+ error->message);
+
if (have_info)
{
- result = gnome_vfs_set_file_info_uri (dest_uri, &info,
- GNOME_VFS_SET_FILE_INFO_PERMISSIONS);
- if (result != GNOME_VFS_OK)
+ if (error->code == G_IO_ERROR_PERMISSION_DENIED)
{
anjuta_util_dialog_warning (parent,
_("Could not set file permissions %s: %s."),
te->uri,
- gnome_vfs_result_to_string (result));
+ error->message);
}
}
+ g_error_free (error);
+ }
+ else
+ {
scintilla_send_message (SCINTILLA (te->scintilla),
SCI_SETSAVEPOINT, 0, 0);
g_signal_emit_by_name (G_OBJECT (te), "saved", te->uri);
anjuta_status (te->status, _("File saved successfully"), 5);
ret = TRUE;
}
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
+ g_object_unref (src_gio);
+ g_object_unref (dest_gio);
}
text_editor_update_monitor (te, FALSE);
g_free (save_uri);
+
return ret;
}
@@ -2674,23 +2717,19 @@
/* IAnjutaFile implementation */
-static gchar*
-ifile_get_uri (IAnjutaFile *editor, GError **error)
+static GFile*
+ifile_get_file (IAnjutaFile *editor, GError **error)
{
TextEditor *text_editor;
text_editor = TEXT_EDITOR(editor);
if (text_editor->uri)
- return g_strdup (text_editor->uri);
-/*
- else if (text_editor->filename)
- return gnome_vfs_get_uri_from_local_path (text_editor->filename);
-*/
+ return g_file_new_for_uri (text_editor->uri);
else
return NULL;
}
static void
-ifile_open (IAnjutaFile *editor, const gchar* uri, GError **error)
+ifile_open (IAnjutaFile *editor, GFile* file, GError **error)
{
/* Close current file and open new file in this editor */
TextEditor* text_editor;
@@ -2699,10 +2738,10 @@
/* Do nothing if current file is not saved */
if (!text_editor_is_saved (text_editor))
return;
- text_editor->uri = g_strdup (uri);
+ text_editor->uri = g_file_get_uri (file);
/* Remove path */
- text_editor->filename = g_strdup (g_basename (uri));
+ text_editor->filename = g_file_get_basename (file);
text_editor_load_file (text_editor);
}
@@ -2715,7 +2754,7 @@
}
static void
-isavable_save_as (IAnjutaFileSavable* editor, const gchar* filename, GError** e)
+isavable_save_as (IAnjutaFileSavable* editor, GFile* file, GError** e)
{
const gchar *past_language;
const gchar *curr_language;
@@ -2725,9 +2764,9 @@
ianjuta_editor_language_get_language (IANJUTA_EDITOR_LANGUAGE (text_editor),
NULL);
- text_editor->uri = g_strdup (filename);
+ text_editor->uri = g_file_get_uri (file);
/* Remove path */
- text_editor->filename = g_path_get_basename (filename);
+ text_editor->filename = g_file_get_basename (file);
text_editor_save_file (text_editor, FALSE);
text_editor_set_hilite_type (text_editor, NULL);
text_editor_hilite (text_editor, FALSE);
@@ -2770,7 +2809,7 @@
ifile_iface_init (IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
/* Implementation of the IAnjutaMarkable interface */
@@ -2850,27 +2889,6 @@
iface->delete_all_markers = imarkable_delete_all_markers;
}
-/* IAnjutaEditorFactory implementation */
-
-static IAnjutaEditor*
-itext_editor_factory_new_editor(IAnjutaEditorFactory* factory,
- const gchar* uri,
- const gchar* filename,
- GError** error)
-{
- TextEditor *current_editor = TEXT_EDITOR (factory);
- GtkWidget* editor = text_editor_new (current_editor->status,
- current_editor->preferences,
- uri, filename);
- return IANJUTA_EDITOR (editor);
-}
-
-static void
-itext_editor_factory_iface_init (IAnjutaEditorFactoryIface *iface)
-{
- iface->new_editor = itext_editor_factory_new_editor;
-}
-
/* IAnjutaEditorConvert implementation */
static void
@@ -3710,7 +3728,4 @@
ANJUTA_TYPE_ADD_INTERFACE(igoto, IANJUTA_TYPE_EDITOR_GOTO);
ANJUTA_TYPE_ADD_INTERFACE(isearch, IANJUTA_TYPE_EDITOR_SEARCH);
ANJUTA_TYPE_ADD_INTERFACE(ihover, IANJUTA_TYPE_EDITOR_HOVER);
-
-/* FIXME: Is factory definition really required for editor class? */
-ANJUTA_TYPE_ADD_INTERFACE(itext_editor_factory, IANJUTA_TYPE_EDITOR_FACTORY);
ANJUTA_TYPE_END;
Modified: trunk/plugins/editor/text_editor.h
==============================================================================
--- trunk/plugins/editor/text_editor.h (original)
+++ trunk/plugins/editor/text_editor.h Wed Jul 2 00:46:18 2008
@@ -23,8 +23,8 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include <libanjuta/anjuta-preferences.h>
-#include <libgnomevfs/gnome-vfs-monitor.h>
#include "aneditor.h"
@@ -62,7 +62,7 @@
gchar *filename;
gchar *uri;
- GnomeVFSMonitorHandle *monitor;
+ GFileMonitor *monitor;
AnjutaStatus *status;
@@ -105,9 +105,9 @@
*/
gchar *last_saved_content;
- /* When a file is saved, gnome-vfs also notifies changes to the file
+ /* When a file is saved, gio also notifies changes to the file
* resulting in unneccessary processing. To avoid this, file modified
- * notifications from gnome-vfs are dampped for 1 sec. After the 1 sec
+ * notifications from gio are dampped for 1 sec. After the 1 sec
* timeout, if the file is still different, the user is notified.
*/
gint file_modified_timer;
Modified: trunk/plugins/file-loader/plugin.c
==============================================================================
--- trunk/plugins/file-loader/plugin.c (original)
+++ trunk/plugins/file-loader/plugin.c Wed Jul 2 00:46:18 2008
@@ -33,6 +33,8 @@
#include <libanjuta/interfaces/ianjuta-file.h>
#include <libanjuta/interfaces/ianjuta-file-loader.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-file-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-wizard.h>
#include "plugin.h"
@@ -257,7 +259,9 @@
NULL);
if (docman)
{
- ianjuta_file_open (IANJUTA_FILE (docman), uri, NULL);
+ GFile* file = g_file_new_for_uri (uri);
+ ianjuta_file_open (IANJUTA_FILE (docman), file, NULL);
+ g_object_unref (file);
}
else
{
@@ -283,8 +287,10 @@
location);
if (loaded_plugin)
{
- ianjuta_file_open (IANJUTA_FILE (loaded_plugin), uri, NULL);
+ GFile* file = g_file_new_for_uri (uri);
+ ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, NULL);
set_recent_file (plugin, uri, mime_type);
+ g_object_unref (file);
}
else
{
@@ -354,6 +360,7 @@
{
GnomeVFSURI *vfs_uri;
gchar *dirname;
+ GFile* file;
vfs_uri = gnome_vfs_uri_new (uri);
dirname = gnome_vfs_uri_extract_dirname (vfs_uri);
@@ -361,10 +368,14 @@
chdir (dirname);
g_free (dirname);
+ file = g_file_new_for_uri (uri);
+
/* FIXME: We have to manage the error to know if we have to remove the recent file
*/
ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin),
- uri, FALSE, NULL);
+ file, FALSE, NULL);
+
+ g_object_unref (file);
}
typedef struct
@@ -721,8 +732,10 @@
location);
if (loaded_plugin)
{
- ianjuta_file_open (IANJUTA_FILE (loaded_plugin), uri, NULL);
+ GFile* file = g_file_new_for_uri (uri);
+ ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, NULL);
set_recent_file (plugin, uri, mime_type);
+ g_object_unref (file);
}
else
{
@@ -922,16 +935,17 @@
}
static void
-value_added_fm_current_uri (AnjutaPlugin *plugin, const char *name,
+value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
AnjutaUI *ui;
- const gchar *uri;
+ gchar *uri;
AnjutaFileLoaderPlugin *fl_plugin;
GtkAction *action;
GtkWidget *parentmenu;
+ GFile* file = G_FILE (g_value_get_object (value));
- uri = g_value_get_string (value);
+ uri = g_file_get_uri (file);
g_return_if_fail (name != NULL);
fl_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
@@ -954,10 +968,12 @@
if (!create_open_with_submenu (fl_plugin, parentmenu, uri,
G_CALLBACK (fm_open_with), plugin))
g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
+
+ g_free (uri);
}
static void
-value_removed_fm_current_uri (AnjutaPlugin *plugin,
+value_removed_fm_current_file (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
AnjutaUI *ui;
@@ -1040,7 +1056,9 @@
static void
dnd_dropped (const gchar *uri, gpointer plugin)
{
- ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin), uri, FALSE, NULL);
+ GFile* file = g_file_new_for_uri (uri);
+ ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin), file, FALSE, NULL);
+ g_object_unref (file);
}
static void
@@ -1093,16 +1111,18 @@
ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin),
uri, FALSE, NULL);
*/
- anjuta_status_progress_tick (status, NULL, label);
+ njuta_status_progress_tick (status, NULL, label);
}
else if (i != 0 &&
(!mime_type ||
strcmp (mime_type, "application/x-anjuta") != 0))
{
/* Then rest of the files */
+ GFile* file = g_file_new_for_uri (uri);
ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin),
- uri, FALSE, NULL);
+ file, FALSE, NULL);
anjuta_status_progress_tick (status, NULL, label);
+ g_object_unref (file);
}
g_free (filename);
g_free (label);
@@ -1227,11 +1247,11 @@
/* Add watches */
loader_plugin->fm_watch_id =
- anjuta_plugin_add_watch (plugin, "file_manager_current_uri",
- value_added_fm_current_uri,
- value_removed_fm_current_uri, NULL);
+ anjuta_plugin_add_watch (plugin, IANJUTA_FILE_MANAGER_SELECTED_FILE,
+ value_added_fm_current_file,
+ value_removed_fm_current_file, NULL);
loader_plugin->pm_watch_id =
- anjuta_plugin_add_watch (plugin, "project_manager_current_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_CURRENT_URI,
value_added_pm_current_uri,
value_removed_pm_current_uri, NULL);
@@ -1306,7 +1326,7 @@
}
static GObject*
-iloader_load (IAnjutaFileLoader *loader, const gchar *uri,
+iloader_load (IAnjutaFileLoader *loader, GFile* file,
gboolean read_only, GError **err)
{
gchar *mime_type;
@@ -1316,6 +1336,7 @@
AnjutaPluginManager *plugin_manager;
GList *plugin_descs = NULL;
GObject *plugin = NULL;
+ gchar* uri = g_file_get_uri (file);
g_return_val_if_fail (uri != NULL, NULL);
vfs_uri = gnome_vfs_uri_new (uri);
@@ -1387,7 +1408,9 @@
launch_in_default_application (ANJUTA_PLUGIN_FILE_LOADER (loader), mime_type, uri);
}
if (plugin)
- ianjuta_file_open (IANJUTA_FILE(plugin), uri, NULL);
+ {
+ ianjuta_file_open (IANJUTA_FILE(plugin), file, NULL);
+ }
set_recent_file (ANJUTA_PLUGIN_FILE_LOADER (loader), new_uri, mime_type);
@@ -1395,8 +1418,9 @@
g_list_free (plugin_descs);
g_free (mime_type);
g_free (new_uri);
+ g_free (uri);
anjuta_status_busy_pop (status);
-
+
return plugin;
}
Modified: trunk/plugins/file-manager/file-model.c
==============================================================================
--- trunk/plugins/file-manager/file-model.c (original)
+++ trunk/plugins/file-manager/file-model.c Wed Jul 2 00:46:18 2008
@@ -128,6 +128,7 @@
GTK_ICON_LOOKUP_GENERIC_FALLBACK);
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
gtk_icon_info_free(icon_info);
+ g_object_unref (icon);
if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_DIRECTORY)
is_dir = TRUE;
@@ -492,18 +493,14 @@
g_object_unref (base);
}
-gchar*
-file_model_get_uri (FileModel* model, GtkTreeIter* iter)
+GFile*
+file_model_get_file (FileModel* model, GtkTreeIter* iter)
{
GFile* file;
- gchar* uri;
gtk_tree_model_get (GTK_TREE_MODEL (model), iter, COLUMN_FILE, &file, -1);
- uri = g_file_get_uri (file);
- g_object_unref (file);
-
- return uri;
+ return file;
}
gchar*
Modified: trunk/plugins/file-manager/file-model.h
==============================================================================
--- trunk/plugins/file-manager/file-model.h (original)
+++ trunk/plugins/file-manager/file-model.h Wed Jul 2 00:46:18 2008
@@ -28,6 +28,7 @@
#include <glib-object.h>
#include <gtk/gtktreestore.h>
#include <gtk/gtktreeview.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -72,8 +73,8 @@
void
file_model_refresh (FileModel* model);
-gchar*
-file_model_get_uri (FileModel* model, GtkTreeIter* iter);
+GFile*
+file_model_get_file (FileModel* model, GtkTreeIter* iter);
gchar*
file_model_get_filename (FileModel* model, GtkTreeIter* iter);
Modified: trunk/plugins/file-manager/file-view-marshal.list
==============================================================================
--- trunk/plugins/file-manager/file-view-marshal.list (original)
+++ trunk/plugins/file-manager/file-view-marshal.list Wed Jul 2 00:46:18 2008
@@ -1 +1 @@
-VOID:STRING,BOOLEAN,INT,INT
+VOID:OBJECT,BOOLEAN,INT,INT
Modified: trunk/plugins/file-manager/file-view.c
==============================================================================
--- trunk/plugins/file-manager/file-view.c (original)
+++ trunk/plugins/file-manager/file-view.c Wed Jul 2 00:46:18 2008
@@ -90,7 +90,7 @@
return FALSE;
}
-gchar*
+GFile*
file_view_get_selected (AnjutaFileView* view)
{
AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
@@ -99,8 +99,8 @@
GtkTreeIter selected;
if (gtk_tree_selection_get_selected (selection, NULL, &selected))
{
- gchar* uri = file_model_get_uri (priv->model, &selected);
- return uri;
+ GFile* file = file_model_get_file (priv->model, &selected);
+ return file;
}
else
return NULL;
@@ -112,9 +112,9 @@
AnjutaFileView* view = ANJUTA_FILE_VIEW (widget);
AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
GtkTreeIter selected;
- gchar* uri;
gboolean is_dir;
- GtkTreePath* path = NULL;
+ GtkTreePath* path = NULL;
+ GFile* file;
GtkTreeSelection* selection =
gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
@@ -128,13 +128,13 @@
gtk_tree_model_get (GTK_TREE_MODEL(priv->model), &select_iter,
COLUMN_IS_DIR, &is_dir,
-1);
- uri = file_model_get_uri (priv->model, &select_iter);
+ file = file_model_get_file (priv->model, &select_iter);
path = gtk_tree_model_get_path(sort_model, &selected);
}
else
{
- uri = NULL;
+ file = NULL;
is_dir = FALSE;
}
@@ -163,7 +163,7 @@
{
g_signal_emit_by_name (G_OBJECT (view),
"file-open",
- uri);
+ file);
}
}
break;
@@ -172,13 +172,14 @@
{
g_signal_emit_by_name (G_OBJECT (view),
"show-popup-menu",
- uri,
+ file,
is_dir,
event->button,
event->time);
}
}
- g_free (uri);
+ if (file)
+ g_object_unref (file);
if (path)
gtk_tree_path_free(path);
return
@@ -252,6 +253,7 @@
{
GtkTreeIter real_selection;
GtkTreePath* path;
+ GFile* file;
gtk_tree_model_sort_convert_iter_to_child_iter(GTK_TREE_MODEL_SORT(model),
&real_selection, &selected);
@@ -261,14 +263,14 @@
file_view_show_extended_data (view, &real_selection);
- gchar* uri = file_model_get_uri (FILE_MODEL(file_model), &real_selection);
- g_signal_emit_by_name (G_OBJECT (view), "current-uri-changed",
- uri, NULL);
- g_free(uri);
+ file = file_model_get_file(FILE_MODEL(file_model), &real_selection);
+ g_signal_emit_by_name (G_OBJECT (view), "current-file-changed",
+ file, NULL);
+ g_object_unref (file);
}
else
{
- g_signal_emit_by_name (G_OBJECT (view), "current-uri-changed",
+ g_signal_emit_by_name (G_OBJECT (view), "current-file-changed",
NULL, NULL);
}
DEBUG_PRINT ("selection_changed");
@@ -461,21 +463,21 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (AnjutaFileViewClass, file_open),
NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING,
+ G_TYPE_OBJECT,
NULL);
- g_signal_new ("current-uri-changed",
+ g_signal_new ("current-file-changed",
ANJUTA_TYPE_FILE_VIEW,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (AnjutaFileViewClass, current_uri_changed),
NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING,
+ G_TYPE_OBJECT,
NULL);
g_signal_new ("show-popup-menu",
@@ -483,10 +485,10 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (AnjutaFileViewClass, show_popup_menu),
NULL, NULL,
- file_view_cclosure_marshal_VOID__STRING_BOOLEAN_INT_INT,
+ file_view_cclosure_marshal_VOID__OBJECT_BOOLEAN_INT_INT,
G_TYPE_NONE,
4,
- G_TYPE_STRING,
+ G_TYPE_OBJECT,
G_TYPE_BOOLEAN,
G_TYPE_INT,
G_TYPE_INT,
Modified: trunk/plugins/file-manager/file-view.h
==============================================================================
--- trunk/plugins/file-manager/file-view.h (original)
+++ trunk/plugins/file-manager/file-view.h Wed Jul 2 00:46:18 2008
@@ -26,6 +26,7 @@
#define _FILE_VIEW_H_
#include <gtk/gtktreeview.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -45,14 +46,14 @@
/* Signals */
void (*file_open) (AnjutaFileView* view,
- const gchar* uri);
+ GFile* file);
void (*show_popup_menu) (AnjutaFileView* view,
- const gchar* uri,
+ GFile* file,
gboolean is_dir,
guint button,
guint32 time);
void (*current_uri_changed) (AnjutaFileView* view,
- const gchar* uri);
+ GFile* file);
};
struct _AnjutaFileView
@@ -69,7 +70,7 @@
gboolean
file_view_can_rename(AnjutaFileView* view);
-gchar*
+GFile*
file_view_get_selected (AnjutaFileView* view);
void
Modified: trunk/plugins/file-manager/plugin.c
==============================================================================
--- trunk/plugins/file-manager/plugin.c (original)
+++ trunk/plugins/file-manager/plugin.c Wed Jul 2 00:46:18 2008
@@ -30,6 +30,7 @@
#include <libanjuta/anjuta-preferences.h>
#include <libanjuta/interfaces/ianjuta-file-loader.h>
#include <libanjuta/interfaces/ianjuta-file-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-preferences.h>
#include "plugin.h"
@@ -119,41 +120,41 @@
}
static void
-on_file_view_current_uri_changed (AnjutaFileView* view, gchar* uri,
- AnjutaFileManager* file_manager)
+on_file_view_current_file_changed (AnjutaFileView* view, GFile* file,
+ AnjutaFileManager* file_manager)
{
- if (uri)
+ if (file)
{
GValue* value;
value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_STRING);
- g_value_take_string (value, uri);
+ g_value_init (value, G_TYPE_FILE);
+ g_value_set_object (value, file);
anjuta_shell_add_value (ANJUTA_PLUGIN (file_manager)->shell,
- "file_manager_current_uri", value, NULL);
+ IANJUTA_FILE_MANAGER_SELECTED_FILE, value, NULL);
}
else
{
anjuta_shell_remove_value (ANJUTA_PLUGIN(file_manager)->shell,
- "file_manager_current_uri", NULL);
+ IANJUTA_FILE_MANAGER_SELECTED_FILE, NULL);
}
}
static void
-on_file_view_open_file (AnjutaFileView* view, const char *uri,
+on_file_view_open_file (AnjutaFileView* view, GFile* file,
AnjutaFileManager* file_manager)
{
IAnjutaFileLoader *loader;
- g_return_if_fail (uri != NULL);
+ g_return_if_fail (file != NULL);
loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (file_manager)->shell,
IAnjutaFileLoader, NULL);
g_return_if_fail (loader != NULL);
- ianjuta_file_loader_load (loader, uri, FALSE, NULL);
+ ianjuta_file_loader_load (loader, file, FALSE, NULL);
}
static void
-on_file_view_show_popup_menu (AnjutaFileView* view, const gchar* uri,
- gboolean is_dir,guint button,
+on_file_view_show_popup_menu (AnjutaFileView* view, GFile* file,
+ gboolean is_dir, guint button,
guint32 time, AnjutaFileManager* file_manager)
{
GtkWidget *popup;
@@ -234,8 +235,8 @@
G_CALLBACK (on_file_view_open_file), file_manager);
g_signal_connect (G_OBJECT(file_manager->fv), "show-popup-menu",
G_CALLBACK (on_file_view_show_popup_menu), file_manager);
- g_signal_connect (G_OBJECT(file_manager->fv), "current-uri-changed",
- G_CALLBACK (on_file_view_current_uri_changed),
+ g_signal_connect (G_OBJECT(file_manager->fv), "current-file-changed",
+ G_CALLBACK (on_file_view_current_file_changed),
file_manager);
file_manager_set_default_uri (file_manager);
file_view_refresh (file_manager->fv);
@@ -251,7 +252,7 @@
ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
file_manager->root_watch_id =
- anjuta_plugin_add_watch (plugin, "project_root_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
@@ -341,12 +342,12 @@
static void
ifile_manager_set_selected (IAnjutaFileManager *file_manager,
- const gchar *root, GError **err)
+ GFile* selected, GError **err)
{
/* TODO */
}
-static gchar*
+static GFile*
ifile_manager_get_selected (IAnjutaFileManager *ifile_manager, GError **err)
{
AnjutaFileManager* file_manager = (AnjutaFileManager*) ifile_manager;
Modified: trunk/plugins/file-wizard/file.c
==============================================================================
--- trunk/plugins/file-wizard/file.c (original)
+++ trunk/plugins/file-wizard/file.c Wed Jul 2 00:46:18 2008
@@ -288,6 +288,7 @@
IAnjutaProjectManager *pm;
GnomeVFSHandle *vfs_write;
gchar* file_uri;
+ GFile* file;
pm = anjuta_shell_get_interface (ANJUTA_PLUGIN(docman)->shell,
IAnjutaProjectManager, NULL);
@@ -306,8 +307,10 @@
g_free (file_uri);
return FALSE;
}
- ianjuta_file_open (IANJUTA_FILE (docman), file_uri, NULL);
+ file = g_file_new_for_uri (file_uri);
+ ianjuta_file_open (IANJUTA_FILE (docman), file, NULL);
g_free (file_uri);
+ g_object_unref (file);
}
else
{
Modified: trunk/plugins/file-wizard/plugin.c
==============================================================================
--- trunk/plugins/file-wizard/plugin.c (original)
+++ trunk/plugins/file-wizard/plugin.c Wed Jul 2 00:46:18 2008
@@ -24,6 +24,7 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-wizard.h>
#include "file.h"
@@ -80,7 +81,7 @@
/* set up project directory watch */
w_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed,
NULL);
Modified: trunk/plugins/gdb/plugin.c
==============================================================================
--- trunk/plugins/gdb/plugin.c (original)
+++ trunk/plugins/gdb/plugin.c Wed Jul 2 00:46:18 2008
@@ -463,12 +463,13 @@
}
static gboolean
-idebugger_run_to (IAnjutaDebugger *plugin, const gchar *file,
+idebugger_run_to (IAnjutaDebugger *plugin, GFile* file,
gint line, GError **err)
{
GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin);
+ gchar* path = g_file_get_path (file);
- debugger_run_to_position (this->debugger, file, line);
+ debugger_run_to_position (this->debugger, path, line);
return TRUE;
}
Modified: trunk/plugins/glade/anjuta-design-document.c
==============================================================================
--- trunk/plugins/glade/anjuta-design-document.c (original)
+++ trunk/plugins/glade/anjuta-design-document.c Wed Jul 2 00:46:18 2008
@@ -110,29 +110,29 @@
NULL));
}
-static void ifile_open(IAnjutaFile* file, const gchar* uri, GError **e)
+static void ifile_open(IAnjutaFile* ifile, GFile* file, GError **e)
{
- AnjutaDesignDocument* self = ANJUTA_DESIGN_DOCUMENT(file);
+ AnjutaDesignDocument* self = ANJUTA_DESIGN_DOCUMENT(ifile);
AnjutaDesignDocumentPrivate* priv = ADD_GET_PRIVATE(self);
- ianjuta_file_open(IANJUTA_FILE(priv->glade_plugin), uri, e);
+ ianjuta_file_open(IANJUTA_FILE(priv->glade_plugin), file, e);
}
-static gchar* ifile_get_uri(IAnjutaFile* file, GError **e)
+static GFile* ifile_get_file(IAnjutaFile* ifile, GError **e)
{
- AnjutaDesignDocument* self = ANJUTA_DESIGN_DOCUMENT(file);
+ AnjutaDesignDocument* self = ANJUTA_DESIGN_DOCUMENT(ifile);
GladeProject* project = glade_design_view_get_project(GLADE_DESIGN_VIEW(self));
#if (GLADEUI_VERSION >= 330)
const gchar* path = glade_project_get_path(project);
if (path != NULL)
- return gnome_vfs_get_uri_from_local_path(path);
+ return g_file_new_for_path (path);
else
return NULL;
#else
if (project && project->path)
- return gnome_vfs_get_uri_from_local_path(project->path);
+ return g_file_new_for_path (project->path);
else
return NULL;
#endif
@@ -143,7 +143,7 @@
ifile_iface_init(IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
static void ifile_savable_save (IAnjutaFileSavable* file, GError **e)
@@ -184,9 +184,9 @@
DEBUG_PRINT("Invalid use of ifile_savable_save!");
}
-static void ifile_savable_save_as(IAnjutaFileSavable* file, const gchar* uri, GError **e)
+static void ifile_savable_save_as(IAnjutaFileSavable* ifile, GFile* file, GError **e)
{
- AnjutaDesignDocument* self = ANJUTA_DESIGN_DOCUMENT(file);
+ AnjutaDesignDocument* self = ANJUTA_DESIGN_DOCUMENT(ifile);
AnjutaDesignDocumentPrivate* priv = ADD_GET_PRIVATE(self);
GladeProject* project = glade_design_view_get_project(GLADE_DESIGN_VIEW(self));
@@ -194,13 +194,13 @@
AnjutaStatus *status = anjuta_shell_get_status (ANJUTA_PLUGIN(priv->glade_plugin)->shell, NULL);
#if (GLADEUI_VERSION >= 330)
- if (glade_project_save (project, gnome_vfs_get_local_path_from_uri(uri),
+ if (glade_project_save (project, g_file_get_path (file),
NULL))
{
anjuta_status_set (status, _("Glade project '%s' saved"),
glade_project_get_name(project));
#else
- if (glade_project_save (project, gnome_vfs_get_local_path_from_uri(uri), NULL))
+ if (glade_project_save (project, g_file_get_path (file), NULL))
{
anjuta_status_set (status, _("Glade project '%s' saved"),
project->name);
Modified: trunk/plugins/glade/plugin.c
==============================================================================
--- trunk/plugins/glade/plugin.c (original)
+++ trunk/plugins/glade/plugin.c Wed Jul 2 00:46:18 2008
@@ -82,7 +82,7 @@
value_added_current_editor (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
- GladePlugin* glade_plugin = ANJUTA_PLUGIN_GLADE(plugin);
+ //GladePlugin* glade_plugin = ANJUTA_PLUGIN_GLADE(plugin);
GObject *editor;
editor = g_value_get_object (value);
if (ANJUTA_IS_DESIGN_DOCUMENT(editor))
@@ -283,13 +283,14 @@
{
if (ANJUTA_IS_DESIGN_DOCUMENT (node->data))
{
- gchar *uri;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (node->data), NULL);
- if (uri != NULL)
+ GFile* file;
+ file = ianjuta_file_get_file (IANJUTA_FILE (node->data), NULL);
+ if (file != NULL)
{
- files = g_list_prepend (files, uri);
+ files = g_list_prepend (files, g_file_get_uri (file));
/* uri is not freed here */
}
+ g_object_unref (file);
}
}
g_list_free (docwids);
@@ -508,7 +509,7 @@
/* Watch documents */
glade_plugin->priv->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
@@ -620,7 +621,7 @@
}
static void
-ifile_open (IAnjutaFile *ifile, const gchar *uri, GError **err)
+ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
{
GladePluginPriv *priv;
GladeProject *project;
@@ -631,15 +632,17 @@
GList* docwids, *node;
GList *glade_obj_node;
- g_return_if_fail (uri != NULL);
+ g_return_if_fail (file != NULL);
priv = ANJUTA_PLUGIN_GLADE (ifile)->priv;
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ filename = g_file_get_path (file);
if (!filename)
{
+ gchar* uri = g_file_get_parse_name(file);
anjuta_util_dialog_warning (GTK_WINDOW (ANJUTA_PLUGIN (ifile)->shell),
_("Not local file: %s"), uri);
+ g_free (uri);
return;
}
@@ -652,20 +655,18 @@
{
if (ANJUTA_IS_DESIGN_DOCUMENT (node->data))
{
- gchar *cur_uri;
- cur_uri = ianjuta_file_get_uri (IANJUTA_FILE (node->data), NULL);
- if (cur_uri)
+ GFile* cur_file;
+ cur_file = ianjuta_file_get_file (IANJUTA_FILE (node->data), NULL);
+ if (cur_file)
{
- DEBUG_PRINT("%s = %s", uri, cur_uri);
- if (g_str_equal (uri, cur_uri))
+ if (g_file_equal (file, cur_file))
{
ianjuta_document_manager_set_current_document (docman,
IANJUTA_DOCUMENT (node->data), NULL);
- g_free (cur_uri);
- g_list_free (docwids);
+ g_object_unref (file);
return;
}
- g_free (cur_uri);
+ g_object_unref (file);
}
}
}
@@ -689,8 +690,10 @@
g_free (filename);
if (!project)
{
+ gchar* name = g_file_get_parse_name (file);
anjuta_util_dialog_warning (GTK_WINDOW (ANJUTA_PLUGIN (ifile)->shell),
- _("Could not open %s"), uri);
+ _("Could not open %s"), name);
+ g_free (name);
return;
}
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->projects_combo)));
@@ -717,19 +720,17 @@
anjuta_shell_present_widget (ANJUTA_PLUGIN (ifile)->shell, priv->view_box, NULL);
}
-static gchar*
-ifile_get_uri (IAnjutaFile* file, GError** e)
+static GFile*
+ifile_get_file (IAnjutaFile* ifile, GError** e)
{
#if (GLADEUI_VERSION >= 330)
const gchar* path = glade_project_get_path(glade_app_get_project());
- if (path != NULL)
- return gnome_vfs_get_uri_from_local_path(path);
- else
- return NULL;
+ GFile* file = g_file_new_for_path (path);
+ return file;
#else
GladeProject* project = glade_app_get_project();
if (project && project->path)
- return project->path;
+ return g_file_new_for_path(project->path);
else
return NULL;
#endif
@@ -739,7 +740,7 @@
ifile_iface_init(IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
static void
Modified: trunk/plugins/gtodo/plugin.c
==============================================================================
--- trunk/plugins/gtodo/plugin.c (original)
+++ trunk/plugins/gtodo/plugin.c Wed Jul 2 00:46:18 2008
@@ -24,6 +24,7 @@
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-todo.h>
#include <libanjuta/interfaces/ianjuta-preferences.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
//#include <libgtodo/main.h>
#include "main.h"
@@ -176,7 +177,7 @@
ANJUTA_SHELL_PLACEMENT_CENTER, NULL);
/* set up project directory watch */
gtodo_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
hide_done = anjuta_ui_get_action (ui, "ActionGroupTodoViewOps",
@@ -256,10 +257,10 @@
}
static void
-itodo_load (IAnjutaTodo *profile, const gchar *filename, GError **err)
+itodo_load (IAnjutaTodo *profile, GFile* file, GError **err)
{
- g_return_if_fail (filename != NULL);
- gtodo_client_load (cl, filename);
+ g_return_if_fail (file != NULL);
+ gtodo_client_load (cl, g_file_get_path (file));
}
static void
Modified: trunk/plugins/language-support-cpp-java/plugin.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/plugin.c (original)
+++ trunk/plugins/language-support-cpp-java/plugin.c Wed Jul 2 00:46:18 2008
@@ -24,6 +24,7 @@
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-iterable.h>
#include <libanjuta/interfaces/ianjuta-document.h>
+#include <libanjuta/interfaces/ianjuta-document-manager.h>
#include <libanjuta/interfaces/ianjuta-editor.h>
#include <libanjuta/interfaces/ianjuta-editor-cell.h>
#include <libanjuta/interfaces/ianjuta-editor-language.h>
@@ -1784,7 +1785,7 @@
lang_plugin->editor_watch_id =
anjuta_plugin_add_watch (plugin,
- "document_manager_current_editor",
+ IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
on_value_added_current_editor,
on_value_removed_current_editor,
plugin);
Modified: trunk/plugins/profiler/gprof-view.c
==============================================================================
--- trunk/plugins/profiler/gprof-view.c (original)
+++ trunk/plugins/profiler/gprof-view.c Wed Jul 2 00:46:18 2008
@@ -117,7 +117,6 @@
{
IAnjutaIterable *symbol_iter;
IAnjutaSymbol *symbol;
- const gchar *uri;
guint line;
if (self->priv->symbol_manager &&
@@ -138,14 +137,16 @@
if (symbol_iter &&
ianjuta_iterable_get_length (symbol_iter, NULL) > 0)
{
+ GFile* file;
symbol = IANJUTA_SYMBOL (symbol_iter);
- uri = ianjuta_symbol_get_uri (symbol, NULL);
+ file = ianjuta_symbol_get_file (symbol, NULL);
line = ianjuta_symbol_get_line (symbol, NULL);
- ianjuta_document_manager_goto_uri_line (self->priv->document_manager,
- uri, line, NULL);
+ ianjuta_document_manager_goto_file_line (self->priv->document_manager,
+ file, line, NULL);
g_object_unref (symbol_iter);
+ g_object_unref (file);
}
}
}
Modified: trunk/plugins/profiler/plugin.c
==============================================================================
--- trunk/plugins/profiler/plugin.c (original)
+++ trunk/plugins/profiler/plugin.c Wed Jul 2 00:46:18 2008
@@ -763,19 +763,12 @@
}
};
-#define REGISTER_ICON(icon, stock_id) \
- pixbuf = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"icon, NULL); \
- icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); \
- gtk_icon_factory_add (icon_factory, stock_id, icon_set); \
- g_object_unref (pixbuf);
-
static void
register_stock_icons (AnjutaPlugin *plugin)
{
AnjutaUI *ui;
GtkIconFactory *icon_factory;
GtkIconSet *icon_set;
- GdkPixbuf *pixbuf;
static gboolean registered = FALSE;
if (registered)
@@ -856,7 +849,7 @@
ANJUTA_SHELL_PLACEMENT_CENTER,
NULL);
- profiler->project_watch_id = anjuta_plugin_add_watch (plugin, "project_root_uri",
+ profiler->project_watch_id = anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
@@ -955,13 +948,15 @@
/* File open interface */
static void
-ifile_open (IAnjutaFile *manager, const gchar *uri,
+ifile_open (IAnjutaFile *manager, GFile* file,
GError **err)
{
Profiler *profiler;
profiler = PROFILER (manager);
+ gchar* uri = g_file_get_uri (file);
+
profiler_set_target (profiler, uri);
/* Respect user settings for this target if they exist. Otherwise, don't
@@ -969,18 +964,18 @@
* balloon with the settings for a bunch of targets, espcially if this
* is a one-time operation. If previous settings don't exist, just use
* the defaults. */
- if (gprof_options_has_target (profiler->options, (gchar *) uri))
- gprof_options_set_target (profiler->options, (gchar *) uri);
+ if (gprof_options_has_target (profiler->options, uri))
+ gprof_options_set_target (profiler->options, uri);
else
gprof_options_set_target (profiler->options, NULL);
if (profiler_get_data (profiler))
gprof_view_manager_refresh_views (profiler->view_manager);
-
+ g_free (file);
}
-static gchar*
-ifile_get_uri (IAnjutaFile *manager, GError **err)
+static GFile*
+ifile_get_file (IAnjutaFile *manager, GError **err)
{
DEBUG_PRINT ("Unsupported operation");
return NULL;
@@ -990,7 +985,7 @@
ifile_iface_init (IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
ANJUTA_PLUGIN_BEGIN (Profiler, profiler);
Modified: trunk/plugins/project-import/plugin.c
==============================================================================
--- trunk/plugins/project-import/plugin.c (original)
+++ trunk/plugins/project-import/plugin.c Wed Jul 2 00:46:18 2008
@@ -100,11 +100,12 @@
}
static void
-ifile_open (IAnjutaFile *file, const gchar *uri, GError **err)
+ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
{
gchar *dir, *ext, *project_name;
ProjectImport* pi;
- AnjutaProjectImportPlugin* plugin = ANJUTA_PLUGIN_PROJECT_IMPORT (file);
+ AnjutaProjectImportPlugin* plugin = ANJUTA_PLUGIN_PROJECT_IMPORT (ifile);
+ gchar* uri = g_file_get_uri (file);
g_return_if_fail (uri != NULL && strlen (uri) > 0);
@@ -117,10 +118,11 @@
pi = project_import_new(ANJUTA_PLUGIN(plugin));
project_import_set_name (pi, project_name);
project_import_set_directory (pi, dir);
+ g_free (uri);
}
-static gchar*
-ifile_get_uri (IAnjutaFile *file, GError **err)
+static GFile*
+ifile_get_file (IAnjutaFile *file, GError **err)
{
g_warning ("Unsupported operation");
return NULL;
@@ -130,7 +132,7 @@
ifile_iface_init (IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
ANJUTA_PLUGIN_BEGIN (AnjutaProjectImportPlugin, project_import_plugin);
Modified: trunk/plugins/project-import/project-import.c
==============================================================================
--- trunk/plugins/project-import/project-import.c (original)
+++ trunk/plugins/project-import/project-import.c Wed Jul 2 00:46:18 2008
@@ -152,8 +152,8 @@
{
const gchar* name = gtk_entry_get_text (GTK_ENTRY(pi->import_name));
gchar* path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(pi->import_path));
-
gchar* project_file = g_strconcat (path, "/", name, ".", "anjuta", NULL);
+ GFile* file = g_file_new_for_path (project_file);
IAnjutaFileLoader* loader;
@@ -172,7 +172,7 @@
g_free (project_file);
return;
}
- ianjuta_file_loader_load (loader, project_file, FALSE, NULL);
+ ianjuta_file_loader_load (loader, file, FALSE, NULL);
g_free (project_file);
g_free (path);
}
Modified: trunk/plugins/project-manager/plugin.c
==============================================================================
--- trunk/plugins/project-manager/plugin.c (original)
+++ trunk/plugins/project-manager/plugin.c Wed Jul 2 00:46:18 2008
@@ -26,6 +26,7 @@
#include <libanjuta/interfaces/ianjuta-file-loader.h>
#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-file-manager.h>
#include <libanjuta/anjuta-profile-manager.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-status.h>
@@ -600,8 +601,7 @@
full_mesg = g_strconcat (question, mesg, NULL);
answer =
anjuta_util_dialog_boolean_question (get_plugin_parent_window (plugin),
- full_mesg, question,
- data->name);
+ full_mesg, data->name);
g_free (full_mesg);
return answer;
}
@@ -715,11 +715,13 @@
ProjectManagerPlugin *plugin)
{
IAnjutaFileLoader *loader;
+ GFile* file = g_file_new_for_uri (uri);
loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
IAnjutaFileLoader, NULL);
if (loader)
- ianjuta_file_loader_load (loader, uri, FALSE, NULL);
+ ianjuta_file_loader_load (loader, file, FALSE, NULL);
+ g_object_unref (file);
}
static void
@@ -961,14 +963,14 @@
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, selected_uri);
anjuta_shell_add_value (ANJUTA_PLUGIN(plugin)->shell,
- "project_manager_current_uri",
+ IANJUTA_PROJECT_MANAGER_CURRENT_URI,
value, NULL);
g_signal_emit_by_name (G_OBJECT (plugin), "element_selected",
selected_uri);
g_free (selected_uri);
} else {
anjuta_shell_remove_value (ANJUTA_PLUGIN(plugin)->shell,
- "project_manager_current_uri", NULL);
+ IANJUTA_PROJECT_MANAGER_CURRENT_URI, NULL);
}
}
@@ -1014,15 +1016,16 @@
}
static void
-value_added_fm_current_uri (AnjutaPlugin *plugin, const char *name,
+value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
AnjutaUI *ui;
GtkAction *action;
- const gchar *uri;
+ gchar *uri;
ProjectManagerPlugin *pm_plugin;
- uri = g_value_get_string (value);
+ GFile* file = g_value_get_object (value);
+ uri = g_file_get_uri (file);
pm_plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (plugin);
ui = anjuta_shell_get_ui (plugin->shell, NULL);
@@ -1034,10 +1037,11 @@
action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
"ActionPopupProjectAddToProject");
g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
+ g_free (uri);
}
static void
-value_removed_fm_current_uri (AnjutaPlugin *plugin,
+value_removed_fm_current_file (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
AnjutaUI *ui;
@@ -1062,6 +1066,7 @@
{
GObject *editor;
ProjectManagerPlugin *pm_plugin;
+ GFile* file;
editor = g_value_get_object (value);
if (!IANJUTA_IS_EDITOR(editor))
@@ -1071,8 +1076,9 @@
if (pm_plugin->current_editor_uri)
g_free (pm_plugin->current_editor_uri);
- pm_plugin->current_editor_uri =
- ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ pm_plugin->current_editor_uri = g_file_get_uri (file);
+
}
static void
@@ -1226,8 +1232,10 @@
node = g_list_next(node);
continue;
}
- gchar *editor_uri =
- ianjuta_file_get_uri (IANJUTA_FILE (node->data), NULL);
+ GFile* editor_file = ianjuta_file_get_file (IANJUTA_FILE (node->data), NULL);
+ gchar *editor_uri = g_file_get_uri (editor_file);
+ g_object_unref (editor_file);
+
/* Only remove if it does not have unsaved data */
if (editor_uri && (!IANJUTA_IS_FILE_SAVABLE (node->data) ||
@@ -1454,11 +1462,11 @@
/* Add watches */
pm_plugin->fm_watch_id =
- anjuta_plugin_add_watch (plugin, "file_manager_current_uri",
- value_added_fm_current_uri,
- value_removed_fm_current_uri, NULL);
+ anjuta_plugin_add_watch (plugin, IANJUTA_FILE_MANAGER_SELECTED_FILE,
+ value_added_fm_current_file,
+ value_removed_fm_current_file, NULL);
pm_plugin->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
/* Connect to save session */
@@ -2264,21 +2272,21 @@
}
static void
-ifile_open (IAnjutaFile *ifile, const gchar* uri, GError **e)
+ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
{
AnjutaProfile *profile;
AnjutaProfileManager *profile_manager;
AnjutaPluginManager *plugin_manager;
AnjutaStatus *status;
- GnomeVFSURI *vfs_uri;
gchar *dirname, *dirname_tmp, *vfs_dir;
gchar *session_profile, *profile_name;
ProjectManagerPlugin *plugin;
GError *error = NULL;
+ gchar* uri = g_file_get_uri (file);
+ GnomeVFSURI* vfs_uri;
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (ifile);
-#if 1 /* Enable it now */
/* If there is already a project loaded, load in separate anjuta window */
if (plugin->project_root_uri)
{
@@ -2289,7 +2297,6 @@
g_free (cmd);
return;
}
-#endif
plugin_manager =
anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (ifile)->shell, NULL);
@@ -2298,10 +2305,6 @@
status = anjuta_shell_get_status (ANJUTA_PLUGIN (ifile)->shell, NULL);
anjuta_status_progress_add_ticks (status, 2);
-#if 0
- /* Freeze shell */
- anjuta_shell_freeze (ANJUTA_PLUGIN (ifile)->shell, NULL);
-#endif
/* Prepare profile */
profile = anjuta_profile_new (PROJECT_PROFILE_NAME, plugin_manager);
@@ -2378,26 +2381,19 @@
anjuta_status_progress_tick (status, NULL,
_("Loaded Project... Initializing"));
update_ui (plugin);
-#if 0
- /* Thaw shell */
- /* FIXME: The shell can not be thawed after the session is loaded,
- * because the layout is loaded in the session. If shell is not thawed
- * before that, the widgets on which layout is applied are not present
- * side the shell (freezing delays the widgets addition).
- */
- anjuta_shell_thaw (ANJUTA_PLUGIN (ifile)->shell, NULL);
-#endif
+
anjuta_status_progress_tick (status, NULL, _("Loaded Project..."));
+ g_free (uri);
}
-static gchar*
-ifile_get_uri (IAnjutaFile *ifile, GError **e)
+static GFile*
+ifile_get_file (IAnjutaFile *ifile, GError **e)
{
ProjectManagerPlugin *plugin;
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (ifile);
if (plugin->project_root_uri)
- return g_strdup (plugin->project_root_uri);
+ return g_file_new_for_uri (plugin->project_root_uri);
else
return NULL;
}
@@ -2406,7 +2402,7 @@
ifile_iface_init(IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
ANJUTA_PLUGIN_BEGIN (ProjectManagerPlugin, project_manager_plugin);
Modified: trunk/plugins/project-wizard/install.c
==============================================================================
--- trunk/plugins/project-wizard/install.c (original)
+++ trunk/plugins/project-wizard/install.c Wed Jul 2 00:46:18 2008
@@ -554,7 +554,9 @@
loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (this->plugin)->shell, IAnjutaFileLoader, NULL);
if (loader)
{
- ianjuta_file_loader_load (loader, npw_action_get_file (this->action), FALSE, NULL);
+ GFile* file = g_file_new_for_path (npw_action_get_file (this->action));
+ ianjuta_file_loader_load (loader, file, FALSE, NULL);
+ g_object_unref (file);
return TRUE;
}
Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c (original)
+++ trunk/plugins/search/search-replace.c Wed Jul 2 00:46:18 2008
@@ -450,8 +450,12 @@
if (fb->te)
ianjuta_editor_goto_line (fb->te, mi->line, NULL);
else
- fb->te = ianjuta_document_manager_goto_uri_line_mark
- (sr->docman, fb->uri, mi->line, FALSE, NULL);
+ {
+ GFile* file = g_file_new_for_uri (fb->uri);
+ fb->te = ianjuta_document_manager_goto_file_line_mark
+ (sr->docman, file, mi->line, FALSE, NULL);
+ g_object_unref (file);
+ }
found_line = mi->line;
}
{
@@ -476,8 +480,12 @@
if (fb->te)
ianjuta_editor_goto_line (fb->te, mi->line, NULL);
else
- fb->te = ianjuta_document_manager_goto_uri_line_mark
- (sr->docman, fb->uri, mi->line, FALSE, NULL);
+ {
+ GFile* file = g_file_new_for_uri (fb->uri);
+ fb->te = ianjuta_document_manager_goto_file_line_mark
+ (sr->docman, file, mi->line, FALSE, NULL);
+ g_object_unref (file);
+ }
found_line = mi->line;
}
@@ -693,7 +701,7 @@
{
gchar *ptr, *ptr2;
gchar *path, *nline;
- gchar *uri;
+ GFile* file;
gint line;
if (!(ptr = g_strstr_len(message, strlen(message), ":")) )
@@ -706,9 +714,9 @@
nline = g_strndup(ptr, ptr2 - ptr);
line = atoi(nline);
- uri = gnome_vfs_get_uri_from_local_path (path);
- ianjuta_document_manager_goto_uri_line_mark (sr->docman, uri, line, TRUE, NULL);
- g_free(uri);
+ file = g_file_new_for_path (path);
+ ianjuta_document_manager_goto_file_line_mark (sr->docman, file, line, TRUE, NULL);
+ g_object_unref (file);
g_free(path);
g_free(nline);
return FALSE;
Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c (original)
+++ trunk/plugins/search/search-replace_backend.c Wed Jul 2 00:46:18 2008
@@ -121,7 +121,7 @@
file_buffer_new_from_te (IAnjutaEditor *te)
{
FileBuffer *fb;
- gchar* uri;
+ GFile* file;
gchar* path;
g_return_val_if_fail(te, NULL);
@@ -129,19 +129,21 @@
fb->type = FB_EDITOR;
fb->te = te;
- uri = ianjuta_file_get_uri(IANJUTA_FILE(te), NULL);
- path = gnome_vfs_get_local_path_from_uri(uri);
+ file = ianjuta_file_get_file(IANJUTA_FILE(te), NULL);
+ path = g_file_get_path (file);
if (path)
{
fb->path = tm_get_real_path(path);
g_free (path);
}
- fb->uri = uri;
+ fb->uri = g_file_get_uri (file);
fb->len = ianjuta_editor_get_length(te, NULL);
fb->buf = ianjuta_editor_get_text_all (fb->te, NULL);
fb->pos = ianjuta_editor_get_offset(fb->te, NULL);
fb->line = ianjuta_editor_get_lineno(fb->te, NULL);
+ g_object_unref (file);
+
return fb;
}
@@ -155,6 +157,7 @@
IAnjutaEditor *te;
IAnjutaDocument* doc;
char *real_path;
+ GFile* file;
char *uri;
int i;
int lineno;
@@ -163,9 +166,11 @@
real_path = tm_get_real_path(path);
/* There might be an already open TextEditor with this path */
- uri = gnome_vfs_get_uri_from_local_path (real_path);
- doc = ianjuta_document_manager_find_document_with_uri (sr->docman,
- uri, NULL);
+ file = g_file_new_for_path (real_path);
+ uri = g_file_get_uri (file);
+ doc = ianjuta_document_manager_find_document_with_file (sr->docman,
+ file, NULL);
+ g_object_unref (file);
if (doc && IANJUTA_IS_EDITOR (doc))
{
Modified: trunk/plugins/sourceview/plugin.c
==============================================================================
--- trunk/plugins/sourceview/plugin.c (original)
+++ trunk/plugins/sourceview/plugin.c Wed Jul 2 00:46:18 2008
@@ -111,7 +111,7 @@
static IAnjutaEditor*
ieditor_factory_new_editor(IAnjutaEditorFactory* factory,
- const gchar* uri,
+ GFile* file,
const gchar* filename,
GError** error)
{
@@ -124,7 +124,7 @@
{
current_style = g_strdup (SOURCEVIEW_DEFAULT_STYLE);
}
- sv = sourceview_new(uri, filename, plugin);
+ sv = sourceview_new(file, filename, plugin);
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (sv->priv->document),
gtk_source_style_scheme_manager_get_scheme (manager,
current_style));
Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c (original)
+++ trunk/plugins/sourceview/sourceview.c Wed Jul 2 00:46:18 2008
@@ -168,8 +168,12 @@
{
if (res == GTK_RESPONSE_YES)
{
+ gchar* uri = anjuta_document_get_uri(sv->priv->document);
+ GFile* file = g_file_new_for_uri (uri);
ianjuta_file_open(IANJUTA_FILE(sv),
- anjuta_document_get_uri(sv->priv->document), NULL);
+ file, NULL);
+ g_object_unref (file);
+ g_free (uri);
}
else
{
@@ -594,7 +598,7 @@
the file will be loaded in the buffer */
Sourceview *
-sourceview_new(const gchar* uri, const gchar* filename, AnjutaPlugin* plugin)
+sourceview_new(GFile* file, const gchar* filename, AnjutaPlugin* plugin)
{
AnjutaShell* shell;
GtkAdjustment* v_adj;
@@ -649,18 +653,20 @@
v_adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sv));
g_signal_connect (v_adj, "value-changed", G_CALLBACK (sourceview_adjustment_changed), sv);
- if (uri != NULL && strlen(uri) > 0)
+ if (file != NULL)
{
- ianjuta_file_open(IANJUTA_FILE(sv), uri, NULL);
+ ianjuta_file_open(IANJUTA_FILE(sv), file, NULL);
}
else if (filename != NULL && strlen(filename) > 0)
- sv->priv->filename = g_strdup(filename);
+ sv->priv->filename = g_strdup(filename);
/* Create Higlight Tag */
sourceview_create_highligth_indic(sv);
DEBUG_PRINT("============ Creating new editor =============");
+ g_signal_emit_by_name (G_OBJECT(sv), "update-ui");
+
return sv;
}
@@ -668,23 +674,26 @@
/* Open uri in Editor */
static void
-ifile_open (IAnjutaFile* file, const gchar *uri, GError** e)
+ifile_open (IAnjutaFile* ifile, GFile* file, GError** e)
{
- Sourceview* sv = ANJUTA_SOURCEVIEW(file);
+ Sourceview* sv = ANJUTA_SOURCEVIEW(ifile);
sourceview_remove_monitor(sv);
/* Hold a reference here to avoid a destroyed editor */
g_object_ref(G_OBJECT(sv));
- anjuta_document_load(sv->priv->document, uri, NULL,
+ anjuta_document_load(sv->priv->document, g_file_get_uri (file), NULL,
-1, FALSE);
}
/* Return the currently loaded uri */
-static gchar*
-ifile_get_uri (IAnjutaFile* file, GError** e)
+static GFile*
+ifile_get_file (IAnjutaFile* ifile, GError** e)
{
- Sourceview* sv = ANJUTA_SOURCEVIEW(file);
- return anjuta_document_get_uri(sv->priv->document);
+ Sourceview* sv = ANJUTA_SOURCEVIEW(ifile);
+ gchar* uri = anjuta_document_get_uri(sv->priv->document);
+ GFile* ret_file = g_file_new_for_uri (uri);
+ g_free (uri);
+ return ret_file;
}
/* IAnjutaFileSavable interface */
@@ -702,13 +711,13 @@
/* Save file as */
static void
-ifile_savable_save_as (IAnjutaFileSavable* file, const gchar *uri, GError** e)
+ifile_savable_save_as (IAnjutaFileSavable* ifile, GFile* file, GError** e)
{
GtkTextIter start_iter;
GtkTextIter end_iter;
- Sourceview* sv = ANJUTA_SOURCEVIEW(file);
+ Sourceview* sv = ANJUTA_SOURCEVIEW(ifile);
sourceview_remove_monitor(sv);
- /* TODO: Set correct encoding */
+ gchar* uri = g_file_get_uri (file);
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER(sv->priv->document),
&start_iter, &end_iter);
g_free(sv->priv->last_saved_content);
@@ -723,6 +732,8 @@
g_free(sv->priv->filename);
sv->priv->filename = NULL;
}
+
+ g_free (uri);
}
static void
@@ -753,7 +764,7 @@
ifile_iface_init (IAnjutaFileIface *iface)
{
iface->open = ifile_open;
- iface->get_uri = ifile_get_uri;
+ iface->get_file = ifile_get_file;
}
/* IAnjutaEditor interface */
Modified: trunk/plugins/sourceview/sourceview.h
==============================================================================
--- trunk/plugins/sourceview/sourceview.h (original)
+++ trunk/plugins/sourceview/sourceview.h Wed Jul 2 00:46:18 2008
@@ -31,6 +31,7 @@
#include <libanjuta/anjuta-preferences.h>
#include <libanjuta/anjuta-status.h>
#include <libanjuta/anjuta-plugin.h>
+#include <gio/gio.h>
#define ANJUTA_TYPE_SOURCEVIEW (sourceview_get_type ())
#define ANJUTA_SOURCEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_SOURCEVIEW, Sourceview))
@@ -53,6 +54,6 @@
} SourceviewClass;
GType sourceview_get_type(void);
-Sourceview *sourceview_new(const gchar* uri, const gchar* filename, AnjutaPlugin* plugin);
+Sourceview *sourceview_new(GFile* file, const gchar* filename, AnjutaPlugin* plugin);
#endif /* SOURCEVIEW_H */
Modified: trunk/plugins/subversion/plugin.c
==============================================================================
--- trunk/plugins/subversion/plugin.c (original)
+++ trunk/plugins/subversion/plugin.c Wed Jul 2 00:46:18 2008
@@ -26,6 +26,8 @@
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-file.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-file-manager.h>
+#include <libanjuta/interfaces/ianjuta-project-manager.h>
#include <libanjuta/interfaces/ianjuta-vcs.h>
#include "plugin.h"
@@ -204,12 +206,12 @@
};
static void
-value_added_fm_current_uri (AnjutaPlugin *plugin, const char *name,
+value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
{
AnjutaUI *ui;
GtkAction *subversion_menu_action;
- const gchar *uri;
+ gchar *uri;
GnomeVFSURI *subversion_uri = NULL;
gchar *subversion_text_uri = NULL;
gchar *subversion_dir;
@@ -217,9 +219,11 @@
GnomeVFSDirectoryHandle* handle;
GnomeVFSFileInfo info;
GnomeVFSResult result;
+ GFile* file;
- uri = g_value_get_string (value);
- filename = gnome_vfs_get_local_path_from_uri (uri);
+ file = G_FILE(g_value_get_object (value));
+ uri = g_file_get_uri (file);
+ filename = g_file_get_path (file);
g_return_if_fail (filename != NULL);
Subversion *subversion = ANJUTA_PLUGIN_SUBVERSION (plugin);
@@ -270,10 +274,11 @@
g_object_set (G_OBJECT (subversion_menu_action), "sensitive", FALSE, NULL);
}
g_free (subversion_dir);
+ g_free (uri);
}
static void
-value_removed_fm_current_uri (AnjutaPlugin *plugin,
+value_removed_fm_current_file (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
AnjutaUI *ui;
@@ -379,7 +384,7 @@
const GValue *value, gpointer data)
{
AnjutaUI *ui;
- gchar *uri;
+ GFile* file;
GObject *editor;
editor = g_value_get_object (value);
@@ -394,16 +399,15 @@
g_free (subversion->current_editor_filename);
subversion->current_editor_filename = NULL;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
- if (uri)
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ if (file)
{
gchar *filename;
- filename = gnome_vfs_get_local_path_from_uri (uri);
- g_return_if_fail (filename != NULL);
+ filename = g_file_get_path (file);
+ if (!filename)
+ return;
subversion->current_editor_filename = filename;
- g_free (uri);
- // update_module_ui (subversion);
}
}
@@ -456,15 +460,15 @@
/* Add watches */
subversion->fm_watch_id =
- anjuta_plugin_add_watch (plugin, "file_manager_current_uri",
- value_added_fm_current_uri,
- value_removed_fm_current_uri, NULL);
+ anjuta_plugin_add_watch (plugin, IANJUTA_FILE_MANAGER_SELECTED_FILE,
+ value_added_fm_current_file,
+ value_removed_fm_current_file, NULL);
subversion->project_watch_id =
- anjuta_plugin_add_watch (plugin, "project_root_uri",
+ anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
value_added_project_root_uri,
value_removed_project_root_uri, NULL);
subversion->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
Modified: trunk/plugins/symbol-browser/an_symbol.c
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol.c (original)
+++ trunk/plugins/symbol-browser/an_symbol.c Wed Jul 2 00:46:18 2008
@@ -203,8 +203,8 @@
}
}
-static const gchar*
-isymbol_uri (IAnjutaSymbol *isymbol, GError **err)
+static GFile*
+isymbol_get_file (IAnjutaSymbol *isymbol, GError **err)
{
AnjutaSymbol *s;
@@ -216,10 +216,13 @@
if (s->priv->uri == NULL)
{
const gchar *file_path;
+ GFile* file;
file_path = s->priv->tm_tag->atts.entry.file->work_object.file_name;
- s->priv->uri = gnome_vfs_get_uri_from_local_path (file_path);
+ file = g_file_new_for_path (file_path);
+ s->priv->uri = g_file_get_uri (file);
+ g_object_unref (file);
}
- return s->priv->uri;
+ return g_file_new_for_path (s->priv->uri);
}
static gulong
@@ -260,7 +263,7 @@
static void
isymbol_iface_init (IAnjutaSymbolIface *iface)
{
- iface->get_uri = isymbol_uri;
+ iface->get_file = isymbol_get_file;
iface->get_name = isymbol_get_name;
iface->get_line = isymbol_get_line;
iface->is_local = isymbol_is_local;
Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c (original)
+++ trunk/plugins/symbol-browser/plugin.c Wed Jul 2 00:46:18 2008
@@ -80,7 +80,7 @@
static void
goto_file_line (AnjutaPlugin *plugin, const gchar *filename, gint lineno)
{
- gchar *uri;
+ GFile* file;
IAnjutaDocumentManager *docman;
g_return_if_fail (filename != NULL);
@@ -89,9 +89,9 @@
docman = anjuta_shell_get_interface (plugin->shell, IAnjutaDocumentManager,
NULL);
- uri = gnome_vfs_get_uri_from_local_path (filename);
- ianjuta_document_manager_goto_uri_line (docman, uri, lineno, NULL);
- g_free (uri);
+ file = g_file_new_for_path (filename);
+ ianjuta_document_manager_goto_file_line (docman, file, lineno, NULL);
+ g_object_unref (file);
}
static void
@@ -723,13 +723,16 @@
{
AnjutaUI *ui;
gchar *uri;
+ GFile* file;
GObject *editor = sv_plugin->current_editor;
if (!editor)
return;
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (sv_plugin)->shell, NULL);
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
if (uri)
{
gchar *local_filename;
@@ -816,6 +819,7 @@
gchar *uri;
GObject *editor;
SymbolBrowserPlugin *sv_plugin;
+ GFile* file;
editor = g_value_get_object (value);
@@ -834,7 +838,9 @@
update_editor_symbol_model (sv_plugin);
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
if (g_hash_table_lookup (sv_plugin->editor_connected, editor) == NULL)
{
g_object_weak_ref (G_OBJECT (editor),
@@ -992,11 +998,11 @@
/* set up project directory watch */
sv_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
sv_plugin->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
return TRUE;
Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c (original)
+++ trunk/plugins/symbol-db/plugin.c Wed Jul 2 00:46:18 2008
@@ -118,12 +118,15 @@
if (sdb_plugin->current_editor)
{
+ GFile* file;
ed = IANJUTA_EDITOR (sdb_plugin->current_editor);
buffer_size = ianjuta_editor_get_length (ed, NULL);
current_buffer = ianjuta_editor_get_text_all (ed, NULL);
- uri = ianjuta_file_get_uri (IANJUTA_FILE (ed), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (ed), NULL);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
}
else
return FALSE;
@@ -297,6 +300,7 @@
const GValue *value, gpointer data)
{
gchar *uri;
+ GFile* file;
gchar *local_path;
GObject *editor;
SymbolDBPlugin *sdb_plugin;
@@ -323,12 +327,13 @@
if (!IANJUTA_IS_EDITOR (editor))
return;
- uri = ianjuta_file_get_uri (IANJUTA_FILE (editor), NULL);
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
- if (uri == NULL)
+ if (file == NULL)
return;
- local_path = gnome_vfs_get_local_path_from_uri (uri);
+ local_path = g_file_get_path (file);
+ uri = g_file_get_uri (file);
DEBUG_PRINT ("value_added_current_editor () gonna refresh local syms: local_path %s "
"uri %s", local_path, uri);
if (local_path == NULL)
@@ -439,18 +444,18 @@
static void
goto_file_line (AnjutaPlugin *plugin, const gchar *filename, gint lineno)
{
- gchar *uri;
- IAnjutaFileLoader *loader;
+ IAnjutaDocumentManager *docman;
+ GFile* file;
g_return_if_fail (filename != NULL);
/* Go to file and line number */
- loader = anjuta_shell_get_interface (plugin->shell, IAnjutaFileLoader,
+ docman = anjuta_shell_get_interface (plugin->shell, IAnjutaDocumentManager,
NULL);
-
- uri = g_strdup_printf ("file://%s#%d", filename, lineno);
- ianjuta_file_loader_load (loader, uri, FALSE, NULL);
- g_free (uri);
+ file = g_file_new_for_path (filename);
+ ianjuta_document_manager_goto_file_line (docman, file, lineno, NULL);
+
+ g_object_unref (file);
}
@@ -1280,7 +1285,7 @@
gtk_notebook_set_current_page (GTK_NOTEBOOK (symbol_db->dbv_notebook), 0);
symbol_db->editor_watch_id =
- anjuta_plugin_add_watch (plugin, "document_manager_current_editor",
+ anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
/* Added widgets */
@@ -1291,7 +1296,7 @@
/* set up project directory watch */
symbol_db->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c Wed Jul 2 00:46:18 2008
@@ -310,8 +310,8 @@
return symbol_db_engine_iterator_node_get_symbol_extra_string (s, sym_info);
}
-static const gchar*
-isymbol_get_uri (IAnjutaSymbol *isymbol, GError **err)
+static GFile*
+isymbol_get_file (IAnjutaSymbol *isymbol, GError **err)
{
SymbolDBEngineIteratorNode *s;
@@ -320,11 +320,14 @@
if (s->priv->uri == NULL)
{
const gchar* file_path;
+ GFile* file;
file_path = symbol_db_engine_iterator_node_get_symbol_extra_string (s,
SYMINFO_FILE_PATH);
- s->priv->uri = gnome_vfs_get_uri_from_local_path (file_path);
+ file = g_file_new_for_path (file_path);
+ s->priv->uri = g_file_get_uri (file);
+ g_object_unref (file);
}
- return s->priv->uri;
+ return g_file_new_for_uri (s->priv->uri);
}
static gulong
@@ -390,7 +393,7 @@
static void
isymbol_iface_init (IAnjutaSymbolIface *iface)
{
- iface->get_uri = isymbol_get_uri;
+ iface->get_file = isymbol_get_file;
iface->get_name = isymbol_get_name;
iface->get_line = isymbol_get_line;
iface->get_sym_type = isymbol_get_sym_type;
Modified: trunk/plugins/tools/editor.c
==============================================================================
--- trunk/plugins/tools/editor.c (original)
+++ trunk/plugins/tools/editor.c Wed Jul 2 00:46:18 2008
@@ -781,7 +781,7 @@
{
IAnjutaDocumentManager *docman;
IAnjutaDocument *doc;
- gchar *uri;
+ GFile* file;
/* Check that default script directory exist */
data = g_build_filename (g_get_home_dir(), LOCAL_ANJUTA_SCRIPT_DIRECTORY, NULL);
@@ -818,25 +818,25 @@
return;
}
- uri = gnome_vfs_get_uri_from_local_path(data);
+ file = g_file_new_for_path (data);
g_free (data);
doc =
- ianjuta_document_manager_find_document_with_uri
- (docman, uri, NULL);
+ ianjuta_document_manager_find_document_with_file
+ (docman, file, NULL);
if (doc == NULL)
{
IAnjutaFileLoader* loader;
/* Not found, load file */
loader = IANJUTA_FILE_LOADER (anjuta_shell_get_interface (ANJUTA_PLUGIN (this->parent->plugin)->shell, IAnjutaFileLoader, NULL));
- ianjuta_file_loader_load (loader, uri, FALSE, NULL);
+ ianjuta_file_loader_load (loader, file, FALSE, NULL);
}
else
{
/* Set as current */
ianjuta_document_manager_set_current_document (docman, doc, NULL);
}
- g_free (uri);
+ g_object_unref (file);
}
}
Modified: trunk/plugins/tools/execute.c
==============================================================================
--- trunk/plugins/tools/execute.c (original)
+++ trunk/plugins/tools/execute.c Wed Jul 2 00:46:18 2008
@@ -261,12 +261,13 @@
if (parse_error_line (line, &filename, &lineno))
{
- gchar *uri;
- IAnjutaFileLoader *loader;
+ gchar *path;
+ GFile* file;
+ IAnjutaDocumentManager* docman;
/* Go to file and line number */
- loader = anjuta_shell_get_interface (this->execution->plugin->shell,
- IAnjutaFileLoader,
+ docman = anjuta_shell_get_interface (this->execution->plugin->shell,
+ IAnjutaDocumentManager,
NULL);
/* Append current directory */
@@ -275,24 +276,24 @@
{
if (*filename == '.')
{
- uri = g_strdup_printf ("file://%s/%s#%d",
- this->execution->directory,
- filename + 1, lineno);
+ path = g_build_filename (this->execution->directory,
+ filename + 1, NULL);
}
else
{
- uri = g_strdup_printf ("file://%s/%s#%d",
- this->execution->directory,
- filename, lineno);
+ path = g_build_filename (this->execution->directory,
+ filename, NULL);
}
}
else
{
- uri = g_strdup_printf ("file:///%s#%d", filename, lineno);
+ path = g_strdup(filename);
}
g_free (filename);
- ianjuta_file_loader_load (loader, uri, FALSE, NULL);
- g_free (uri);
+ file = g_file_new_for_path (path);
+ ianjuta_document_manager_goto_file_line (docman, file, lineno, NULL);
+ g_free (path);
+ g_object_unref (file);
}
}
Modified: trunk/plugins/tools/variable.c
==============================================================================
--- trunk/plugins/tools/variable.c (original)
+++ trunk/plugins/tools/variable.c Wed Jul 2 00:46:18 2008
@@ -302,6 +302,8 @@
IAnjutaEditor *ed;
gchar* val;
gchar* uri;
+ gchar* path;
+ GFile* file;
GError* err = NULL;
docman = anjuta_shell_get_interface (this->shell, IAnjutaDocumentManager, NULL);
@@ -324,8 +326,11 @@
val = g_strdup (ianjuta_document_get_filename (IANJUTA_DOCUMENT(ed), &err));
break;
case ATP_EDITOR_CURRENT_DIRECTORY:
- uri = ianjuta_file_get_uri (IANJUTA_FILE (ed), &err);
- val = remove_filename(get_path_from_uri(uri));
+ file = ianjuta_file_get_file (IANJUTA_FILE (ed), &err);
+ path = g_file_get_path (file);
+ val = remove_filename(path);
+ g_object_unref (file);
+ g_free(path);
break;
default:
g_return_val_if_reached (NULL);
Modified: trunk/plugins/valgrind/plugin.c
==============================================================================
--- trunk/plugins/valgrind/plugin.c (original)
+++ trunk/plugins/valgrind/plugin.c Wed Jul 2 00:46:18 2008
@@ -565,7 +565,7 @@
/* set up project directory watch */
valgrind->project_root_uri = NULL;
valgrind->root_watch_id = anjuta_plugin_add_watch (plugin,
- "project_root_uri",
+ IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
project_root_added,
project_root_removed, NULL);
Modified: trunk/plugins/valgrind/vgdefaultview.c
==============================================================================
--- trunk/plugins/valgrind/vgdefaultview.c (original)
+++ trunk/plugins/valgrind/vgdefaultview.c Wed Jul 2 00:46:18 2008
@@ -40,7 +40,7 @@
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libanjuta/anjuta-debug.h>
-#include <libanjuta/interfaces/ianjuta-file-loader.h>
+#include <libanjuta/interfaces/ianjuta-document-manager.h>
#include "vgdefaultview.h"
#include "vgrulepattern.h"
@@ -1108,7 +1108,7 @@
custom_editor_cb (GtkWidget *widget, gpointer user_data)
{
VgDefaultView *view = user_data;
- IAnjutaFileLoader *loader;
+ IAnjutaDocumentManager* docman;
GtkTreeSelection *selection;
VgErrorStack *stack = NULL;
GtkTreeModel *model;
@@ -1129,15 +1129,13 @@
DEBUG_PRINT ("got this path for file opening: %s and line %d", path, stack->info.src.lineno );
/* Goto file line */
- loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (view->valgrind_plugin)->shell,
- IAnjutaFileLoader, NULL);
- if (loader)
+ docman = anjuta_shell_get_interface (ANJUTA_PLUGIN (view->valgrind_plugin)->shell,
+ IAnjutaDocumentManager, NULL);
+ if (docman)
{
- gchar *uri;
- uri = g_strdup_printf ("file:///%s#%d", path, stack->info.src.lineno);
-
- ianjuta_file_loader_load (loader, uri, FALSE, NULL);
- g_free (uri);
+ GFile* file = g_file_new_for_path (path);
+ ianjuta_document_manager_goto_file_line (docman, file, stack->info.src.lineno, NULL);
+ g_object_unref (file);
}
g_free (path);
Modified: trunk/src/anjuta.c
==============================================================================
--- trunk/src/anjuta.c (original)
+++ trunk/src/anjuta.c Wed Jul 2 00:46:18 2008
@@ -475,11 +475,13 @@
/* Load project file */
if (project_file)
{
+ GFile* file = g_file_new_for_uri (project_file);
IAnjutaFileLoader *loader;
loader = anjuta_shell_get_interface (ANJUTA_SHELL (app),
IAnjutaFileLoader, NULL);
- ianjuta_file_loader_load (loader, project_file, FALSE, NULL);
+ ianjuta_file_loader_load (loader, file, FALSE, NULL);
g_free (project_file);
+ g_object_unref (file);
}
anjuta_profile_manager_thaw (profile_manager, &error);
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Wed Jul 2 00:46:18 2008
@@ -177,6 +177,7 @@
gint i;
GdkDisplay *display;
GdkScreen *screen;
+ GList* file;
g_return_if_fail (message != NULL);
@@ -232,15 +233,16 @@
/* execute the commands */
- while (file_list != NULL)
+ for (file = file_list; file != NULL; file = g_list_next (file))
{
- IAnjutaFileLoader* file =
+ IAnjutaFileLoader* loader =
anjuta_shell_get_interface(ANJUTA_SHELL(app), IAnjutaFileLoader, NULL);
- gchar* uri = g_strdup_printf("%s:%d", (gchar*) file_list->data, line_position);
-
- ianjuta_file_loader_load(file, file_list->data, FALSE, NULL);
- g_free(uri);
- file_list = g_list_next(file_list);
+ GFile* gfile = g_file_new_for_uri(file->data);
+ if (gfile)
+ {
+ ianjuta_file_loader_load(loader, gfile, FALSE, NULL);
+ g_object_unref (gfile);
+ }
}
/* free the file list and reset to default */
@@ -351,7 +353,7 @@
if (connection != NULL)
{
if (!bacon_message_connection_get_is_server (connection) &&
- no_client ==FALSE)
+ no_client == FALSE)
{
DEBUG_PRINT("Client");
send_bacon_message ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]