Commit 1815bfbf authored by Darin Adler's avatar Darin Adler

Put flags in the debuting_uris hash table so we can tell files that are

	* libnautilus-extensions/nautilus-file-operations.c:
	(sync_transfer_callback): Put flags in the debuting_uris hash
	table so we can tell files that are actually moved from files that
	are not because they are already in the right place.

	* src/file-manager/fm-directory-view.c:
	(copy_move_done_data_free): Use nautilus_file_list_free to save
	code.
	(remove_not_really_moved_files): Function to pick out files that
	are not actually moved (recognized by the flag in the
	debuting_uris hash table) and treat them as if they had already
	been moved.
	(copy_move_done_callback): Use g_hash_table_foreach_remove with
	the function above.

	* src/Nautilus_shell.oaf.in: Fix the the typo.

	* src/nautilus-sidebar-tabs.c: (get_property_bag): New function
	so we can share more code.
	(tab_item_destroy): Use new function for clarity and to fix lack
	of CORBA_exception_free.
	(get_tab_image_name): New function factored out.
	(nautilus_sidebar_tabs_update_tab_item): Use new function, also
	reduced some redundant code.
	(nautilus_sidebar_tabs_connect_view): Use new function for clarity
	and to save some code.

	* src/nautilus-view-frame.c: (destroy_view), (attach_view): Don't
	bother holding a reference to the NautilusView since it's part of
	the same object as the BonoboControl.

	* src/nautilus-window-menus.c: (help_menu_about_nautilus_callback):
	Get rid of non-ASCII character in a msgid string.

	* src/nautilus-window.c: (add_view_as_bonobo_menu_item): Fix tip
	string to be easier to translate.
parent 8917482d
2001-04-11 Darin Adler <darin@eazel.com>
* libnautilus-extensions/nautilus-file-operations.c:
(sync_transfer_callback): Put flags in the debuting_uris hash
table so we can tell files that are actually moved from files that
are not because they are already in the right place.
* src/file-manager/fm-directory-view.c:
(copy_move_done_data_free): Use nautilus_file_list_free to save
code.
(remove_not_really_moved_files): Function to pick out files that
are not actually moved (recognized by the flag in the
debuting_uris hash table) and treat them as if they had already
been moved.
(copy_move_done_callback): Use g_hash_table_foreach_remove with
the function above.
* src/Nautilus_shell.oaf.in: Fix the the typo.
* src/nautilus-sidebar-tabs.c: (get_property_bag): New function
so we can share more code.
(tab_item_destroy): Use new function for clarity and to fix lack
of CORBA_exception_free.
(get_tab_image_name): New function factored out.
(nautilus_sidebar_tabs_update_tab_item): Use new function, also
reduced some redundant code.
(nautilus_sidebar_tabs_connect_view): Use new function for clarity
and to save some code.
* src/nautilus-view-frame.c: (destroy_view), (attach_view): Don't
bother holding a reference to the NautilusView since it's part of
the same object as the BonoboControl.
* src/nautilus-window-menus.c: (help_menu_about_nautilus_callback):
Get rid of non-ASCII character in a msgid string.
* src/nautilus-window.c: (add_view_as_bonobo_menu_item): Fix tip
string to be easier to translate.
2001-04-11 John Harper <jsh@eazel.com>
reviewed by: Darin Adler <darin@eazel.com>
......
......@@ -73,7 +73,7 @@ typedef struct {
GtkWidget *parent_view;
TransferKind kind;
gboolean show_progress_dialog;
void (*done_callback) (GHashTable *debuting_uris, gpointer data);
void (* done_callback) (GHashTable *debuting_uris, gpointer data);
gpointer done_callback_data;
GHashTable *debuting_uris;
gboolean cancelled;
......@@ -1577,7 +1577,9 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
progress_info->target_name);
}
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
g_hash_table_insert (debuting_uris,
g_strdup (progress_info->target_name),
GINT_TO_POINTER (TRUE));
}
}
nautilus_file_changes_queue_file_added (progress_info->target_name);
......@@ -1608,7 +1610,9 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
}
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
g_hash_table_insert (debuting_uris,
g_strdup (progress_info->target_name),
GINT_TO_POINTER (really_moved));
}
}
if (really_moved) {
......
......@@ -73,7 +73,7 @@ typedef struct {
GtkWidget *parent_view;
TransferKind kind;
gboolean show_progress_dialog;
void (*done_callback) (GHashTable *debuting_uris, gpointer data);
void (* done_callback) (GHashTable *debuting_uris, gpointer data);
gpointer done_callback_data;
GHashTable *debuting_uris;
gboolean cancelled;
......@@ -1577,7 +1577,9 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
progress_info->target_name);
}
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
g_hash_table_insert (debuting_uris,
g_strdup (progress_info->target_name),
GINT_TO_POINTER (TRUE));
}
}
nautilus_file_changes_queue_file_added (progress_info->target_name);
......@@ -1608,7 +1610,9 @@ sync_transfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
}
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
g_hash_table_insert (debuting_uris,
g_strdup (progress_info->target_name),
GINT_TO_POINTER (really_moved));
}
}
if (really_moved) {
......
......@@ -38,7 +38,7 @@
<item value="IDL:Bonobo/Zoomable:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="Nautilus file manager desktop icon view"/>
<oaf_attribute name="description" type="string" _value="Nautilus file manager component that shows icons on the the desktop"/>
<oaf_attribute name="description" type="string" _value="Nautilus file manager component that shows icons on the desktop"/>
</oaf_server>
<oaf_server iid="OAFIID:nautilus_file_manager_list_view:521e489d-0662-4ad7-ac3a-832deabe111c" type="factory" location="OAFIID:nautilus_factory:bd1e1862-92d7-4391-963e-37583f0daef3">
......
......@@ -38,7 +38,7 @@
<item value="IDL:Bonobo/Zoomable:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="Nautilus file manager desktop icon view"/>
<oaf_attribute name="description" type="string" _value="Nautilus file manager component that shows icons on the the desktop"/>
<oaf_attribute name="description" type="string" _value="Nautilus file manager component that shows icons on the desktop"/>
</oaf_server>
<oaf_server iid="OAFIID:nautilus_file_manager_list_view:521e489d-0662-4ad7-ac3a-832deabe111c" type="factory" location="OAFIID:nautilus_factory:bd1e1862-92d7-4391-963e-37583f0daef3">
......
......@@ -1665,11 +1665,9 @@ typedef struct {
static void
debuting_uri_data_free (DebutingUriData *data)
{
if (data != NULL) {
eel_g_hash_table_destroy_deep (data->debuting_uris);
eel_g_list_free_deep_custom (data->added_files, (GFunc) gtk_object_unref, NULL);
g_free (data);
}
eel_g_hash_table_destroy_deep (data->debuting_uris);
nautilus_file_list_free (data->added_files);
g_free (data);
}
/* This signal handler watch for the arrival of the icons created
......@@ -1677,7 +1675,9 @@ debuting_uri_data_free (DebutingUriData *data)
* it selects and reveals them all.
*/
static void
debuting_uri_add_file_callback (FMDirectoryView *view, NautilusFile *new_file, DebutingUriData *data)
debuting_uri_add_file_callback (FMDirectoryView *view,
NautilusFile *new_file,
DebutingUriData *data)
{
char *uri;
......@@ -1690,7 +1690,9 @@ debuting_uri_add_file_callback (FMDirectoryView *view, NautilusFile *new_file, D
if (g_hash_table_size (data->debuting_uris) == 0) {
fm_directory_view_set_selection (view, data->added_files);
fm_directory_view_reveal_selection (view);
gtk_signal_disconnect_by_func (GTK_OBJECT (view), &debuting_uri_add_file_callback, data);
gtk_signal_disconnect_by_func (GTK_OBJECT (view),
debuting_uri_add_file_callback,
data);
}
}
......@@ -1708,7 +1710,7 @@ copy_move_done_data_free (CopyMoveDoneData *data)
g_assert (data != NULL);
eel_nullify_cancel (&data->directory_view);
eel_g_list_free_deep_custom (data->added_files, (GFunc) gtk_object_unref, NULL);
nautilus_file_list_free (data->added_files);
g_free (data);
}
......@@ -1756,14 +1758,30 @@ copy_move_done_partition_func (gpointer data, gpointer callback_data)
gboolean result;
uri = nautilus_file_get_uri (NAUTILUS_FILE (data));
result = eel_g_hash_table_remove_deep ((GHashTable *) callback_data, uri);
g_free (uri);
return result;
}
static gboolean
remove_not_really_moved_files (gpointer key,
gpointer value,
gpointer callback_data)
{
GList **added_files;
if (GPOINTER_TO_INT (value)) {
return FALSE;
}
added_files = callback_data;
*added_files = g_list_prepend (*added_files,
nautilus_file_get (key));
return TRUE;
}
/* When this function is invoked, the file operation is over, but all
* the icons may not have been added to the directory view yet, so
* we can't select them yet.
......@@ -1786,20 +1804,31 @@ copy_move_done_callback (GHashTable *debuting_uris, gpointer data)
debuting_uri_data = g_new (DebutingUriData, 1);
debuting_uri_data->debuting_uris = debuting_uris;
debuting_uri_data->added_files = eel_g_list_partition (copy_move_done_data->added_files,
copy_move_done_partition_func,
debuting_uris,
&copy_move_done_data->added_files);
debuting_uri_data->added_files = eel_g_list_partition
(copy_move_done_data->added_files,
copy_move_done_partition_func,
debuting_uris,
&copy_move_done_data->added_files);
/* We're passed the same data used by pre_copy_move_add_file_callback, so disconnecting
* it will free data. We've already siphoned off the added_files we need, and stashed the
* directory_view pointer.
*/
gtk_signal_disconnect_by_func (GTK_OBJECT (directory_view), &pre_copy_move_add_file_callback, data);
gtk_signal_disconnect_by_func (GTK_OBJECT (directory_view),
pre_copy_move_add_file_callback,
data);
/* Any items in the debuting_uris hash table that have
* "FALSE" as their value aren't really being copied
* or moved, so we can't wait for an add_file signal
* to come in for those.
*/
g_hash_table_foreach_remove (debuting_uris,
remove_not_really_moved_files,
&debuting_uri_data->added_files);
if (g_hash_table_size (debuting_uris) == 0) {
/* on the off-chance that all the icons have already been added ...
*/
/* on the off-chance that all the icons have already been added */
if (debuting_uri_data->added_files != NULL) {
fm_directory_view_set_selection (directory_view,
debuting_uri_data->added_files);
......
......@@ -600,7 +600,7 @@ help_menu_about_nautilus_callback (BonoboUIComponent *component,
"Susan Kare",
NULL
};
const char *copyright, *translator_credits;
if (about == NULL) {
/* timestamp overrides build message, because timestamp
......@@ -614,30 +614,37 @@ help_menu_about_nautilus_callback (BonoboUIComponent *component,
}
}
/* The copyright character in here is correct for
* Latin-1 encoding, but not for UTF-8, so we have
* to change it when we upgrade to GTK 2.0.
/* Localize to deal with issues in the copyright
* symbol characters -- do not translate the company
* name, please.
*/
copyright = _("Copyright (C) 1999-2001 Eazel, Inc.");
/* This is a workaround for problems when the msgid
* itself has a non-ASCII character in it.
*/
if (strcmp (copyright, "Copyright (C) 1999-2001 Eazel, Inc.") == 0) {
/* The copyright character here is correct for
* Latin-1 encoding, but not for UTF-8, so we
* have to change it when we move to GTK 2.0.
*/
copyright = "Copyright \xA9 1999-2001 Eazel, Inc.";
}
/* Translators should localize the following string
* which will be displayed at the bottom of the about
* box to give credit to the translator(s).
*/
translator_credits = _("Translator Credits");
about = nautilus_about_new (_("Nautilus"),
VERSION,
/* Localize to deal with
* issues in the copyright
* symbol characters -- do
* not translate the
* company name, please.
*/
_("Copyright \xA9 1999-2001 Eazel, Inc."),
copyright,
authors,
_("Nautilus is a graphical shell\n"
"for GNOME that makes it\n"
"easy to manage your files\n"
"and the rest of your system."),
/* translators should localize the following
* string which will be displayed at the
* bottom of the about box to give credit
* to the translator(s)
*/
_("Translator Credits"),
translator_credits,
time_stamp);
g_free (time_stamp);
......
......@@ -4,7 +4,7 @@
* Nautilus
*
* Copyright (C) 1999, 2000 Red Hat, Inc.
* Copyright (C) 1999, 2000 Eazel, Inc.
* Copyright (C) 1999, 2000, 2001 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
......@@ -40,13 +40,20 @@
#include "nautilus-window-manage-views.h"
#include "nautilus-window-service-ui.h"
#include "nautilus-zoom-control.h"
#include <bonobo/bonobo-ui-util.h>
#include <X11/Xatom.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-ui-util.h>
#include <ctype.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmenubar.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkoptionmenu.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
......@@ -61,26 +68,19 @@
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-drag-window.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-generous-bin.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <libnautilus-extensions/nautilus-horizontal-splitter.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-mime-actions.h>
#include <libnautilus-extensions/nautilus-program-choosing.h>
#include <libnautilus-extensions/nautilus-sidebar-functions.h>
#include <eel/eel-string.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus/nautilus-clipboard.h>
#include <libnautilus/nautilus-undo.h>
#include <math.h>
#include <sys/time.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
/* FIXME bugzilla.eazel.com 1243:
* We should use inheritance instead of these special cases
......@@ -1228,7 +1228,8 @@ add_view_as_bonobo_menu_item (NautilusWindow *window,
identifier->view_as_label,
"viewers group");
tip = g_strdup_printf (_("Display this location with the %s"), identifier->viewer_label);
tip = g_strdup_printf (_("Display this location with \"%s\""),
identifier->viewer_label);
item_path = nautilus_bonobo_get_numbered_menu_item_path
(window->details->shell_ui,
placeholder_path,
......
......@@ -4,7 +4,7 @@
* Nautilus
*
* Copyright (C) 1999, 2000 Red Hat, Inc.
* Copyright (C) 1999, 2000 Eazel, Inc.
* Copyright (C) 1999, 2000, 2001 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
......@@ -40,13 +40,20 @@
#include "nautilus-window-manage-views.h"
#include "nautilus-window-service-ui.h"
#include "nautilus-zoom-control.h"
#include <bonobo/bonobo-ui-util.h>
#include <X11/Xatom.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-ui-util.h>
#include <ctype.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmenubar.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkoptionmenu.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
......@@ -61,26 +68,19 @@
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-drag-window.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-generous-bin.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <libnautilus-extensions/nautilus-horizontal-splitter.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-mime-actions.h>
#include <libnautilus-extensions/nautilus-program-choosing.h>
#include <libnautilus-extensions/nautilus-sidebar-functions.h>
#include <eel/eel-string.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus/nautilus-clipboard.h>
#include <libnautilus/nautilus-undo.h>
#include <math.h>
#include <sys/time.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
/* FIXME bugzilla.eazel.com 1243:
* We should use inheritance instead of these special cases
......@@ -1228,7 +1228,8 @@ add_view_as_bonobo_menu_item (NautilusWindow *window,
identifier->view_as_label,
"viewers group");
tip = g_strdup_printf (_("Display this location with the %s"), identifier->viewer_label);
tip = g_strdup_printf (_("Display this location with \"%s\""),
identifier->viewer_label);
item_path = nautilus_bonobo_get_numbered_menu_item_path
(window->details->shell_ui,
placeholder_path,
......
......@@ -319,14 +319,32 @@ nautilus_sidebar_tabs_new (void)
return gtk_widget_new (nautilus_sidebar_tabs_get_type (), NULL);
}
/* utility to destroy all the storage used by a tab item */
static Bonobo_PropertyBag
get_property_bag (TabItem *item)
{
Bonobo_Control control;
CORBA_Environment ev;
Bonobo_PropertyBag property_bag;
control = nautilus_view_frame_get_control (NAUTILUS_VIEW_FRAME (item->tab_view));
if (control == NULL) {
return CORBA_OBJECT_NIL;
}
CORBA_exception_init (&ev);
property_bag = Bonobo_Control_getProperties (control, &ev);
if (BONOBO_EX (&ev)) {
property_bag = CORBA_OBJECT_NIL;
}
CORBA_exception_free (&ev);
return property_bag;
}
/* utility to destroy all the storage used by a tab item */
static void
tab_item_destroy (TabItem *item)
{
CORBA_Environment ev;
Bonobo_PropertyBag property_bag;
Bonobo_Control control;
g_free (item->tab_text);
g_free (item->indicator_pixbuf_name);
......@@ -336,17 +354,11 @@ tab_item_destroy (TabItem *item)
}
if (item->listener_id != 0) {
CORBA_exception_init (&ev);
control = nautilus_view_frame_get_control (NAUTILUS_VIEW_FRAME (item->tab_view));
if (control != NULL) {
property_bag = Bonobo_Control_getProperties (control, &ev);
if (!BONOBO_EX (&ev) && property_bag != CORBA_OBJECT_NIL) {
bonobo_event_source_client_remove_listener
(property_bag,
item->listener_id,
&ev);
bonobo_object_release_unref (property_bag, &ev);
}
property_bag = get_property_bag (item);
if (property_bag != CORBA_OBJECT_NIL) {
bonobo_event_source_client_remove_listener
(property_bag, item->listener_id, NULL);
bonobo_object_release_unref (property_bag, NULL);
}
}
g_free (item);
......@@ -1213,13 +1225,14 @@ draw_or_layout_all_tabs (NautilusSidebarTabs *sidebar_tabs, gboolean layout_only
static TabItem *
tab_item_find_by_name (NautilusSidebarTabs *sidebar_tabs, const char *name)
{
GList *iterator;
GList *node;
TabItem *tab_item;
g_return_val_if_fail (NAUTILUS_IS_SIDEBAR_TABS (sidebar_tabs), NULL);
g_return_val_if_fail (name != NULL, NULL);
for (iterator = sidebar_tabs->details->tab_items; iterator != NULL; iterator = iterator->next) {
TabItem *tab_item = iterator->data;
for (node = sidebar_tabs->details->tab_items; node != NULL; node = node->next) {
tab_item = node->data;
g_assert (tab_item != NULL);
g_assert (tab_item->tab_text != NULL);
......@@ -1300,65 +1313,64 @@ nautilus_sidebar_tabs_expose (GtkWidget *widget, GdkEventExpose *event)
return FALSE;
}
static char *
get_tab_image_name (TabItem *tab_item)
{
Bonobo_PropertyBag property_bag;
char *tab_image_name;
property_bag = get_property_bag (tab_item);
if (property_bag == CORBA_OBJECT_NIL) {
return NULL;
}
tab_image_name = bonobo_property_bag_client_get_value_string
(property_bag, "tab_image", NULL);
bonobo_object_release_unref (property_bag, NULL);
return tab_image_name;
}
/* update the indicator image for the passed in tab */
static void
nautilus_sidebar_tabs_update_tab_item (NautilusSidebarTabs *sidebar_tabs, TabItem *tab_item)
{
CORBA_Environment ev;
Bonobo_Control control;
Bonobo_PropertyBag property_bag;
char *tab_image_name, *image_path;
/* fetch indicator icon through the bonobo propertybag mechanism */
CORBA_exception_init (&ev);
control = nautilus_view_frame_get_control (NAUTILUS_VIEW_FRAME (tab_item->tab_view));
if (control != NULL) {
property_bag = Bonobo_Control_getProperties (control, &ev);
if (property_bag != NULL) {
tab_image_name = bonobo_property_bag_client_get_value_string (property_bag, "tab_image", &ev);
bonobo_object_release_unref (property_bag, &ev);
/* see if the indicator icon changed; if so, fetch the new one */
if (eel_strcmp (tab_image_name, tab_item->indicator_pixbuf_name) != 0) {
g_free (tab_item->indicator_pixbuf_name);
if (tab_item->indicator_pixbuf != NULL) {
gdk_pixbuf_unref (tab_item->indicator_pixbuf);
tab_item->indicator_pixbuf = NULL;
}
if (tab_image_name != NULL) {
tab_item->indicator_pixbuf_name = g_strdup (tab_image_name);
image_path = nautilus_theme_get_image_path (tab_image_name);
if (image_path != NULL) {
tab_item->indicator_pixbuf = gdk_pixbuf_new_from_file (image_path);
g_free (image_path);
}
} else {
tab_item->indicator_pixbuf_name = NULL;
if (tab_item->indicator_pixbuf != NULL) {
gdk_pixbuf_unref (tab_item->indicator_pixbuf);
tab_item->indicator_pixbuf = NULL;
}
}
recalculate_size (sidebar_tabs);
gtk_widget_queue_draw (GTK_WIDGET (sidebar_tabs));
tab_image_name = get_tab_image_name (tab_item);
/* see if the indicator icon changed; if so, fetch the new one */
if (eel_strcmp (tab_image_name, tab_item->indicator_pixbuf_name) != 0) {
g_free (tab_item->indicator_pixbuf_name);
tab_item->indicator_pixbuf_name = g_strdup (tab_image_name);
if (tab_item->indicator_pixbuf != NULL) {
gdk_pixbuf_unref (tab_item->indicator_pixbuf);
tab_item->indicator_pixbuf = NULL;
}
if (tab_image_name != NULL) {
image_path = nautilus_theme_get_image_path (tab_image_name);
if (image_path != NULL) {
tab_item->indicator_pixbuf = gdk_pixbuf_new_from_file (image_path);
g_free (image_path);
}
g_free (tab_image_name);
}
recalculate_size (sidebar_tabs);
gtk_widget_queue_draw (GTK_WIDGET (sidebar_tabs));
}
CORBA_exception_free (&ev);
g_free (tab_image_name);
}
static TabItem *
get_tab_item_from_view (NautilusSidebarTabs *sidebar_tabs, GtkWidget *view)
{
GList *iterator;
for (iterator = sidebar_tabs->details->tab_items; iterator != NULL; iterator = iterator->next) {
TabItem *tab_item = iterator->data;
GList *node;
TabItem *tab_item;
for (node = sidebar_tabs->details->tab_items; node != NULL; node = node->next) {
tab_item = node->data;
if (tab_item->tab_view == view) {
return tab_item;
}
......@@ -1370,10 +1382,11 @@ get_tab_item_from_view (NautilusSidebarTabs *sidebar_tabs, GtkWidget *view)
static void
nautilus_sidebar_tabs_update_all_indicators (NautilusSidebarTabs *sidebar_tabs)
{
GList *iterator;
GList *node;
TabItem *tab_item;
for (iterator = sidebar_tabs->details->tab_items; iterator != NULL; iterator = iterator->next) {
TabItem *tab_item = iterator->data;
for (node = sidebar_tabs->details->tab_items; node != NULL; node = node->next) {
tab_item = node->data;
nautilus_sidebar_tabs_update_tab_item (sidebar_tabs, tab_item);
}
}
......@@ -1382,10 +1395,11 @@ nautilus_sidebar_tabs_update_all_indicators (NautilusSidebarTabs *sidebar_tabs)
static void
nautilus_sidebar_tabs_update_indicator (NautilusSidebarTabs *sidebar_tabs, GtkWidget *view)
{
GList *iterator;
for (iterator = sidebar_tabs->details->tab_items; iterator != NULL; iterator = iterator->next) {
TabItem *tab_item = iterator->data;
GList *node;
TabItem *tab_item;
for (node = sidebar_tabs->details->tab_items; node != NULL; node = node->next) {
tab_item = node->data;
if (tab_item->tab_view == view) {
nautilus_sidebar_tabs_update_tab_item (sidebar_tabs, tab_item);
break;
......@@ -1401,6 +1415,7 @@ tab_indicator_changed_callback (BonoboListener *listener,
gpointer callback_data)
{
NautilusSidebarTabs *sidebar_tabs;
sidebar_tabs = NAUTILUS_SIDEBAR_TABS (callback_data);
nautilus_sidebar_tabs_update_all_indicators (sidebar_tabs);
}
......@@ -1409,24 +1424,21 @@ tab_indicator_changed_callback (BonoboListener *listener,
void
nautilus_sidebar_tabs_connect_view (NautilusSidebarTabs *sidebar_tabs, GtkWidget *view)
{
CORBA_Environment ev;
Bonobo_PropertyBag property_bag;
TabItem *tab_item;
Bonobo_PropertyBag property_bag;
tab_item = get_tab_item_from_view (sidebar_tabs, view);
if (tab_item == NULL) {
return;
}
CORBA_exception_init (&ev);
property_bag = Bonobo_Control_getProperties (nautilus_view_frame_get_control (NAUTILUS_VIEW_FRAME (view)), &ev);
if (!BONOBO_EX (&ev) && property_bag != CORBA_OBJECT_NIL) {
tab_item->listener_id = bonobo_event_source_client_add_listener
property_bag = get_property_bag (tab_item);
if (property_bag != CORBA_OBJECT_NIL) {
tab_item->listener_id = bonobo_event_source_client_add_listener
(property_bag, tab_indicator_changed_callback,
"Bonobo/Property:change:tab_image", NULL, sidebar_tabs);
bonobo_object_release_unref (property_bag, &ev);
"Bonobo/Property:change:tab_image", NULL, sidebar_tabs);
bonobo_object_release_unref (property_bag, NULL);
}
CORBA_exception_free (&ev);
nautilus_sidebar_tabs_update_indicator (sidebar_tabs, view);
}
......
......@@ -4,7 +4,7 @@
* Nautilus
*
* Copyright (C) 1999, 2000 Red Hat, Inc.
* Copyright (C) 1999, 2000 Eazel, Inc.
* Copyright (C) 1999, 2000, 2001 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
......@@ -40,13 +40,20 @@
#include "nautilus-window-manage-views.h"
#include "nautilus-window-service-ui.h"
#include "nautilus-zoom-control.h"
#include <bonobo/bonobo-ui-util.h>
#include <X11/Xatom.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-ui-util.h>
#include <ctype.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmenubar.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkoptionmenu.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
......@@ -61,26 +68,19 @@
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-drag-window.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-generous-bin.h>