Commit 88838071 authored by Darin Adler's avatar Darin Adler
Browse files

Changed history list to include a separate position field instead of

	* components/history/nautilus-history-view.c:
	(history_view_update_icons), (get_history_list),
	(hyperbola_navigation_history_load_location):
	* libnautilus/nautilus-view-component.idl:
	* src/nautilus-history-frame.c:
	(impl_Nautilus_HistoryFrame_get_history_list):
	* src/nautilus-view-frame.h:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_get_history_list):
	* src/nautilus-window.c:
	(nautilus_window_get_history_list_callback),
	(nautilus_window_connect_view):
	Changed history list to include a separate position field
	instead of having a position in each entry.

	* components/notes/nautilus-notes.c: (done_with_file):
	Name changed from nautilus_file_cancel_callback to
	nautilus_file_cancel_call_when_ready to reduce confusion with
	nautilus_file_cancel.

	* libnautilus-extensions/nautilus-directory.c:
	(nautilus_directory_get): Made NULL for URI be legal (and result
	in NULL for the directory object).
	* libnautilus-extensions/nautilus-mime-actions.c:
	(get_mime_type_from_uri): Made NULL for URI be legal (and result
	in NULL for MIME type).

	* libnautilus-extensions/nautilus-entry.c:
	(nautilus_entry_set_text): Minor tweak.

	* libnautilus-extensions/nautilus-file.h:
	* libnautilus-extensions/nautilus-file-private.h:
	* libnautilus-extensions/nautilus-file.c: (operation_new),
	(operation_free), (operation_complete), (operation_cancel),
	(rename_update_info_and_metafile), (rename_callback),
	(nautilus_file_rename), (nautilus_file_cancel),
	(nautilus_file_set_owner), (nautilus_file_cancel_call_when_ready):
	Added cancelling to rename as a prelude to doing the same for
	set_file_info-based calls.

	* libnautilus-extensions/nautilus-graphic.c:
	Fixed a formatting mistake and a typo.

	* libnautilus-extensions/nautilus-stock-dialogs.h:
	* libnautilus-extensions/nautilus-stock-dialogs.c:
	(timed_wait_hash), (timed_wait_hash_equal),
	(nautilus_timed_wait_start), (nautilus_timed_wait_free),
	(nautilus_timed_wait_stop): Re-did timed wait API now that
	we are really using it. Still unimplemented.

	* src/Makefile.am:
	Since IDL dependencies are not understood by automake, added
	an explicit one so we pick up the change to the libnautilus
	view component IDL.

	* src/file-manager/fm-error-reporting.h:
	* src/file-manager/fm-error-reporting.c: (rename_callback),
	(cancel_rename_callback), (fm_rename_file): Moved code for
	renaming into here so it can be shared between the icon view
	and the properties dialog. Perhaps it needs to be renamed.

	* src/file-manager/fm-icon-view.c:
	(fm_icon_view_icon_text_changed_callback): Use the shared
	code instead of having the rename code here.

	* src/nautilus-application.c: (create_object): Make a new
	shell object each time instead of trying to share one.
	(nautilus_application_startup): Activate the shell object
	using OAF. This makes it work across processes and adds
	the feature.

	* src/nautilus-main.c: (main): Call bonobo_activate explicitly so
	CORBA calls work before the main loop.

	* src/nautilus-shell.c: (display_caveat_first_time),
	(corba_manage_desktop): Got rid of all state in NautilusShell
	so we can use multiple shell objects if we want.

	* src/nautilus-sidebar.c: (nautilus_sidebar_update_info):
	Got rid of code that checks for NULL.
parent b3c9a1c6
2000-07-10 Darin Adler <darin@eazel.com>
* components/history/nautilus-history-view.c:
(history_view_update_icons), (get_history_list),
(hyperbola_navigation_history_load_location):
* libnautilus/nautilus-view-component.idl:
* src/nautilus-history-frame.c:
(impl_Nautilus_HistoryFrame_get_history_list):
* src/nautilus-view-frame.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_get_history_list):
* src/nautilus-window.c:
(nautilus_window_get_history_list_callback),
(nautilus_window_connect_view):
Changed history list to include a separate position field
instead of having a position in each entry.
* components/notes/nautilus-notes.c: (done_with_file):
Name changed from nautilus_file_cancel_callback to
nautilus_file_cancel_call_when_ready to reduce confusion with
nautilus_file_cancel.
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_get): Made NULL for URI be legal (and result
in NULL for the directory object).
* libnautilus-extensions/nautilus-mime-actions.c:
(get_mime_type_from_uri): Made NULL for URI be legal (and result
in NULL for MIME type).
* libnautilus-extensions/nautilus-entry.c:
(nautilus_entry_set_text): Minor tweak.
* libnautilus-extensions/nautilus-file.h:
* libnautilus-extensions/nautilus-file-private.h:
* libnautilus-extensions/nautilus-file.c: (operation_new),
(operation_free), (operation_complete), (operation_cancel),
(rename_update_info_and_metafile), (rename_callback),
(nautilus_file_rename), (nautilus_file_cancel),
(nautilus_file_set_owner), (nautilus_file_cancel_call_when_ready):
Added cancelling to rename as a prelude to doing the same for
set_file_info-based calls.
* libnautilus-extensions/nautilus-graphic.c:
Fixed a formatting mistake and a typo.
* libnautilus-extensions/nautilus-stock-dialogs.h:
* libnautilus-extensions/nautilus-stock-dialogs.c:
(timed_wait_hash), (timed_wait_hash_equal),
(nautilus_timed_wait_start), (nautilus_timed_wait_free),
(nautilus_timed_wait_stop): Re-did timed wait API now that
we are really using it. Still unimplemented.
* src/Makefile.am:
Since IDL dependencies are not understood by automake, added
an explicit one so we pick up the change to the libnautilus
view component IDL.
* src/file-manager/fm-error-reporting.h:
* src/file-manager/fm-error-reporting.c: (rename_callback),
(cancel_rename_callback), (fm_rename_file): Moved code for
renaming into here so it can be shared between the icon view
and the properties dialog. Perhaps it needs to be renamed.
* src/file-manager/fm-icon-view.c:
(fm_icon_view_icon_text_changed_callback): Use the shared
code instead of having the rename code here.
* src/nautilus-application.c: (create_object): Make a new
shell object each time instead of trying to share one.
(nautilus_application_startup): Activate the shell object
using OAF. This makes it work across processes and adds
the feature.
* src/nautilus-main.c: (main): Call bonobo_activate explicitly so
CORBA calls work before the main loop.
* src/nautilus-shell.c: (display_caveat_first_time),
(corba_manage_desktop): Got rid of all state in NautilusShell
so we can use multiple shell objects if we want.
* src/nautilus-sidebar.c: (nautilus_sidebar_update_info):
Got rid of code that checks for NULL.
2000-07-10 Ramiro Estrugo <ramiro@eazel.com>
* icons/eazel/Services.png:
New icon from arlo.
New icon from Arlo.
2000-07-10 Michael Engber <engber@eazel.com>
......@@ -69,9 +152,8 @@
* test/test-nautilus-graphic.c: (main):
Update for new boundary offset support.
components/services/install/nautilus-view/nautilus-service-install-
view.c: (generate_install_form), (create_graphic_widget),
* components/services/install/nautilus-view/nautilus-service-install-view.c:
(generate_install_form), (create_graphic_widget),
(create_title_widget):
* components/services/login/nautilus-view/nautilus-login-view.c:
(generate_login_form), (create_graphic_widget),
......@@ -82,16 +164,12 @@
* components/services/trilobite/libtrilobite/Makefile.am:
* components/services/trilobite/libtrilobite/libtrilobite.h:
*
components/services/trilobite/libtrilobite/trilobite-core-utils.c:
* components/services/trilobite/libtrilobite/trilobite-core-utils.c:
(trilobite_pexec):
*
components/services/trilobite/libtrilobite/trilobite-core-utils.h:
*
components/services/trilobite/libtrilobite/trilobite-root-helper.c:
* components/services/trilobite/libtrilobite/trilobite-core-utils.h:
* components/services/trilobite/libtrilobite/trilobite-root-helper.c:
new file
*
components/services/trilobite/libtrilobite/trilobite-root-helper.h:
* components/services/trilobite/libtrilobite/trilobite-root-helper.h:
new file
Add baseline TrilobiteRootHelper object. It uses the "userhelper"
......
......@@ -108,26 +108,20 @@ history_view_update_icons (GtkCList *clist)
{
int row;
for (row = 0; row < clist->rows; ++row)
{
for (row = 0; row < clist->rows; ++row) {
install_icon (clist, row);
}
}
static Nautilus_HistoryList *
static Nautilus_History *
get_history_list (HistoryView *hview)
{
CORBA_Environment ev;
Nautilus_HistoryFrame view_frame;
Nautilus_HistoryList *list;
Nautilus_History *list;
list = NULL;
view_frame = history_view_frame_call_begin (hview->view, &ev);
if (view_frame != CORBA_OBJECT_NIL) {
list = Nautilus_HistoryFrame_get_history_list (view_frame, &ev);
}
list = Nautilus_HistoryFrame_get_history_list (view_frame, &ev);
history_view_frame_call_end (view_frame, &ev);
return list;
......@@ -142,51 +136,46 @@ hyperbola_navigation_history_load_location (NautilusView *view,
int new_rownum;
GtkCList *clist;
NautilusBookmark *bookmark;
//int i;
//GnomeVFSURI *vfs_uri;
//char *short_name;
Nautilus_HistoryList *history_list;
Nautilus_History *history;
Nautilus_HistoryItem *item;
int index;
int i;
hview->notify_count++;
clist = hview->clist;
gtk_clist_freeze(clist);
gtk_clist_freeze (clist);
/* Clear out list */
/* FIXME: Storage leak of column names here. */
gtk_clist_clear (clist);
/* Populate with data from main history list */
history_list = get_history_list (hview);
if (history_list != NULL) {
for (index = 0; index < history_list->_length; index++) {
item = &history_list->_buffer[index];
bookmark = nautilus_bookmark_new (item->location, item->name);
cols[HISTORY_VIEW_COLUMN_ICON] = NULL;
cols[HISTORY_VIEW_COLUMN_NAME] = item->name;
new_rownum = gtk_clist_append(clist, cols);
gtk_clist_set_row_data_full (clist, new_rownum, bookmark,
(GtkDestroyNotify)gtk_object_unref);
install_icon (clist, new_rownum);
gtk_clist_columns_autosize(clist);
if(gtk_clist_row_is_visible(clist, new_rownum) != GTK_VISIBILITY_FULL) {
gtk_clist_moveto(clist, new_rownum, -1, 0.5, 0.0);
}
history = get_history_list (hview);
for (i = 0; i < history->list._length; i++) {
item = &history->list._buffer[i];
bookmark = nautilus_bookmark_new (item->location, item->title);
cols[HISTORY_VIEW_COLUMN_ICON] = NULL;
/* FIXME: Storage leak of column names when list goes away. */
cols[HISTORY_VIEW_COLUMN_NAME] = g_strdup (item->title);
new_rownum = gtk_clist_append (clist, cols);
gtk_clist_set_row_data_full (clist, new_rownum, bookmark,
(GtkDestroyNotify) gtk_object_unref);
install_icon (clist, new_rownum);
gtk_clist_columns_autosize (clist);
if (gtk_clist_row_is_visible(clist, new_rownum) != GTK_VISIBILITY_FULL) {
gtk_clist_moveto(clist, new_rownum, -1, 0.5, 0.0);
}
CORBA_free (history_list);
}
CORBA_free (history);
gtk_clist_select_row(clist, 0, 0);
gtk_clist_select_row (clist, 0, 0);
gtk_clist_thaw(clist);
gtk_clist_thaw (clist);
hview->notify_count--;
}
......@@ -249,14 +238,14 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_clist_set_row_height (clist, NAUTILUS_ICON_SIZE_SMALLER);
gtk_clist_set_selection_mode(clist, GTK_SELECTION_BROWSE);
gtk_clist_columns_autosize(clist);
wtmp = gtk_scrolled_window_new(gtk_clist_get_hadjustment(clist),
gtk_clist_get_vadjustment(clist));
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(wtmp),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(wtmp), GTK_WIDGET (clist));
wtmp = gtk_scrolled_window_new (gtk_clist_get_hadjustment (clist),
gtk_clist_get_vadjustment (clist));
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wtmp),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (wtmp), GTK_WIDGET (clist));
gtk_widget_show_all(wtmp);
gtk_widget_show_all (wtmp);
/* create object */
hview->view = nautilus_view_new (wtmp);
......@@ -267,7 +256,7 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
/* handle events */
gtk_signal_connect(GTK_OBJECT(hview->view), "load_location",
hyperbola_navigation_history_load_location, hview);
hyperbola_navigation_history_load_location, hview);
gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (),
......@@ -278,20 +267,20 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
return BONOBO_OBJECT (hview->view);
}
int main(int argc, char *argv[])
int
main (int argc, char *argv[])
{
BonoboGenericFactory *factory;
CORBA_ORB orb;
gnome_init_with_popt_table("nautilus-history-view", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
gnome_init_with_popt_table ("nautilus-history-view", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
gnome_vfs_init ();
factory = bonobo_generic_factory_new_multi("OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", make_obj, NULL);
factory = bonobo_generic_factory_new_multi ("OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", make_obj, NULL);
do {
bonobo_main();
......
......@@ -77,7 +77,7 @@ finish_loading_note (NautilusFile *file,
static void
done_with_file (Notes *notes)
{
nautilus_file_cancel_callback (notes->file, finish_loading_note, notes);
nautilus_file_cancel_call_when_ready (notes->file, finish_loading_note, notes);
nautilus_file_unref (notes->file);
}
......
......@@ -270,7 +270,9 @@ nautilus_directory_get (const char *uri)
char *canonical_uri;
NautilusDirectory *directory;
g_return_val_if_fail (uri != NULL, NULL);
if (uri == NULL) {
return NULL;
}
canonical_uri = make_uri_canonical (uri);
......
......@@ -202,13 +202,13 @@ nautilus_entry_select_all_at_idle (NautilusEntry *entry)
* @test: The text to set
**/
void
void
nautilus_entry_set_text (NautilusEntry *entry, const gchar *text)
{
g_return_if_fail (NAUTILUS_IS_ENTRY (entry));
entry->user_edit = FALSE;
gtk_entry_set_text ( GTK_ENTRY (entry), text);
gtk_entry_set_text (GTK_ENTRY (entry), text);
entry->user_edit = TRUE;
}
......
......@@ -48,6 +48,13 @@ struct NautilusFileDetails
gboolean got_top_left_text;
char *top_left_text;
/* The following is for file operations in progress. Since
* there are normally only a few of these, we can move them to
* a separate hash table or something if required to keep the
* file objects small.
*/
GList *operations_in_progress;
};
#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
......
......@@ -520,58 +520,81 @@ typedef struct {
/* Operation-specific data. */
char *new_name; /* rename */
} FileOperationState;
} Operation;
static FileOperationState *
file_operation_state_new (NautilusFile *file,
NautilusFileOperationCallback callback,
gpointer callback_data)
static Operation *
operation_new (NautilusFile *file,
NautilusFileOperationCallback callback,
gpointer callback_data)
{
FileOperationState *state;
Operation *op;
nautilus_file_ref (file);
state = g_new0 (FileOperationState, 1);
state->file = file;
state->callback = callback;
state->callback_data = callback_data;
op = g_new0 (Operation, 1);
op->file = file;
op->callback = callback;
op->callback_data = callback_data;
return state;
op->file->details->operations_in_progress = g_list_prepend
(op->file->details->operations_in_progress, op);
return op;
}
static void
file_operation_state_free (FileOperationState *state)
operation_free (Operation *op)
{
nautilus_file_unref (state->file);
g_free (state->new_name);
g_free (state);
op->file->details->operations_in_progress = g_list_remove
(op->file->details->operations_in_progress, op);
nautilus_file_unref (op->file);
g_free (op->new_name);
g_free (op);
}
static void
file_operation_state_complete (FileOperationState *state,
GnomeVFSResult result)
operation_complete (Operation *op,
GnomeVFSResult result)
{
/* Claim that something changed even if the operation failed.
* This makes it easier for some clients who see the "reverting"
* as "changing back".
*/
nautilus_file_changed (state->file);
(* state->callback) (state->file, result, state->callback_data);
file_operation_state_free (state);
nautilus_file_changed (op->file);
(* op->callback) (op->file, result, op->callback_data);
operation_free (op);
}
static void
rename_update_info_and_metafile (FileOperationState *state)
operation_cancel (Operation *op)
{
/* Cancel the operation if it's still in progress. */
g_assert (op->handle != NULL);
gnome_vfs_async_cancel (op->handle);
/* Claim that something changed even though the operation was
* canceled in case some work was partly done, but don't call
* the callback.
*/
nautilus_file_changed (op->file);
operation_free (op);
}
static void
rename_update_info_and_metafile (Operation *op)
{
nautilus_directory_update_file_metadata
(state->file->details->directory,
state->file->details->name,
state->new_name);
(op->file->details->directory,
op->file->details->name,
op->new_name);
g_free (state->file->details->name);
state->file->details->name = g_strdup (state->new_name);
if (state->file->details->info != NULL) {
state->file->details->info->name = state->file->details->name;
g_free (op->file->details->name);
op->file->details->name = g_strdup (op->new_name);
if (op->file->details->info != NULL) {
op->file->details->info->name = op->file->details->name;
}
}
......@@ -580,10 +603,10 @@ rename_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSXferProgressInfo *info,
gpointer callback_data)
{
FileOperationState *state;
Operation *op;
state = callback_data;
g_assert (handle == state->handle);
op = callback_data;
g_assert (handle == op->handle);
g_assert (info != NULL);
/* We aren't really interested in progress, but we do need to see
......@@ -594,16 +617,17 @@ rename_callback (GnomeVFSAsyncHandle *handle,
if (info->phase == GNOME_VFS_XFER_PHASE_COMPLETED) {
/* Here's the case where we are done renaming. */
if (info->vfs_status == GNOME_VFS_OK) {
rename_update_info_and_metafile (state);
rename_update_info_and_metafile (op);
}
file_operation_state_complete (state, info->vfs_status);
operation_complete (op, info->vfs_status);
}
break;
case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
/* We have to handle this case because if you pass
* GNOME_VFS_ERROR_MODE_ABORT, you never get the
* error code for a failed rename.
* FIXME bugzilla.eazel.com 912: I believe this
*/
/* FIXME bugzilla.eazel.com 912: I believe this
* represents a bug in GNOME VFS.
*/
return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
......@@ -611,8 +635,10 @@ rename_callback (GnomeVFSAsyncHandle *handle,
break;
}
/* FIXME bugzilla.eazel.com 886: Pavel says I should return
* this, but he promises he will fix the API.
/* FIXME bugzilla.eazel.com 886: Pavel says we should return
* this, but he promises he will fix the API so we don't have
* to have special "occult knowledge" to understand this must
* be a 1.
*/
return 1;
}
......@@ -626,7 +652,7 @@ nautilus_file_rename (NautilusFile *file,
char *directory_uri_text;
GList *source_name_list, *target_name_list;
GnomeVFSResult result;
FileOperationState *state;
Operation *op;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (new_name != NULL);
......@@ -660,35 +686,48 @@ nautilus_file_rename (NautilusFile *file,
return;
}
state = file_operation_state_new (file, callback, callback_data);
state->new_name = g_strdup (new_name);
/* Set up a renaming operation. */
op = operation_new (file, callback, callback_data);
op->new_name = g_strdup (new_name);
directory_uri_text = nautilus_directory_get_uri (file->details->directory);
source_name_list = g_list_prepend (NULL, file->details->name);
target_name_list = g_list_prepend (NULL, (char *) new_name);
result = gnome_vfs_async_xfer
(&state->handle,
(&op->handle,
directory_uri_text, source_name_list,
directory_uri_text, target_name_list,
GNOME_VFS_XFER_SAMEFS | GNOME_VFS_XFER_REMOVESOURCE,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_ABORT,
rename_callback, state,
rename_callback, op,
NULL, NULL);
g_free (directory_uri_text);
g_list_free (source_name_list);
g_list_free (target_name_list);
if (result != GNOME_VFS_OK) {
file_operation_state_free (state);
operation_complete (op, result);
}
}
/* Claim that something changed even if the rename failed.
* This makes it easier for some clients who see the "reverting"
* to the old name as "changing back".
*/
nautilus_file_changed (file);
(* callback) (file, result, callback_data);
return;
void
nautilus_file_cancel (NautilusFile *file,
NautilusFileOperationCallback callback,
gpointer callback_data)
{
GList *p, *next;
Operation *op;
for (p = file->details->operations_in_progress; p != NULL; p = next) {
next = p->next;
op = p->data;
g_assert (op->file == file);
if (op->callback == callback
&& op->callback_data == callback_data) {
operation_cancel (op);
}
}
}
......@@ -1893,7 +1932,7 @@ nautilus_file_set_owner (NautilusFile *file,
if (!nautilus_file_can_set_owner (file)) {
/* Claim that something changed even if the permission change failed.
* This makes it easier for some clients who see the "reverting"
* to the old permissions as "changing back".
* to the old owner as "changing back".
*/
nautilus_file_changed (file);
(* callback) (file, GNOME_VFS_ERROR_ACCESS_DENIED, callback_data);
......@@ -3330,9 +3369,9 @@ nautilus_file_call_when_ready (NautilusFile *file,
}
void
nautilus_file_cancel_callback (NautilusFile *file,
NautilusFileCallback callback,
gpointer callback_data)
nautilus_file_cancel_call_when_ready (NautilusFile *file,
NautilusFileCallback callback,
gpointer callback_data)
{
g_return_if_fail (callback != NULL);
......
......@@ -99,7 +99,7 @@ void nautilus_file_call_when_ready (NautilusFile
gboolean wait_for_metadata,
NautilusFileCallback callback,
gpointer callback_data);
void nautilus_file_cancel_callback (NautilusFile *file,
void nautilus_file_cancel_call_when_ready (NautilusFile *file,
NautilusFileCallback callback,
gpointer callback_data);
gboolean nautilus_file_check_if_ready (NautilusFile *file,
......@@ -172,7 +172,8 @@ void nautilus_file_rename (NautilusFile
gboolean nautilus_file_is_rename_in_progress (NautilusFile *file,
char **old_name,
char **<