Commit 612168d1 authored by Darin Adler's avatar Darin Adler
Browse files

Fixed a bug that was causing some icons to not get selected or unselected

	* libnautilus/gnome-icon-container.c:
	(icon_select):
	Fixed a bug that was causing some icons to not get
	selected or unselected properly due to strangeness of
	bit fields.

	* libnautilus/gnome-progressive-loader.h:
	libnautilus/gnome-progressive-loader.c:
	libnautilus/Makefile.am:
	Got rid of GnomeProgressiveLoader.
	We're not going to use it.

	* RENAMING: Andy added a new file that matched RENAMING,
	but then I changed my mind about a renaming, spawning yet
	more renaming!

	* src/file-manager/fm-directory-view-icons.c:
	Just tiny reformatting.
parent f588a6af
......@@ -7,6 +7,7 @@ ExplorerLocationBar -> NautilusLocationBar
FMIconCache -> NautilusIconFactory
GnomeIconContainer -> NautilusIconContainer
NautilusIconsViewIconItem -> NautilusIconContainerItem
GtkFList -> NautilusList
FMDirectoryViewIcons -> FMDirectoryIconView
......
......@@ -27,8 +27,6 @@ libnautilusinclude_HEADERS= \
gnome-icon-container-dnd.h \
gnome-icon-container-private.h \
gnome-icon-container.h \
gnome-progressive-loader.c \
gnome-progressive-loader.h \
gtkflist.h \
gtkscrollframe.h \
nautilus.h \
......
......@@ -28,9 +28,7 @@
#include "gnome-icon-container.h"
#include "gnome-icon-container-private.h"
#include "gnome-icon-container-dnd.h"
#include "nautilus-icons-view-icon-item.h"
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtksignal.h>
......@@ -40,8 +38,9 @@
#include "nautilus-gtk-macros.h"
/* for memset */
#include <string.h>
#include "gnome-icon-container-private.h"
#include "gnome-icon-container-dnd.h"
#include "nautilus-icons-view-icon-item.h"
/* Interval for updating the rubberband selection, in milliseconds. */
#define RUBBERBAND_TIMEOUT_INTERVAL 10
......@@ -192,10 +191,16 @@ static gboolean
icon_select (GnomeIconContainerIcon *icon,
gboolean select)
{
if (select == icon->is_selected)
/* Since is_selected is a bit field, we have to do the ! business
* to be sure we have either a 1 or a 0. Similarly, the caller
* might pass a value other than 1 or 0 so we have to pass do the
* same thing there.
*/
if (!select == !icon->is_selected)
return FALSE;
icon_toggle_selected (icon);
g_assert (!select == !icon->is_selected);
return TRUE;
}
......@@ -2722,6 +2727,7 @@ gnome_icon_container_get_icon_by_uri (GnomeIconContainer *container,
/* Eventually, we must avoid searching the entire icon list,
but it's OK for now.
A hash table mapping uri to icon is one possibility.
*/
details = container->details;
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-progressive-loader.c
*
* Copyright (C) 1999, 2000 Free Software Foundaton
*
* 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: Ettore Perazzoli
*/
/* FIXME this is just a quick hack. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gnome.h>
#include "gnome-progressive-loader.h"
static BonoboObjectClass *parent_class = NULL;
POA_Bonobo_ProgressiveLoader__epv bonobo_progressive_loader_epv;
POA_Bonobo_ProgressiveLoader__vepv bonobo_progressive_loader_vepv;
static void
impl_load (PortableServer_Servant servant,
const CORBA_char *uri,
Bonobo_ProgressiveDataSink pdsink,
CORBA_Environment *ev)
{
BonoboObject *object;
BonoboProgressiveLoader *loader;
GnomeVFSResult result;
Bonobo_ProgressiveLoader_Error *exception;
object = bonobo_object_from_servant (servant);
loader = BONOBO_PROGRESSIVE_LOADER (object);
result = (* loader->load_fn) (loader, uri, pdsink);
if (result == GNOME_VFS_OK)
return;
exception = g_new (Bonobo_ProgressiveLoader_Error, 1);
exception->vfs_result = result;
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_ProgressiveLoader_Error,
exception);
}
static Bonobo_ProgressiveLoader
create_Bonobo_ProgressiveLoader (BonoboObject *object)
{
POA_Bonobo_ProgressiveLoader *servant;
CORBA_Environment ev;
servant = (POA_Bonobo_ProgressiveLoader *) g_new (BonoboObjectServant, 1);
servant->vepv = &bonobo_progressive_loader_vepv;
CORBA_exception_init (&ev);
POA_Bonobo_ProgressiveLoader__init ((PortableServer_Servant) servant,
&ev);
if (ev._major != CORBA_NO_EXCEPTION){
g_free (servant);
CORBA_exception_free (&ev);
return CORBA_OBJECT_NIL;
}
CORBA_exception_free (&ev);
return (Bonobo_ProgressiveLoader) bonobo_object_activate_servant
(object, servant);
}
/* GtkObject methods. */
static void
destroy (GtkObject *object)
{
BonoboProgressiveLoader *loader;
loader = BONOBO_PROGRESSIVE_LOADER (object);
/* Nothing special. */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
corba_class_init (void)
{
bonobo_progressive_loader_epv.load = impl_load;
bonobo_progressive_loader_vepv.Bonobo_ProgressiveLoader_epv
= &bonobo_progressive_loader_epv;
}
static void
class_init (BonoboProgressiveLoaderClass *class)
{
GtkObjectClass *object_class;
parent_class = gtk_type_class (bonobo_object_get_type ());
object_class = GTK_OBJECT_CLASS (class);
object_class->destroy = destroy;
corba_class_init ();
}
static void
init (BonoboProgressiveLoader *progressive_loader)
{
}
GtkType
bonobo_progressive_loader_get_type (void)
{
static GtkType type = 0;
if (type == 0) {
static const GtkTypeInfo info = {
"IDL:GNOME/ProgressiveLoader:1.0",
sizeof (BonoboProgressiveLoader),
sizeof (BonoboProgressiveLoaderClass),
(GtkClassInitFunc) class_init,
(GtkObjectInitFunc) init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
type = gtk_type_unique (bonobo_object_get_type (), &info);
}
return type;
}
gboolean
bonobo_progressive_loader_construct (BonoboProgressiveLoader *loader,
Bonobo_ProgressiveLoader corba_loader,
BonoboProgressiveLoaderLoadFn load_fn)
{
g_return_val_if_fail (loader != NULL, FALSE);
g_return_val_if_fail (BONOBO_IS_PROGRESSIVE_LOADER (loader), FALSE);
g_return_val_if_fail (corba_loader != CORBA_OBJECT_NIL, FALSE);
g_return_val_if_fail (load_fn != NULL, FALSE);
bonobo_object_construct (BONOBO_OBJECT (loader), corba_loader);
if (corba_loader == CORBA_OBJECT_NIL) {
corba_loader = create_Bonobo_ProgressiveLoader (BONOBO_OBJECT (loader));
if (corba_loader == CORBA_OBJECT_NIL)
return FALSE;
}
loader->load_fn = load_fn;
return TRUE;
}
BonoboProgressiveLoader *
bonobo_progressive_loader_new (BonoboProgressiveLoaderLoadFn load_fn)
{
BonoboProgressiveLoader *loader;
g_return_val_if_fail (load_fn != NULL, NULL);
loader = gtk_type_new (bonobo_progressive_loader_get_type ());
if (! bonobo_progressive_loader_construct (loader, CORBA_OBJECT_NIL,
load_fn)) {
gtk_object_destroy (GTK_OBJECT (loader));
return NULL;
}
return loader;
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-progressive-loader.h
*
* Copyright (C) 1999, 2000 Free Software Foundaton
*
* 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: Ettore Perazzoli
*/
/* FIXME this is just a quick hack. */
#ifndef __BONOBO_PROGRESSIVE_LOADER_H__
#define __BONOBO_PROGRESSIVE_LOADER_H__
#include <gnome.h>
#include <bonobo.h>
#include <libgnomevfs/gnome-vfs.h>
#include "Bonobo_ProgressiveLoader.h"
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GNOME_TYPE_PROGRESSIVE_LOADER \
(bonobo_progressive_loader_get_type ())
#define BONOBO_PROGRESSIVE_LOADER(obj) \
(GTK_CHECK_CAST ((obj), GNOME_TYPE_PROGRESSIVE_LOADER, BonoboProgressiveLoader))
#define BONOBO_PROGRESSIVE_LOADER_CLASS(klass) \
(GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_PROGRESSIVE_LOADER, BonoboProgressiveLoaderClass))
#define BONOBO_IS_PROGRESSIVE_LOADER(obj) \
(GTK_CHECK_TYPE ((obj), GNOME_TYPE_PROGRESSIVE_LOADER))
#define BONOBO_IS_PROGRESSIVE_LOADER_CLASS(klass) \
(GTK_CHECK_CLASS_TYPE ((obj), GNOME_TYPE_PROGRESSIVE_LOADER))
typedef struct _BonoboProgressiveLoader BonoboProgressiveLoader;
typedef struct _BonoboProgressiveLoaderClass BonoboProgressiveLoaderClass;
typedef GnomeVFSResult (* BonoboProgressiveLoaderLoadFn)
(BonoboProgressiveLoader *progressive_loader,
const gchar *uri,
Bonobo_ProgressiveDataSink pdsink);
struct _BonoboProgressiveLoader {
BonoboObject parent;
BonoboProgressiveLoaderLoadFn load_fn;
};
struct _BonoboProgressiveLoaderClass {
BonoboObjectClass parent_class;
};
GtkType bonobo_progressive_loader_get_type (void);
BonoboProgressiveLoader *bonobo_progressive_loader_new (BonoboProgressiveLoaderLoadFn fn);
gboolean bonobo_progressive_loader_construct (BonoboProgressiveLoader *loader,
Bonobo_ProgressiveLoader corba_loader,
BonoboProgressiveLoaderLoadFn load_fn);
extern POA_Bonobo_ProgressiveLoader__epv bonobo_progressive_loader_epv;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __BONOBO_PROGRESSIVE_LOADER_H__ */
......@@ -27,8 +27,6 @@ libnautilusinclude_HEADERS= \
gnome-icon-container-dnd.h \
gnome-icon-container-private.h \
gnome-icon-container.h \
gnome-progressive-loader.c \
gnome-progressive-loader.h \
gtkflist.h \
gtkscrollframe.h \
nautilus.h \
......
......@@ -28,9 +28,7 @@
#include "gnome-icon-container.h"
#include "gnome-icon-container-private.h"
#include "gnome-icon-container-dnd.h"
#include "nautilus-icons-view-icon-item.h"
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtksignal.h>
......@@ -40,8 +38,9 @@
#include "nautilus-gtk-macros.h"
/* for memset */
#include <string.h>
#include "gnome-icon-container-private.h"
#include "gnome-icon-container-dnd.h"
#include "nautilus-icons-view-icon-item.h"
/* Interval for updating the rubberband selection, in milliseconds. */
#define RUBBERBAND_TIMEOUT_INTERVAL 10
......@@ -192,10 +191,16 @@ static gboolean
icon_select (GnomeIconContainerIcon *icon,
gboolean select)
{
if (select == icon->is_selected)
/* Since is_selected is a bit field, we have to do the ! business
* to be sure we have either a 1 or a 0. Similarly, the caller
* might pass a value other than 1 or 0 so we have to pass do the
* same thing there.
*/
if (!select == !icon->is_selected)
return FALSE;
icon_toggle_selected (icon);
g_assert (!select == !icon->is_selected);
return TRUE;
}
......@@ -2722,6 +2727,7 @@ gnome_icon_container_get_icon_by_uri (GnomeIconContainer *container,
/* Eventually, we must avoid searching the entire icon list,
but it's OK for now.
A hash table mapping uri to icon is one possibility.
*/
details = container->details;
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-progressive-loader.c
*
* Copyright (C) 1999, 2000 Free Software Foundaton
*
* 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: Ettore Perazzoli
*/
/* FIXME this is just a quick hack. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gnome.h>
#include "gnome-progressive-loader.h"
static BonoboObjectClass *parent_class = NULL;
POA_Bonobo_ProgressiveLoader__epv bonobo_progressive_loader_epv;
POA_Bonobo_ProgressiveLoader__vepv bonobo_progressive_loader_vepv;
static void
impl_load (PortableServer_Servant servant,
const CORBA_char *uri,
Bonobo_ProgressiveDataSink pdsink,
CORBA_Environment *ev)
{
BonoboObject *object;
BonoboProgressiveLoader *loader;
GnomeVFSResult result;
Bonobo_ProgressiveLoader_Error *exception;
object = bonobo_object_from_servant (servant);
loader = BONOBO_PROGRESSIVE_LOADER (object);
result = (* loader->load_fn) (loader, uri, pdsink);
if (result == GNOME_VFS_OK)
return;
exception = g_new (Bonobo_ProgressiveLoader_Error, 1);
exception->vfs_result = result;
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_ProgressiveLoader_Error,
exception);
}
static Bonobo_ProgressiveLoader
create_Bonobo_ProgressiveLoader (BonoboObject *object)
{
POA_Bonobo_ProgressiveLoader *servant;
CORBA_Environment ev;
servant = (POA_Bonobo_ProgressiveLoader *) g_new (BonoboObjectServant, 1);
servant->vepv = &bonobo_progressive_loader_vepv;
CORBA_exception_init (&ev);
POA_Bonobo_ProgressiveLoader__init ((PortableServer_Servant) servant,
&ev);
if (ev._major != CORBA_NO_EXCEPTION){
g_free (servant);
CORBA_exception_free (&ev);
return CORBA_OBJECT_NIL;
}
CORBA_exception_free (&ev);
return (Bonobo_ProgressiveLoader) bonobo_object_activate_servant
(object, servant);
}
/* GtkObject methods. */
static void
destroy (GtkObject *object)
{
BonoboProgressiveLoader *loader;
loader = BONOBO_PROGRESSIVE_LOADER (object);
/* Nothing special. */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
corba_class_init (void)
{
bonobo_progressive_loader_epv.load = impl_load;
bonobo_progressive_loader_vepv.Bonobo_ProgressiveLoader_epv
= &bonobo_progressive_loader_epv;
}
static void
class_init (BonoboProgressiveLoaderClass *class)
{
GtkObjectClass *object_class;
parent_class = gtk_type_class (bonobo_object_get_type ());
object_class = GTK_OBJECT_CLASS (class);
object_class->destroy = destroy;
corba_class_init ();
}
static void
init (BonoboProgressiveLoader *progressive_loader)
{
}
GtkType
bonobo_progressive_loader_get_type (void)
{
static GtkType type = 0;
if (type == 0) {
static const GtkTypeInfo info = {
"IDL:GNOME/ProgressiveLoader:1.0",
sizeof (BonoboProgressiveLoader),
sizeof (BonoboProgressiveLoaderClass),
(GtkClassInitFunc) class_init,
(GtkObjectInitFunc) init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
type = gtk_type_unique (bonobo_object_get_type (), &info);
}
return type;
}
gboolean
bonobo_progressive_loader_construct (BonoboProgressiveLoader *loader,
Bonobo_ProgressiveLoader corba_loader,
BonoboProgressiveLoaderLoadFn load_fn)
{
g_return_val_if_fail (loader != NULL, FALSE);
g_return_val_if_fail (BONOBO_IS_PROGRESSIVE_LOADER (loader), FALSE);
g_return_val_if_fail (corba_loader != CORBA_OBJECT_NIL, FALSE);
g_return_val_if_fail (load_fn != NULL, FALSE);
bonobo_object_construct (BONOBO_OBJECT (loader), corba_loader);
if (corba_loader == CORBA_OBJECT_NIL) {
corba_loader = create_Bonobo_ProgressiveLoader (BONOBO_OBJECT (loader));
if (corba_loader == CORBA_OBJECT_NIL)
return FALSE;
}
loader->load_fn = load_fn;
return TRUE;
}
BonoboProgressiveLoader *
bonobo_progressive_loader_new (BonoboProgressiveLoaderLoadFn load_fn)
{
BonoboProgressiveLoader *loader;
g_return_val_if_fail (load_fn != NULL, NULL);
loader = gtk_type_new (bonobo_progressive_loader_get_type ());
if (! bonobo_progressive_loader_construct (loader, CORBA_OBJECT_NIL,
load_fn)) {
gtk_object_destroy (GTK_OBJECT (loader));
return NULL;
}
return loader;
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-progressive-loader.h