anjuta r4009 - in trunk: . plugins/file-manager
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4009 - in trunk: . plugins/file-manager
- Date: Fri, 13 Jun 2008 20:27:46 +0000 (UTC)
Author: jhs
Date: Fri Jun 13 20:27:45 2008
New Revision: 4009
URL: http://svn.gnome.org/viewvc/anjuta?rev=4009&view=rev
Log:
2008-06-13 Johannes Schmid <jhs gnome org>
* plugins/file-manager/file-manager.ui:
* plugins/file-manager/file-model.c (file_model_filter_file),
(file_model_remove_file), (file_model_update_file),
(file_model_add_file), (on_file_model_changed),
(file_model_add_watch), (file_model_expand_row_real),
(file_model_row_collapsed), (file_model_new), (file_model_refresh):
* plugins/file-manager/file-model.h:
* plugins/file-manager/file-view.c (file_view_refresh),
(file_view_rename), (file_view_can_rename),
(file_view_show_extended_data), (file_view_selection_changed),
(file_view_init):
* plugins/file-manager/file-view.h:
* plugins/file-manager/plugin.c (on_file_manager_rename),
(project_root_added), (project_root_removed),
(on_file_view_show_popup_menu), (on_gconf_notify),
(file_manager_activate):
Big code reorganization in file-manger plugin. No more refresh as it now
listens to file system changes and an extended selection view.
Modified:
trunk/ChangeLog
trunk/plugins/file-manager/file-manager.ui
trunk/plugins/file-manager/file-model.c
trunk/plugins/file-manager/file-model.h
trunk/plugins/file-manager/file-view.c
trunk/plugins/file-manager/file-view.h
trunk/plugins/file-manager/plugin.c
Modified: trunk/plugins/file-manager/file-manager.ui
==============================================================================
--- trunk/plugins/file-manager/file-manager.ui (original)
+++ trunk/plugins/file-manager/file-manager.ui Fri Jun 13 20:27:45 2008
@@ -5,6 +5,6 @@
<placeholder name="PlaceholderPopupFileBuild"/>
<placeholder name="PlaceholderPopupFileVCS"/>
<separator/>
- <menuitem name="PopupFileManagerRefresh" action="ActionPopupFileManagerRefresh"/>
+ <menuitem name="PopupFileManagerRename" action="ActionPopupFileManagerRename"/>
</popup>
</ui>
Modified: trunk/plugins/file-manager/file-model.c
==============================================================================
--- trunk/plugins/file-manager/file-model.c (original)
+++ trunk/plugins/file-manager/file-model.c Fri Jun 13 20:27:45 2008
@@ -30,7 +30,7 @@
#include <gtk/gtk.h>
#define DIRECTORY_MIME_TYPE "x-directory/normal"
-#define ICON_SIZE 12
+#define ICON_SIZE 16
enum
{
@@ -59,6 +59,20 @@
G_DEFINE_TYPE (FileModel, file_model, GTK_TYPE_TREE_STORE)
+static gboolean
+file_model_filter_file (FileModel* model,
+ GFileInfo* file_info)
+{
+ FileModelPrivate* priv = FILE_MODEL_GET_PRIVATE (model);
+
+ if (priv->filter_hidden && g_file_info_get_is_hidden(file_info))
+ return FALSE;
+ else if (priv->filter_backup && g_file_info_get_is_backup(file_info))
+ return FALSE;
+
+ return TRUE;
+}
+
static void
file_model_add_dummy (FileModel* model,
GtkTreeIter* iter)
@@ -73,18 +87,199 @@
-1);
}
-static gboolean
-file_model_filter_file (FileModel* model,
+static void
+file_model_remove_file (FileModel* model,
+ GtkTreeIter* iter)
+{
+ GFile* file;
+ GtkTreeRowReference* reference;
+ GFileMonitor* monitor;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
+ COLUMN_FILE, &file, -1);
+
+ monitor = g_object_get_data (G_OBJECT(file), "file-monitor");
+ if (monitor)
+ g_object_unref (monitor);
+
+ reference = g_object_get_data (G_OBJECT(file), "reference");
+ if (reference)
+ gtk_tree_row_reference_free(reference);
+
+ gtk_tree_store_remove (GTK_TREE_STORE (model), iter);
+}
+
+static void
+file_model_update_file (FileModel* model,
+ GtkTreeIter* iter,
+ GFile* file,
GFileInfo* file_info)
{
- FileModelPrivate* priv = FILE_MODEL_GET_PRIVATE (model);
+ GtkTreeStore* store = GTK_TREE_STORE(model);
+ gboolean is_dir = FALSE;
+ const gchar** icon_names;
+ GtkIconInfo* icon_info;
+ GIcon* icon;
+ GdkPixbuf* pixbuf;
+ gchar* display_name;
- if (priv->filter_hidden && g_file_info_get_is_hidden(file_info))
- return FALSE;
- else if (priv->filter_backup && g_file_info_get_is_backup(file_info))
- return FALSE;
+ icon = g_file_info_get_icon(file_info);
+ g_object_get (icon, "names", &icon_names, NULL);
+ icon_info = gtk_icon_theme_choose_icon (gtk_icon_theme_get_default(),
+ icon_names,
+ ICON_SIZE,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
+ gtk_icon_info_free(icon_info);
- return TRUE;
+ if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_DIRECTORY)
+ is_dir = TRUE;
+
+ display_name = g_markup_printf_escaped("%s",
+ g_file_info_get_display_name(file_info));
+
+ gtk_tree_store_set (store, iter,
+ COLUMN_DISPLAY, display_name,
+ COLUMN_FILENAME, display_name,
+ COLUMN_FILE, file,
+ COLUMN_PIXBUF, pixbuf,
+ COLUMN_IS_DIR, is_dir,
+ COLUMN_SORT, g_file_info_get_sort_order(file_info),
+ -1);
+ if (is_dir)
+ file_model_add_dummy(model, iter);
+
+ g_object_unref (pixbuf);
+ g_free(display_name);
+}
+
+static void
+file_model_add_file (FileModel* model,
+ GtkTreeIter* parent,
+ GFile* file,
+ GFileInfo* file_info)
+{
+ GtkTreeIter iter;
+ GtkTreeStore* store = GTK_TREE_STORE(model);
+
+ if (file_model_filter_file (model, file_info))
+ {
+ gtk_tree_store_append (store, &iter, parent);
+ file_model_update_file (model, &iter, file, file_info);
+ }
+}
+
+static void
+on_file_model_changed (GFileMonitor* monitor,
+ GFile* file,
+ GFile* other_file,
+ GFileMonitorEvent event_type,
+ gpointer data)
+{
+ GtkTreeRowReference* reference = (GtkTreeRowReference*)data;
+ FileModel* model = FILE_MODEL (gtk_tree_row_reference_get_model(reference));
+ GtkTreeIter iter;
+ GtkTreePath* path;
+ GtkTreeIter file_iter;
+
+ path = gtk_tree_row_reference_get_path (reference);
+ if (!path)
+ {
+ return;
+ }
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL(model), &iter, path);
+ gtk_tree_path_free (path);
+
+ if (event_type == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED ||
+ event_type == G_FILE_MONITOR_EVENT_DELETED)
+ {
+ gboolean found = FALSE;
+ if (gtk_tree_model_iter_children (GTK_TREE_MODEL(model), &file_iter, &iter))
+ {
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL(model), &file_iter))
+ {
+ GFile* model_file;
+ gtk_tree_model_get (GTK_TREE_MODEL(model), &file_iter,
+ COLUMN_FILE, &model_file, -1);
+ if (g_file_equal (model_file, file))
+ {
+ g_object_unref (model_file);
+ found = TRUE;
+ break;
+ }
+ g_object_unref (model_file);
+ }
+ }
+ if (!found)
+ return;
+ }
+
+ switch (event_type)
+ {
+ case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
+ {
+ GFileInfo* file_info;
+ file_info = g_file_query_info (file,
+ "standard::*",
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+ if (file_info)
+ {
+ file_model_update_file (model, &file_iter, file, file_info);
+ g_object_unref (file_info);
+ }
+ break;
+ }
+ case G_FILE_MONITOR_EVENT_CREATED:
+ {
+ GFileInfo* file_info;
+ file_info = g_file_query_info (file,
+ "standard::*",
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+ if (file_info)
+ {
+ file_model_add_file (model, &iter, file, file_info);
+ g_object_unref (file_info);
+ }
+ break;
+ }
+ case G_FILE_MONITOR_EVENT_DELETED:
+ {
+ file_model_remove_file (model, &file_iter);
+ break;
+ }
+ default:
+ /* do nothing */
+ break;
+ }
+}
+
+static void
+file_model_add_watch (FileModel* model, GtkTreePath* path)
+{
+ GtkTreeIter iter;
+ GtkTreeRowReference* reference;
+ GFile* file;
+ GFileMonitor* monitor;
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (model),
+ &iter, path);
+
+ gtk_tree_model_get (GTK_TREE_MODEL(model), &iter,
+ COLUMN_FILE, &file, -1);
+
+ reference = gtk_tree_row_reference_new (GTK_TREE_MODEL(model), path);
+
+ monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE,
+ NULL, NULL);
+ g_signal_connect (monitor, "changed", G_CALLBACK(on_file_model_changed),
+ reference);
+
+ g_object_set_data (G_OBJECT(file), "file-monitor", monitor);
+ g_object_set_data (G_OBJECT(file), "reference", reference);
+ g_object_unref (file);
}
static void
@@ -98,53 +293,31 @@
GFileEnumerator* files = g_file_enumerate_children_finish(dir, result, &err);
GFileInfo* file_info;
GtkTreeIter dummy;
+ GtkTreePath* path;
+
+ if (!priv->expand_iter)
+ {
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model),
+ &iter);
+ priv->expand_iter = gtk_tree_iter_copy (&iter);
+ }
+
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), priv->expand_iter);
while (files && (file_info = g_file_enumerator_next_file (files, NULL, NULL)))
{
- GtkTreeIter iter;
- GtkTreeStore* store = GTK_TREE_STORE(model);
- gboolean is_dir = FALSE;
- const gchar** icon_names;
- GtkIconInfo* icon_info;
- GIcon* icon;
- GdkPixbuf* pixbuf;
- GFile* file;
-
- if (!file_model_filter_file (model, file_info))
- continue;
-
- file = g_file_get_child (dir, g_file_info_get_name(file_info));
-
- icon = g_file_info_get_icon(file_info);
- g_object_get (icon, "names", &icon_names, NULL);
- icon_info = gtk_icon_theme_choose_icon (gtk_icon_theme_get_default(),
- icon_names,
- ICON_SIZE,
- GTK_ICON_LOOKUP_GENERIC_FALLBACK);
- pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
- gtk_icon_info_free(icon_info);
- gtk_tree_store_append (store, &iter, priv->expand_iter);
-
- if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_DIRECTORY)
- is_dir = TRUE;
-
- gtk_tree_store_set (store, &iter,
- COLUMN_FILENAME, g_file_info_get_display_name(file_info),
- COLUMN_FILE, file,
- COLUMN_PIXBUF, pixbuf,
- COLUMN_IS_DIR, is_dir,
- COLUMN_SORT, g_file_info_get_sort_order(file_info),
- -1);
- if (is_dir)
- file_model_add_dummy(model, &iter);
-
+ GFile* file = g_file_get_child (dir, g_file_info_get_name(file_info));
+ file_model_add_file (model, priv->expand_iter, file, file_info);
g_object_unref (file);
- g_object_unref (pixbuf);
}
/* Remove dummy node */
gtk_tree_model_iter_children (GTK_TREE_MODEL(model), &dummy, priv->expand_iter);
gtk_tree_store_remove (GTK_TREE_STORE(model), &dummy);
-
+
+ file_model_add_watch (model, path);
+ gtk_tree_path_free (path);
+
if (priv->expand_iter)
gtk_tree_iter_free(priv->expand_iter);
priv->expand_iter = NULL;
@@ -192,8 +365,9 @@
while (gtk_tree_model_iter_children (GTK_TREE_MODEL(model), &child, &real_iter))
{
- gtk_tree_store_remove (GTK_TREE_STORE (model), &child);
+ file_model_remove_file (model, &child);
}
+
file_model_add_dummy (model, &real_iter);
}
@@ -340,7 +514,8 @@
{
GObject* model =
g_object_new (FILE_TYPE_MODEL, "base_uri", base_uri, NULL);
- GType types[N_COLUMNS] = {GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_OBJECT,
+ GType types[N_COLUMNS] = {GDK_TYPE_PIXBUF, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_OBJECT,
G_TYPE_BOOLEAN, G_TYPE_INT};
g_signal_connect (G_OBJECT (tree_view), "row-collapsed",
@@ -358,48 +533,22 @@
file_model_refresh (FileModel* model)
{
GtkTreeStore* store = GTK_TREE_STORE (model);
- GtkTreeIter iter;
FileModelPrivate* priv = FILE_MODEL_GET_PRIVATE(model);
- GdkPixbuf *pixbuf;
GFile* base;
GFileInfo* base_info;
- const gchar** icon_names;
- GtkIconInfo* icon_info;
- GIcon* icon;
-
g_cancellable_cancel(priv->expand_cancel);
g_cancellable_reset(priv->expand_cancel);
gtk_tree_store_clear (store);
base = g_file_new_for_uri (priv->base_uri);
- base_info = g_file_query_info (base, "standard::display-name,standard::icon",
+ base_info = g_file_query_info (base, "standard::*",
G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (!base_info)
return;
- icon = g_file_info_get_icon(base_info);
- g_object_get (icon, "names", &icon_names, NULL);
- icon_info = gtk_icon_theme_choose_icon (gtk_icon_theme_get_default(),
- icon_names,
- ICON_SIZE,
- GTK_ICON_LOOKUP_GENERIC_FALLBACK);
- pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
- gtk_icon_info_free(icon_info);
-
-
- gtk_tree_store_append (store, &iter, NULL);
- gtk_tree_store_set (store, &iter,
- COLUMN_FILENAME, g_file_info_get_display_name(base_info),
- COLUMN_FILE, base,
- COLUMN_PIXBUF, pixbuf,
- COLUMN_IS_DIR, TRUE,
- COLUMN_SORT, 0,
- -1);
- file_model_add_dummy (model, &iter);
-
- g_object_unref (pixbuf);
+ file_model_add_file (model, NULL, base, base_info);
g_object_unref (base);
}
Modified: trunk/plugins/file-manager/file-model.h
==============================================================================
--- trunk/plugins/file-manager/file-model.h (original)
+++ trunk/plugins/file-manager/file-model.h Fri Jun 13 20:27:45 2008
@@ -47,6 +47,7 @@
{
COLUMN_PIXBUF,
COLUMN_FILENAME,
+ COLUMN_DISPLAY,
COLUMN_FILE,
COLUMN_IS_DIR,
COLUMN_SORT,
Modified: trunk/plugins/file-manager/file-view.c
==============================================================================
--- trunk/plugins/file-manager/file-view.c (original)
+++ trunk/plugins/file-manager/file-view.c Fri Jun 13 20:27:45 2008
@@ -34,6 +34,8 @@
#include <gtk/gtktreemodelsort.h>
#include <gtk/gtkversion.h>
+#include <gio/gio.h>
+
#include <string.h>
#define HAVE_TOOLTIP_API (GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 12))
@@ -52,7 +54,7 @@
FileModel* model;
GList* saved_paths;
- guint refresh_idle_id;
+ GtkTreeRowReference* current_selection;
};
#define ANJUTA_FILE_VIEW_GET_PRIVATE(o) \
@@ -66,94 +68,28 @@
PROP_END
};
-static void
-file_view_cancel_refresh(AnjutaFileView* view)
-{
- AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE(view);
- if (priv->refresh_idle_id)
- {
- GSource* source = g_main_context_find_source_by_id (g_main_context_default(),
- priv->refresh_idle_id);
- g_source_destroy (source);
- priv->refresh_idle_id = 0;
- }
-}
-
-static void
-file_view_on_file_clicked (GtkTreeViewColumn* column, AnjutaFileView* view)
-{
-
-}
-
-static void
-file_view_save_expanded_row (GtkTreeView* tree_view, GtkTreePath* path,
- gpointer user_data)
-{
- AnjutaFileView* view = ANJUTA_FILE_VIEW (tree_view);
- AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
- priv->saved_paths = g_list_append (priv->saved_paths,
- gtk_tree_path_to_string (path));
-}
-
-static void
-file_view_get_expanded_rows (AnjutaFileView* view)
-{
- AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
-
- priv->saved_paths = NULL;
- gtk_tree_view_map_expanded_rows (GTK_TREE_VIEW (view),
- file_view_save_expanded_row,
- priv->saved_paths);
-}
-
-static gboolean
-file_view_expand_row_idle (gpointer user_data)
-{
- AnjutaFileView* view = ANJUTA_FILE_VIEW (user_data);
- AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
-
- if (priv->saved_paths)
- {
- gchar* path_string = (gchar*) priv->saved_paths->data;
- GtkTreePath* path = gtk_tree_path_new_from_string (path_string);
-
- gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
- gtk_tree_path_free (path);
- g_free (path_string);
- priv->saved_paths = g_list_next (priv->saved_paths);
- return TRUE;
- }
- else
- {
- g_list_free (priv->saved_paths);
- priv->saved_paths = NULL;
- priv->refresh_idle_id = 0;
- return FALSE;
- }
-}
-
void
-file_view_refresh (AnjutaFileView* view, gboolean remember_open)
+file_view_refresh (AnjutaFileView* view)
{
AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
GtkTreePath* tree_path;
- file_view_cancel_refresh(view);
-
- if (remember_open)
- {
- file_view_get_expanded_rows (view);
- }
-
file_model_refresh (priv->model);
tree_path = gtk_tree_path_new_first ();
gtk_tree_view_expand_row (GTK_TREE_VIEW (view), tree_path, FALSE);
gtk_tree_path_free (tree_path);
- if (remember_open)
- {
- priv->refresh_idle_id = g_idle_add (file_view_expand_row_idle, view);
- }
+}
+
+void file_view_rename (AnjutaFileView* view)
+{
+ /* TODO */
+}
+
+gboolean file_view_can_rename (AnjutaFileView* view)
+{
+ /* TODO */
+ return FALSE;
}
gchar*
@@ -253,16 +189,82 @@
}
static void
+file_view_show_extended_data (AnjutaFileView* view, GtkTreeIter* iter)
+{
+ AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
+ GtkTreeModel* file_model = GTK_TREE_MODEL (priv->model);
+ GFile* file;
+ GFileInfo* file_info;
+ gboolean is_dir;
+
+ gtk_tree_model_get (file_model, iter, COLUMN_IS_DIR, &is_dir, -1);
+ if (!is_dir)
+ {
+ gchar* display;
+ gchar time_str[21];
+ gtk_tree_model_get (file_model, iter, COLUMN_FILE, &file, -1);
+ time_t time;
+
+ file_info = g_file_query_info (file,
+ "standard::*,time::changed",
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+ time = g_file_info_get_attribute_uint64(file_info, "time::changed");
+ strftime(time_str, 20, "%x %X", localtime(&time));
+
+ display = g_markup_printf_escaped("%s\n"
+ "<small><tt>%s</tt></small>",
+ g_file_info_get_display_name(file_info),
+ time_str);
+
+ gtk_tree_store_set (GTK_TREE_STORE(file_model), iter,
+ COLUMN_DISPLAY, display,
+ -1);
+
+ g_object_unref (file_info);
+ g_free(display);
+ }
+
+}
+
+static void
file_view_selection_changed (GtkTreeSelection* selection, AnjutaFileView* view)
{
+ AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
+ GtkTreeModel* file_model = GTK_TREE_MODEL(priv->model);
GtkTreeIter selected;
- GtkTreeModel* model;
+ GtkTreeModel* model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
+
+ if (priv->current_selection)
+ {
+ GtkTreeIter iter;
+ GtkTreePath* path = gtk_tree_row_reference_get_path (priv->current_selection);
+ if (path && gtk_tree_model_get_iter (file_model, &iter, path))
+ {
+ gchar* filename;
+ gtk_tree_model_get (file_model, &iter, COLUMN_FILENAME, &filename, -1);
+ gtk_tree_store_set (GTK_TREE_STORE (file_model), &iter,
+ COLUMN_DISPLAY, filename, -1);
+ g_free(filename);
+ gtk_tree_path_free(path);
+ }
+ gtk_tree_row_reference_free(priv->current_selection);
+ priv->current_selection = NULL;
+ }
+
if (gtk_tree_selection_get_selected (selection, &model, &selected))
{
- GtkTreeModel* file_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(model));
GtkTreeIter real_selection;
+ GtkTreePath* path;
gtk_tree_model_sort_convert_iter_to_child_iter(GTK_TREE_MODEL_SORT(model),
&real_selection, &selected);
+
+ path = gtk_tree_model_get_path(file_model, &real_selection);
+ priv->current_selection = gtk_tree_row_reference_new (file_model, path);
+ gtk_tree_path_free(path);
+
+ file_view_show_extended_data (view, &real_selection);
+
gchar* uri = file_model_get_uri (FILE_MODEL(file_model), &real_selection);
g_signal_emit_by_name (G_OBJECT (view), "current-uri-changed",
uri, NULL);
@@ -353,6 +355,8 @@
AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (object);
+ priv->current_selection = NULL;
+
priv->model = file_model_new (GTK_TREE_VIEW(object), NULL);
sort_model = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(priv->model));
@@ -372,12 +376,9 @@
gtk_tree_view_column_set_attributes (column, renderer_pixbuf,
"pixbuf", COLUMN_PIXBUF, NULL);
gtk_tree_view_column_set_attributes (column, renderer_text,
- "text", COLUMN_FILENAME, NULL);
+ "markup", COLUMN_DISPLAY, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (object), column);
- g_signal_connect (G_OBJECT (column), "clicked",
- G_CALLBACK (file_view_on_file_clicked), object);
-
selection =
gtk_tree_view_get_selection (GTK_TREE_VIEW (object));
g_signal_connect (selection, "changed",
Modified: trunk/plugins/file-manager/file-view.h
==============================================================================
--- trunk/plugins/file-manager/file-view.h (original)
+++ trunk/plugins/file-manager/file-view.h Fri Jun 13 20:27:45 2008
@@ -64,12 +64,17 @@
GtkWidget* file_view_new (void);
void
-file_view_refresh(AnjutaFileView* view,
- gboolean remember_open);
+file_view_rename(AnjutaFileView* view);
+
+gboolean
+file_view_can_rename(AnjutaFileView* view);
gchar*
file_view_get_selected (AnjutaFileView* view);
+void
+file_view_refresh (AnjutaFileView* view);
+
G_END_DECLS
#endif /* _FILE_VIEW_H_ */
Modified: trunk/plugins/file-manager/plugin.c
==============================================================================
--- trunk/plugins/file-manager/plugin.c (original)
+++ trunk/plugins/file-manager/plugin.c Fri Jun 13 20:27:45 2008
@@ -60,17 +60,17 @@
};
static void
-on_file_manager_refresh (GtkAction* action, AnjutaFileManager* file_manager)
+on_file_manager_rename (GtkAction* action, AnjutaFileManager* file_manager)
{
- file_view_refresh (file_manager->fv, TRUE);
+ file_view_rename (file_manager->fv);
}
static GtkActionEntry popup_actions[] =
{
{
- "ActionPopupFileManagerRefresh", GTK_STOCK_REFRESH,
- N_("_Refresh"), NULL, N_("Refresh file manager tree"),
- G_CALLBACK (on_file_manager_refresh)
+ "ActionPopupFileManagerRename", NULL,
+ N_("_Rename"), NULL, N_("Rename file or directory"),
+ G_CALLBACK (on_file_manager_rename)
}
};
@@ -96,13 +96,13 @@
if (root_uri)
{
g_object_set (G_OBJECT(file_manager->fv), "base_uri", root_uri, NULL);
- file_view_refresh (file_manager->fv, FALSE);
+ file_view_refresh (file_manager->fv);
file_manager->have_project = TRUE;
}
else
{
file_manager_set_default_uri (file_manager);
- file_view_refresh (file_manager->fv, FALSE);
+ file_view_refresh (file_manager->fv);
}
}
@@ -112,7 +112,7 @@
{
AnjutaFileManager* file_manager = (AnjutaFileManager*) plugin;
file_manager_set_default_uri (file_manager);
- file_view_refresh (file_manager->fv, FALSE);
+ file_view_refresh (file_manager->fv);
}
static void
@@ -154,10 +154,16 @@
guint32 time, AnjutaFileManager* file_manager)
{
GtkWidget *popup;
+ GtkAction *rename;
AnjutaUI* ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(file_manager)->shell,
NULL);
popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
"/PopupFileManager");
+ rename = gtk_ui_manager_get_action (GTK_UI_MANAGER (ui),
+ "ActionPopupFileManagerRename");
+ /* TODO */
+ gtk_action_set_visible (rename, FALSE);
+
g_return_if_fail (GTK_IS_WIDGET (popup));
gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, button, time);
}
@@ -178,11 +184,11 @@
if (!file_manager->have_project)
{
file_manager_set_default_uri (file_manager);
- file_view_refresh (file_manager->fv, FALSE);
+ file_view_refresh (file_manager->fv);
}
else
{
- file_view_refresh (file_manager->fv, TRUE);
+ file_view_refresh (file_manager->fv);
}
}
@@ -229,7 +235,7 @@
G_CALLBACK (on_file_view_current_uri_changed),
file_manager);
file_manager_set_default_uri (file_manager);
- file_view_refresh (file_manager->fv, FALSE);
+ file_view_refresh (file_manager->fv);
gtk_container_add (GTK_CONTAINER (file_manager->sw),
GTK_WIDGET (file_manager->fv));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]