Commit 30f5c8ef authored by Cosimo Cecchi's avatar Cosimo Cecchi

Remove unused code related to renaming

This code is not used anymore.
parent 38368bf7
......@@ -5777,28 +5777,6 @@ nautilus_canvas_container_get_icon_images (NautilusCanvasContainer *container,
return klass->get_icon_images (container, data, size, for_drag_accept, has_open_window);
}
static void
nautilus_canvas_container_freeze_updates (NautilusCanvasContainer *container)
{
NautilusCanvasContainerClass *klass;
klass = NAUTILUS_CANVAS_CONTAINER_GET_CLASS (container);
g_assert (klass->freeze_updates != NULL);
klass->freeze_updates (container);
}
static void
nautilus_canvas_container_unfreeze_updates (NautilusCanvasContainer *container)
{
NautilusCanvasContainerClass *klass;
klass = NAUTILUS_CANVAS_CONTAINER_GET_CLASS (container);
g_assert (klass->unfreeze_updates != NULL);
klass->unfreeze_updates (container);
}
static void
nautilus_canvas_container_prioritize_thumbnailing (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon)
......
......@@ -152,8 +152,6 @@ typedef struct {
int (* compare_icons_by_name) (NautilusCanvasContainer *container,
NautilusCanvasIconData *canvas_a,
NautilusCanvasIconData *canvas_b);
void (* freeze_updates) (NautilusCanvasContainer *container);
void (* unfreeze_updates) (NautilusCanvasContainer *container);
void (* prioritize_thumbnailing) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data);
......@@ -202,11 +200,6 @@ typedef struct {
void (* icon_position_changed) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data,
const NautilusCanvasPosition *position);
void (* icon_rename_started) (NautilusCanvasContainer *container,
GtkWidget *renaming_widget);
void (* icon_rename_ended) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data,
const char *text);
void (* icon_stretch_started) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data);
void (* icon_stretch_ended) (NautilusCanvasContainer *container,
......@@ -288,8 +281,6 @@ gboolean nautilus_canvas_container_has_stretch_handles (Nauti
gboolean nautilus_canvas_container_is_stretched (NautilusCanvasContainer *container);
void nautilus_canvas_container_show_stretch_handles (NautilusCanvasContainer *container);
void nautilus_canvas_container_unstretch (NautilusCanvasContainer *container);
void nautilus_canvas_container_start_renaming_selected_item (NautilusCanvasContainer *container,
gboolean select_all);
/* options */
NautilusCanvasZoomLevel nautilus_canvas_container_get_zoom_level (NautilusCanvasContainer *view);
......
......@@ -114,8 +114,6 @@ struct NautilusCanvasItemDetails {
guint rendered_is_prelit : 1;
guint rendered_is_focused : 1;
guint is_renaming : 1;
guint bounds_cached : 1;
guint is_visible : 1;
......@@ -903,8 +901,7 @@ draw_label_text (NautilusCanvasItem *item,
NULL);
/* if the canvas is highlighted, do some set-up */
if (needs_highlight &&
!details->is_renaming) {
if (needs_highlight) {
state |= GTK_STATE_FLAG_SELECTED;
frame_x = text_rect.x0;
......@@ -940,8 +937,7 @@ draw_label_text (NautilusCanvasItem *item,
x = text_rect.x0 + ((text_rect.x1 - text_rect.x0) - max_text_width) / 2;
if (have_editable &&
!details->is_renaming) {
if (have_editable) {
state = base_state;
if (prelight_label && item->details->is_prelit) {
......@@ -965,8 +961,7 @@ draw_label_text (NautilusCanvasItem *item,
gtk_style_context_restore (context);
}
if (have_additional &&
!details->is_renaming) {
if (have_additional) {
state = base_state;
if (needs_highlight) {
......@@ -1461,8 +1456,7 @@ hit_test (NautilusCanvasItem *canvas_item, EelIRect icon_rect)
}
/* Check for hit in the text. */
if (eel_irect_hits_irect (details->text_rect, icon_rect)
&& !canvas_item->details->is_renaming) {
if (eel_irect_hits_irect (details->text_rect, icon_rect)) {
return TRUE;
}
......@@ -1829,28 +1823,6 @@ nautilus_canvas_item_hit_test_rectangle (NautilusCanvasItem *item, EelIRect icon
return hit_test (item, icon_rect);
}
const char *
nautilus_canvas_item_get_editable_text (NautilusCanvasItem *canvas_item)
{
g_return_val_if_fail (NAUTILUS_IS_CANVAS_ITEM (canvas_item), NULL);
return canvas_item->details->editable_text;
}
void
nautilus_canvas_item_set_renaming (NautilusCanvasItem *item, gboolean state)
{
g_return_if_fail (NAUTILUS_IS_CANVAS_ITEM (item));
g_return_if_fail (state == FALSE || state == TRUE);
if (!item->details->is_renaming == !state) {
return;
}
item->details->is_renaming = state;
eel_canvas_item_request_update (EEL_CANVAS_ITEM (item));
}
double
nautilus_canvas_item_get_max_text_width (NautilusCanvasItem *item)
{
......
......@@ -73,9 +73,6 @@ void nautilus_canvas_item_set_emblems (NautilusCanvasItem
void nautilus_canvas_item_set_show_stretch_handles (NautilusCanvasItem *item,
gboolean show_stretch_handles);
double nautilus_canvas_item_get_max_text_width (NautilusCanvasItem *item);
const char *nautilus_canvas_item_get_editable_text (NautilusCanvasItem *canvas_item);
void nautilus_canvas_item_set_renaming (NautilusCanvasItem *canvas_item,
gboolean state);
/* geometry and hit testing */
gboolean nautilus_canvas_item_hit_test_rectangle (NautilusCanvasItem *item,
......
......@@ -153,11 +153,6 @@ struct NautilusCanvasContainerDetails {
*/
NautilusCanvasIcon *pending_icon_to_reveal;
/* If a request is made to rename an unpositioned icon we remember
* it and start renaming it once it gets positioned (in relayout).
*/
NautilusCanvasIcon *pending_icon_to_rename;
/* Remembered information about the start of the current event. */
guint32 button_down_time;
......@@ -176,11 +171,6 @@ struct NautilusCanvasContainerDetails {
NautilusCanvasIcon *range_selection_base_icon;
/* Renaming Details */
gboolean renaming;
GtkWidget *rename_widget; /* Editable text item */
char *original_text; /* Copy of editable text for later compare */
/* Idle ID. */
guint idle_id;
......
......@@ -408,24 +408,6 @@ nautilus_canvas_view_container_compare_icons_by_name (NautilusCanvasContainer *c
FALSE, FALSE);
}
static void
nautilus_canvas_view_container_freeze_updates (NautilusCanvasContainer *container)
{
NautilusCanvasView *canvas_view;
canvas_view = get_canvas_view (container);
g_return_if_fail (canvas_view != NULL);
nautilus_view_freeze_updates (NAUTILUS_VIEW (canvas_view));
}
static void
nautilus_canvas_view_container_unfreeze_updates (NautilusCanvasContainer *container)
{
NautilusCanvasView *canvas_view;
canvas_view = get_canvas_view (container);
g_return_if_fail (canvas_view != NULL);
nautilus_view_unfreeze_updates (NAUTILUS_VIEW (canvas_view));
}
static void
nautilus_canvas_view_container_class_init (NautilusCanvasViewContainerClass *klass)
{
......@@ -442,8 +424,6 @@ nautilus_canvas_view_container_class_init (NautilusCanvasViewContainerClass *kla
ic_class->compare_icons = nautilus_canvas_view_container_compare_icons;
ic_class->compare_icons_by_name = nautilus_canvas_view_container_compare_icons_by_name;
ic_class->freeze_updates = nautilus_canvas_view_container_freeze_updates;
ic_class->unfreeze_updates = nautilus_canvas_view_container_unfreeze_updates;
}
static void
......
......@@ -174,13 +174,6 @@ nautilus_empty_view_can_zoom_out (NautilusView *view)
return FALSE;
}
static void
nautilus_empty_view_start_renaming_file (NautilusView *view,
NautilusFile *file,
gboolean select_all)
{
}
static void
nautilus_empty_view_click_policy_changed (NautilusView *directory_view)
{
......@@ -265,7 +258,6 @@ nautilus_empty_view_class_init (NautilusEmptyViewClass *class)
nautilus_view_class->set_selection = nautilus_empty_view_set_selection;
nautilus_view_class->compare_files = nautilus_empty_view_compare_files;
nautilus_view_class->sort_directories_first_changed = nautilus_empty_view_sort_directories_first_changed;
nautilus_view_class->start_renaming_file = nautilus_empty_view_start_renaming_file;
nautilus_view_class->get_zoom_level = nautilus_empty_view_get_zoom_level;
nautilus_view_class->zoom_to_level = nautilus_empty_view_zoom_to_level;
nautilus_view_class->end_file_changes = nautilus_empty_view_end_file_changes;
......
......@@ -69,7 +69,6 @@ struct NautilusListViewDetails {
GtkCellRendererPixbuf *pixbuf_cell;
GtkCellRendererText *file_name_cell;
GList *cells;
GtkCellEditable *editable_widget;
NautilusListZoomLevel zoom_level;
......@@ -95,10 +94,6 @@ struct NautilusListViewDetails {
char *original_name;
NautilusFile *renaming_file;
gboolean rename_done;
guint renaming_file_activate_timeout;
gulong clipboard_handler_id;
GQuark last_sort_attr;
......@@ -119,9 +114,6 @@ struct SelectionForeachData {
/* We wait two seconds after row is collapsed to unload the subdirectory */
#define COLLAPSE_TO_UNLOAD_DELAY 2
/* Wait for the rename to end when activating a file being renamed */
#define WAIT_FOR_RENAME_ON_ACTIVATE 200
static GdkCursor * hand_cursor = NULL;
static GtkTargetList * source_target_list = NULL;
......@@ -132,10 +124,6 @@ static void nautilus_list_view_set_zoom_level (NautilusListVi
NautilusListZoomLevel new_level);
static void nautilus_list_view_scroll_to_file (NautilusListView *view,
NautilusFile *file);
static void nautilus_list_view_rename_callback (NautilusFile *file,
GFile *result_location,
GError *error,
gpointer callback_data);
static void apply_columns_settings (NautilusListView *list_view,
char **column_order,
......@@ -255,23 +243,6 @@ activate_selected_items (NautilusListView *view)
GList *file_list;
file_list = nautilus_list_view_get_selection (NAUTILUS_VIEW (view));
if (view->details->renaming_file) {
/* We're currently renaming a file, wait until the rename is
finished, or the activation uri will be wrong */
if (view->details->renaming_file_activate_timeout == 0) {
view->details->renaming_file_activate_timeout =
g_timeout_add (WAIT_FOR_RENAME_ON_ACTIVATE, (GSourceFunc) activate_selected_items, view);
}
return;
}
if (view->details->renaming_file_activate_timeout != 0) {
g_source_remove (view->details->renaming_file_activate_timeout);
view->details->renaming_file_activate_timeout = 0;
}
nautilus_view_activate_files (NAUTILUS_VIEW (view),
file_list,
0, TRUE);
......@@ -1255,106 +1226,6 @@ sort_column_changed_callback (GtkTreeSortable *sortable,
view->details->last_sort_attr = sort_attr;
}
static gboolean
editable_focus_out_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
NautilusListView *view = user_data;
view->details->editable_widget = NULL;
nautilus_view_set_is_renaming (NAUTILUS_VIEW (view), FALSE);
nautilus_view_unfreeze_updates (NAUTILUS_VIEW (view));
return FALSE;
}
static void
cell_renderer_editing_started_cb (GtkCellRenderer *renderer,
GtkCellEditable *editable,
const gchar *path_str,
NautilusListView *list_view)
{
GtkEntry *entry;
entry = GTK_ENTRY (editable);
list_view->details->editable_widget = editable;
/* Free a previously allocated original_name */
g_free (list_view->details->original_name);
list_view->details->original_name = g_strdup (gtk_entry_get_text (entry));
g_signal_connect (entry, "focus-out-event",
G_CALLBACK (editable_focus_out_cb), list_view);
}
static void
cell_renderer_editing_canceled (GtkCellRendererText *cell,
NautilusListView *view)
{
view->details->editable_widget = NULL;
nautilus_view_set_is_renaming (NAUTILUS_VIEW (view), FALSE);
nautilus_view_unfreeze_updates (NAUTILUS_VIEW (view));
}
static void
cell_renderer_edited (GtkCellRendererText *cell,
const char *path_str,
const char *new_text,
NautilusListView *view)
{
GtkTreePath *path;
NautilusFile *file;
GtkTreeIter iter;
view->details->editable_widget = NULL;
nautilus_view_set_is_renaming (NAUTILUS_VIEW (view), FALSE);
/* Don't allow a rename with an empty string. Revert to original
* without notifying the user.
*/
if (new_text[0] == '\0') {
g_object_set (G_OBJECT (view->details->file_name_cell),
"editable", FALSE,
NULL);
nautilus_view_unfreeze_updates (NAUTILUS_VIEW (view));
return;
}
path = gtk_tree_path_new_from_string (path_str);
gtk_tree_model_get_iter (GTK_TREE_MODEL (view->details->model),
&iter, path);
gtk_tree_path_free (path);
gtk_tree_model_get (GTK_TREE_MODEL (view->details->model),
&iter,
NAUTILUS_LIST_MODEL_FILE_COLUMN, &file,
-1);
/* Only rename if name actually changed */
if (strcmp (new_text, view->details->original_name) != 0) {
view->details->renaming_file = nautilus_file_ref (file);
view->details->rename_done = FALSE;
nautilus_rename_file (file, new_text, nautilus_list_view_rename_callback, g_object_ref (view));
g_free (view->details->original_name);
view->details->original_name = g_strdup (new_text);
}
nautilus_file_unref (file);
/*We're done editing - make the filename-cells readonly again.*/
g_object_set (G_OBJECT (view->details->file_name_cell),
"editable", FALSE,
NULL);
nautilus_view_unfreeze_updates (NAUTILUS_VIEW (view));
}
static char *
get_root_uri_callback (NautilusTreeViewDragDest *dest,
gpointer user_data)
......@@ -2079,10 +1950,6 @@ create_and_set_up_tree_view (NautilusListView *view)
"xpad", 5,
NULL);
g_signal_connect (cell, "edited", G_CALLBACK (cell_renderer_edited), view);
g_signal_connect (cell, "editing-canceled", G_CALLBACK (cell_renderer_editing_canceled), view);
g_signal_connect (cell, "editing-started", G_CALLBACK (cell_renderer_editing_started_cb), view);
gtk_tree_view_column_pack_start (view->details->file_name_column, cell, TRUE);
gtk_tree_view_column_set_cell_data_func (view->details->file_name_column, cell,
(GtkTreeCellDataFunc) filename_cell_data_func,
......@@ -2348,24 +2215,6 @@ nautilus_list_view_begin_loading (NautilusView *view)
set_columns_settings_from_metadata_and_preferences (list_view);
}
static void
stop_cell_editing (NautilusListView *list_view)
{
GtkTreeViewColumn *column;
/* Stop an ongoing rename to commit the name changes when the user
* changes directories without exiting cell edit mode. It also prevents
* the edited handler from being called on the cleared list model.
*/
column = list_view->details->file_name_column;
if (column != NULL && list_view->details->editable_widget != NULL &&
GTK_IS_CELL_EDITABLE (list_view->details->editable_widget)) {
gtk_cell_editable_editing_done (list_view->details->editable_widget);
}
g_clear_object (&list_view->details->renaming_file);
}
static void
nautilus_list_view_clear (NautilusView *view)
{
......@@ -2374,67 +2223,18 @@ nautilus_list_view_clear (NautilusView *view)
list_view = NAUTILUS_LIST_VIEW (view);
if (list_view->details->model != NULL) {
stop_cell_editing (list_view);
nautilus_list_model_clear (list_view->details->model);
}
}
static void
nautilus_list_view_rename_callback (NautilusFile *file,
GFile *result_location,
GError *error,
gpointer callback_data)
{
NautilusListView *view;
view = NAUTILUS_LIST_VIEW (callback_data);
if (view->details->renaming_file) {
view->details->rename_done = TRUE;
if (error != NULL) {
/* If the rename failed (or was cancelled), kill renaming_file.
* We won't get a change event for the rename, so otherwise
* it would stay around forever.
*/
nautilus_file_unref (view->details->renaming_file);
view->details->renaming_file = NULL;
}
}
g_object_unref (view);
}
static void
nautilus_list_view_file_changed (NautilusView *view, NautilusFile *file, NautilusDirectory *directory)
{
NautilusListView *listview;
GtkTreeIter iter;
GtkTreePath *file_path;
listview = NAUTILUS_LIST_VIEW (view);
nautilus_list_model_file_changed (listview->details->model, file, directory);
if (listview->details->renaming_file != NULL &&
file == listview->details->renaming_file &&
listview->details->rename_done) {
/* This is (probably) the result of the rename operation, and
* the tree-view changes above could have resorted the list, so
* scroll to the new position
*/
if (nautilus_list_model_get_tree_iter_from_file (listview->details->model, file, directory, &iter)) {
file_path = gtk_tree_model_get_path (GTK_TREE_MODEL (listview->details->model), &iter);
gtk_tree_view_scroll_to_cell (listview->details->tree_view,
file_path, NULL,
FALSE, 0.0, 0.0);
gtk_tree_path_free (file_path);
}
nautilus_file_unref (listview->details->renaming_file);
listview->details->renaming_file = NULL;
}
}
typedef struct {
......@@ -3257,7 +3057,6 @@ nautilus_list_view_dispose (GObject *object)
list_view = NAUTILUS_LIST_VIEW (object);
if (list_view->details->model) {
stop_cell_editing (list_view);
g_object_unref (list_view->details->model);
list_view->details->model = NULL;
}
......@@ -3267,11 +3066,6 @@ nautilus_list_view_dispose (GObject *object)
list_view->details->drag_dest = NULL;
}
if (list_view->details->renaming_file_activate_timeout != 0) {
g_source_remove (list_view->details->renaming_file_activate_timeout);
list_view->details->renaming_file_activate_timeout = 0;
}
if (list_view->details->clipboard_handler_id != 0) {
g_signal_handler_disconnect (nautilus_clipboard_monitor_get (),
list_view->details->clipboard_handler_id);
......
......@@ -203,16 +203,6 @@ struct NautilusViewDetails
gboolean templates_present;
gboolean scripts_present;
/* flag to indicate that no file updates should be dispatched to subclasses.
* This is a workaround for bug #87701 that prevents the list view from
* losing focus when the underlying GtkTreeView is updated.
*/
gboolean updates_frozen;
guint updates_queued;
gboolean needs_reload;
gboolean is_renaming;
gboolean sort_directories_first;
gboolean show_foreign_files;
......@@ -3331,12 +3321,6 @@ process_old_files (NautilusView *view)
static void
display_pending_files (NautilusView *view)
{
/* Don't dispatch any updates while the view is frozen. */
if (view->details->updates_frozen) {
return;
}
process_new_files (view);
process_old_files (view);
......@@ -3347,29 +3331,6 @@ display_pending_files (NautilusView *view)
}
}
void
nautilus_view_freeze_updates (NautilusView *view)
{
view->details->updates_frozen = TRUE;
view->details->updates_queued = 0;
view->details->needs_reload = FALSE;
}
void
nautilus_view_unfreeze_updates (NautilusView *view)
{
view->details->updates_frozen = FALSE;
if (view->details->needs_reload) {
view->details->needs_reload = FALSE;
if (view->details->model != NULL) {
load_directory (view, view->details->model);
}
} else {
schedule_idle_display_of_pending_files (view);
}
}
static gboolean
display_selection_info_idle_callback (gpointer data)
{
......@@ -3486,24 +3447,6 @@ queue_pending_files (NautilusView *view,
return;
}
/* Don't queue any more updates if we need to reload anyway */
if (view->details->needs_reload) {
return;
}
if (view->details->updates_frozen) {
view->details->updates_queued += g_list_length (files);
/* Mark the directory for reload when there are too much queued
* changes to prevent the pending list from growing infinitely.
*/
if (view->details->updates_queued > MAX_QUEUED_UPDATES) {
view->details->needs_reload = TRUE;
return;
}
}
*pending_list = g_list_concat (file_and_directory_list_from_files (directory, files),
*pending_list);
......@@ -3890,19 +3833,6 @@ can_rename_file (NautilusView *view, NautilusFile *file)
return nautilus_file_can_rename (file);
}
gboolean
nautilus_view_get_is_renaming (NautilusView *view)
{
return view->details->is_renaming;
}
void
nautilus_view_set_is_renaming (NautilusView *view,
gboolean is_renaming)
{
view->details->is_renaming = is_renaming;
}
static void
open_one_in_new_window (gpointer data, gpointer callback_data)
{
......
......@@ -327,11 +327,6 @@ void nautilus_view_set_show_foreign (NautilusView
gboolean nautilus_view_handle_scroll_event (NautilusView *view,
GdkEventScroll *event);
void nautilus_view_freeze_updates (NautilusView *view);
void nautilus_view_unfreeze_updates (NautilusView *view);
gboolean nautilus_view_get_is_renaming (NautilusView *view);
void nautilus_view_set_is_renaming (NautilusView *view,
gboolean renaming);
void nautilus_view_add_subdirectory (NautilusView *view,
NautilusDirectory*directory);
void nautilus_view_remove_subdirectory (NautilusView *view,
......
......@@ -2304,17 +2304,6 @@ nautilus_window_key_press_event (GtkWidget *widget,
active_slot = nautilus_window_get_active_slot (window);
view = nautilus_window_slot_get_view (active_slot);
if (view != NULL && nautilus_view_get_is_renaming (view)) {
/* if we're renaming, just forward the event to the
* focused widget and return. We don't want to process the window
* accelerator bindings, as they might conflict with the
* editable widget bindings.
*/
if (gtk_window_propagate_key_event (GTK_WINDOW (window), event)) {
return TRUE;
}
}
focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
if (view != NULL && focus_widget != NULL &&
GTK_IS_EDITABLE (focus_widget)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment