mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-21 16:52:32 +00:00
c885369012
ask questions and perform actions, even though only the FMDirectoryViewIcons knows how to answer the questions and perform the actions. Replaced use of nautilus_file_get_info with specific accessors for various file info. * libnautilus/Makefile.am: libnautilus/nautilus-icons-controller.h: libnautilus/nautilus-icons-controller.c: libnautilus/gnome-icon-container-private.h: libnautilus/gnome-icon-container.h: libnautilus/gnome-icon-container.c: (icon_new_pixbuf): (gnome_icon_container_new): (gnome_icon_container_add): (gnome_icon_container_add_auto): Added NautilusIconsController, an interface provided so that the file manager can connect the icons up with the file code. This is all so we can keep the view/controller separation. This eliminates the need to pass around the icon name all the time, so the signals have changed to not take the icon name as a parameter. * src/file-manager/Makefile.am: src/file-manager/fm-icons-controller.c: src/file-manager/fm-icons-controller.h: Added FMIconsController, the actual controller used by the file manager instance of GnomeIconContainer. src/file-manager/fm-directory-view-icons.c: (create_icon_container): (add_icon_if_already_positioned): (add_icon_at_free_position): (icon_container_activate_cb): (fm_directory_view_icons_icon_moved_cb): Create and use the FMIconController. * libnautilus/gnome-icon-container-private.h: libnautilus/gnome-icon-container-dnd.c: (set_gnome_icon_list_selection): (set_uri_list_selection): libnautilus/gnome-icon-container.c: (gnome_icon_container_set_base_uri): src/file-manager/fm-directory-view-icons.c: (set_up_base_uri): (fm_directory_view_icons_begin_loading): Get rid of the old base_uri technique for handling drags. Instead the icon controller supplies URIs for icons when requested. * RENAMING: Proposed that we use NautilusIconsView as the new name for GnomeIconContainer instead of NautilusIconContainer. * libnautilus/gnome-icon-container-private.h: libnautilus/gnome-icon-container.h: libnautilus/gnome-icon-container.c: (gnome_icon_container_initialize): (handle_icon_enter_notify): (handle_icon_leave_notify): Renamed browser mode to linger selection mode. * libnautilus/gnome-icon-container-private.h: libnautilus/gnome-icon-container.h: libnautilus/gnome-icon-container.c: (icon_configure): (icon_position): (change_icon_mode): (gnome_icon_container_initialize): (gnome_icon_container_set_icon_mode): (gnome_icon_container_get_icon_mode): src/file-manager/fm-directory-view-icons.c: (fm_directory_view_icons_initialize): Got rid of icon mode, since we won't be using it. * libnautilus/gnome-icon-container-dnd.c: (get_gnome_icon_list_selection): Changed geometry parsing so it will not ignore extra characters after the numeric geometry. (gnome_icon_container_receive_dropped_icons): The code here tried to work when dragging icons between windows, but the implementation was actually only good within the same window, so I modified it to check for that case. * libnautilus/gnome-icon-container-dnd.c: (create_selection_shadow): (set_gnome_icon_list_selection): libnautilus/gnome-icon-container.c: (icon_position): Renamed GNOME_ICON_CONTAINER_ICON_XOFFSET to GNOME_ICON_CONTAINER_ICON_X_OFFSET and GNOME_ICON_CONTAINER_ICON_YOFFSET to GNOME_ICON_CONTAINER_ICON_Y_OFFSET. We use an underscore between words in identifiers. * libnautilus/gnome-icon-container.c: (destroy): Added code to remove timeouts and idles when the container is destroyed. * libnautilus/nautilus-directory.h: libnautilus/nautilus-directory.c: (nautilus_file_get_info): Get rid of the direct call to get GnomeVFSFileInfo. All info is accessed through individual functions. (nautilus_file_get_size): (nautilus_file_get_type): (nautilus_file_get_mime_type): (nautilus_file_is_executable): (nautilus_file_is_symbolic_link): Added new accessor functions as needed. src/file-manager/fm-directory-view.c: (display_selection_info): src/file-manager/fm-icon-cache.c: (fm_icon_cache_get_icon_set_for_file): (fm_icon_cache_get_icon_for_file): Change code to use the accessors instead of get_info. * libnautilus/nautilus-gtk-macros.h: (NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL): Changed macro to take a class pointer of the right type instead of taking both a casting macro name and a class pointer. src/file-manager/fm-directory-view.c: (fm_directory_view_initialize_class): Changed existing uses of macro to match. * src/file-manager/Makefile.am: src/file-manager/fm-icon-cache.c: src/file-manager/fm-default-file-icon.h: src/file-manager/fm-default-file-icon.c: Moved the default icon into its own file.
79 lines
2.8 KiB
C
79 lines
2.8 KiB
C
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
|
|
|
|
nautilus-icons-controller.c: Abstract interface for getting information
|
|
about icons in NautilusIconsView (GnomeIconContainer).
|
|
|
|
Copyright (C) 2000 Eazel, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public
|
|
License along with this program; if not, write to the
|
|
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
Author: Darin Adler <darin@eazel.com>
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include "nautilus-icons-controller.h"
|
|
|
|
#include "nautilus-gtk-macros.h"
|
|
|
|
static void nautilus_icons_controller_initialize_class (NautilusIconsControllerClass *klass);
|
|
static void nautilus_icons_controller_initialize (NautilusIconsController *controller);
|
|
|
|
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconsController, nautilus_icons_controller, GTK_TYPE_OBJECT)
|
|
|
|
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_image)
|
|
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_name)
|
|
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_uri)
|
|
|
|
static void
|
|
nautilus_icons_controller_initialize_class (NautilusIconsControllerClass *klass)
|
|
{
|
|
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_image);
|
|
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_name);
|
|
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_uri);
|
|
}
|
|
|
|
static void
|
|
nautilus_icons_controller_initialize (NautilusIconsController *controller)
|
|
{
|
|
}
|
|
|
|
GdkPixbuf *
|
|
nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
|
|
NautilusControllerIcon *icon)
|
|
{
|
|
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_image)
|
|
(controller, icon);
|
|
}
|
|
|
|
char *
|
|
nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
|
|
NautilusControllerIcon *icon)
|
|
{
|
|
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_name)
|
|
(controller, icon);
|
|
}
|
|
|
|
char *
|
|
nautilus_icons_controller_get_icon_uri (NautilusIconsController *controller,
|
|
NautilusControllerIcon *icon)
|
|
{
|
|
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_uri)
|
|
(controller, icon);
|
|
}
|