Commit 62ae0377 authored by Darin Adler's avatar Darin Adler

The main change here is revamping the undo manager.

	To get a complete check-out you might have to delete
	the file named libnautilus/nautilus-undo.h that used
	to be a generated file and is now checked-in.

	* components/help/help-method.c: (vfs_module_transform):
	Removed a bogus extraneous FIXME.

	* libnautilus-extensions/Makefile.am:
	Moved the undo manager into libnautilus-extensions
	since it's not needed by Nautilus components.

	* libnautilus-extensions/nautilus-entry.c:
	* libnautilus-extensions/nautilus-icon-text-item.c:
	* libnautilus/nautilus-view.c:
	* src/nautilus-application.c:
	* src/nautilus-bookmarks-window.c: (create_bookmarks_window):
	* src/nautilus-view-frame.c:
	* src/nautilus-window-private.h:
	* src/nautilus-window.c:
	Updated includes and a few small function name changes.

	* libnautilus-extensions/nautilus-gtk-extensions.h:
	* libnautilus-extensions/nautilus-gtk-extensions.c:
	(alive_disconnecter),
	(nautilus_gtk_signal_connect_full_while_alive):
	Added a new function that combines the features of
	gtk_signal_connect_full with gtk_signal_connect_while_alive.

	* libnautilus/nautilus-undo-context.h: [removed]
	* libnautilus/nautilus-undo-context.c: [removed]
	* libnautilus-extensions/nautilus-undo-context.h:
	* libnautilus-extensions/nautilus-undo-context.c:
	(impl_Nautilus_Undo_Context__destroy),
	(impl_Nautilus_Undo_Context__create),
	(impl_Nautilus_Undo_Context__get_undo_manager),
	(nautilus_undo_context_new), (destroy),
	(nautilus_undo_context_initialize_class):
	Rewrote this class to simplify it (after moving it here).

	* libnautilus/nautilus-undo-manager.h: [removed]
	* libnautilus/nautilus-undo-manager.c: [removed]
	* libnautilus/nautilus-undo-manager-private.h: [removed]
	* libnautilus-extensions/nautilus-undo-manager.h:
	* libnautilus-extensions/nautilus-undo-manager.c:
	(impl_Nautilus_Undo_Manager__destroy),
	(impl_Nautilus_Undo_Manager__create),
	(impl_Nautilus_Undo_Manager__append),
	(impl_Nautilus_Undo_Manager__forget),
	(nautilus_undo_manager_initialize),
	(nautilus_undo_manager_initialize_class),
	(nautilus_undo_manager_undo),
	(nautilus_undo_manager_add_transaction),
	(nautilus_undo_manager_forget_transaction),
	(nautilus_undo_manager_set_queue_depth),
	(nautilus_undo_manager_attach),
	(nautilus_undo_manager_add_interface), (update_undo_menu_item),
	(undo_menu_handler_connection_free),
	(undo_menu_handler_connection_free_cover),
	(nautilus_undo_manager_set_up_bonobo_ui_handler_undo_item):
	Rewrote this class to simplify it. Got rid of many old
	interfaces and added some new ones.

	* libnautilus/.cvsignore:
	* libnautilus/Makefile.am:
	Renamed the old nautilus-undo.idl to
	nautilus-distributed-undo.idl.  The IDL is only about the internal
	part of the undo framework.  Clients use calls that are in
	nautilus-undo.h. The part that's public needs the prettier name.

	* libnautilus/nautilus-undo.idl: [removed]
	* libnautilus/nautilus-distributed-undo.idl:
	Updated the names of menu-item-related things to better match the
	standard terminology.

	* libnautilus/nautilus-undo-private.h:
	Added this new header for things needed by the undo manager that
	are in libnautilus. Maybe we can eliminate this later.

	* libnautilus/nautilus-undo-transaction.h:
	* libnautilus/nautilus-undo-transaction.c:
	(impl_Nautilus_Undo_Transaction__destroy),
	(impl_Nautilus_Undo_Transaction__create),
	(impl_Nautilus_Undo_Transaction__get_undo_menu_item),
	(impl_Nautilus_Undo_Transaction__get_redo_menu_item),
	(impl_Nautilus_Undo_Transaction__get_operation_name),
	(impl_Nautilus_Undo_Transaction__undo),
	(nautilus_undo_transaction_new),
	(nautilus_undo_transaction_initialize),
	(remove_transaction_from_object),
	(nautilus_undo_transaction_destroy),
	(nautilus_undo_transaction_initialize_class),
	(nautilus_undo_transaction_add_atom),
	(nautilus_undo_transaction_undo),
	(nautilus_undo_transaction_add_to_undo_manager), (remove_atoms),
	(remove_atoms_cover),
	(nautilus_undo_transaction_unregister_object), (undo_atom_free),
	(undo_atom_undo_and_free), (undo_atom_free_cover),
	(undo_atom_undo_and_free_cover), (undo_atom_list_free),
	(undo_atom_list_undo_and_free):
	Rewrote and simplified this class and got rid of all uses of
	NautilusUndoable.

	* libnautilus/nautilus-undoable.h: [removed]
	* libnautilus/nautilus-undoable.c: [removed]
	* libnautilus/nautilus-undo.h:
	* libnautilus/nautilus-undo.c: (nautilus_undo_register),
	(nautilus_undo_register_full), (nautilus_undo_unregister),
	(nautilus_undo), (nautilus_undo_get_undo_manager),
	(undo_manager_ref), (undo_manager_unref),
	(undo_manager_unref_cover), (nautilus_undo_attach_undo_manager),
	(nautilus_undo_share_undo_manager), (set_up_bonobo_control),
	(nautilus_undo_set_up_bonobo_control):
	Added this new file with the public interface of the undo code and
	most of the basic implementation. Most of this was previously in
	nautilus-undoable.c.

	* nautilus-widgets/nautilus-preferences.c:
	(preferences_hash_node_free), (preferences_hash_node_add_callback),
	(preferences_hash_node_remove_callback),
	(preferences_hash_node_check_changes_func),
	(preferences_callback_node_alloc),
	(preferences_callback_node_free),
	(preferences_callback_node_free_func),
	(preferences_callback_node_invoke_func),
	(preferences_gconf_callback):
	Fixed a repeated spelling error in this file.

	* src/nautilus-application.c: (nautilus_app_init):
	* src/nautilus-view-frame.c: (nautilus_view_frame_load_client):
	* src/nautilus-window-menus.c: (edit_menu_undo_callback),
	(nautilus_window_initialize_menus):
	* src/nautilus-window.c: (nautilus_window_constructed):
	Changed to use public parts of the undo API instead of the old
	stuff that used private secret stuff. Many places use nice new
	convenient calls that do a lot of the work for you.
parent aac364ac
2000-06-06 Darin Adler <darin@eazel.com>
The main change here is revamping the undo manager.
To get a complete check-out you might have to delete
the file named libnautilus/nautilus-undo.h that used
to be a generated file and is now checked-in.
* components/help/help-method.c: (vfs_module_transform):
Removed a bogus extraneous FIXME.
* libnautilus-extensions/Makefile.am:
Moved the undo manager into libnautilus-extensions
since it's not needed by Nautilus components.
* libnautilus-extensions/nautilus-entry.c:
* libnautilus-extensions/nautilus-icon-text-item.c:
* libnautilus/nautilus-view.c:
* src/nautilus-application.c:
* src/nautilus-bookmarks-window.c: (create_bookmarks_window):
* src/nautilus-view-frame.c:
* src/nautilus-window-private.h:
* src/nautilus-window.c:
Updated includes and a few small function name changes.
* libnautilus-extensions/nautilus-gtk-extensions.h:
* libnautilus-extensions/nautilus-gtk-extensions.c:
(alive_disconnecter),
(nautilus_gtk_signal_connect_full_while_alive):
Added a new function that combines the features of
gtk_signal_connect_full with gtk_signal_connect_while_alive.
* libnautilus/nautilus-undo-context.h: [removed]
* libnautilus/nautilus-undo-context.c: [removed]
* libnautilus-extensions/nautilus-undo-context.h:
* libnautilus-extensions/nautilus-undo-context.c:
(impl_Nautilus_Undo_Context__destroy),
(impl_Nautilus_Undo_Context__create),
(impl_Nautilus_Undo_Context__get_undo_manager),
(nautilus_undo_context_new), (destroy),
(nautilus_undo_context_initialize_class):
Rewrote this class to simplify it (after moving it here).
* libnautilus/nautilus-undo-manager.h: [removed]
* libnautilus/nautilus-undo-manager.c: [removed]
* libnautilus/nautilus-undo-manager-private.h: [removed]
* libnautilus-extensions/nautilus-undo-manager.h:
* libnautilus-extensions/nautilus-undo-manager.c:
(impl_Nautilus_Undo_Manager__destroy),
(impl_Nautilus_Undo_Manager__create),
(impl_Nautilus_Undo_Manager__append),
(impl_Nautilus_Undo_Manager__forget),
(nautilus_undo_manager_initialize),
(nautilus_undo_manager_initialize_class),
(nautilus_undo_manager_undo),
(nautilus_undo_manager_add_transaction),
(nautilus_undo_manager_forget_transaction),
(nautilus_undo_manager_set_queue_depth),
(nautilus_undo_manager_attach),
(nautilus_undo_manager_add_interface), (update_undo_menu_item),
(undo_menu_handler_connection_free),
(undo_menu_handler_connection_free_cover),
(nautilus_undo_manager_set_up_bonobo_ui_handler_undo_item):
Rewrote this class to simplify it. Got rid of many old
interfaces and added some new ones.
* libnautilus/.cvsignore:
* libnautilus/Makefile.am:
Renamed the old nautilus-undo.idl to
nautilus-distributed-undo.idl. The IDL is only about the internal
part of the undo framework. Clients use calls that are in
nautilus-undo.h. The part that's public needs the prettier name.
* libnautilus/nautilus-undo.idl: [removed]
* libnautilus/nautilus-distributed-undo.idl:
Updated the names of menu-item-related things to better match the
standard terminology.
* libnautilus/nautilus-undo-private.h:
Added this new header for things needed by the undo manager that
are in libnautilus. Maybe we can eliminate this later.
* libnautilus/nautilus-undo-transaction.h:
* libnautilus/nautilus-undo-transaction.c:
(impl_Nautilus_Undo_Transaction__destroy),
(impl_Nautilus_Undo_Transaction__create),
(impl_Nautilus_Undo_Transaction__get_undo_menu_item),
(impl_Nautilus_Undo_Transaction__get_redo_menu_item),
(impl_Nautilus_Undo_Transaction__get_operation_name),
(impl_Nautilus_Undo_Transaction__undo),
(nautilus_undo_transaction_new),
(nautilus_undo_transaction_initialize),
(remove_transaction_from_object),
(nautilus_undo_transaction_destroy),
(nautilus_undo_transaction_initialize_class),
(nautilus_undo_transaction_add_atom),
(nautilus_undo_transaction_undo),
(nautilus_undo_transaction_add_to_undo_manager), (remove_atoms),
(remove_atoms_cover),
(nautilus_undo_transaction_unregister_object), (undo_atom_free),
(undo_atom_undo_and_free), (undo_atom_free_cover),
(undo_atom_undo_and_free_cover), (undo_atom_list_free),
(undo_atom_list_undo_and_free):
Rewrote and simplified this class and got rid of all uses of
NautilusUndoable.
* libnautilus/nautilus-undoable.h: [removed]
* libnautilus/nautilus-undoable.c: [removed]
* libnautilus/nautilus-undo.h:
* libnautilus/nautilus-undo.c: (nautilus_undo_register),
(nautilus_undo_register_full), (nautilus_undo_unregister),
(nautilus_undo), (nautilus_undo_get_undo_manager),
(undo_manager_ref), (undo_manager_unref),
(undo_manager_unref_cover), (nautilus_undo_attach_undo_manager),
(nautilus_undo_share_undo_manager), (set_up_bonobo_control),
(nautilus_undo_set_up_bonobo_control):
Added this new file with the public interface of the undo code and
most of the basic implementation. Most of this was previously in
nautilus-undoable.c.
* nautilus-widgets/nautilus-preferences.c:
(preferences_hash_node_free), (preferences_hash_node_add_callback),
(preferences_hash_node_remove_callback),
(preferences_hash_node_check_changes_func),
(preferences_callback_node_alloc),
(preferences_callback_node_free),
(preferences_callback_node_free_func),
(preferences_callback_node_invoke_func),
(preferences_gconf_callback):
Fixed a repeated spelling error in this file.
* src/nautilus-application.c: (nautilus_app_init):
* src/nautilus-view-frame.c: (nautilus_view_frame_load_client):
* src/nautilus-window-menus.c: (edit_menu_undo_callback),
(nautilus_window_initialize_menus):
* src/nautilus-window.c: (nautilus_window_constructed):
Changed to use public parts of the undo API instead of the old
stuff that used private secret stuff. Many places use nice new
convenient calls that do a lot of the work for you.
2000-06-06 Pavel Cisler <pavel@eazel.com>
* libnautilus-extensions/nautilus-icon-factory.c:
......
......@@ -291,7 +291,7 @@ vfs_module_transform (const char *method_name, const char *args)
{
init_help_module ();
#ifdef ALI_DEBUG
g_print ("Loading libvfs-help.so...\n"); /* FIXME: Remove me */
g_print ("Loading libvfs-help.so...\n");
#endif
return &transform;
}
......@@ -72,6 +72,7 @@ libnautilus_extensionsinclude_HEADERS= \
nautilus-self-checks.h \
nautilus-string-list.h \
nautilus-string.h \
nautilus-undo-manager.h \
nautilus-view-identifier.h \
nautilus-xml-extensions.h \
$(NULL)
......@@ -82,6 +83,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-directory-private.h \
nautilus-directory-metafile.h \
nautilus-lib-self-check-functions.h \
nautilus-undo-context.h \
bonobo-stream-vfs.c \
nautilus-background-canvas-group.c \
nautilus-background.c \
......@@ -127,6 +129,8 @@ libnautilus_extensions_la_SOURCES = \
nautilus-self-checks.c \
nautilus-string-list.c \
nautilus-string.c \
nautilus-undo-context.c \
nautilus-undo-manager.c \
nautilus-view-identifier.c \
nautilus-xml-extensions.c \
$(NULL)
......@@ -36,8 +36,6 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libnautilus/nautilus-undo-manager.h>
#include <libnautilus/nautilus-undoable.h>
#include <libnautilus/nautilus-undo.h>
#include <orb/orbit.h>
......
......@@ -663,3 +663,84 @@ nautilus_gtk_widget_set_font_by_name (GtkWidget *widget, const char *font_name)
nautilus_gtk_widget_set_font (widget, font);
gdk_font_unref (font);
}
/* This stuff is stolen from Gtk. */
typedef struct DisconnectInfo {
GtkObject *object1;
guint disconnect_handler1;
guint signal_handler;
GtkObject *object2;
guint disconnect_handler2;
} DisconnectInfo;
static guint
alive_disconnecter (GtkObject *object, DisconnectInfo *info)
{
g_assert (info != NULL);
g_assert (GTK_IS_OBJECT (info->object1));
g_assert (info->disconnect_handler1 != 0);
g_assert (info->signal_handler != 0);
g_assert (GTK_IS_OBJECT (info->object2));
g_assert (info->disconnect_handler2 != 0);
g_assert (object == info->object1 || object == info->object2);
gtk_signal_disconnect (info->object1, info->disconnect_handler1);
gtk_signal_disconnect (info->object1, info->signal_handler);
gtk_signal_disconnect (info->object2, info->disconnect_handler2);
g_free (info);
return 0;
}
/**
* nautilus_gtk_signal_connect_full_while_alive
*
* Like gtk_signal_connect_while_alive, but works with full parameters.
**/
void
nautilus_gtk_signal_connect_full_while_alive (GtkObject *object,
const gchar *name,
GtkSignalFunc func,
GtkCallbackMarshal marshal,
gpointer data,
GtkDestroyNotify destroy_func,
gboolean object_signal,
gboolean after,
GtkObject *alive_object)
{
DisconnectInfo *info;
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (name != NULL);
g_return_if_fail (func != NULL);
g_return_if_fail (object_signal == FALSE || object_signal == TRUE);
g_return_if_fail (after == FALSE || after == TRUE);
g_return_if_fail (GTK_IS_OBJECT (alive_object));
info = g_new (DisconnectInfo, 1);
info->object1 = object;
info->object2 = alive_object;
info->signal_handler =
gtk_signal_connect_full (object,
name,
func,
marshal,
data,
destroy_func,
object_signal,
after);
info->disconnect_handler1 =
gtk_signal_connect (object,
"destroy",
GTK_SIGNAL_FUNC (alive_disconnecter),
info);
info->disconnect_handler2 =
gtk_signal_connect (alive_object,
"destroy",
GTK_SIGNAL_FUNC (alive_disconnecter),
info);
}
......@@ -34,56 +34,64 @@
#define NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT 2
/* GtkCList */
int nautilus_gtk_clist_get_first_selected_row (GtkCList *list);
int nautilus_gtk_clist_get_last_selected_row (GtkCList *list);
int nautilus_gtk_clist_get_first_selected_row (GtkCList *list);
int nautilus_gtk_clist_get_last_selected_row (GtkCList *list);
/* signals */
guint nautilus_gtk_signal_connect_free_data (GtkObject *object,
const gchar *name,
GtkSignalFunc func,
gpointer data);
guint nautilus_gtk_signal_connect_free_data (GtkObject *object,
const gchar *name,
GtkSignalFunc func,
gpointer data);
guint nautilus_gtk_signal_connect_free_data_custom (GtkObject *object,
const gchar *name,
GtkSignalFunc func,
gpointer data,
GtkDestroyNotify destroy_func);
const gchar *name,
GtkSignalFunc func,
gpointer data,
GtkDestroyNotify destroy_func);
void nautilus_gtk_signal_connect_full_while_alive (GtkObject *object,
const gchar *name,
GtkSignalFunc func,
GtkCallbackMarshal marshal,
gpointer data,
GtkDestroyNotify destroy_func,
gboolean object_signal,
gboolean after,
GtkObject *alive_object);
/* list of GtkObject */
GList * nautilus_gtk_object_list_ref (GList *list);
void nautilus_gtk_object_list_unref (GList *list);
void nautilus_gtk_object_list_free (GList *list);
GList * nautilus_gtk_object_list_copy (GList *list);
GList * nautilus_gtk_object_list_ref (GList *list);
void nautilus_gtk_object_list_unref (GList *list);
void nautilus_gtk_object_list_free (GList *list);
GList * nautilus_gtk_object_list_copy (GList *list);
/* GtkWidget */
gboolean nautilus_point_in_allocation (const GtkAllocation *allocation,
int x,
int y);
void nautilus_gtk_widget_set_font (GtkWidget *widget,
GdkFont *font);
void nautilus_gtk_widget_set_font_by_name (GtkWidget *widget,
const char *font_name);
gboolean nautilus_point_in_widget (GtkWidget *widget,
int x,
int y);
gboolean nautilus_point_in_allocation (const GtkAllocation *allocation,
int x,
int y);
void nautilus_gtk_widget_set_font (GtkWidget *widget,
GdkFont *font);
void nautilus_gtk_widget_set_font_by_name (GtkWidget *widget,
const char *font_name);
gboolean nautilus_point_in_widget (GtkWidget *widget,
int x,
int y);
/* GtkWindow */
void nautilus_gtk_window_present (GtkWindow *window);
void nautilus_gtk_window_present (GtkWindow *window);
/* selection data */
GtkSelectionData *nautilus_gtk_selection_data_copy_deep (const GtkSelectionData *selection_data);
void nautilus_gtk_selection_data_free_deep (GtkSelectionData *selection_data);
GtkSelectionData *nautilus_gtk_selection_data_copy_deep (const GtkSelectionData *selection_data);
void nautilus_gtk_selection_data_free_deep (GtkSelectionData *selection_data);
/* GtkMenu */
void nautilus_pop_up_context_menu (GtkMenu *menu,
gint16 offset_x,
gint16 offset_y);
void nautilus_pop_up_context_menu (GtkMenu *menu,
gint16 offset_x,
gint16 offset_y);
/* GtkStyle */
void nautilus_gtk_style_set_font (GtkStyle *style,
GdkFont *font);
void nautilus_gtk_style_set_font_by_name (GtkStyle *style,
const char *font_name);
void nautilus_gtk_style_set_font (GtkStyle *style,
GdkFont *font);
void nautilus_gtk_style_set_font_by_name (GtkStyle *style,
const char *font_name);
/* marshals */
......
......@@ -14,7 +14,7 @@
#include "nautilus-icon-text-item.h"
#include "nautilus-entry.h"
#include <libnautilus/nautilus-undoable.h>
#include <libnautilus/nautilus-undo.h>
#include <math.h>
#include <stdio.h>
......
......@@ -93,13 +93,13 @@ static void preferences_hash_node_check_changes_func (
/* PreferencesCallbackNode functions */
static PreferencesCallbackNode *preferneces_callback_node_alloc (NautilusPreferencesCallback callback_proc,
static PreferencesCallbackNode *preferences_callback_node_alloc (NautilusPreferencesCallback callback_proc,
gpointer callback_data,
const PreferencesHashNode *hash_node);
static void preferneces_callback_node_free (PreferencesCallbackNode *node);
static void preferneces_callback_node_free_func (gpointer data,
static void preferences_callback_node_free (PreferencesCallbackNode *node);
static void preferences_callback_node_free_func (gpointer data,
gpointer callback_data);
static void preferneces_callback_node_invoke_func (gpointer data,
static void preferences_callback_node_invoke_func (gpointer data,
gpointer callback_data);
static void preferences_hash_node_add_callback (PreferencesHashNode *node,
NautilusPreferencesCallback callback_proc,
......@@ -177,7 +177,7 @@ preferences_hash_node_free (PreferencesHashNode *node)
}
nautilus_g_list_free_deep_custom (node->callback_list,
preferneces_callback_node_free_func,
preferences_callback_node_free_func,
NULL);
node->callback_list = NULL;
......@@ -201,21 +201,21 @@ preferences_hash_node_add_callback (PreferencesHashNode *node,
NautilusPreferencesCallback callback_proc,
gpointer callback_data)
{
PreferencesCallbackNode *preferneces_callback_node;
PreferencesCallbackNode *preferences_callback_node;
guint i;
g_assert (node != NULL);
g_assert (callback_proc != NULL);
preferneces_callback_node = preferneces_callback_node_alloc (callback_proc,
preferences_callback_node = preferences_callback_node_alloc (callback_proc,
callback_data,
node);
g_assert (preferneces_callback_node != NULL);
g_assert (preferences_callback_node != NULL);
node->callback_list = g_list_append (node->callback_list,
(gpointer) preferneces_callback_node);
(gpointer) preferences_callback_node);
/*
* We install only one gconf notification for each preference node.
......@@ -279,7 +279,7 @@ preferences_hash_node_remove_callback (PreferencesHashNode *node,
node->callback_list = g_list_remove (node->callback_list,
(gpointer) callback_info);
preferneces_callback_node_free (callback_info);
preferences_callback_node_free (callback_info);
}
}
......@@ -345,14 +345,14 @@ preferences_hash_node_check_changes_func (gpointer key,
/* Invoke callbacks for this node */
if (node->callback_list) {
g_list_foreach (node->callback_list,
preferneces_callback_node_invoke_func,
preferences_callback_node_invoke_func,
(gpointer) NULL);
}
}
}
/**
* preferneces_callback_node_alloc
* preferences_callback_node_alloc
*
* Allocate a callback info struct from the given values. PreferencesCallbackNode
* structures are used as nodes for the callbac_list member of pref hash table
......@@ -364,7 +364,7 @@ preferences_hash_node_check_changes_func (gpointer key,
* Return value: A newly allocated node.
**/
static PreferencesCallbackNode *
preferneces_callback_node_alloc (NautilusPreferencesCallback callback_proc,
preferences_callback_node_alloc (NautilusPreferencesCallback callback_proc,
gpointer callback_data,
const PreferencesHashNode *hash_node)
{
......@@ -382,13 +382,13 @@ preferneces_callback_node_alloc (NautilusPreferencesCallback callback_proc,
}
/**
* preferneces_callback_node_free
* preferences_callback_node_free
*
* Free a callback info struct.
* @preferneces_callback_node: The struct to free.
* @preferences_callback_node: The struct to free.
**/
static void
preferneces_callback_node_free (PreferencesCallbackNode *callback_node)
preferences_callback_node_free (PreferencesCallbackNode *callback_node)
{
g_assert (callback_node != NULL);
......@@ -399,7 +399,7 @@ preferneces_callback_node_free (PreferencesCallbackNode *callback_node)
}
/**
* preferneces_callback_node_free_func
* preferences_callback_node_free_func
*
* A function that frees a callback info struct. It is meant to be fed to
* g_list_foreach ()
......@@ -407,16 +407,16 @@ preferneces_callback_node_free (PreferencesCallbackNode *callback_node)
* @callback_data: The callback_data privately maintained by the GList.
**/
static void
preferneces_callback_node_free_func (gpointer data,
preferences_callback_node_free_func (gpointer data,
gpointer callback_data)
{
g_assert (data != NULL);
preferneces_callback_node_free ((PreferencesCallbackNode *) data);
preferences_callback_node_free ((PreferencesCallbackNode *) data);
}
/**
* preferneces_callback_node_invoke_func
* preferences_callback_node_invoke_func
*
* A function that invokes a callback from the given struct. It is meant to be fed to
* g_list_foreach ()
......@@ -424,7 +424,7 @@ preferneces_callback_node_free_func (gpointer data,
* @callback_data: The callback_data privately maintained by the GList.
**/
static void
preferneces_callback_node_invoke_func (gpointer data,
preferences_callback_node_invoke_func (gpointer data,
gpointer callback_data)
{
PreferencesCallbackNode *callback_node;
......@@ -562,7 +562,7 @@ preferences_gconf_callback (GConfClient *client,
/* Invoke callbacks for this node */
if (node->callback_list) {
g_list_foreach (node->callback_list,
preferneces_callback_node_invoke_func,
preferences_callback_node_invoke_func,
(gpointer) NULL);
}
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* NautilusUndoContext
/* NautilusUndoContext - Used internally by undo machinery.
* Not public.
*
* Copyright (C) 2000 Eazel, Inc.
*
......@@ -23,16 +24,11 @@
*/
#include <config.h>
#include "nautilus-undo-context.h"
#include "nautilus-gtk-macros.h"
#include <gtk/gtksignal.h>
#include <gtk/gtkmain.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-control.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-undo.h"
#include "nautilus-undo-context.h"
typedef struct {
POA_Nautilus_Undo_Context servant;
......@@ -57,7 +53,7 @@ POA_Nautilus_Undo_Context__epv libnautilus_Nautilus_Undo_Context_epv =
};
static PortableServer_ServantBase__epv base_epv;
static POA_Nautilus_Undo_Context__vepv impl_Nautilus_Undo_Context_vepv =
static POA_Nautilus_Undo_Context__vepv vepv =
{
&base_epv,
NULL,
......@@ -65,54 +61,42 @@ static POA_Nautilus_Undo_Context__vepv impl_Nautilus_Undo_Context_vepv =
};
static void
impl_Nautilus_Undo_Context__destroy (BonoboObject *obj, impl_POA_Nautilus_Undo_Context *servant)
impl_Nautilus_Undo_Context__destroy (BonoboObject *object,
PortableServer_Servant servant)
{
PortableServer_ObjectId *objid;
PortableServer_ObjectId *object_id;
CORBA_Environment ev;
void (*servant_destroy_func) (PortableServer_Servant servant, CORBA_Environment *ev);
CORBA_exception_init (&ev);
servant_destroy_func = NAUTILUS_UNDO_CONTEXT_CLASS
(GTK_OBJECT (servant->bonobo_object)->klass)->servant_destroy_func;
objid = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
PortableServer_POA_deactivate_object (bonobo_poa (), objid, &ev);
CORBA_free (objid);
obj->servant = NULL;
(* servant_destroy_func) ((PortableServer_Servant) servant, &ev);
object_id = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev);
CORBA_free (object_id);
object->servant = NULL;
POA_Nautilus_Undo_Context__fini (servant, &ev);
g_free (servant);
CORBA_exception_free (&ev);
}
static Nautilus_Undo_Context
impl_Nautilus_Undo_Context__create (NautilusUndoContext *context, CORBA_Environment * ev)
impl_Nautilus_Undo_Context__create (NautilusUndoContext *bonobo_object,
CORBA_Environment *ev)
{
Nautilus_Undo_Context retval;
impl_POA_Nautilus_Undo_Context *servant;
void (*servant_init_func) (PortableServer_Servant servant, CORBA_Environment *ev);
NautilusUndoContextClass *context_class;
context_class = NAUTILUS_UNDO_CONTEXT_CLASS (GTK_OBJECT (context)->klass);
servant_init_func = context_class->servant_init_func;
servant = g_new0 (impl_POA_Nautilus_Undo_Context, 1);
servant->servant.vepv = context_class->vepv;
if (servant->servant.vepv->Bonobo_Unknown_epv == NULL) {
servant->servant.vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
}
(* servant_init_func) ((PortableServer_Servant) servant, ev);
servant->bonobo_object = context;
servant->servant.vepv = &vepv;
vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
POA_Nautilus_Undo_Context__init ((PortableServer_Servant) servant, ev);
retval = bonobo_object_activate_servant (BONOBO_OBJECT (context), servant);
gtk_signal_connect (GTK_OBJECT (context), "destroy",
gtk_signal_connect (GTK_OBJECT (bonobo_object), "destroy",
GTK_SIGNAL_FUNC (impl_Nautilus_Undo_Context__destroy),
servant);
return retval;
servant->bonobo_object = bonobo_object;
return bonobo_object_activate_servant (BONOBO_OBJECT (bonobo_object), servant);
}
static Nautilus_Undo_Manager
......@@ -122,23 +106,26 @@ impl_Nautilus_Undo_Context__get_undo_manager (PortableServer_Servant servant,
NautilusUndoContext *context;
context = ((impl_POA_Nautilus_Undo_Context *) servant)->bonobo_object;
g_assert (NAUTILUS_IS_UNDO_CONTEXT (context));
return CORBA_Object_duplicate (context->undo_manager, ev);
}
/* nautilus_undo_manager_new */
NautilusUndoContext *
nautilus_undo_context_new (Nautilus_Undo_Manager undo_manager)
{
CORBA_Environment ev;
NautilusUndoContext *context;
CORBA_exception_init (&ev);
context = gtk_type_new (nautilus_undo_context_get_type ());
context->undo_manager = undo_manager;
context->undo_manager = CORBA_Object_duplicate (undo_manager, &ev);
CORBA_exception_free (&ev);
return context;
}
/* Object initialization function for the NautilusUndoContext */
static void
nautilus_undo_context_initialize (NautilusUndoContext *context)
{
......@@ -152,28 +139,24 @@ nautilus_undo_context_initialize (NautilusUndoContext *context)
CORBA_exception_free (&ev);
}
/* Class initialization function for the NautilusUndoManager. */
static void
nautilus_undo_context_initialize_class (NautilusUndoContextClass *klass)
destroy (GtkObject *object)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (klass);
CORBA_Environment ev;
NautilusUndoContext *context;
object_class->destroy = destroy;
CORBA_exception_init (&ev);
klass->servant_init_func = POA_Nautilus_Undo_Context__init;
klass->servant_destroy_func = POA_Nautilus_Undo_Context__fini;
klass->vepv = &impl_Nautilus_Undo_Context_vepv;
context = NAUTILUS_UNDO_CONTEXT (object);
CORBA_Object_release (context->undo_manager, &ev);
CORBA_exception_free (&ev);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
/* destroy */
static void
destroy (GtkObject *object)