[anjuta] project-manager: Open file on source or display properties when a node is activated
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-manager: Open file on source or display properties when a node is activated
- Date: Mon, 17 Oct 2011 19:05:37 +0000 (UTC)
commit fb632c71b9ce91777fbd09abdb1558a7f9a21f8a
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Sat Oct 15 16:38:50 2011 +0200
project-manager: Open file on source or display properties when a node is activated
plugins/project-manager/plugin.c | 408 ++++++++++++++++----------------
plugins/project-manager/project-view.c | 233 ++++++++-----------
plugins/project-manager/project-view.h | 9 +-
3 files changed, 303 insertions(+), 347 deletions(-)
---
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 06a445c..463a72a 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -73,7 +73,7 @@ get_plugin_parent_window (ProjectManagerPlugin *plugin)
{
GtkWindow *win;
GtkWidget *toplevel;
-
+
toplevel = gtk_widget_get_toplevel (plugin->scrolledwindow);
if (toplevel && GTK_IS_WINDOW (toplevel))
win = GTK_WINDOW (toplevel);
@@ -102,10 +102,10 @@ update_title (ProjectManagerPlugin* plugin, const gchar *project_uri)
{
gchar *dispname;
gchar *ext;
-
+
dispname = g_strdup (
g_file_info_get_display_name (file_info));
- ext = strrchr (dispname, '.');
+ ext = strrchr (dispname, '.');
if (ext)
*ext = '\0';
anjuta_status_set_title (status, dispname);
@@ -126,9 +126,9 @@ get_session_dir (ProjectManagerPlugin *plugin)
{
gchar *session_dir = NULL;
gchar *local_dir;
-
+
g_return_val_if_fail (plugin->project_root_uri, NULL);
-
+
local_dir = anjuta_util_get_local_path_from_uri (plugin->project_root_uri);
if (local_dir)
{
@@ -136,7 +136,7 @@ get_session_dir (ProjectManagerPlugin *plugin)
NULL);
}
g_free (local_dir);
-
+
return session_dir;
}
@@ -146,7 +146,7 @@ project_manager_save_session (ProjectManagerPlugin *plugin)
gchar *session_dir;
session_dir = get_session_dir (plugin);
g_return_if_fail (session_dir != NULL);
-
+
plugin->session_by_me = TRUE;
anjuta_shell_session_save (ANJUTA_PLUGIN (plugin)->shell,
session_dir, NULL);
@@ -162,10 +162,10 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
if (phase != ANJUTA_SESSION_PHASE_NORMAL)
return;
-
+
/*
* When a project session is being saved (session_by_me == TRUE),
- * we should not save the current project uri, because project
+ * 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)
@@ -197,14 +197,14 @@ on_session_save (AnjutaShell *shell, AnjutaSessionPhase phase,
g_list_foreach (list, (GFunc)g_free, NULL);
g_list_free (list);
}
-
+
}
static void
on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *session, ProjectManagerPlugin *plugin)
{
GList *list;
-
+
if (phase != ANJUTA_SESSION_PHASE_NORMAL)
return;
@@ -234,7 +234,7 @@ on_close_project_idle (gpointer plugin)
{
project_manager_plugin_close (ANJUTA_PLUGIN_PROJECT_MANAGER (plugin));
ANJUTA_PLUGIN_PROJECT_MANAGER(plugin)->close_project_idle = -1;
-
+
return FALSE;
}
@@ -251,7 +251,7 @@ find_missing_files (GList *pre, GList *post)
GHashTable *hash;
GList *ret = NULL;
GList *node;
-
+
hash = g_hash_table_new (g_file_hash, (GEqualFunc) g_file_equal);
node = pre;
while (node)
@@ -259,7 +259,7 @@ find_missing_files (GList *pre, GList *post)
g_hash_table_insert (hash, node->data, node->data);
node = g_list_next (node);
}
-
+
node = post;
while (node)
{
@@ -276,7 +276,7 @@ update_operation_emit_signals (ProjectManagerPlugin *plugin, GList *pre,
GList *post)
{
GList *missing_files, *node;
-
+
missing_files = find_missing_files (pre, post);
node = missing_files;
while (node)
@@ -287,7 +287,7 @@ update_operation_emit_signals (ProjectManagerPlugin *plugin, GList *pre,
node = g_list_next (node);
}
g_list_free (missing_files);
-
+
missing_files = find_missing_files (post, pre);
node = missing_files;
while (node)
@@ -395,13 +395,13 @@ on_refresh_idle (gpointer user_data)
ProjectManagerPlugin *plugin;
AnjutaStatus *status;
GError *err = NULL;
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (user_data);
-
+
status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL);
anjuta_status_push (status, _("Refreshing symbol treeâ"));
anjuta_status_busy_push (status);
-
+
anjuta_pm_project_refresh (plugin->project, &err);
if (err)
{
@@ -437,14 +437,14 @@ on_new_group (GtkAction *action, ProjectManagerPlugin *plugin)
{
GFile *group;
GFile *default_group = NULL;
-
+
if (plugin->current_editor_uri)
{
gchar *uri = g_path_get_dirname (plugin->current_editor_uri);
default_group = g_file_new_for_uri (uri);
g_free (uri);
}
-
+
group =
ianjuta_project_manager_add_group (IANJUTA_PROJECT_MANAGER (plugin),
"", default_group,
@@ -459,10 +459,10 @@ on_new_package (GtkAction *action, ProjectManagerPlugin *plugin)
GtkTreeIter selected_module;
GList *new_module;
GbfTreeData *data;
-
+
update_operation_begin (plugin);
data = gbf_project_view_get_first_selected (plugin->view, &selected_module);
-
+
new_module = anjuta_pm_project_new_package (plugin,
get_plugin_parent_window (plugin),
data == NULL ? NULL : &selected_module, NULL);
@@ -476,7 +476,7 @@ on_add_module (GtkAction *action, ProjectManagerPlugin *plugin)
GtkTreeIter selected_target;
GList *new_modules;
GbfTreeData *data;
-
+
update_operation_begin (plugin);
data = gbf_project_view_get_first_selected (plugin->view, &selected_target);
@@ -492,14 +492,14 @@ on_new_target (GtkAction *action, ProjectManagerPlugin *plugin)
{
GFile *target;
GFile *default_group = NULL;
-
+
if (plugin->current_editor_uri)
{
gchar *uri = g_path_get_dirname (plugin->current_editor_uri);
default_group = g_file_new_for_uri (uri);
g_free (uri);
}
-
+
target =
ianjuta_project_manager_add_target (IANJUTA_PROJECT_MANAGER (plugin),
"", default_group,
@@ -515,7 +515,7 @@ on_add_source (GtkAction *action, ProjectManagerPlugin *plugin)
GFile *default_group = NULL;
gchar *source_uri = NULL;
GFile *source;
-
+
if (plugin->current_editor_uri)
{
gchar *uri = g_path_get_dirname (plugin->current_editor_uri);
@@ -556,10 +556,10 @@ on_popup_new_package (GtkAction *action, ProjectManagerPlugin *plugin)
{
GtkTreeIter selected_module;
GList *packages;
-
+
update_operation_begin (plugin);
gbf_project_view_get_first_selected (plugin->view, &selected_module);
-
+
packages = anjuta_pm_project_new_package (plugin,
get_plugin_parent_window (plugin),
&selected_module, NULL);
@@ -571,10 +571,10 @@ on_popup_add_module (GtkAction *action, ProjectManagerPlugin *plugin)
{
GtkTreeIter selected_target;
GList *new_modules;
-
+
update_operation_begin (plugin);
gbf_project_view_get_first_selected (plugin->view, &selected_target);
-
+
new_modules = anjuta_pm_project_new_module (plugin,
get_plugin_parent_window (plugin),
&selected_target, NULL);
@@ -587,10 +587,10 @@ on_popup_new_group (GtkAction *action, ProjectManagerPlugin *plugin)
{
GtkTreeIter selected_group;
AnjutaProjectNode *new_group;
-
+
update_operation_begin (plugin);
gbf_project_view_get_first_selected (plugin->view, &selected_group);
-
+
new_group = anjuta_pm_project_new_group (plugin,
get_plugin_parent_window (plugin),
&selected_group, NULL);
@@ -609,7 +609,7 @@ on_popup_new_target (GtkAction *action, ProjectManagerPlugin *plugin)
new_target = anjuta_pm_project_new_target (plugin,
get_plugin_parent_window (plugin),
&selected_group, NULL);
-
+
update_operation_end (plugin, TRUE);
}
@@ -618,7 +618,7 @@ on_popup_add_source (GtkAction *action, ProjectManagerPlugin *plugin)
{
GtkTreeIter selected_target;
AnjutaProjectNode *new_source;
-
+
update_operation_begin (plugin);
gbf_project_view_get_first_selected (plugin->view, &selected_target);
@@ -640,7 +640,7 @@ confirm_removal (ProjectManagerPlugin *plugin, GList *selected)
gboolean remove_group_file = FALSE;
gboolean source = FALSE;
gboolean remove_source_file = FALSE;
-
+
g_return_val_if_fail (selected != NULL, FALSE);
type = ((GbfTreeData *)selected->data)->type;
@@ -733,13 +733,13 @@ confirm_removal (ProjectManagerPlugin *plugin, GList *selected)
g_string_append (mesg, _("The source file will be deleted from the file system."));
else if (source)
g_string_append (mesg, _("The source file will not be deleted from the file system."));
- }
-
+ }
+
answer =
anjuta_util_dialog_boolean_question (get_plugin_parent_window (plugin),
mesg->str, _("Confirm remove"));
g_string_free (mesg, TRUE);
-
+
return answer;
}
@@ -747,7 +747,7 @@ static void
on_popup_remove (GtkAction *action, ProjectManagerPlugin *plugin)
{
GList *selected;
-
+
selected = gbf_project_view_get_all_selected (plugin->view);
if (selected != NULL)
@@ -778,7 +778,7 @@ on_popup_remove (GtkAction *action, ProjectManagerPlugin *plugin)
if (err)
{
const gchar *name;
-
+
update_operation_end (plugin, TRUE);
update = FALSE;
name = anjuta_project_node_get_name (node);
@@ -811,7 +811,7 @@ on_popup_add_to_project (GtkAction *action, ProjectManagerPlugin *plugin)
GFile *parent_directory;
gchar *filename;
GError *error = NULL;
-
+
win = get_plugin_parent_window (plugin);
file = g_file_new_for_uri (plugin->fm_current_uri);
@@ -823,7 +823,7 @@ on_popup_add_to_project (GtkAction *action, ProjectManagerPlugin *plugin)
if (file_info != NULL)
{
parent_directory = g_file_get_parent (file);
-
+
filename = g_file_get_basename (file);
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
{
@@ -856,34 +856,32 @@ on_popup_add_to_project (GtkAction *action, ProjectManagerPlugin *plugin)
}
static void
-on_uri_activated (GtkWidget *widget, const gchar *uri,
+on_node_selected (GtkWidget *widget, AnjutaProjectNode *node,
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, file, FALSE, NULL);
- g_object_unref (file);
-}
-static void
-on_target_activated (GtkWidget *widget, const gchar *target_id,
- ProjectManagerPlugin *plugin)
-{
- on_popup_properties (NULL, plugin);
-}
-
-static void
-on_group_activated (GtkWidget *widget, const gchar *group_id,
- ProjectManagerPlugin *plugin)
-{
- on_popup_properties (NULL, plugin);
+ switch (anjuta_project_node_get_node_type (node))
+ {
+ case ANJUTA_PROJECT_GROUP:
+ case ANJUTA_PROJECT_ROOT:
+ case ANJUTA_PROJECT_TARGET:
+ case ANJUTA_PROJECT_MODULE:
+ case ANJUTA_PROJECT_PACKAGE:
+ on_popup_properties (NULL, plugin);
+ break;
+ case ANJUTA_PROJECT_SOURCE:
+ loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
+ IAnjutaFileLoader, NULL);
+ if (loader)
+ ianjuta_file_loader_load (loader, anjuta_project_node_get_file (node), FALSE, NULL);
+ break;
+ default:
+ break;
+ }
}
-static GtkActionEntry pm_actions[] =
+static GtkActionEntry pm_actions[] =
{
{
"ActionMenuProject", NULL,
@@ -926,7 +924,7 @@ static GtkActionEntry pm_actions[] =
},
};
-static GtkActionEntry popup_actions[] =
+static GtkActionEntry popup_actions[] =
{
{
"ActionPopupProjectNewDirectory", GTK_STOCK_ADD,
@@ -983,11 +981,11 @@ update_ui (ProjectManagerPlugin *plugin)
gint caps;
gint main_caps;
gint popup_caps;
-
+
/* Close project is always here */
main_caps = 0x101;
popup_caps = 0x100;
-
+
/* Check for supported node */
caps = anjuta_pm_project_get_capabilities (plugin->project);
if (caps != 0)
@@ -1031,18 +1029,18 @@ update_ui (ProjectManagerPlugin *plugin)
for (j = 0; j < G_N_ELEMENTS (pm_actions); j++)
{
GtkAction *action;
-
+
action = anjuta_ui_get_action (ui, "ActionGroupProjectManager",
pm_actions[j].name);
g_object_set (G_OBJECT (action), "visible", INT_TO_GBOOLEAN (main_caps & 0x1), NULL);
main_caps >>= 1;
}
-
+
/* Popup menu */
for (j = 0; j < G_N_ELEMENTS (popup_actions); j++)
{
GtkAction *action;
-
+
action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
popup_actions[j].name);
g_object_set (G_OBJECT (action), "visible", INT_TO_GBOOLEAN (popup_caps & 0x1), NULL);
@@ -1060,7 +1058,7 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
gint state = 0;
GFile *selected_file;
GbfTreeData *data;
-
+
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
node = gbf_project_view_find_selected (plugin->view,
ANJUTA_PROJECT_UNKNOWN);
@@ -1069,7 +1067,7 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
if (node != NULL)
{
AnjutaProjectNode *parent;
-
+
state = anjuta_project_node_get_state (node);
/* Allow to select a sibling instead of a parent node */
parent = anjuta_project_node_parent (node);
@@ -1101,13 +1099,13 @@ on_treeview_selection_changed (GtkTreeSelection *sel,
action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
"ActionPopupProjectSortShortcut");
g_object_set (G_OBJECT (action), "sensitive", (data != NULL) && (data->type == GBF_TREE_NODE_SHORTCUT), NULL);
-
+
selected_file = node != NULL ? anjuta_project_node_get_file (node) : NULL;
if (selected_file)
{
GValue *value;
gchar *uri = g_file_get_uri (selected_file);
-
+
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, uri);
@@ -1129,16 +1127,16 @@ on_treeview_popup_menu (GtkWidget *widget,
{
AnjutaUI *ui;
GtkWidget *popup;
-
+
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/PopupProjectManager");
g_return_val_if_fail (GTK_IS_WIDGET (popup), FALSE);
-
+
gtk_menu_popup (GTK_MENU (popup),
NULL, NULL, NULL, NULL,
0,
gtk_get_current_event_time());
-
+
return TRUE;
}
@@ -1171,19 +1169,19 @@ on_treeview_button_press_event (GtkWidget *widget,
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/PopupProjectManager");
g_return_val_if_fail (GTK_IS_WIDGET (popup), FALSE);
-
+
gtk_menu_popup (GTK_MENU (popup),
NULL, NULL, NULL, NULL,
((GdkEventButton *) event)->button,
((GdkEventButton *) event)->time);
-
+
return TRUE;
}
-
+
return FALSE;
}
-/*
+/*
*---------------------------------------------------------------------------*/
static void
@@ -1210,17 +1208,17 @@ value_added_fm_current_file (AnjutaPlugin *plugin, const char *name,
GtkAction *action;
gchar *uri;
ProjectManagerPlugin *pm_plugin;
-
+
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);
-
+
if (pm_plugin->fm_current_uri)
g_free (pm_plugin->fm_current_uri);
pm_plugin->fm_current_uri = g_strdup (uri);
-
+
action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
"ActionPopupProjectAddToProject");
g_object_set (G_OBJECT (action), "sensitive", TRUE, NULL);
@@ -1236,11 +1234,11 @@ value_removed_fm_current_file (AnjutaPlugin *plugin,
ProjectManagerPlugin *pm_plugin;
pm_plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (plugin);
-
+
if (pm_plugin->fm_current_uri)
g_free (pm_plugin->fm_current_uri);
pm_plugin->fm_current_uri = NULL;
-
+
ui = anjuta_shell_get_ui (plugin->shell, NULL);
action = anjuta_ui_get_action (ui, "ActionGroupProjectManagerPopup",
"ActionPopupProjectAddToProject");
@@ -1254,11 +1252,11 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
GObject *editor;
ProjectManagerPlugin *pm_plugin;
GFile* file;
-
+
editor = g_value_get_object (value);
if (!IANJUTA_IS_EDITOR(editor))
return;
-
+
pm_plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (plugin);
if (pm_plugin->current_editor_uri)
@@ -1279,9 +1277,9 @@ value_removed_current_editor (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
ProjectManagerPlugin *pm_plugin;
-
+
pm_plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (plugin);
-
+
if (pm_plugin->current_editor_uri)
g_free (pm_plugin->current_editor_uri);
pm_plugin->current_editor_uri = NULL;
@@ -1301,7 +1299,7 @@ on_project_loaded (AnjutaPmProject *project, GtkTreeIter *parent, gboolean compl
{
GtkWidget *toplevel;
GtkWindow *win;
-
+
toplevel = gtk_widget_get_toplevel (plugin->scrolledwindow);
if (toplevel && GTK_IS_WINDOW (toplevel))
win = GTK_WINDOW (toplevel);
@@ -1317,7 +1315,7 @@ on_project_loaded (AnjutaPmProject *project, GtkTreeIter *parent, gboolean compl
if (complete)
{
gchar *basename = g_path_get_basename (dirname);
-
+
anjuta_status_progress_tick (status, NULL, _("Update project viewâ"));
update_ui (plugin);
anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
@@ -1325,14 +1323,14 @@ on_project_loaded (AnjutaPmProject *project, GtkTreeIter *parent, gboolean compl
NULL);
anjuta_status_set_default (status, _("Project"), basename);
g_free (basename);
-
+
if (plugin->busy)
{
anjuta_status_pop (status);
anjuta_status_busy_pop (status);
plugin->busy = FALSE;
}
-
+
/* Emit loaded signal for other plugins */
g_signal_emit_by_name (G_OBJECT (plugin), "project_loaded", error);
@@ -1352,10 +1350,10 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
GError *error = NULL;
root_uri = pm_plugin->project_root_uri;
-
+
dirname = anjuta_util_get_local_path_from_uri (root_uri);
dirfile = g_file_new_for_uri (root_uri);
-
+
g_return_if_fail (dirname != NULL);
status = anjuta_shell_get_status (ANJUTA_PLUGIN (pm_plugin)->shell, NULL);
@@ -1366,7 +1364,7 @@ project_manager_load_gbf (ProjectManagerPlugin *pm_plugin)
pm_plugin->busy = TRUE;
anjuta_pm_project_unload (pm_plugin->project, NULL);
-
+
DEBUG_PRINT ("loading project %s\n\n", dirname);
anjuta_pm_project_load (pm_plugin->project, dirfile, &error);
update_ui (pm_plugin);
@@ -1380,11 +1378,11 @@ static void
project_manager_unload_gbf (ProjectManagerPlugin *pm_plugin)
{
AnjutaStatus *status;
-
+
if (anjuta_pm_project_is_open (pm_plugin->project))
{
IAnjutaDocumentManager *docman;
-
+
/* Close files that belong to this project (that are saved) */
docman = anjuta_shell_get_interface (ANJUTA_PLUGIN (pm_plugin)->shell,
IAnjutaDocumentManager, NULL);
@@ -1393,7 +1391,7 @@ project_manager_unload_gbf (ProjectManagerPlugin *pm_plugin)
GList *to_remove = NULL;
GList *editors;
GList *node;
-
+
editors =
ianjuta_document_manager_get_doc_widgets (docman, NULL);
node = editors;
@@ -1407,8 +1405,8 @@ project_manager_unload_gbf (ProjectManagerPlugin *pm_plugin)
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) ||
!ianjuta_file_savable_is_dirty
@@ -1439,7 +1437,7 @@ project_manager_unload_gbf (ProjectManagerPlugin *pm_plugin)
if (to_remove)
g_list_free (to_remove);
}
-
+
/* Release project */
anjuta_pm_project_unload (pm_plugin->project, NULL);
update_ui (pm_plugin);
@@ -1457,19 +1455,19 @@ on_profile_scoped (AnjutaProfileManager *profile_manager,
DEBUG_PRINT ("Profile scoped: %s", anjuta_profile_get_name (profile));
if (strcmp (anjuta_profile_get_name (profile), PROJECT_PROFILE_NAME) != 0)
return;
-
+
DEBUG_PRINT ("%s", "Project profile loaded; Restoring project session");
/* Load gbf project */
project_manager_load_gbf (plugin);
-
-
+
+
update_title (plugin, plugin->project_root_uri);
-
+
/* If profile scoped to "project", restore project session */
session_dir = get_session_dir (plugin);
g_return_if_fail (session_dir != NULL);
-
+
/*
* If there is a session load already in progress (that is this
* project is being opened in session restoration), our session
@@ -1487,26 +1485,26 @@ on_profile_descoped (AnjutaProfileManager *profile_manager,
AnjutaProfile *profile, ProjectManagerPlugin *plugin)
{
DEBUG_PRINT ("Profile descoped: %s", anjuta_profile_get_name (profile));
-
+
if (strcmp (anjuta_profile_get_name (profile), PROJECT_PROFILE_NAME) != 0)
return;
-
+
DEBUG_PRINT ("%s", "Project profile descoped; Saving project session");
-
+
/* Save current project session */
g_return_if_fail (plugin->project_root_uri != NULL);
-
+
/* Save project session */
project_manager_save_session (plugin);
-
+
/* Close current project */
project_manager_unload_gbf (plugin);
-
+
g_free (plugin->project_root_uri);
g_free (plugin->project_uri);
plugin->project_uri = NULL;
plugin->project_root_uri = NULL;
-
+
update_title (ANJUTA_PLUGIN_PROJECT_MANAGER (plugin), NULL);
anjuta_shell_remove_value (ANJUTA_PLUGIN (plugin)->shell,
IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI, NULL);
@@ -1517,9 +1515,9 @@ project_manager_plugin_close (ProjectManagerPlugin *plugin)
{
AnjutaProfileManager *profile_manager;
GError *error = NULL;
-
+
/* Remove project profile */
- profile_manager =
+ profile_manager =
anjuta_shell_get_profile_manager (ANJUTA_PLUGIN (plugin)->shell, NULL);
anjuta_profile_manager_pop (profile_manager, PROJECT_PROFILE_NAME, &error);
if (error)
@@ -1541,44 +1539,40 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
GtkTreeSelection *selection;
/* GladeXML *gxml; */
ProjectManagerPlugin *pm_plugin;
-
+
DEBUG_PRINT ("ProjectManagerPlugin: Activating Project Manager plugin %pâ", plugin);
-
+
if (!initialized)
register_stock_icons (plugin);
-
+
pm_plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (plugin);
pm_plugin->ui = anjuta_shell_get_ui (plugin->shell, NULL);
pm_plugin->prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
/* Create project */
pm_plugin->project = anjuta_pm_project_new (plugin);
-
+
/* create model & view and bind them */
view = gbf_project_view_new ();
/* Add project to view */
gbf_project_view_set_project (GBF_PROJECT_VIEW (view), pm_plugin->project);
g_signal_connect (view, "node-loaded", G_CALLBACK (on_project_loaded), plugin);
-
+
/*gtk_tree_view_set_model (GTK_TREE_VIEW (view),
GTK_TREE_MODEL (anjuta_pm_project_get_model (pm_plugin->project)));*/
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
- g_signal_connect (view, "uri-activated",
- G_CALLBACK (on_uri_activated), plugin);
- g_signal_connect (view, "target-selected",
- G_CALLBACK (on_target_activated), plugin);
- g_signal_connect (view, "group-selected",
- G_CALLBACK (on_group_activated), plugin);
+ g_signal_connect (view, "node-selected",
+ G_CALLBACK (on_node_selected), plugin);
g_signal_connect (selection, "changed",
G_CALLBACK (on_treeview_selection_changed), plugin);
g_signal_connect (view, "button-press-event",
G_CALLBACK (on_treeview_button_press_event), plugin);
g_signal_connect (view, "popup-menu",
G_CALLBACK (on_treeview_popup_menu), plugin);
-
+
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
@@ -1588,12 +1582,12 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
gtk_container_add (GTK_CONTAINER (scrolled_window), view);
gtk_widget_show (view);
gtk_widget_show (scrolled_window);
-
+
pm_plugin->scrolledwindow = scrolled_window;
pm_plugin->view = GBF_PROJECT_VIEW (view);
-
+
/* Action groups */
- pm_plugin->pm_action_group =
+ pm_plugin->pm_action_group =
anjuta_ui_add_action_group_entries (pm_plugin->ui,
"ActionGroupProjectManager",
_("Project manager actions"),
@@ -1601,7 +1595,7 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
G_N_ELEMENTS(pm_actions),
GETTEXT_PACKAGE, TRUE,
plugin);
- pm_plugin->popup_action_group =
+ pm_plugin->popup_action_group =
anjuta_ui_add_action_group_entries (pm_plugin->ui,
"ActionGroupProjectManagerPopup",
_("Project manager popup actions"),
@@ -1610,11 +1604,11 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
GETTEXT_PACKAGE, TRUE,
plugin);
/* Merge UI */
- pm_plugin->merge_id =
+ pm_plugin->merge_id =
anjuta_ui_merge (pm_plugin->ui, UI_FILE);
-
+
update_ui (pm_plugin);
-
+
/* Added widget in shell */
anjuta_shell_add_widget (plugin->shell, pm_plugin->scrolledwindow,
"AnjutaProjectManager", _("Project"),
@@ -1623,19 +1617,19 @@ project_manager_plugin_activate_plugin (AnjutaPlugin *plugin)
#if 0
/* Add preferences page */
gxml = glade_xml_new (PREFS_GLADE, "dialog.project.manager", NULL);
-
+
anjuta_preferences_add_page (pm_plugin->prefs,
gxml, "Project Manager", ICON_FILE);
preferences_changed(pm_plugin->prefs, pm_plugin);
g_object_unref (G_OBJECT (gxml));
#endif
-
+
/* Add watches */
pm_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);
- pm_plugin->editor_watch_id =
+ pm_plugin->editor_watch_id =
anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
value_added_current_editor,
value_removed_current_editor, NULL);
@@ -1672,7 +1666,7 @@ project_manager_plugin_deactivate_plugin (AnjutaPlugin *plugin)
/* Close project if it's open */
if (pm_plugin->project_root_uri)
project_manager_plugin_close (pm_plugin);
-
+
profile_manager = anjuta_shell_get_profile_manager (plugin->shell, NULL);
/* Disconnect signals */
@@ -1694,10 +1688,10 @@ project_manager_plugin_deactivate_plugin (AnjutaPlugin *plugin)
/* Remove watches */
anjuta_plugin_remove_watch (plugin, pm_plugin->fm_watch_id, TRUE);
anjuta_plugin_remove_watch (plugin, pm_plugin->editor_watch_id, TRUE);
-
+
/* Widget is removed from the shell when destroyed */
gtk_widget_destroy (pm_plugin->scrolledwindow);
-
+
anjuta_ui_unmerge (pm_plugin->ui, pm_plugin->merge_id);
anjuta_ui_remove_action_group (pm_plugin->ui, pm_plugin->pm_action_group);
anjuta_ui_remove_action_group (pm_plugin->ui,
@@ -1710,7 +1704,7 @@ project_manager_plugin_deactivate_plugin (AnjutaPlugin *plugin)
/* Destroy project */
anjuta_pm_project_free (pm_plugin->project);
-
+
return TRUE;
}
@@ -1748,7 +1742,7 @@ project_manager_plugin_instance_init (GObject *obj)
}
static void
-project_manager_plugin_class_init (GObjectClass *klass)
+project_manager_plugin_class_init (GObjectClass *klass)
{
AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
@@ -1773,14 +1767,14 @@ file_is_inside_project (ProjectManagerPlugin *plugin, GFile *file)
/* No project open */
return FALSE;
}
-
+
if (strncmp (uri, plugin->project_root_uri,
strlen (plugin->project_root_uri)) == 0)
{
g_free (uri);
return TRUE;
}
-
+
if (uri[0] == '/')
{
const gchar *project_root_path = strchr (plugin->project_root_uri, ':');
@@ -1792,7 +1786,7 @@ file_is_inside_project (ProjectManagerPlugin *plugin, GFile *file)
strlen (project_root_path)) == 0;
}
g_free (uri);
-
+
return inside;
}
@@ -1801,10 +1795,10 @@ get_element_file_from_node (ProjectManagerPlugin *plugin, AnjutaProjectNode *nod
{
const gchar *project_root = NULL;
GFile *file = NULL;
-
+
if (!node)
return NULL;
-
+
anjuta_shell_get (ANJUTA_PLUGIN (plugin)->shell,
root, G_TYPE_STRING,
&project_root, NULL);
@@ -1834,12 +1828,12 @@ get_element_file_from_node (ProjectManagerPlugin *plugin, AnjutaProjectNode *nod
node_file = g_file_get_child (root_file, rel_path);
g_object_unref (root_file);
g_object_unref (file);
-
+
file = node_file;
g_free (rel_path);
}
}
-
+
return file;
}
@@ -1874,7 +1868,7 @@ static AnjutaProjectNode *
get_node_from_file (const AnjutaProjectNode *root, GFile *file)
{
AnjutaProjectNode *node;
-
+
node = anjuta_project_node_traverse ((AnjutaProjectNode *)root, G_PRE_ORDER, project_node_compare, file);
return node;
@@ -1884,7 +1878,7 @@ static AnjutaProjectNodeType
get_element_type (ProjectManagerPlugin *plugin, GFile *element)
{
AnjutaProjectNode *node;
-
+
node = gbf_project_view_get_node_from_file (plugin->view, ANJUTA_PROJECT_UNKNOWN, element);
return node == NULL ? ANJUTA_PROJECT_UNKNOWN : anjuta_project_node_get_node_type (node);
@@ -1897,9 +1891,9 @@ iproject_manager_get_elements (IAnjutaProjectManager *project_manager,
{
GList *nodes, *node;
ProjectManagerPlugin *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
/* Get all nodes */
@@ -1928,10 +1922,10 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
GError **err)
{
ProjectManagerPlugin *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager),
ANJUTA_PROJECT_UNKNOWN);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
/* Check that file belongs to the project */
@@ -1946,7 +1940,7 @@ iproject_manager_get_target_type (IAnjutaProjectManager *project_manager,
if (node != NULL) return anjuta_project_node_get_node_type (node);
}
}
-
+
return ANJUTA_PROJECT_UNKNOWN;
}
static GList*
@@ -1956,9 +1950,9 @@ iproject_manager_get_targets (IAnjutaProjectManager *project_manager,
{
GList *targets, *node;
ProjectManagerPlugin *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
/* Get all targets */
@@ -1980,9 +1974,9 @@ iproject_manager_get_parent (IAnjutaProjectManager *project_manager,
{
ProjectManagerPlugin *plugin;
GFile *file = NULL;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
if (plugin->project != NULL)
{
@@ -2010,9 +2004,9 @@ iproject_manager_get_children (IAnjutaProjectManager *project_manager,
GError **err)
{
ProjectManagerPlugin *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
/* FIXME: */
return NULL;
@@ -2024,12 +2018,12 @@ iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
{
AnjutaProjectNode *node;
ProjectManagerPlugin *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), NULL);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
if (!anjuta_pm_project_is_open (plugin->project)) return NULL;
-
+
node = gbf_project_view_find_selected (plugin->view,
ANJUTA_PROJECT_SOURCE);
if (node && anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_SOURCE)
@@ -2050,7 +2044,7 @@ iproject_manager_get_selected (IAnjutaProjectManager *project_manager,
{
return g_object_ref (anjuta_project_node_get_file (node));
}
-
+
return NULL;
}
@@ -2059,9 +2053,9 @@ iproject_manager_get_capabilities (IAnjutaProjectManager *project_manager,
GError **err)
{
ProjectManagerPlugin *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), 0);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
return anjuta_pm_project_get_capabilities (plugin->project);
}
@@ -2077,9 +2071,9 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
GtkTreeIter *iter = NULL;
AnjutaProjectNode *source_id;
GFile* source;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
update_operation_begin (plugin);
@@ -2092,9 +2086,9 @@ iproject_manager_add_source (IAnjutaProjectManager *project_manager,
iter,
source_uri_to_add);
update_operation_end (plugin, TRUE);
-
+
source = get_element_file_from_node(plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
-
+
return source;
}
@@ -2107,9 +2101,9 @@ iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
ProjectManagerPlugin *plugin;
AnjutaProjectNode *source_id;
AnjutaProjectNode *target = NULL;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
target = gbf_project_view_get_node_from_file (plugin->view, ANJUTA_PROJECT_TARGET, location_file);
@@ -2120,7 +2114,7 @@ iproject_manager_add_source_quiet (IAnjutaProjectManager *project_manager,
source_uri_to_add,
err);
update_operation_end (plugin, TRUE);
-
+
return get_element_file_from_node (plugin, source_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
}
@@ -2135,9 +2129,9 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
GtkTreeIter *iter = NULL;
GList* source_ids;
GList* source_files = NULL;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
update_operation_begin (plugin);
@@ -2151,7 +2145,7 @@ iproject_manager_add_source_multi (IAnjutaProjectManager *project_manager,
iter,
source_add_uris);
update_operation_end (plugin, TRUE);
-
+
while (source_ids)
{
source_files = g_list_append (source_files,
@@ -2175,16 +2169,16 @@ iproject_manager_add_target (IAnjutaProjectManager *project_manager,
GtkTreeIter *iter = NULL;
GFile *target = NULL;
AnjutaProjectNode *target_id;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
if (default_group_file != NULL)
{
iter = get_tree_iter_from_file (plugin, &group_iter, default_group_file, GBF_TREE_NODE_GROUP);
}
-
+
update_operation_begin (plugin);
target_id = anjuta_pm_project_new_target (plugin,
get_plugin_parent_window (plugin),
@@ -2207,16 +2201,16 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
GtkTreeIter *iter = NULL;
GFile *group = NULL;
AnjutaProjectNode *group_id;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN (project_manager), FALSE);
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (G_OBJECT (project_manager));
if (default_group_file != NULL)
{
iter = get_tree_iter_from_file (plugin, &group_iter, default_group_file, GBF_TREE_NODE_GROUP);
}
-
+
update_operation_begin (plugin);
group_id = anjuta_pm_project_new_group (plugin,
get_plugin_parent_window (plugin),
@@ -2224,7 +2218,7 @@ iproject_manager_add_group (IAnjutaProjectManager *project_manager,
group_name_to_add);
update_operation_end (plugin, TRUE);
group = get_element_file_from_node (plugin, group_id, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI);
-
+
return group;
}
@@ -2294,7 +2288,7 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
GError *error = NULL;
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (ifile);
-
+
/* If there is already a project loaded, load in separate anjuta window */
if (plugin->project_root_uri)
{
@@ -2305,20 +2299,20 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
anjuta_util_execute_shell (NULL, cmd);
g_free (cmd);
g_free (uri);
-
+
return;
}
-
+
plugin_manager =
anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (ifile)->shell, NULL);
profile_manager =
anjuta_shell_get_profile_manager (ANJUTA_PLUGIN (ifile)->shell, NULL);
status = anjuta_shell_get_status (ANJUTA_PLUGIN (ifile)->shell, NULL);
-
+
anjuta_status_progress_add_ticks (status, 2);
/* Prepare profile */
profile = anjuta_profile_new (PROJECT_PROFILE_NAME, plugin_manager);
-
+
/* System default profile */
default_profile = g_file_new_for_uri (DEFAULT_PROFILE);
anjuta_profile_add_plugins_from_xml (profile, default_profile,
@@ -2330,29 +2324,29 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
g_propagate_error (e, error);
g_free (profile_name);
g_object_unref (profile);
-
+
return;
}
-
+
/* Project default profile */
anjuta_profile_add_plugins_from_xml (profile, file, TRUE, &error);
if (error)
{
g_propagate_error (e, error);
-
+
g_free (profile_name);
g_object_unref (profile);
return;
}
-
+
/* Project session profile */
project_root = g_file_get_parent (file);
tmp = g_file_get_child (project_root, ".anjuta");
session_profile = g_file_get_child (tmp, profile_name);
g_object_unref (tmp);
g_free (profile_name);
-
+
session_profile_path = g_file_get_path (session_profile);
DEBUG_PRINT ("Loading project session profile: %s", session_profile_path);
if (g_file_query_exists (session_profile, NULL))
@@ -2362,26 +2356,26 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
if (error)
{
g_propagate_error (e, error);
-
+
g_free (session_profile_path);
g_object_unref (project_root);
g_object_unref (profile);
g_object_unref (session_profile);
-
+
return;
}
}
- anjuta_profile_set_sync_file (profile, session_profile);
+ anjuta_profile_set_sync_file (profile, session_profile);
g_free (session_profile_path);
-
+
/* Set project uri */
g_free (plugin->project_root_uri);
g_free (plugin->project_uri);
-
+
plugin->project_uri = g_file_get_uri (file);
plugin->project_root_uri = g_file_get_uri (project_root);
g_object_unref (project_root);
-
+
/* Load profile */
anjuta_profile_manager_push (profile_manager, profile, &error);
if (error)
@@ -2391,7 +2385,7 @@ ifile_open (IAnjutaFile *ifile, GFile* file, GError **e)
g_error_free (error);
error = NULL;
}
-
+
anjuta_status_progress_tick (status, NULL,
_("Initializing Projectâ"));
update_ui (plugin);
@@ -2403,7 +2397,7 @@ static GFile*
ifile_get_file (IAnjutaFile *ifile, GError **e)
{
ProjectManagerPlugin *plugin;
-
+
plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (ifile);
if (plugin->project_root_uri)
return g_file_new_for_uri (plugin->project_root_uri);
diff --git a/plugins/project-manager/project-view.c b/plugins/project-manager/project-view.c
index b48d0cf..8a93fd6 100644
--- a/plugins/project-manager/project-view.c
+++ b/plugins/project-manager/project-view.c
@@ -43,9 +43,7 @@
#define ICON_SIZE 16
enum {
- URI_ACTIVATED,
- TARGET_SELECTED,
- GROUP_SELECTED,
+ NODE_SELECTED,
NODE_LOADED,
LAST_SIGNAL
};
@@ -83,7 +81,7 @@ idrag_source_row_draggable (GtkTreeDragSource *drag_source, GtkTreePath *path)
GtkTreeIter iter;
GbfTreeData *data;
gboolean retval = FALSE;
-
+
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (drag_source), &iter, path))
return FALSE;
@@ -104,7 +102,7 @@ idrag_source_row_draggable (GtkTreeDragSource *drag_source, GtkTreePath *path)
return retval;
}
-static gboolean
+static gboolean
idrag_source_drag_data_delete (GtkTreeDragSource *drag_source, GtkTreePath *path)
{
return FALSE;
@@ -179,7 +177,7 @@ idrag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreePath *src_path;
GtkTreeIter iter;
gboolean retval = FALSE;
-
+
//g_return_val_if_fail (GBF_IS_PROJECT_MODEL (drag_dest), FALSE);
if (GTK_IS_TREE_MODEL_FILTER (drag_dest))
@@ -197,12 +195,12 @@ idrag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
{
return FALSE;
}
-
-
+
+
if (gtk_tree_model_get_iter (src_model, &iter, src_path))
{
GbfTreeData *data = NULL;
-
+
gtk_tree_model_get (src_model, &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
@@ -221,7 +219,7 @@ idrag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
{
GtkTreePath *root_path;
GtkTreePath *child_path;
-
+
root_path = gbf_project_model_get_project_root (GBF_PROJECT_MODEL (project_model));
child_path = gtk_tree_model_filter_convert_path_to_child_path (GTK_TREE_MODEL_FILTER (drag_dest), dest_path);
retval = gtk_tree_path_compare (child_path, root_path) <= 0;
@@ -232,7 +230,7 @@ idrag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
}
}
gtk_tree_path_free (src_path);
-
+
return retval;
}
@@ -250,7 +248,7 @@ pm_project_model_filter_drag_dest_iface_init (GtkTreeDragDestIface *iface)
iface->row_drop_possible = idrag_dest_row_drop_possible;
}
-static GType pm_project_model_filter_get_type (void);
+static GType pm_project_model_filter_get_type (void);
G_DEFINE_TYPE_WITH_CODE (PmProjectModelFilter,
pm_project_model_filter,
@@ -305,8 +303,8 @@ row_activated (GtkTreeView *tree_view,
GtkTreeModel *model;
GtkTreeIter iter;
GbfTreeData *data;
- gchar *uri;
-
+ AnjutaProjectNode *node;
+
model = gtk_tree_view_get_model (tree_view);
gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
@@ -315,25 +313,13 @@ row_activated (GtkTreeView *tree_view,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
- uri = gbf_tree_data_get_uri (data);
- if (uri != NULL) {
- g_signal_emit (G_OBJECT (tree_view),
- signals [URI_ACTIVATED], 0,
- uri);
- }
-
- if (data->type == GBF_TREE_NODE_TARGET) {
- g_signal_emit (G_OBJECT (tree_view),
- signals [TARGET_SELECTED], 0,
- uri);
- }
-
- if (data->type == GBF_TREE_NODE_GROUP) {
+ node = gbf_tree_data_get_node (data);
+ if (node)
+ {
g_signal_emit (G_OBJECT (tree_view),
- signals [GROUP_SELECTED], 0,
- uri);
+ signals [NODE_SELECTED], 0,
+ node);
}
- g_free (uri);
}
static void on_node_loaded (AnjutaPmProject *sender, AnjutaProjectNode *node, gboolean complete, GError *error, GbfProjectView *view);
@@ -342,7 +328,7 @@ static void
dispose (GObject *object)
{
GbfProjectView *view;
-
+
view = GBF_PROJECT_VIEW (object);
if (view->filter)
@@ -362,7 +348,7 @@ dispose (GObject *object)
g_object_unref (G_OBJECT (view->model));
view->model = NULL;
}
-
+
G_OBJECT_CLASS (gbf_project_view_parent_class)->dispose (object);
}
@@ -370,9 +356,9 @@ static void
destroy (GtkWidget *object)
{
GbfProjectView *tree;
-
+
tree = GBF_PROJECT_VIEW (object);
-
+
if (GTK_WIDGET_CLASS (gbf_project_view_parent_class)->destroy)
(* GTK_WIDGET_CLASS (gbf_project_view_parent_class)->destroy) (object);
}
@@ -386,7 +372,7 @@ get_icon (GFile *file)
GdkPixbuf* pixbuf = NULL;
GFileInfo* file_info;
GError *error = NULL;
-
+
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_ICON,
G_FILE_QUERY_INFO_NONE,
@@ -413,7 +399,7 @@ get_icon (GFile *file)
gtk_icon_info_free(icon_info);
g_object_unref (file_info);
}
-
+
return pixbuf;
}
@@ -426,7 +412,7 @@ set_pixbuf (GtkTreeViewColumn *tree_column,
{
GbfTreeData *data = NULL;
GdkPixbuf *pixbuf = NULL;
-
+
gtk_tree_model_get (model, iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
g_return_if_fail (data != NULL);
@@ -459,7 +445,7 @@ set_pixbuf (GtkTreeViewColumn *tree_column,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
break;
- case GBF_TREE_NODE_TARGET:
+ case GBF_TREE_NODE_TARGET:
{
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
GTK_STOCK_CONVERT,
@@ -468,7 +454,7 @@ set_pixbuf (GtkTreeViewColumn *tree_column,
NULL);
break;
}
- case GBF_TREE_NODE_MODULE:
+ case GBF_TREE_NODE_MODULE:
{
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
GTK_STOCK_DND_MULTIPLE,
@@ -477,7 +463,7 @@ set_pixbuf (GtkTreeViewColumn *tree_column,
NULL);
break;
}
- case GBF_TREE_NODE_PACKAGE:
+ case GBF_TREE_NODE_PACKAGE:
{
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
GTK_STOCK_DND,
@@ -487,7 +473,7 @@ set_pixbuf (GtkTreeViewColumn *tree_column,
break;
}
default:
- /* Can reach this if type = GBF_TREE_NODE_SHORTCUT. It
+ /* Can reach this if type = GBF_TREE_NODE_SHORTCUT. It
* means a shortcut with the original data removed */
pixbuf = NULL;
}
@@ -508,8 +494,8 @@ set_text (GtkTreeViewColumn *tree_column,
gtk_tree_model_get (model, iter, GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
/* data can be NULL just after gtk_tree_store_insert before
- calling gtk_tree_store_set */
- g_object_set (GTK_CELL_RENDERER (cell), "text",
+ calling gtk_tree_store_set */
+ g_object_set (GTK_CELL_RENDERER (cell), "text",
data == NULL ? "" : data->name, NULL);
}
@@ -520,7 +506,7 @@ search_equal_func (GtkTreeModel *model, gint column,
{
GbfTreeData *data;
gboolean ret = TRUE;
-
+
gtk_tree_model_get (model, iter, GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
if (strncmp (data->name, key, strlen (key)) == 0)
ret = FALSE;
@@ -548,17 +534,17 @@ draw (GtkWidget *widget, cairo_t *cr)
model && GBF_IS_PROJECT_MODEL (model)) {
GtkTreePath *root;
GdkRectangle rect;
-
+
/* paint an horizontal ruler to separate the project
* tree from the target shortcuts */
-
+
root = gbf_project_model_get_project_root (GBF_PROJECT_MODEL (model));
if (root) {
if (view_model != model)
{
/* Convert path */
GtkTreePath *child_path;
-
+
child_path = gtk_tree_model_filter_convert_child_path_to_path (GTK_TREE_MODEL_FILTER (view_model), root);
gtk_tree_path_free (root);
root = child_path;
@@ -579,7 +565,7 @@ draw (GtkWidget *widget, cairo_t *cr)
return event_handled;
}
-static void
+static void
gbf_project_view_class_init (GbfProjectViewClass *klass)
{
GObjectClass *g_object_class;
@@ -595,31 +581,12 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
widget_class->draw = draw;
tree_view_class->row_activated = row_activated;
- signals [URI_ACTIVATED] =
- g_signal_new ("uri_activated",
- GBF_TYPE_PROJECT_VIEW,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GbfProjectViewClass,
- uri_activated),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- signals [TARGET_SELECTED] =
- g_signal_new ("target_selected",
- GBF_TYPE_PROJECT_VIEW,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GbfProjectViewClass,
- target_selected),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals [GROUP_SELECTED] =
- g_signal_new ("group_selected",
+ signals [NODE_SELECTED] =
+ g_signal_new ("node-selected",
GBF_TYPE_PROJECT_VIEW,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GbfProjectViewClass,
- group_selected),
+ node_selected),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
@@ -635,7 +602,7 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
G_TYPE_POINTER,
G_TYPE_BOOLEAN,
G_TYPE_ERROR);
-
+
}
static gboolean
@@ -650,7 +617,7 @@ is_project_node_visible (GtkTreeModel *model, GtkTreeIter *iter, gpointer user_d
return (data != NULL) && (gbf_tree_data_get_node (data) != NULL);
}
-static void
+static void
gbf_project_view_init (GbfProjectView *tree)
{
GtkCellRenderer *renderer;
@@ -658,14 +625,14 @@ gbf_project_view_init (GbfProjectView *tree)
static GtkTargetEntry row_targets[] = {
{ "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
};
-
+
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree), FALSE);
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree), TRUE);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (tree), 0);
gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (tree),
search_equal_func,
NULL, NULL);
-
+
gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (tree),
GDK_BUTTON1_MASK,
row_targets,
@@ -675,13 +642,13 @@ gbf_project_view_init (GbfProjectView *tree)
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE);
-
- /* set renderer for files column. */
+
+ /* set renderer for files column. */
column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_cell_data_func (column, renderer, set_pixbuf, tree, NULL);
-
+
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_cell_data_func (column, renderer, set_text, tree, NULL);
@@ -692,7 +659,7 @@ gbf_project_view_init (GbfProjectView *tree)
tree->model = gbf_project_model_new (NULL);
tree->filter = GTK_TREE_MODEL_FILTER (pm_project_model_filter_new (GTK_TREE_MODEL (tree->model), NULL));
gtk_tree_model_filter_set_visible_func (tree->filter, is_project_node_visible, tree, NULL);
-
+
gtk_tree_view_set_model (GTK_TREE_VIEW (tree), GTK_TREE_MODEL (tree->filter));
}
@@ -714,16 +681,16 @@ gbf_project_view_find_selected (GbfProjectView *view, AnjutaProjectNodeType type
data = gbf_project_view_get_first_selected (view, NULL);
if (data != NULL)
{
-
+
node = gbf_tree_data_get_node (data);
-
+
/* walk up the hierarchy searching for a node of the given type */
while ((node != NULL) && (type != ANJUTA_PROJECT_UNKNOWN) && (anjuta_project_node_get_node_type (node) != type))
{
node = anjuta_project_node_parent (node);
}
}
-
+
return node;
}
@@ -737,13 +704,13 @@ gbf_project_view_get_first_selected (GbfProjectView *view, GtkTreeIter* selected
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (GBF_IS_PROJECT_VIEW (view), NULL);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
list = gtk_tree_selection_get_selected_rows(selection, &model);
if (list != NULL)
{
GtkTreeIter iter;
-
+
if (gtk_tree_model_get_iter (model, &iter, list->data))
{
if (selected)
@@ -778,7 +745,7 @@ gbf_project_view_set_cursor_to_iter (GbfProjectView *view,
{
GtkTreePath *path = NULL;
GtkTreeIter view_iter;
-
+
/* select node if we find it in the view*/
if ((selected != NULL) && gtk_tree_model_filter_convert_child_iter_to_iter (
GTK_TREE_MODEL_FILTER (view->filter), &view_iter, selected))
@@ -800,7 +767,7 @@ gbf_project_view_set_cursor_to_iter (GbfProjectView *view,
{
/* Select the corresponding node */
GtkTreeIter iter;
-
+
if (gbf_project_model_find_tree_data (view->model, &iter, data->shortcut))
{
if (gtk_tree_model_filter_convert_child_iter_to_iter (
@@ -836,7 +803,7 @@ gbf_project_view_set_cursor_to_iter (GbfProjectView *view,
if (path)
{
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
-
+
gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), path, NULL,
TRUE, 0.5, 0.0);
@@ -869,7 +836,7 @@ gbf_project_view_get_all_selected (GbfProjectView *view)
g_return_val_if_fail (view != NULL, FALSE);
g_return_val_if_fail (GBF_IS_PROJECT_VIEW (view), FALSE);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
gtk_tree_selection_selected_foreach (selection, on_each_get_data, &selected);
@@ -883,7 +850,7 @@ on_each_get_iter (GtkTreeModel *model,
gpointer user_data)
{
GList **selected = (GList **)user_data;
-
+
*selected = g_list_prepend (*selected, gtk_tree_iter_copy (iter));
}
@@ -895,7 +862,7 @@ gbf_project_view_get_all_selected_iter (GbfProjectView *view)
g_return_val_if_fail (view != NULL, FALSE);
g_return_val_if_fail (GBF_IS_PROJECT_VIEW (view), FALSE);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
gtk_tree_selection_selected_foreach (selection, on_each_get_iter, &selected);
@@ -930,7 +897,7 @@ gbf_project_view_update_shortcut (GbfProjectView *view, AnjutaProjectNode *paren
gbf_project_view_update_tree (view, parent, &child);
}
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (view->model), &child);
- }
+ }
}
static gint
@@ -952,7 +919,7 @@ list_visible_children (AnjutaProjectNode *parent)
{
if (anjuta_project_node_get_node_type (node) != ANJUTA_PROJECT_OBJECT)
{
- list = g_list_prepend (list, node);
+ list = g_list_prepend (list, node);
}
else
{
@@ -964,10 +931,10 @@ list_visible_children (AnjutaProjectNode *parent)
}
}
list = g_list_reverse (list);
-
+
return list;
}
-
+
void
gbf_project_view_update_tree (GbfProjectView *view, AnjutaProjectNode *parent, GtkTreeIter *iter)
{
@@ -983,7 +950,7 @@ gbf_project_view_update_tree (GbfProjectView *view, AnjutaProjectNode *parent, G
if (gtk_tree_model_iter_children (GTK_TREE_MODEL (view->model), &child, iter))
{
gboolean valid = TRUE;
-
+
while (valid) {
data = NULL;
AnjutaProjectNode* data_node = NULL;
@@ -997,7 +964,7 @@ gbf_project_view_update_tree (GbfProjectView *view, AnjutaProjectNode *parent, G
/* Skip shortcuts */
if (data->type == GBF_TREE_NODE_SHORTCUT)
- {
+ {
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (view->model), &child);
continue;
}
@@ -1027,7 +994,7 @@ gbf_project_view_update_tree (GbfProjectView *view, AnjutaProjectNode *parent, G
/* Update shortcut */
gbf_project_view_update_shortcut (view, data_node);
-
+
/* update recursively */
gbf_project_view_update_tree (view, data_node, &child);
@@ -1035,7 +1002,7 @@ gbf_project_view_update_tree (GbfProjectView *view, AnjutaProjectNode *parent, G
{
gboolean expanded;
GtkTreeIter iter;
-
+
gbf_project_model_add_target_shortcut (view->model, &iter, data, NULL, &expanded);
if (expanded)
{
@@ -1072,7 +1039,7 @@ gbf_project_view_update_tree (GbfProjectView *view, AnjutaProjectNode *parent, G
/* Update shortcut */
gbf_project_view_update_shortcut (view, data_node);
-
+
/* update recursively */
gbf_project_view_update_tree (view, data_node, &child);
@@ -1130,7 +1097,7 @@ gbf_project_view_sort_shortcuts (GbfProjectView *view)
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (view->model),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
-
+
}
GList *
@@ -1149,26 +1116,26 @@ gbf_project_view_get_shortcut_list (GbfProjectView *view)
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter))
{
GbfTreeData *data;
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
if ((data->type == GBF_TREE_NODE_SHORTCUT) && (data->shortcut != NULL))
{
GtkTreeIter iter;
-
+
if (gbf_project_model_find_tree_data (view->model, &iter, data->shortcut))
{
GString *str;
GtkTreeIter child;
-
+
str = g_string_new (NULL);
do
{
GbfTreeData *data;
child = iter;
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
@@ -1186,7 +1153,7 @@ gbf_project_view_get_shortcut_list (GbfProjectView *view)
}
list = g_list_reverse (list);
}
-
+
return list;
}
@@ -1196,21 +1163,21 @@ save_expanded_node (GtkTreeView *view, GtkTreePath *path, gpointer user_data)
GList **list = (GList **)user_data;
GtkTreeModel *model;
GtkTreeIter iter;
-
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
if (gtk_tree_model_get_iter (model, &iter, path))
{
GString *str;
GtkTreeIter child;
-
+
str = g_string_new (NULL);
do
{
GbfTreeData *data;
child = iter;
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
@@ -1252,8 +1219,8 @@ gbf_project_view_remove_all_shortcut (GbfProjectView* view)
valid == TRUE;)
{
GbfTreeData *data;
-
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
@@ -1292,11 +1259,11 @@ gbf_project_view_set_shortcut_list (GbfProjectView *view, GList *shortcuts)
if (!gbf_project_model_find_child_name (view->model, &iter, parent, name))
{
GbfTreeData *data;
-
+
/* Create proxy node */
data = gbf_tree_data_new_proxy (name, FALSE);
gtk_tree_store_append (GTK_TREE_STORE (view->model), &iter, parent);
- gtk_tree_store_set (GTK_TREE_STORE (view->model), &iter,
+ gtk_tree_store_set (GTK_TREE_STORE (view->model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, data,
-1);
if (end == NULL)
@@ -1306,7 +1273,7 @@ gbf_project_view_set_shortcut_list (GbfProjectView *view, GList *shortcuts)
/* Create another proxy at root level to keep shortcut order */
data = gbf_tree_data_new_proxy (name, FALSE);
gtk_tree_store_append (GTK_TREE_STORE (view->model), &iter, NULL);
- gtk_tree_store_set (GTK_TREE_STORE (view->model), &iter,
+ gtk_tree_store_set (GTK_TREE_STORE (view->model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, data,
-1);
}
@@ -1315,7 +1282,7 @@ gbf_project_view_set_shortcut_list (GbfProjectView *view, GList *shortcuts)
{
GbfTreeData *data;
- gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
if (end == NULL) data->has_shortcut = TRUE;
@@ -1330,7 +1297,7 @@ gbf_project_view_set_shortcut_list (GbfProjectView *view, GList *shortcuts)
}
while (end != NULL);
}
-
+
return;
}
@@ -1355,11 +1322,11 @@ gbf_project_view_set_expanded_list (GbfProjectView *view, GList *expand)
if (!gbf_project_model_find_child_name (view->model, &iter, parent, name))
{
GbfTreeData *data;
-
+
/* Create proxy node */
data = gbf_tree_data_new_proxy (name, TRUE);
gtk_tree_store_append (GTK_TREE_STORE (view->model), &iter, parent);
- gtk_tree_store_set (GTK_TREE_STORE (view->model), &iter,
+ gtk_tree_store_set (GTK_TREE_STORE (view->model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, data,
-1);
}
@@ -1367,7 +1334,7 @@ gbf_project_view_set_expanded_list (GbfProjectView *view, GList *expand)
{
GbfTreeData *data;
- gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
data->expanded = TRUE;
@@ -1382,7 +1349,7 @@ gbf_project_view_set_expanded_list (GbfProjectView *view, GList *expand)
}
while (end != NULL);
}
-
+
return;
}
@@ -1397,10 +1364,10 @@ gbf_project_view_get_node_from_file (GbfProjectView *view, AnjutaProjectNodeType
{
GtkTreeIter iter;
AnjutaProjectNode *node = NULL;
-
+
if (gbf_project_model_find_file (view->model, &iter, NULL, type, file))
{
-
+
node = gbf_project_model_get_node (view->model, &iter);
}
@@ -1411,7 +1378,7 @@ gboolean
gbf_project_view_remove_data (GbfProjectView *view, GbfTreeData *data, GError **error)
{
GtkTreeIter iter;
-
+
if (gbf_project_model_find_tree_data (view->model, &iter, data))
{
gbf_project_model_remove (view->model, &iter);
@@ -1440,7 +1407,7 @@ on_node_loaded (AnjutaPmProject *sender, AnjutaProjectNode *node, gboolean compl
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (view->model),
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
-
+
found = gbf_project_model_find_node (view->model, &iter, NULL, node);
if (!found)
{
@@ -1462,8 +1429,8 @@ on_node_loaded (AnjutaPmProject *sender, AnjutaProjectNode *node, gboolean compl
else
{
GbfTreeData *data;
-
- gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
+
+ gtk_tree_model_get (GTK_TREE_MODEL (view->model), &iter,
GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-1);
if (data->type == GBF_TREE_NODE_UNKNOWN)
@@ -1499,7 +1466,7 @@ on_node_loaded (AnjutaPmProject *sender, AnjutaProjectNode *node, gboolean compl
g_signal_emit (G_OBJECT (view), signals[NODE_LOADED], 0, found ? &iter : NULL, complete, NULL);
}
-
+
if (complete)
{
// Add shortcut for all new primary targets
@@ -1508,7 +1475,7 @@ on_node_loaded (AnjutaPmProject *sender, AnjutaProjectNode *node, gboolean compl
}
-void
+void
gbf_project_view_set_project (GbfProjectView *view, AnjutaPmProject *project)
{
AnjutaPmProject *old_project;
@@ -1524,21 +1491,21 @@ gbf_project_view_set_project (GbfProjectView *view, AnjutaPmProject *project)
gbf_project_model_set_project (view->model, project);
}
-void
+void
gbf_project_view_set_parent_view (GbfProjectView *view,
GbfProjectView *parent,
GtkTreePath *root)
{
-
+
if (view->model != NULL) g_object_unref (view->model);
if (view->filter != NULL) g_object_unref (view->model);
-
+
view->model = g_object_ref (parent->model);
view->filter = GTK_TREE_MODEL_FILTER (pm_project_model_filter_new (GTK_TREE_MODEL (view->model), root));
gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (view->filter));
}
-void
+void
gbf_project_view_set_visible_func (GbfProjectView *view,
GtkTreeModelFilterVisibleFunc func,
gpointer data,
@@ -1558,7 +1525,7 @@ gbf_project_view_set_visible_func (GbfProjectView *view,
gboolean
gbf_project_view_find_file (GbfProjectView *view, GtkTreeIter* iter, GFile *file, GbfTreeNodeType type)
{
- return gbf_project_model_find_file (view->model, iter, NULL, type, file);
+ return gbf_project_model_find_file (view->model, iter, NULL, type, file);
}
GbfProjectModel *
@@ -1581,7 +1548,7 @@ gbf_project_view_get_project_root (GbfProjectView *view, GtkTreeIter *iter)
{
model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (view_model));
}
-
+
path = gbf_project_model_get_project_root (GBF_PROJECT_MODEL (model));
if (path)
{
diff --git a/plugins/project-manager/project-view.h b/plugins/project-manager/project-view.h
index a528e0d..6464767 100644
--- a/plugins/project-manager/project-view.h
+++ b/plugins/project-manager/project-view.h
@@ -53,14 +53,9 @@ struct _GbfProjectViewClass {
GtkTreeIter *iter,
gboolean complete,
GError *error);
-
- void (* uri_activated) (GbfProjectView *project_view,
- const char *uri);
- void (* target_selected) (GbfProjectView *project_view,
+ void (* node_selected) (GbfProjectView *project_view,
AnjutaProjectNode *target);
- void (* group_selected) (GbfProjectView *project_view,
- AnjutaProjectNode *group);
};
GType gbf_project_view_get_type (void);
@@ -103,7 +98,7 @@ void gbf_project_view_update_tree (GbfProjectView *view,
AnjutaProjectNode *parent,
GtkTreeIter *iter);
-
+
AnjutaProjectNode *gbf_project_view_get_node_from_iter (GbfProjectView *view, GtkTreeIter *iter);
AnjutaProjectNode *gbf_project_view_get_node_from_file (GbfProjectView *view, AnjutaProjectNodeType type, GFile *file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]