[anjuta] anjuta, document-manager, file-loader, glade, project-manager: Save relative URI
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] anjuta, document-manager, file-loader, glade, project-manager: Save relative URI
- Date: Wed, 1 Feb 2012 20:41:03 +0000 (UTC)
commit f518ff8a8c92017c50c252f8528a1a42adf2921c
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Wed Feb 1 21:31:48 2012 +0100
anjuta, document-manager, file-loader, glade, project-manager: Save relative URI
plugins/document-manager/plugin.c | 11 +-
plugins/file-loader/plugin.c | 317 ++++++++++++++++++-------------------
plugins/glade/plugin.c | 82 +++++-----
plugins/project-manager/plugin.c | 20 ++--
plugins/project-manager/plugin.h | 2 +-
src/anjuta.c | 28 +---
6 files changed, 222 insertions(+), 238 deletions(-)
---
diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c
index 1412649..1aaaa52 100644
--- a/plugins/document-manager/plugin.c
+++ b/plugins/document-manager/plugin.c
@@ -1407,13 +1407,12 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
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", file_uri,
- ianjuta_editor_get_lineno (te, NULL));
- files = g_list_prepend (files, uri);
- g_free (file_uri);
+ gchar *line_number;
+
+ line_number = g_strdup_printf ("%d", ianjuta_editor_get_lineno (te, NULL));
+ files = g_list_prepend (files, anjuta_session_get_relative_uri_from_file (session, file, line_number));
+ g_free (line_number);
}
}
}
diff --git a/plugins/file-loader/plugin.c b/plugins/file-loader/plugin.c
index 4dcdf2d..4a2a9d2 100644
--- a/plugins/file-loader/plugin.c
+++ b/plugins/file-loader/plugin.c
@@ -49,7 +49,7 @@ sort_wizards(gconstpointer wizard1, gconstpointer wizard2)
gchar* name1, *name2;
AnjutaPluginDescription* desc1 = (AnjutaPluginDescription*) wizard1;
AnjutaPluginDescription* desc2 = (AnjutaPluginDescription*) wizard2;
-
+
if ((anjuta_plugin_description_get_locale_string (desc1, "Wizard",
"Title", &name1) ||
anjuta_plugin_description_get_locale_string (desc1, "Anjuta Plugin",
@@ -71,11 +71,11 @@ static void
update_recent_file (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
const gchar *mime, gboolean add)
{
-
+
if (add)
{
GtkRecentData *recent_data;
-
+
recent_data = g_slice_new (GtkRecentData);
recent_data->display_name = NULL;
@@ -85,7 +85,7 @@ update_recent_file (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
recent_data->app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL);
recent_data->groups = NULL;
recent_data->is_private = FALSE;
-
+
if (!gtk_recent_manager_add_full (plugin->recent_manager, uri, recent_data))
{
g_warning ("Unable to add '%s' to the list of recently used documents", uri);
@@ -108,7 +108,7 @@ launch_application_failure (AnjutaFileLoaderPlugin *plugin,
{
GtkWidget *parent;
gchar *basename;
-
+
parent =
gtk_widget_get_toplevel (GTK_WIDGET(ANJUTA_PLUGIN (plugin)->shell));
basename = g_path_get_basename (uri);
@@ -124,12 +124,12 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
{
AnjutaPluginManager *plugin_manager;
GList *plugin_descs = NULL;
-
+
g_return_val_if_fail (mime_type != NULL, NULL);
-
+
plugin_manager = anjuta_shell_get_plugin_manager (plugin->shell,
NULL);
-
+
/* Check an exact match */
plugin_descs = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
@@ -138,13 +138,13 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
"SupportedMimeTypes",
mime_type,
NULL);
-
+
/* Check for plugins supporting one supertype */
if (plugin_descs == NULL)
{
GList *node;
- GList *loader_descs = NULL;
-
+ GList *loader_descs = NULL;
+
loader_descs = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
"Interfaces", "IAnjutaFile",
@@ -152,18 +152,18 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
for (node = g_list_first (loader_descs); node != NULL; node = g_list_next (node))
{
gchar *value;
-
+
if (anjuta_plugin_description_get_string ((AnjutaPluginDescription *)node->data,
"File Loader", "SupportedMimeTypes", &value))
{
gchar **split_value;
-
+
split_value = g_strsplit (value, ",", -1);
g_free (value);
if (split_value)
{
gchar **mime;
-
+
for (mime = split_value; *mime != NULL; mime++)
{
/* The following line is working on unix only where
@@ -176,7 +176,7 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
gchar *loc;
anjuta_plugin_description_get_string ((AnjutaPluginDescription *)node->data,
"Anjuta Plugin", "Location", &loc);
-
+
plugin_descs = g_list_prepend (plugin_descs, node->data);
break;
}
@@ -188,7 +188,7 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
g_list_free (loader_descs);
plugin_descs = g_list_reverse (plugin_descs);
}
-
+
return plugin_descs;
}
@@ -224,7 +224,7 @@ on_value_added_current_doc (AnjutaPlugin *plugin, const gchar *name,
{
fplugin->dm_current_uri = NULL;
- }
+ }
}
static void
@@ -243,14 +243,14 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
GList *plugin_descs, *snode;
GList *mime_apps, *node;
GAppInfo *mime_app;
-
+
GtkWidget *dialog, *parent, *hbox, *label;
GtkWidget *options;
gchar *message;
gchar *basename;
gint col = -1;
AnjutaPluginManager *plugin_manager;
-
+
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin)->shell,
NULL);
basename = g_path_get_basename (uri);
@@ -273,7 +273,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
GTK_BUTTONS_OK_CANCEL, "%s",
message);
g_free (message);
-
+
hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
hbox, FALSE, FALSE, 5);
@@ -281,11 +281,11 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
options = gtk_combo_box_text_new ();
gtk_box_pack_end (GTK_BOX(hbox), options, FALSE, FALSE, 10);
gtk_box_pack_end (GTK_BOX(hbox), label, FALSE, FALSE, 10);
-
+
/* Document manager plugin */
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (options), _("Document Manager"));
col ++;
-
+
/* Open with plugins menu items */
plugin_descs = get_available_plugins_for_mime (ANJUTA_PLUGIN (plugin), mime_type);
snode = plugin_descs;
@@ -293,14 +293,14 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
{
gchar *name;
AnjutaPluginDescription *desc;
-
+
desc = (AnjutaPluginDescription *)(snode->data);
-
+
name = NULL;
-
+
anjuta_plugin_description_get_locale_string (desc, "File Loader",
"Title", &name);
-
+
if (!name)
{
anjuta_plugin_description_get_locale_string (desc, "Anjuta Plugin",
@@ -316,7 +316,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
g_free (name);
snode = g_list_next (snode);
}
-
+
/* Open with application menu items */
mime_apps = g_app_info_get_all_for_type (mime_type);
if (mime_apps)
@@ -325,7 +325,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
col++;
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (options), "");
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (options), RowSeparatorFunc, GINT_TO_POINTER(col), NULL);
- }
+ }
node = mime_apps;
while (node)
{
@@ -338,11 +338,11 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
}
gtk_combo_box_set_active (GTK_COMBO_BOX (options), 0);
gtk_widget_show_all (hbox);
-
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
gint option;
-
+
option = gtk_combo_box_get_active(GTK_COMBO_BOX (options));
if (option == 0)
{
@@ -365,7 +365,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
{
AnjutaPluginDescription *desc;
gchar *location = NULL;
-
+
option--;
desc = g_list_nth_data (plugin_descs, option);
anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
@@ -374,7 +374,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
if (location != NULL)
{
GObject *loaded_plugin;
-
+
loaded_plugin =
anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
location);
@@ -398,7 +398,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
{
GList *uris = NULL;
GError *error = NULL;
-
+
option -= (g_list_length (plugin_descs) + 2);
mime_app = g_list_nth_data (mime_apps, option);
uris = g_list_prepend (uris, (gpointer)uri);
@@ -423,9 +423,9 @@ static void
open_file (AnjutaFileLoaderPlugin *plugin, const gchar *uri)
{
GFile* file;
-
+
file = g_file_new_for_uri (uri);
-
+
ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin),
file, FALSE, NULL);
g_object_unref (file);
@@ -441,7 +441,7 @@ static gboolean
on_open_recent_file_idle (gpointer data)
{
RecentIdleOpenData *rdata;
-
+
rdata = (RecentIdleOpenData*)data;
open_file (rdata->plugin, rdata->uri);
g_free (rdata);
@@ -454,7 +454,7 @@ on_open_recent_file (GtkRecentChooser *chooser, AnjutaFileLoaderPlugin *plugin)
const gchar *uri;
gboolean ret = TRUE;
RecentIdleOpenData *rdata;
-
+
uri = gtk_recent_chooser_get_current_uri (chooser);
rdata = g_new0 (RecentIdleOpenData, 1);
rdata->plugin = plugin;
@@ -475,7 +475,7 @@ on_open_response_ok (GtkDialog* dialog, gint id,
gtk_widget_destroy (GTK_WIDGET (dialog));
return;
}
-
+
list = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog));
node = list;
while (node)
@@ -492,18 +492,18 @@ static void
setup_file_filters (GtkFileChooser *fc)
{
GtkFileFilter *filter;
-
+
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All files"));
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (fc, filter);
-
+
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Anjuta Projects"));
gtk_file_filter_add_pattern (filter, "*.anjuta");
gtk_file_filter_add_pattern (filter, "*.prj");
gtk_file_chooser_add_filter (fc, filter);
-
+
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("C/C++ source files"));
gtk_file_filter_add_pattern (filter, "*.c");
@@ -587,8 +587,8 @@ setup_file_filters (GtkFileChooser *fc)
static GtkWidget*
create_file_open_dialog_gui(GtkWindow* parent, AnjutaFileLoaderPlugin* plugin)
{
- GtkWidget* dialog =
- gtk_file_chooser_dialog_new (_("Open file"),
+ GtkWidget* dialog =
+ gtk_file_chooser_dialog_new (_("Open file"),
parent,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -603,13 +603,13 @@ create_file_open_dialog_gui(GtkWindow* parent, AnjutaFileLoaderPlugin* plugin)
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_destroy_with_parent (GTK_WINDOW(dialog), TRUE);
-
+
setup_file_filters (GTK_FILE_CHOOSER (dialog));
-
- g_signal_connect(G_OBJECT(dialog), "response",
+
+ g_signal_connect(G_OBJECT(dialog), "response",
G_CALLBACK(on_open_response_ok), plugin);
- g_signal_connect_swapped (dialog,
- "response",
+ g_signal_connect_swapped (dialog,
+ "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
return dialog;
@@ -619,7 +619,7 @@ static void
on_new_clicked (GtkToolButton *button, AnjutaFileLoaderPlugin *plugin)
{
AnjutaShell* shell = ANJUTA_PLUGIN (plugin)->shell;
- IAnjutaDocumentManager *docman = anjuta_shell_get_interface (shell,
+ IAnjutaDocumentManager *docman = anjuta_shell_get_interface (shell,
IAnjutaDocumentManager,
NULL);
if (docman)
@@ -630,7 +630,7 @@ static void
on_open_clicked (GtkToolButton *button, AnjutaFileLoaderPlugin *plugin)
{
GtkWidget *dlg;
-
+
dlg =
create_file_open_dialog_gui (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
plugin);
@@ -641,7 +641,7 @@ static void
on_new_activate (GtkAction *action, AnjutaFileLoaderPlugin *plugin)
{
AnjutaShell* shell = ANJUTA_PLUGIN (plugin)->shell;
- IAnjutaDocumentManager *docman = anjuta_shell_get_interface (shell,
+ IAnjutaDocumentManager *docman = anjuta_shell_get_interface (shell,
IAnjutaDocumentManager,
NULL);
if (docman)
@@ -652,7 +652,7 @@ static void
on_open_activate (GtkAction *action, AnjutaFileLoaderPlugin *plugin)
{
GtkWidget *dlg;
-
+
dlg =
create_file_open_dialog_gui (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
plugin);
@@ -665,7 +665,7 @@ on_activate_wizard (GtkMenuItem *menuitem,
{
AnjutaPluginManager *plugin_manager;
AnjutaPluginDescription *desc;
-
+
desc = g_object_get_data (G_OBJECT (menuitem), "__plugin_desc");
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (loader)->shell,
NULL);
@@ -673,7 +673,7 @@ on_activate_wizard (GtkMenuItem *menuitem,
{
gchar *id;
GObject *plugin;
-
+
if (anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
"Location", &id))
{
@@ -693,13 +693,13 @@ on_create_submenu (gpointer user_data)
gint count;
GtkWidget *submenu = NULL;
GList *plugin_descs = NULL;
-
+
loader = ANJUTA_PLUGIN_FILE_LOADER (user_data);
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (loader)->shell,
NULL);
submenu = gtk_menu_new ();
gtk_widget_show (submenu);
-
+
plugin_descs = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
"Interfaces", "IAnjutaWizard",
@@ -713,9 +713,9 @@ on_create_submenu (gpointer user_data)
GtkWidget *menuitem;
GtkWidget *icon;
gchar *str, *icon_path, *name;
-
+
desc = node->data;
-
+
icon = NULL;
name = NULL;
if (anjuta_plugin_description_get_locale_string (desc, "Wizard",
@@ -735,7 +735,7 @@ on_create_submenu (gpointer user_data)
{
GdkPixbuf *pixbuf, *scaled_pixbuf;
gint height, width;
-
+
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (submenu),
GTK_ICON_SIZE_MENU,
&width, &height);
@@ -751,7 +751,7 @@ on_create_submenu (gpointer user_data)
}
else
icon = gtk_image_new ();
-
+
gtk_widget_show (icon);
g_free (icon_path);
g_free (str);
@@ -783,7 +783,7 @@ open_uri_with (AnjutaFileLoaderPlugin *plugin, GtkMenuItem *menuitem,
GAppInfo *app;
AnjutaPluginDescription *desc;
const gchar *mime_type;
-
+
/* Open with plugin */
desc = (AnjutaPluginDescription*) g_object_get_data (G_OBJECT (menuitem),
"desc");
@@ -796,14 +796,14 @@ open_uri_with (AnjutaFileLoaderPlugin *plugin, GtkMenuItem *menuitem,
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin)->shell,
NULL);
-
+
anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
"Location", &location);
g_assert (location != NULL);
if (location != NULL)
{
GObject *loaded_plugin;
-
+
loaded_plugin =
anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
location);
@@ -811,7 +811,7 @@ open_uri_with (AnjutaFileLoaderPlugin *plugin, GtkMenuItem *menuitem,
{
GFile* file = g_file_new_for_uri (uri);
GError *error = NULL;
-
+
ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, &error);
g_object_unref (file);
update_recent_file (plugin, uri, mime_type, error == NULL);
@@ -835,7 +835,7 @@ open_uri_with (AnjutaFileLoaderPlugin *plugin, GtkMenuItem *menuitem,
{
GList *uris = NULL;
GError *error = NULL;
-
+
uris = g_list_prepend (uris, (gpointer)uri);
g_app_info_launch_uris (app, uris, NULL, &error);
g_list_free (uris);
@@ -878,10 +878,10 @@ pm_open_with (GtkMenuItem *menuitem, AnjutaFileLoaderPlugin *plugin)
}
static GtkActionEntry actions_file[] = {
- {
- "ActionFileNew",
+ {
+ "ActionFileNew",
GTK_STOCK_NEW,
- N_("_New"),
+ N_("_New"),
"<control>n",
N_("New empty file"),
G_CALLBACK (on_new_activate)
@@ -932,30 +932,30 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
{
GList *mime_apps;
GList *plugin_descs;
- GList *node;
+ GList *node;
GtkWidget *menu, *menuitem;
gchar *mime_type;
GFile *file;
-
+
g_return_val_if_fail (GTK_IS_MENU_ITEM (parentmenu), FALSE);
-
+
menu = gtk_menu_new ();
gtk_widget_show (menu);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parentmenu), menu);
-
+
file = g_file_new_for_uri (uri);
mime_type = anjuta_util_get_file_mime_type (file);
g_object_unref (file);
if (mime_type == NULL)
return FALSE;
-
+
/* Open with plugins menu items */
plugin_descs = get_available_plugins_for_mime (ANJUTA_PLUGIN (plugin), mime_type);
for (node = plugin_descs; node != NULL; node = g_list_next (node))
{
gchar *name;
AnjutaPluginDescription *desc;
-
+
desc = (AnjutaPluginDescription *)(node->data);
name = NULL;
anjuta_plugin_description_get_locale_string (desc, "File Loader",
@@ -972,14 +972,14 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
}
menuitem = gtk_menu_item_new_with_label (name);
g_object_set_data (G_OBJECT (menuitem), "desc", (gpointer)(desc));
- g_object_set_data (G_OBJECT (menuitem), "mime_type", mime_type);
+ g_object_set_data (G_OBJECT (menuitem), "mime_type", mime_type);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (callback), callback_data);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_free (name);
}
g_list_free (plugin_descs);
-
+
/* Open with applications */
mime_apps = g_app_info_get_all_for_type (mime_type);
if (plugin_descs && mime_apps)
@@ -987,17 +987,17 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
menuitem = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
-
+
for (node = mime_apps; node != NULL; node = g_list_next (node))
{
GAppInfo *mime_app;
-
+
mime_app = (GAppInfo *)(node->data);
if (g_app_info_should_show (mime_app))
{
menuitem = gtk_menu_item_new_with_label ( g_app_info_get_name (mime_app));
- g_object_set_data_full (G_OBJECT (menuitem), "app", mime_app, g_object_unref);
- g_object_set_data (G_OBJECT (menuitem), "mime_type", mime_type);
+ g_object_set_data_full (G_OBJECT (menuitem), "app", mime_app, g_object_unref);
+ g_object_set_data (G_OBJECT (menuitem), "mime_type", mime_type);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (callback), callback_data);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
@@ -1014,17 +1014,17 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
if ((mime_apps != NULL) || (plugin_descs != NULL))
{
g_object_set_data_full (G_OBJECT (menu), "mime_type", (gpointer)mime_type, g_free);
-
+
return TRUE;
}
else
{
g_free (mime_type);
-
+
return FALSE;
}
}
-
+
static void
value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
const GValue *value, gpointer data)
@@ -1035,31 +1035,31 @@ value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
GtkAction *action;
GtkWidget *parentmenu;
GFile* file = G_FILE (g_value_get_object (value));
-
+
uri = g_file_get_uri (file);
g_return_if_fail (name != NULL);
fl_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader", "ActionPopupOpen");
g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader",
"ActionPopupOpenWith");
g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-
+
if (fl_plugin->fm_current_uri)
g_free (fl_plugin->fm_current_uri);
fl_plugin->fm_current_uri = g_strdup (uri);
-
+
parentmenu =
gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
"/PopupFileManager/PlaceholderPopupFileOpen/OpenWith");
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);
}
@@ -1072,15 +1072,15 @@ value_removed_fm_current_file (AnjutaPlugin *plugin,
AnjutaFileLoaderPlugin *fl_plugin;
fl_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
-
+
if (fl_plugin->fm_current_uri)
g_free (fl_plugin->fm_current_uri);
fl_plugin->fm_current_uri = NULL;
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader", "ActionPopupOpen");
g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader",
"ActionPopupOpenWith");
g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
@@ -1095,24 +1095,24 @@ value_added_pm_current_uri (AnjutaPlugin *plugin, const char *name,
AnjutaFileLoaderPlugin *fl_plugin;
GtkAction *action;
GtkWidget *parentmenu;
-
+
uri = g_value_get_string (value);
g_return_if_fail (name != NULL);
-
+
fl_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader", "ActionPopupPMOpen");
g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader",
"ActionPopupPMOpenWith");
g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
-
+
if (fl_plugin->pm_current_uri)
g_free (fl_plugin->pm_current_uri);
fl_plugin->pm_current_uri = g_strdup (uri);
-
+
parentmenu =
gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
"/PopupProjectManager/PlaceholderPopupProjectOpen/OpenWith");
@@ -1130,15 +1130,15 @@ value_removed_pm_current_uri (AnjutaPlugin *plugin,
AnjutaFileLoaderPlugin *fl_plugin;
fl_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
-
+
if (fl_plugin->pm_current_uri)
g_free (fl_plugin->pm_current_uri);
fl_plugin->pm_current_uri = NULL;
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader", "ActionPopupPMOpen");
g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupPopupLoader",
"ActionPopupPMOpenWith");
g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
@@ -1156,38 +1156,33 @@ on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase,
AnjutaFileLoaderPlugin *plugin)
{
GList *files, *node;
-
+
/* We want to load the files first before other session loads */
if (phase != ANJUTA_SESSION_PHASE_FIRST)
return;
-
+
files = anjuta_session_get_string_list (session, "File Loader", "Files");
if (!files)
return;
-
+
/* Open all files except project files */
for (node = g_list_first (files); node != NULL; node = g_list_next (node))
{
gchar *uri = node->data;
-
+
if (uri)
{
- gchar *fragment;
-
- fragment = strchr (uri, '#');
- if (fragment)
- *fragment = '\0';
-
if (!anjuta_util_is_project_file (uri))
{
- GFile* file = g_file_new_for_uri (uri);
+ gchar *fragment = NULL;
+ GFile* file = anjuta_session_get_file_from_relative_uri (session, uri, &fragment);
GObject *loader = ianjuta_file_loader_load (IANJUTA_FILE_LOADER (plugin),
file, FALSE, NULL);
- if (fragment)
+ if (fragment != NULL)
{
if (IANJUTA_IS_DOCUMENT_MANAGER (loader))
{
- ianjuta_document_manager_goto_file_line (IANJUTA_DOCUMENT_MANAGER (loader), file, atoi(fragment + 1), NULL);
+ ianjuta_document_manager_goto_file_line (IANJUTA_DOCUMENT_MANAGER (loader), file, atoi(fragment), NULL);
}
}
g_object_unref (file);
@@ -1214,7 +1209,7 @@ setup_recent_chooser_menu (GtkRecentChooser* recent_menu, AnjutaFileLoaderPlugin
gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (recent_menu), filter);
g_signal_connect (recent_menu, "item-activated",
- G_CALLBACK (on_open_recent_file), plugin);
+ G_CALLBACK (on_open_recent_file), plugin);
}
static gboolean
@@ -1227,16 +1222,16 @@ activate_plugin (AnjutaPlugin *plugin)
GtkWidget *widget;
GtkWidget* recent_menu;
GtkWidget* toolbar_menu;
-
+
loader_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
-
+
DEBUG_PRINT ("%s", "AnjutaFileLoaderPlugin: Activating File Loader pluginâ");
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
+
/* Recent manager */
loader_plugin->recent_manager = gtk_recent_manager_get_default();
-
+
/* Add action group */
loader_plugin->action_group =
anjuta_ui_add_action_group_entries (ui, "ActionGroupLoader",
@@ -1255,7 +1250,7 @@ activate_plugin (AnjutaPlugin *plugin)
g_object_set (saction, "stock-id", GTK_STOCK_NEW, NULL);
gtk_action_group_add_action (loader_plugin->action_group,
GTK_ACTION (saction));
-
+
/* Set short labels */
action = anjuta_ui_get_action (ui, "ActionGroupLoader", "ActionFileOpen");
g_object_set (G_OBJECT (action), "short-label", _("Open"),
@@ -1266,32 +1261,32 @@ activate_plugin (AnjutaPlugin *plugin)
_("Open recent file"), NULL);
g_object_set (action, "stock-id", GTK_STOCK_OPEN, NULL);
setup_recent_chooser_menu (GTK_RECENT_CHOOSER (action), loader_plugin);
-
+
gtk_action_group_add_action (group, action);
anjuta_ui_add_action_group (ui, "ActionGroupLoaderRecent",
N_("Open recent files"), group, FALSE);
loader_plugin->recent_group = group;
-
+
/* Add UI */
loader_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
-
+
/* Adding submenus */
recent_menu = anjuta_recent_chooser_menu_new_for_manager (loader_plugin->recent_manager);
setup_recent_chooser_menu (GTK_RECENT_CHOOSER (recent_menu), loader_plugin);
widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
"/MenuMain/MenuFile/PlaceholderFileMenus/OpenRecent");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget),
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget),
recent_menu);
-
+
widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
"/MenuMain/MenuFile/PlaceholderFileMenus/Wizard");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), on_create_submenu(loader_plugin));
-
+
widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
"/ToolbarMain/PlaceholderFileToolbar/New");
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (widget), on_create_submenu(loader_plugin));
g_signal_connect (widget, "clicked", G_CALLBACK (on_new_clicked), loader_plugin);
-
+
widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
"/ToolbarMain/PlaceholderFileToolbar/Open");
toolbar_menu = anjuta_recent_chooser_menu_new_for_manager (loader_plugin->recent_manager);
@@ -1305,23 +1300,23 @@ activate_plugin (AnjutaPlugin *plugin)
/* Install drag n drop handler */
dnd_drop_init (GTK_WIDGET (plugin->shell), dnd_dropped, plugin);
-
+
/* Add watches */
- loader_plugin->fm_watch_id =
+ loader_plugin->fm_watch_id =
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 =
+ loader_plugin->pm_watch_id =
anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_CURRENT_URI,
value_added_pm_current_uri,
value_removed_pm_current_uri, NULL);
- loader_plugin->dm_watch_id =
+ loader_plugin->dm_watch_id =
anjuta_plugin_add_watch (plugin,
IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
on_value_added_current_doc,
on_value_removed_current_doc,
plugin);
-
+
/* Connect to session */
g_signal_connect (G_OBJECT (plugin->shell), "load_session",
G_CALLBACK (on_session_load), plugin);
@@ -1333,15 +1328,15 @@ deactivate_plugin (AnjutaPlugin *plugin)
{
AnjutaUI *ui;
AnjutaFileLoaderPlugin *loader_plugin;
-
+
loader_plugin = ANJUTA_PLUGIN_FILE_LOADER (plugin);
-
+
DEBUG_PRINT ("%s", "AnjutaFileLoaderPlugin: Deactivating File Loader pluginâ");
-
+
/* Disconnect session */
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
G_CALLBACK (on_session_load), plugin);
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
/* Remove watches */
anjuta_plugin_remove_watch (plugin, loader_plugin->fm_watch_id, TRUE);
@@ -1374,14 +1369,14 @@ static void
anjuta_file_loader_plugin_instance_init (GObject *obj)
{
AnjutaFileLoaderPlugin *plugin = ANJUTA_PLUGIN_FILE_LOADER (obj);
-
+
plugin->fm_current_uri = NULL;
plugin->pm_current_uri = NULL;
- plugin->dm_current_uri = NULL;
+ plugin->dm_current_uri = NULL;
}
static void
-anjuta_file_loader_plugin_class_init (GObjectClass *klass)
+anjuta_file_loader_plugin_class_init (GObjectClass *klass)
{
AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
@@ -1401,40 +1396,40 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
AnjutaStatus *status;
AnjutaPluginManager *plugin_manager;
GList *plugin_descs = NULL;
- GObject *plugin = NULL;
+ GObject *plugin = NULL;
gchar *uri = g_file_get_uri (file);
-
+
g_return_val_if_fail (uri != NULL, NULL);
mime_type = anjuta_util_get_file_mime_type (file);
-
+
if (mime_type == NULL)
{
- update_recent_file (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, NULL, FALSE);
-
+ update_recent_file (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, NULL, FALSE);
+
if (err == NULL)
launch_application_failure (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, _("File not found"));
-
+
g_set_error (err, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("File not found"));
-
+
g_free (uri);
return NULL;
}
-
+
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (loader)->shell,
NULL);
status = anjuta_shell_get_status (ANJUTA_PLUGIN (loader)->shell, NULL);
anjuta_status_busy_push (status);
-
+
DEBUG_PRINT ("Opening URI: %s", uri);
-
+
plugin_descs = get_available_plugins_for_mime (ANJUTA_PLUGIN (loader), mime_type);
-
+
if (g_list_length (plugin_descs) > 1)
{
gchar* basename = g_path_get_basename (uri);
- /* %s is name of file that will be opened */
- gchar* message = g_strdup_printf (_("Please select a plugin to open <b>%s</b>."),
+ /* %s is name of file that will be opened */
+ gchar* message = g_strdup_printf (_("Please select a plugin to open <b>%s</b>."),
basename);
plugin =
anjuta_plugin_manager_select_and_activate (plugin_manager,
@@ -1447,7 +1442,7 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
else if (g_list_length (plugin_descs) == 1)
{
gchar *location = NULL;
-
+
AnjutaPluginDescription *desc = plugin_descs->data;
anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
"Location", &location);
@@ -1475,34 +1470,34 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
else
{
update_recent_file (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, mime_type, error == NULL);
- }
+ }
g_object_unref (G_OBJECT (appinfo));
}
g_list_free (uris);
}
-
+
if (plugin)
{
GError *error = NULL;
-
+
ianjuta_file_open (IANJUTA_FILE(plugin), file, &error);
if (error != NULL)
{
-
+
if (err == NULL)
launch_application_failure (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, error->message);
g_propagate_error (err, error);
}
update_recent_file (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, mime_type, error == NULL);
}
-
+
if (plugin_descs)
g_list_free (plugin_descs);
-
+
g_free (mime_type);
g_free (uri);
anjuta_status_busy_pop (status);
-
+
return plugin;
}
diff --git a/plugins/glade/plugin.c b/plugins/glade/plugin.c
index 5ded804..dc47706 100644
--- a/plugins/glade/plugin.c
+++ b/plugins/glade/plugin.c
@@ -45,7 +45,7 @@ struct _GladePluginPriv
GtkWidget *inspector;
GtkWidget *palette;
GtkWidget *editor;
-
+
GtkWidget *view_box;
GtkWidget *paned;
GtkWidget *palette_box;
@@ -54,7 +54,7 @@ struct _GladePluginPriv
GtkWidget *selector_toggle;
GtkWidget *resize_toggle;
-
+
/* File count, disable plugin when NULL */
guint file_count;
@@ -70,7 +70,7 @@ enum {
static void
on_pointer_mode_changed (GladeProject *project,
- GParamSpec *pspec,
+ GParamSpec *pspec,
GladePlugin *plugin);
static void
@@ -79,7 +79,7 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
{
GladePlugin* glade_plugin = ANJUTA_PLUGIN_GLADE(plugin);
GladePluginPriv* priv = glade_plugin->priv;
- GObject *editor;
+ GObject *editor;
editor = g_value_get_object (value);
if (ANJUTA_IS_DESIGN_DOCUMENT(editor))
{
@@ -114,7 +114,7 @@ on_signal_editor_created (GladeApp* app,
}
static void
-on_api_help (GladeEditor* editor,
+on_api_help (GladeEditor* editor,
const gchar* book,
const gchar* page,
const gchar* search,
@@ -174,12 +174,12 @@ on_document_mapped (GtkWidget* doc, GladePlugin* plugin)
{
GladeProject* project = glade_design_view_get_project (GLADE_DESIGN_VIEW (doc));
GladeEditor* editor = GLADE_EDITOR (plugin->priv->editor);
- GList* glade_obj_node;
+ GList* glade_obj_node;
GList* list = g_list_copy ((GList*)glade_project_get_objects (project));
gboolean first = TRUE;
-
+
/* Select the all windows in the project, select the first */
for (glade_obj_node = list;
glade_obj_node != NULL;
@@ -261,7 +261,7 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
file = ianjuta_file_get_file (IANJUTA_FILE (node->data), NULL);
if (file != NULL)
{
- files = g_list_prepend (files, g_file_get_uri (file));
+ files = g_list_prepend (files, anjuta_session_get_relative_uri_from_file (session, file, NULL));
g_object_unref (file);
/* uri is not freed here */
}
@@ -279,7 +279,7 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
}
static void
-glade_plugin_selection_changed (GladeProject *project,
+glade_plugin_selection_changed (GladeProject *project,
GladePlugin *plugin)
{
GladeWidget *glade_widget = NULL;
@@ -288,7 +288,7 @@ glade_plugin_selection_changed (GladeProject *project,
{
GList *list;
GList *node;
-
+
list = glade_project_selection_get (project);
for (node = list; node != NULL; node = g_list_next (node))
@@ -307,7 +307,7 @@ glade_plugin_add_project (GladePlugin *glade_plugin, GladeProject *project)
{
GtkWidget *view;
GladePluginPriv *priv;
- IAnjutaDocumentManager* docman =
+ IAnjutaDocumentManager* docman =
anjuta_shell_get_interface(ANJUTA_PLUGIN(glade_plugin)->shell,
IAnjutaDocumentManager, NULL);
@@ -330,9 +330,9 @@ glade_plugin_add_project (GladePlugin *glade_plugin, GladeProject *project)
g_signal_connect (project, "selection-changed",
G_CALLBACK (glade_plugin_selection_changed),
glade_plugin);
-
+
priv->file_count++;
-
+
ianjuta_document_manager_add_document(docman, IANJUTA_DOCUMENT(view), NULL);
}
@@ -411,7 +411,7 @@ on_drag_resize_button_toggled (GtkToggleToolButton *button,
static void
on_pointer_mode_changed (GladeProject *project,
- GParamSpec *pspec,
+ GParamSpec *pspec,
GladePlugin *plugin)
{
GladeProject *active_project = glade_inspector_get_project(GLADE_INSPECTOR (plugin->priv->inspector));
@@ -428,9 +428,9 @@ on_pointer_mode_changed (GladeProject *project,
gtk_widget_set_sensitive (plugin->priv->selector_toggle, TRUE);
gtk_widget_set_sensitive (plugin->priv->resize_toggle, TRUE);
- g_signal_handlers_block_by_func (plugin->priv->selector_toggle,
+ g_signal_handlers_block_by_func (plugin->priv->selector_toggle,
on_selector_button_toggled, plugin);
- g_signal_handlers_block_by_func (plugin->priv->resize_toggle,
+ g_signal_handlers_block_by_func (plugin->priv->resize_toggle,
on_drag_resize_button_toggled, plugin);
if (glade_project_get_pointer_mode (project) == GLADE_POINTER_SELECT)
@@ -449,9 +449,9 @@ on_pointer_mode_changed (GladeProject *project,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->priv->selector_toggle), FALSE);
}
- g_signal_handlers_unblock_by_func (plugin->priv->selector_toggle,
+ g_signal_handlers_unblock_by_func (plugin->priv->selector_toggle,
on_selector_button_toggled, plugin);
- g_signal_handlers_unblock_by_func (plugin->priv->resize_toggle,
+ g_signal_handlers_unblock_by_func (plugin->priv->resize_toggle,
on_drag_resize_button_toggled, plugin);
}
@@ -460,7 +460,7 @@ static void
glade_plugin_parse_began (GladeProject *project,
GladePlugin *plugin)
{
- AnjutaStatus *status = anjuta_shell_get_status (ANJUTA_PLUGIN(plugin)->shell,
+ AnjutaStatus *status = anjuta_shell_get_status (ANJUTA_PLUGIN(plugin)->shell,
NULL);
anjuta_status_busy_push (status);
plugin->priv->add_ticks = TRUE;
@@ -470,7 +470,7 @@ static void
glade_plugin_parse_finished (GladeProject *project,
AnjutaPlugin *plugin)
{
- AnjutaStatus *status = anjuta_shell_get_status (ANJUTA_PLUGIN(plugin)->shell,
+ AnjutaStatus *status = anjuta_shell_get_status (ANJUTA_PLUGIN(plugin)->shell,
NULL);
GladePlugin* gplugin = ANJUTA_PLUGIN_GLADE (plugin);
anjuta_status_busy_pop (status);
@@ -498,21 +498,21 @@ glade_plugin_load_progress (GladeProject *project,
GTK_ICON_SIZE_BUTTON,
0, NULL);
}
-
-
+
+
if (glade_plugin->priv->add_ticks)
{
glade_plugin->priv->add_ticks = FALSE;
anjuta_status_progress_add_ticks (status, total_ticks);
}
-
+
project_name = glade_project_get_name (project);
text = g_strdup_printf ("Loading %sâ", project_name);
anjuta_status_progress_tick (status,
icon,
text);
g_free (text);
- g_free (project_name);
+ g_free (project_name);
}
static GtkWidget *
@@ -586,7 +586,7 @@ activate_plugin (AnjutaPlugin *plugin)
anjuta_status_busy_push (status);
anjuta_status_set (status, "%s", _("Loading Gladeâ"));
-
+
priv->app = glade_app_get ();
if (!priv->app)
{
@@ -604,7 +604,7 @@ activate_plugin (AnjutaPlugin *plugin)
priv->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
priv->editor = GTK_WIDGET(glade_editor_new());
-
+
priv->palette = glade_palette_new();
priv->palette_box = gtk_vbox_new (FALSE, 5);
priv->selector_toggle = create_selector_tool_button ();
@@ -622,19 +622,19 @@ activate_plugin (AnjutaPlugin *plugin)
gtk_box_pack_start (GTK_BOX (priv->palette_box),
priv->palette,
TRUE, TRUE, 0);
-
-
+
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->selector_toggle),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->resize_toggle),
FALSE);
-
+
g_signal_connect (G_OBJECT (priv->selector_toggle), "toggled",
G_CALLBACK (on_selector_button_toggled), plugin);
g_signal_connect (G_OBJECT (priv->resize_toggle), "toggled",
G_CALLBACK (on_drag_resize_button_toggled), plugin);
-
+
glade_palette_set_show_selector_button (GLADE_PALETTE (priv->palette),
FALSE);
@@ -657,7 +657,7 @@ activate_plugin (AnjutaPlugin *plugin)
gtk_widget_show (priv->palette);
gtk_widget_show (priv->editor);
gtk_widget_show (priv->inspector);
-
+
/* Add widgets */
anjuta_shell_add_widget (anjuta_plugin_get_shell (ANJUTA_PLUGIN (plugin)),
priv->paned,
@@ -674,7 +674,7 @@ activate_plugin (AnjutaPlugin *plugin)
G_CALLBACK (on_session_save), plugin);
/* Watch documents */
- glade_plugin->priv->editor_watch_id =
+ glade_plugin->priv->editor_watch_id =
anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
@@ -697,7 +697,7 @@ deactivate_plugin (AnjutaPlugin *plugin)
return FALSE;
}
-
+
/* Disconnect signals */
g_signal_handlers_disconnect_by_func (plugin->shell,
G_CALLBACK (on_shell_destroy),
@@ -757,7 +757,7 @@ glade_plugin_instance_init (GObject *obj)
}
static void
-glade_plugin_class_init (GObjectClass *klass)
+glade_plugin_class_init (GObjectClass *klass)
{
AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
@@ -791,7 +791,7 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
_("Not local file: %s"), uri);
if (priv->file_count <= 0)
anjuta_plugin_deactivate (ANJUTA_PLUGIN (plugin));
-
+
g_free (uri);
return;
}
@@ -824,11 +824,11 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
}
project = glade_project_new ();
- g_signal_connect (project, "parse-began",
+ g_signal_connect (project, "parse-began",
G_CALLBACK (glade_plugin_parse_began), plugin);
- g_signal_connect (project, "parse-finished",
+ g_signal_connect (project, "parse-finished",
G_CALLBACK (glade_plugin_parse_finished), plugin);
- g_signal_connect (project, "load-progress",
+ g_signal_connect (project, "load-progress",
G_CALLBACK (glade_plugin_load_progress), plugin);
if (!glade_project_load_from_file (project, filename))
{
@@ -842,9 +842,9 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **err)
return;
}
g_free (filename);
-
+
glade_plugin_add_project (ANJUTA_PLUGIN_GLADE (ifile), project);
-
+
anjuta_shell_present_widget (ANJUTA_PLUGIN (ifile)->shell, priv->paned, NULL);
}
@@ -852,7 +852,7 @@ static GFile*
ifile_get_file (IAnjutaFile* ifile, GError** e)
{
GladePlugin* plugin = (GladePlugin*) ifile;
- const gchar* path =
+ const gchar* path =
glade_project_get_path(glade_inspector_get_project(GLADE_INSPECTOR (plugin->priv->inspector)));
GFile* file = g_file_new_for_path (path);
return file;
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index c207028..e1524ba 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -75,8 +75,8 @@ update_title (ProjectManagerPlugin* plugin, const gchar *project_uri)
status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL);
if (project_uri)
{
- GFile *file;
GFileInfo *file_info;
+ GFile *file;
file = g_file_new_for_uri (project_uri);
file_info = g_file_query_info (file,
@@ -154,12 +154,12 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
* we should not save the current project uri, because project
* sessions are loaded when the project has already been loaded.
*/
- if (plugin->project_uri && !plugin->session_by_me)
+ if (plugin->project_file && !plugin->session_by_me)
{
list = anjuta_session_get_string_list (session,
"File Loader",
"Files");
- list = g_list_append (list, g_strdup (plugin->project_uri));
+ list = g_list_append (list, anjuta_session_get_relative_uri_from_file (session, plugin->project_file, NULL));
anjuta_session_set_string_list (session, "File Loader",
"Files", list);
g_list_foreach (list, (GFunc)g_free, NULL);
@@ -208,7 +208,7 @@ on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *se
static void
on_shell_exiting (AnjutaShell *shell, ProjectManagerPlugin *plugin)
{
- if (plugin->project_uri)
+ if (plugin->project_file)
{
/* Also make sure we save the project session also */
project_manager_save_session (plugin);
@@ -227,7 +227,7 @@ on_close_project_idle (gpointer plugin)
static void
on_close_project (GtkAction *action, ProjectManagerPlugin *plugin)
{
- if (plugin->project_uri)
+ if (plugin->project_file)
plugin->close_project_idle = g_idle_add (on_close_project_idle, plugin);
}
@@ -1510,8 +1510,8 @@ on_profile_descoped (AnjutaProfileManager *profile_manager,
project_manager_unload_gbf (plugin);
g_free (plugin->project_root_uri);
- g_free (plugin->project_uri);
- plugin->project_uri = NULL;
+ if (plugin->project_file) g_object_unref (plugin->project_file);
+ plugin->project_file = NULL;
plugin->project_root_uri = NULL;
update_title (ANJUTA_PLUGIN_PROJECT_MANAGER (plugin), NULL);
@@ -1742,7 +1742,7 @@ project_manager_plugin_instance_init (GObject *obj)
plugin->pre_update_targets = NULL;
plugin->pre_update_groups = NULL;
plugin->project_root_uri = NULL;
- plugin->project_uri = NULL;
+ plugin->project_file = NULL;
plugin->fm_current_uri = NULL;
plugin->current_editor_uri = NULL;
plugin->session_by_me = FALSE;
@@ -2379,9 +2379,9 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
/* Set project uri */
g_free (plugin->project_root_uri);
- g_free (plugin->project_uri);
+ if (plugin->project_file) g_object_unref (plugin->project_file);
- plugin->project_uri = g_file_get_uri (file);
+ plugin->project_file = g_object_ref (file);
plugin->project_root_uri = g_file_get_uri (project_root);
g_object_unref (project_root);
diff --git a/plugins/project-manager/plugin.h b/plugins/project-manager/plugin.h
index 7851468..85e387c 100644
--- a/plugins/project-manager/plugin.h
+++ b/plugins/project-manager/plugin.h
@@ -59,7 +59,7 @@ struct _ProjectManagerPlugin{
gchar *fm_current_uri;
gchar *current_editor_uri;
gchar *project_root_uri;
- gchar *project_uri;
+ GFile *project_file;
/* Target shortcuts */
GList *shortcuts;
diff --git a/src/anjuta.c b/src/anjuta.c
index 32b230e..6700e4c 100644
--- a/src/anjuta.c
+++ b/src/anjuta.c
@@ -194,17 +194,16 @@ on_profile_descoped (AnjutaProfileManager *profile_manager,
/* This extracts the project URI saved in the session so that it could be
* loaded sequencially. Returned string must be freed.
*/
-static gchar*
+static GFile*
extract_project_from_session (const gchar* session_dir)
{
AnjutaSession *session;
GList *node, *files;
- gchar *project_uri = NULL;
+ GFile *project = NULL;
session = anjuta_session_new (session_dir);
files = anjuta_session_get_string_list (session, "File Loader", "Files");
- g_object_unref (session);
/* Find project file */
node = files;
@@ -215,18 +214,16 @@ extract_project_from_session (const gchar* session_dir)
{
if (anjuta_util_is_project_file (uri))
{
- g_free (project_uri);
- project_uri = uri;
- }
- else
- {
- g_free (uri);
+ if (project != NULL) g_object_unref (project);
+ project = anjuta_session_get_file_from_relative_uri (session, uri, NULL);
}
+ g_free (uri);
}
}
g_list_free (files);
+ g_object_unref (session);
- return project_uri;
+ return project;
}
AnjutaApp*
@@ -334,7 +331,6 @@ create_window (GFile **files, int n_files, gboolean no_splash,
if (files || geometry)
{
gchar *session_dir;
- gchar *project_uri;
AnjutaSession *session;
gint i;
GList *files_load = NULL;
@@ -342,11 +338,8 @@ create_window (GFile **files, int n_files, gboolean no_splash,
/* Reset default session */
session_dir = USER_SESSION_PATH_NEW;
- project_uri = extract_project_from_session (session_dir);
+ project = extract_project_from_session (session_dir);
template = NULL;
- if (project_uri)
- project = g_file_new_for_uri (project_uri);
- g_free (project_uri);
session = anjuta_session_new (session_dir);
anjuta_session_clear (session);
@@ -419,10 +412,7 @@ create_window (GFile **files, int n_files, gboolean no_splash,
/* Otherwise, load session normally */
else
{
- gchar *project_uri = extract_project_from_session (session_dir);
- if (project_uri)
- project = g_file_new_for_uri (project_uri);
- g_free (project_uri);
+ project = extract_project_from_session (session_dir);
}
g_free (session_dir);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]