[nautilus/refactor] view: remove useless virtual methods
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/refactor] view: remove useless virtual methods
- Date: Mon, 10 Jan 2011 12:02:21 +0000 (UTC)
commit e0c108be2f64650995df6ad7aa7946b898cd92ae
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Dec 31 19:06:20 2010 +0100
view: remove useless virtual methods
No need for some internal methods to be virtual if they're never
overridden.
Also, some of this code does nothing.
src/file-manager/fm-icon-container.c | 2 +-
src/nautilus-view.c | 79 ++++++++++------------------------
src/nautilus-view.h | 20 +--------
3 files changed, 25 insertions(+), 76 deletions(-)
---
diff --git a/src/file-manager/fm-icon-container.c b/src/file-manager/fm-icon-container.c
index e310b46..36867d4 100644
--- a/src/file-manager/fm-icon-container.c
+++ b/src/file-manager/fm-icon-container.c
@@ -99,7 +99,7 @@ fm_icon_container_get_icon_images (NautilusIconContainer *container,
flags |= NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT;
}
- emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude
+ emblems_to_ignore = nautilus_view_get_emblem_names_to_exclude
(FM_DIRECTORY_VIEW (icon_view));
emblem_icons = nautilus_file_get_emblem_icons (file,
emblems_to_ignore);
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 06471aa..7d962eb 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -525,16 +525,6 @@ fm_directory_view_supports_creating_files (FMDirectoryView *view)
}
static gboolean
-fm_directory_view_supports_properties (FMDirectoryView *view)
-{
- g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
-
- return EEL_CALL_METHOD_WITH_RETURN_VALUE
- (FM_DIRECTORY_VIEW_CLASS, view,
- supports_properties, (view));
-}
-
-static gboolean
fm_directory_view_is_empty (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -702,13 +692,25 @@ nautilus_view_scroll_to_file (NautilusView *view,
}
char **
-fm_directory_view_get_emblem_names_to_exclude (FMDirectoryView *view)
+nautilus_view_get_emblem_names_to_exclude (NautilusView *view)
{
- g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NULL);
+ char **excludes;
+ int i;
+
+ g_assert (FM_IS_DIRECTORY_VIEW (view));
- return EEL_CALL_METHOD_WITH_RETURN_VALUE
- (FM_DIRECTORY_VIEW_CLASS, view,
- get_emblem_names_to_exclude, (view));
+ excludes = g_new (char *, 3);
+
+ i = 0;
+ excludes[i++] = g_strdup (NAUTILUS_FILE_EMBLEM_NAME_TRASH);
+
+ if (!nautilus_file_can_write (view->details->directory_as_file)) {
+ excludes[i++] = g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE);
+ }
+
+ excludes[i++] = NULL;
+
+ return excludes;
}
void
@@ -3276,7 +3278,9 @@ copy_move_done_callback (GHashTable *debuting_files, gpointer data)
}
static gboolean
-real_file_still_belongs (FMDirectoryView *view, NautilusFile *file, NautilusDirectory *directory)
+view_file_still_belongs (FMDirectoryView *view,
+ NautilusFile *file,
+ NautilusDirectory *directory)
{
if (view->details->model != directory &&
g_list_find (view->details->subdirectory_list, directory) == NULL) {
@@ -3289,8 +3293,8 @@ real_file_still_belongs (FMDirectoryView *view, NautilusFile *file, NautilusDire
static gboolean
still_should_show_file (FMDirectoryView *view, NautilusFile *file, NautilusDirectory *directory)
{
- return fm_directory_view_should_show_file (view, file)
- && EEL_INVOKE_METHOD (FM_DIRECTORY_VIEW_CLASS, view, file_still_belongs, (view, file, directory));
+ return fm_directory_view_should_show_file (view, file) &&
+ view_file_still_belongs (view, file, directory);
}
static gboolean
@@ -8320,9 +8324,6 @@ real_update_location_menu (FMDirectoryView *view)
update_restore_from_trash_action (action, &l, TRUE);
real_update_location_menu_volumes (view);
-
- /* we silently assume that fm_directory_view_supports_properties always returns the same value.
- * Therefore, we don't update the sensitivity of FM_ACTION_LOCATION_PROPERTIES */
}
static void
@@ -8660,8 +8661,7 @@ real_update_menus (FMDirectoryView *view)
selection_count),
NULL);
- show_properties = (!FM_IS_DESKTOP_ICON_VIEW (view) || selection_count > 0) &&
- fm_directory_view_supports_properties (view);
+ show_properties = (!FM_IS_DESKTOP_ICON_VIEW (view) || selection_count > 0);
action = gtk_action_group_get_action (view->details->dir_action_group,
FM_ACTION_PROPERTIES);
@@ -9280,28 +9280,6 @@ metadata_for_files_in_directory_ready_callback (NautilusDirectory *directory,
finish_loading_if_all_metadata_loaded (view);
}
-static char **
-real_get_emblem_names_to_exclude (FMDirectoryView *view)
-{
- char **excludes;
- int i;
-
- g_assert (FM_IS_DIRECTORY_VIEW (view));
-
- excludes = g_new (char *, 3);
-
- i = 0;
- excludes[i++] = g_strdup (NAUTILUS_FILE_EMBLEM_NAME_TRASH);
-
- if (!nautilus_file_can_write (view->details->directory_as_file)) {
- excludes[i++] = g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE);
- }
-
- excludes[i++] = NULL;
-
- return excludes;
-}
-
static void
disconnect_handler (GObject *object, int *id)
{
@@ -9455,14 +9433,6 @@ real_supports_creating_files (FMDirectoryView *view)
}
static gboolean
-real_supports_properties (FMDirectoryView *view)
-{
- g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
-
- return TRUE;
-}
-
-static gboolean
real_supports_zooming (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -9859,15 +9829,12 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- klass->file_still_belongs = real_file_still_belongs;
- klass->get_emblem_names_to_exclude = real_get_emblem_names_to_exclude;
klass->get_selected_icon_locations = real_get_selected_icon_locations;
klass->is_read_only = real_is_read_only;
klass->load_error = real_load_error;
klass->can_rename_file = can_rename_file;
klass->start_renaming_file = start_renaming_file;
klass->supports_creating_files = real_supports_creating_files;
- klass->supports_properties = real_supports_properties;
klass->supports_zooming = real_supports_zooming;
klass->using_manual_layout = real_using_manual_layout;
klass->merge_menus = real_merge_menus;
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 2ebcc4e..230fc65 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -240,20 +240,6 @@ struct FMDirectoryViewClass {
NautilusFile *a,
NautilusFile *b);
- /* get_emblem_names_to_exclude is a function pointer that subclasses
- * may override to specify a set of emblem names that should not
- * be displayed with each file. By default, all emblems returned by
- * NautilusFile are displayed.
- */
- char ** (* get_emblem_names_to_exclude) (FMDirectoryView *view);
-
- /* supports_properties is a function pointer that subclasses may
- * override to control whether the "Show Properties" menu item
- * should be enabled for selected items. The default implementation
- * returns TRUE.
- */
- gboolean (* supports_properties) (FMDirectoryView *view);
-
/* supports_zooming is a function pointer that subclasses may
* override to control whether or not the zooming control and
* menu items should be enabled. The default implementation
@@ -298,10 +284,6 @@ struct FMDirectoryViewClass {
NautilusFile *file,
gboolean select_all);
- gboolean (* file_still_belongs) (FMDirectoryView *view,
- NautilusFile *file,
- NautilusDirectory *directory);
-
/* convert *point from widget's coordinate system to a coordinate
* system used for specifying file operation positions, which is view-specific.
*
@@ -372,7 +354,6 @@ void fm_directory_view_start_batching_selection_changes (FMDirect
void fm_directory_view_stop_batching_selection_changes (FMDirectoryView *view);
void fm_directory_view_notify_selection_changed (FMDirectoryView *view);
GtkUIManager * fm_directory_view_get_ui_manager (FMDirectoryView *view);
-char ** fm_directory_view_get_emblem_names_to_exclude (FMDirectoryView *view);
NautilusDirectory *fm_directory_view_get_model (FMDirectoryView *view);
NautilusFile *fm_directory_view_get_directory_as_file (FMDirectoryView *view);
void fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view,
@@ -429,6 +410,7 @@ void nautilus_view_load_location (NautilusView *v
GFile *location);
void nautilus_view_stop_loading (NautilusView *view);
+char ** nautilus_view_get_emblem_names_to_exclude (NautilusView *view);
char * nautilus_view_get_first_visible_file (NautilusView *view);
void nautilus_view_scroll_to_file (NautilusView *view,
const char *uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]