diff options
author | John Sullivan <sullivan@src.gnome.org> | 2000-04-25 23:03:03 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2000-04-25 23:03:03 +0000 |
commit | b539db7f0d6d08e04eacc30f3a71e515ffc0f0c8 (patch) | |
tree | 19d42a8e0b1182eb1952aa1ca3ff345979e21ce0 | |
parent | 467f7b3fe9e4bf3a49880739f31547688eefdc4b (diff) | |
download | nautilus-b539db7f0d6d08e04eacc30f3a71e515ffc0f0c8.tar.gz |
Started going through the FIXMEs adding bug reports
and fixing some trivial ones. 14 down, 152 Nautilus
FIXMEs to go.
* src/ntl-index-panel.c:
Wrote bug reports for all FIXMEs in this file.
* src/ntl-window-msgs.c,
* src/ntl-window-private.h,
* src/ntl-window.c:
(view_menu_switch_views_callback),
(nautilus_window_load_content_view_menu): Moved functions from
ntl-window-msgs.c to ntl-window.c. Updated private header file
as necessary.
Wrote bug reports for all other FIXMEs in these files.
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | src/nautilus-information-panel.c | 28 | ||||
-rw-r--r-- | src/nautilus-navigation-window.c | 108 | ||||
-rw-r--r-- | src/nautilus-object-window.c | 108 | ||||
-rw-r--r-- | src/nautilus-sidebar.c | 28 | ||||
-rw-r--r-- | src/nautilus-spatial-window.c | 108 | ||||
-rw-r--r-- | src/nautilus-window-manage-views.c | 111 | ||||
-rw-r--r-- | src/nautilus-window-private.h | 5 | ||||
-rw-r--r-- | src/nautilus-window.c | 108 | ||||
-rw-r--r-- | src/ntl-index-panel.c | 28 | ||||
-rw-r--r-- | src/ntl-window-msgs.c | 111 | ||||
-rw-r--r-- | src/ntl-window-private.h | 5 | ||||
-rw-r--r-- | src/ntl-window.c | 108 |
13 files changed, 611 insertions, 264 deletions
@@ -1,3 +1,22 @@ +2000-04-25 John Sullivan <sullivan@eazel.com> + + Started going through the FIXMEs adding bug reports + and fixing some trivial ones. 14 down, 152 Nautilus + FIXMEs to go. + + * src/ntl-index-panel.c: + Wrote bug reports for all FIXMEs in this file. + + * src/ntl-window-msgs.c, + * src/ntl-window-private.h, + * src/ntl-window.c: + (view_menu_switch_views_callback), + (nautilus_window_load_content_view_menu): Moved functions from + ntl-window-msgs.c to ntl-window.c. Updated private header file + as necessary. + + Wrote bug reports for all other FIXMEs in these files. + 2000-04-25 Andy Hertzfeld <andy@eazel.com> * src/ntl-index-panel.c: diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index 311db8fe1..8be44db50 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -247,13 +247,17 @@ hit_test (NautilusIndexPanel *index_panel, return NO_PART; } -/* FIXME: If passed a bogus URI this could block for a long time. */ +/* FIXME bugzilla.eazel.com 606: + * If passed a bogus URI this could block for a long time. + */ static gboolean uri_is_local_image (const char *uri) { GdkPixbuf *pixbuf; - /* FIXME: Perhaps this should not be hardcoded like this. */ + /* FIXME bugzilla.eazel.com 607: + * Perhaps this should not be hardcoded like this. + */ if (!nautilus_str_has_prefix (uri, "file://")) { return FALSE; } @@ -277,8 +281,9 @@ receive_dropped_uri_list (NautilusIndexPanel *index_panel, uris = g_strsplit (selection_data->data, "\r\n", 0); exactly_one = uris[0] != NULL && uris[1] == NULL; - /* FIXME: handle background images and keywords soon */ - /* FIXME: handle files by setting the location to the file */ + /* FIXME bugzilla.eazel.com 602: set keywords by drag-and-drop */ + /* FIXME bugzilla.eazel.com 603: handle background images soon */ + /* FIXME bugzilla.eazel.com 604: handle files by setting the location to the file */ switch (hit_test (index_panel, x, y)) { case NO_PART: @@ -288,7 +293,8 @@ receive_dropped_uri_list (NautilusIndexPanel *index_panel, break; case ICON_PART: /* handle images dropped on the logo specially */ - /* FIXME: Need feedback for cases where there is more than one URI + /* FIXME bugzilla.eazel.com 605: + * Need feedback for cases where there is more than one URI * and where the URI is not alocal image. */ if (exactly_one && uri_is_local_image (uris[0])) { @@ -402,7 +408,9 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie description = nautilus_meta_view_get_label (NAUTILUS_META_VIEW (meta_view)); if (description == NULL) { - /* FIXME: Why is a hex address better than an empty string? */ + /* FIXME bugzilla.eazel.com 599: + * Why is a hex address better than an empty string? + */ g_snprintf (cbuf, sizeof (cbuf), "%p", meta_view); description = cbuf; } @@ -650,7 +658,9 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) gtk_button_set_relief (GTK_BUTTON (temp_button), GTK_RELIEF_NORMAL); gtk_widget_set_usize (GTK_WIDGET (temp_button), 80, 20); - /* FIXME: we must quote the uri in case it has blanks */ + /* FIXME bugzilla.eazel.com 600: + * we must quote the uri in case it has blanks. + */ if (nautilus_str_has_prefix (index_panel->details->uri, "file://")) { temp_str = index_panel->details->uri + 7; } else { @@ -667,7 +677,9 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) } /* here's where we set up the command buttons, based on the mime-type of the associated URL */ -/* FIXME: eventually, we need a way to override/augment the type from info in the metadata */ +/* FIXME bugzilla.eazel.com 596: eventually, we need a way to + * override/augment the type from info in the metadata. + */ void nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel) diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 22ae39dcc..05a1b2417 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -40,6 +40,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-string.h> #include "nautilus-zoom-control.h" #include <ctype.h> @@ -610,9 +611,9 @@ nautilus_window_realize (GtkWidget *widget) (* GTK_WIDGET_CLASS(parent_class)->realize) (widget); /* Set the mini icon */ - /* FIXME draw a real icon */ - /* FIXME The icon should be 16x16, we get garbage on the edges - since it's 12x12 */ + /* FIXME bugzilla.eazel.com 609: + * Need a real icon for Nautilus here. It should be 16x16. + */ filename = gnome_pixmap_file("panel-arrow-down.png"); if (filename != NULL) { @@ -634,7 +635,9 @@ nautilus_window_realize (GtkWidget *widget) pixmap, mask); - /* FIXME I think we are leaking the pixmap/mask here */ + /* FIXME bugzilla.eazel.com 610: + * I think we are leaking the pixmap/mask here. + */ } /* @@ -656,6 +659,97 @@ nautilus_window_send_show_properties(GtkWidget *dockitem, GdkEventButton *event, } #endif +static void +view_menu_switch_views_callback (GtkWidget *widget, gpointer data) +{ + NautilusWindow *window; + NautilusView *view; + NautilusDirectory *directory; + char *iid; + + g_return_if_fail (GTK_IS_MENU_ITEM (widget)); + g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); + g_return_if_fail (data != NULL); + + window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); + g_assert (window->ni != NULL); + + iid = (char *) data; + + directory = nautilus_directory_get (window->ni->requested_uri); + g_assert (directory != NULL); + nautilus_directory_set_metadata (directory, + NAUTILUS_METADATA_KEY_INITIAL_VIEW, + NULL, + iid); + nautilus_directory_unref (directory); + + nautilus_window_allow_stop (window, TRUE); + + view = nautilus_window_load_content_view (window, iid, window->ni, NULL); + nautilus_window_set_state_info (window, + (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, + (NautilusWindowStateItem)0); +} + +void +nautilus_window_load_content_view_menu (NautilusWindow *window, + NautilusNavigationInfo *ni) +{ + GSList *p; + GtkWidget *new_menu; + int index, default_view_index; + GtkWidget *menu_item; + NautilusViewIdentifier *identifier; + char *menu_label; + + g_return_if_fail (NAUTILUS_IS_WINDOW (window)); + g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); + g_return_if_fail (ni != NULL); + + new_menu = gtk_menu_new (); + + /* Add a menu item for each available content view type */ + index = 0; + default_view_index = -1; + for (p = ni->content_identifiers; p != NULL; p = p->next) { + identifier = (NautilusViewIdentifier *) p->data; + menu_label = g_strdup_printf (_("View as %s"), identifier->name); + menu_item = gtk_menu_item_new_with_label (menu_label); + g_free (menu_label); + + if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { + default_view_index = index; + } + + /* Free copy of iid string when signal disconnected. */ + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (menu_item), + "activate", + GTK_SIGNAL_FUNC (view_menu_switch_views_callback), + g_strdup (identifier->iid)); + + /* Store reference to window in item; no need to free this. */ + gtk_object_set_user_data (GTK_OBJECT (menu_item), window); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + gtk_widget_show (menu_item); + + ++index; + } + + /* + * We create and attach a new menu here because adding/removing + * items from existing menu screws up the size of the option menu. + */ + + gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), + new_menu); + + g_assert (default_view_index >= 0); + gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), + default_view_index); +} + void nautilus_window_set_content_view(NautilusWindow *window, NautilusView *content_view) { @@ -698,8 +792,10 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di g_assert (g_slist_length (list) > distance); memset(&nri, 0, sizeof(nri)); - /* FIXME: Have to cast away the const for nri.requested_uri. This field should be - * declared const. */ + /* FIXME bugzilla.eazel.com 608: + * Have to cast away the const for nri.requested_uri. This field should be + * declared const. + */ nri.requested_uri = (char *)nautilus_bookmark_get_uri (g_slist_nth_data (list, distance)); nri.new_window_requested = FALSE; diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 22ae39dcc..05a1b2417 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -40,6 +40,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-string.h> #include "nautilus-zoom-control.h" #include <ctype.h> @@ -610,9 +611,9 @@ nautilus_window_realize (GtkWidget *widget) (* GTK_WIDGET_CLASS(parent_class)->realize) (widget); /* Set the mini icon */ - /* FIXME draw a real icon */ - /* FIXME The icon should be 16x16, we get garbage on the edges - since it's 12x12 */ + /* FIXME bugzilla.eazel.com 609: + * Need a real icon for Nautilus here. It should be 16x16. + */ filename = gnome_pixmap_file("panel-arrow-down.png"); if (filename != NULL) { @@ -634,7 +635,9 @@ nautilus_window_realize (GtkWidget *widget) pixmap, mask); - /* FIXME I think we are leaking the pixmap/mask here */ + /* FIXME bugzilla.eazel.com 610: + * I think we are leaking the pixmap/mask here. + */ } /* @@ -656,6 +659,97 @@ nautilus_window_send_show_properties(GtkWidget *dockitem, GdkEventButton *event, } #endif +static void +view_menu_switch_views_callback (GtkWidget *widget, gpointer data) +{ + NautilusWindow *window; + NautilusView *view; + NautilusDirectory *directory; + char *iid; + + g_return_if_fail (GTK_IS_MENU_ITEM (widget)); + g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); + g_return_if_fail (data != NULL); + + window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); + g_assert (window->ni != NULL); + + iid = (char *) data; + + directory = nautilus_directory_get (window->ni->requested_uri); + g_assert (directory != NULL); + nautilus_directory_set_metadata (directory, + NAUTILUS_METADATA_KEY_INITIAL_VIEW, + NULL, + iid); + nautilus_directory_unref (directory); + + nautilus_window_allow_stop (window, TRUE); + + view = nautilus_window_load_content_view (window, iid, window->ni, NULL); + nautilus_window_set_state_info (window, + (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, + (NautilusWindowStateItem)0); +} + +void +nautilus_window_load_content_view_menu (NautilusWindow *window, + NautilusNavigationInfo *ni) +{ + GSList *p; + GtkWidget *new_menu; + int index, default_view_index; + GtkWidget *menu_item; + NautilusViewIdentifier *identifier; + char *menu_label; + + g_return_if_fail (NAUTILUS_IS_WINDOW (window)); + g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); + g_return_if_fail (ni != NULL); + + new_menu = gtk_menu_new (); + + /* Add a menu item for each available content view type */ + index = 0; + default_view_index = -1; + for (p = ni->content_identifiers; p != NULL; p = p->next) { + identifier = (NautilusViewIdentifier *) p->data; + menu_label = g_strdup_printf (_("View as %s"), identifier->name); + menu_item = gtk_menu_item_new_with_label (menu_label); + g_free (menu_label); + + if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { + default_view_index = index; + } + + /* Free copy of iid string when signal disconnected. */ + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (menu_item), + "activate", + GTK_SIGNAL_FUNC (view_menu_switch_views_callback), + g_strdup (identifier->iid)); + + /* Store reference to window in item; no need to free this. */ + gtk_object_set_user_data (GTK_OBJECT (menu_item), window); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + gtk_widget_show (menu_item); + + ++index; + } + + /* + * We create and attach a new menu here because adding/removing + * items from existing menu screws up the size of the option menu. + */ + + gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), + new_menu); + + g_assert (default_view_index >= 0); + gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), + default_view_index); +} + void nautilus_window_set_content_view(NautilusWindow *window, NautilusView *content_view) { @@ -698,8 +792,10 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di g_assert (g_slist_length (list) > distance); memset(&nri, 0, sizeof(nri)); - /* FIXME: Have to cast away the const for nri.requested_uri. This field should be - * declared const. */ + /* FIXME bugzilla.eazel.com 608: + * Have to cast away the const for nri.requested_uri. This field should be + * declared const. + */ nri.requested_uri = (char *)nautilus_bookmark_get_uri (g_slist_nth_data (list, distance)); nri.new_window_requested = FALSE; diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index 311db8fe1..8be44db50 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -247,13 +247,17 @@ hit_test (NautilusIndexPanel *index_panel, return NO_PART; } -/* FIXME: If passed a bogus URI this could block for a long time. */ +/* FIXME bugzilla.eazel.com 606: + * If passed a bogus URI this could block for a long time. + */ static gboolean uri_is_local_image (const char *uri) { GdkPixbuf *pixbuf; - /* FIXME: Perhaps this should not be hardcoded like this. */ + /* FIXME bugzilla.eazel.com 607: + * Perhaps this should not be hardcoded like this. + */ if (!nautilus_str_has_prefix (uri, "file://")) { return FALSE; } @@ -277,8 +281,9 @@ receive_dropped_uri_list (NautilusIndexPanel *index_panel, uris = g_strsplit (selection_data->data, "\r\n", 0); exactly_one = uris[0] != NULL && uris[1] == NULL; - /* FIXME: handle background images and keywords soon */ - /* FIXME: handle files by setting the location to the file */ + /* FIXME bugzilla.eazel.com 602: set keywords by drag-and-drop */ + /* FIXME bugzilla.eazel.com 603: handle background images soon */ + /* FIXME bugzilla.eazel.com 604: handle files by setting the location to the file */ switch (hit_test (index_panel, x, y)) { case NO_PART: @@ -288,7 +293,8 @@ receive_dropped_uri_list (NautilusIndexPanel *index_panel, break; case ICON_PART: /* handle images dropped on the logo specially */ - /* FIXME: Need feedback for cases where there is more than one URI + /* FIXME bugzilla.eazel.com 605: + * Need feedback for cases where there is more than one URI * and where the URI is not alocal image. */ if (exactly_one && uri_is_local_image (uris[0])) { @@ -402,7 +408,9 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie description = nautilus_meta_view_get_label (NAUTILUS_META_VIEW (meta_view)); if (description == NULL) { - /* FIXME: Why is a hex address better than an empty string? */ + /* FIXME bugzilla.eazel.com 599: + * Why is a hex address better than an empty string? + */ g_snprintf (cbuf, sizeof (cbuf), "%p", meta_view); description = cbuf; } @@ -650,7 +658,9 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) gtk_button_set_relief (GTK_BUTTON (temp_button), GTK_RELIEF_NORMAL); gtk_widget_set_usize (GTK_WIDGET (temp_button), 80, 20); - /* FIXME: we must quote the uri in case it has blanks */ + /* FIXME bugzilla.eazel.com 600: + * we must quote the uri in case it has blanks. + */ if (nautilus_str_has_prefix (index_panel->details->uri, "file://")) { temp_str = index_panel->details->uri + 7; } else { @@ -667,7 +677,9 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) } /* here's where we set up the command buttons, based on the mime-type of the associated URL */ -/* FIXME: eventually, we need a way to override/augment the type from info in the metadata */ +/* FIXME bugzilla.eazel.com 596: eventually, we need a way to + * override/augment the type from info in the metadata. + */ void nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel) diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 22ae39dcc..05a1b2417 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -40,6 +40,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-string.h> #include "nautilus-zoom-control.h" #include <ctype.h> @@ -610,9 +611,9 @@ nautilus_window_realize (GtkWidget *widget) (* GTK_WIDGET_CLASS(parent_class)->realize) (widget); /* Set the mini icon */ - /* FIXME draw a real icon */ - /* FIXME The icon should be 16x16, we get garbage on the edges - since it's 12x12 */ + /* FIXME bugzilla.eazel.com 609: + * Need a real icon for Nautilus here. It should be 16x16. + */ filename = gnome_pixmap_file("panel-arrow-down.png"); if (filename != NULL) { @@ -634,7 +635,9 @@ nautilus_window_realize (GtkWidget *widget) pixmap, mask); - /* FIXME I think we are leaking the pixmap/mask here */ + /* FIXME bugzilla.eazel.com 610: + * I think we are leaking the pixmap/mask here. + */ } /* @@ -656,6 +659,97 @@ nautilus_window_send_show_properties(GtkWidget *dockitem, GdkEventButton *event, } #endif +static void +view_menu_switch_views_callback (GtkWidget *widget, gpointer data) +{ + NautilusWindow *window; + NautilusView *view; + NautilusDirectory *directory; + char *iid; + + g_return_if_fail (GTK_IS_MENU_ITEM (widget)); + g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); + g_return_if_fail (data != NULL); + + window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); + g_assert (window->ni != NULL); + + iid = (char *) data; + + directory = nautilus_directory_get (window->ni->requested_uri); + g_assert (directory != NULL); + nautilus_directory_set_metadata (directory, + NAUTILUS_METADATA_KEY_INITIAL_VIEW, + NULL, + iid); + nautilus_directory_unref (directory); + + nautilus_window_allow_stop (window, TRUE); + + view = nautilus_window_load_content_view (window, iid, window->ni, NULL); + nautilus_window_set_state_info (window, + (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, + (NautilusWindowStateItem)0); +} + +void +nautilus_window_load_content_view_menu (NautilusWindow *window, + NautilusNavigationInfo *ni) +{ + GSList *p; + GtkWidget *new_menu; + int index, default_view_index; + GtkWidget *menu_item; + NautilusViewIdentifier *identifier; + char *menu_label; + + g_return_if_fail (NAUTILUS_IS_WINDOW (window)); + g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); + g_return_if_fail (ni != NULL); + + new_menu = gtk_menu_new (); + + /* Add a menu item for each available content view type */ + index = 0; + default_view_index = -1; + for (p = ni->content_identifiers; p != NULL; p = p->next) { + identifier = (NautilusViewIdentifier *) p->data; + menu_label = g_strdup_printf (_("View as %s"), identifier->name); + menu_item = gtk_menu_item_new_with_label (menu_label); + g_free (menu_label); + + if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { + default_view_index = index; + } + + /* Free copy of iid string when signal disconnected. */ + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (menu_item), + "activate", + GTK_SIGNAL_FUNC (view_menu_switch_views_callback), + g_strdup (identifier->iid)); + + /* Store reference to window in item; no need to free this. */ + gtk_object_set_user_data (GTK_OBJECT (menu_item), window); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + gtk_widget_show (menu_item); + + ++index; + } + + /* + * We create and attach a new menu here because adding/removing + * items from existing menu screws up the size of the option menu. + */ + + gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), + new_menu); + + g_assert (default_view_index >= 0); + gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), + default_view_index); +} + void nautilus_window_set_content_view(NautilusWindow *window, NautilusView *content_view) { @@ -698,8 +792,10 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di g_assert (g_slist_length (list) > distance); memset(&nri, 0, sizeof(nri)); - /* FIXME: Have to cast away the const for nri.requested_uri. This field should be - * declared const. */ + /* FIXME bugzilla.eazel.com 608: + * Have to cast away the const for nri.requested_uri. This field should be + * declared const. + */ nri.requested_uri = (char *)nautilus_bookmark_get_uri (g_slist_nth_data (list, distance)); nri.new_window_requested = FALSE; diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index 680e13772..5e9cab1d9 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -41,7 +41,6 @@ #include <libnautilus-extensions/nautilus-file.h> #include <libnautilus-extensions/nautilus-string.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> -#include <libnautilus-extensions/nautilus-metadata.h> #include "ntl-app.h" #include "ntl-meta-view.h" #include "ntl-uri-map.h" @@ -62,8 +61,6 @@ static void nautilus_window_notify_selection_change (NautilusWindow *win NautilusView *view, Nautilus_SelectionInfo *loc, NautilusView *requesting_view); -static void nautilus_window_load_content_view_menu (NautilusWindow *window, - NautilusNavigationInfo *ni); typedef enum { PROGRESS_INITIAL, PROGRESS_VIEWS, PROGRESS_DONE, PROGRESS_ERROR } ProgressType; @@ -441,10 +438,10 @@ nautilus_window_update_internals (NautilusWindow *window, NautilusNavigationInfo nautilus_location_bar_set_location(NAUTILUS_LOCATION_BAR(window->ent_uri), window->ni->requested_uri); - /* - * Notify the index panel of the location change. FIXME: Eventually, - * this will not be necessary when we restructure the index panel to - * be a NautilusView. + /* Notify the index panel of the location change. */ + /* FIXME bugzilla.eazel.com 211: + * Eventually, this will not be necessary when we restructure the + * index panel to be a NautilusView. */ current_title = nautilus_window_get_current_location_title (window); nautilus_index_panel_set_uri (window->index_panel, window->ni->requested_uri, current_title); @@ -650,7 +647,7 @@ nautilus_window_request_location_change (NautilusWindow *window, } } -static NautilusView * +NautilusView * nautilus_window_load_content_view(NautilusWindow *window, const char *iid, Nautilus_NavigationInfo *navinfo, @@ -1191,100 +1188,4 @@ nautilus_window_begin_location_change (NautilusWindow *window, (loc, window->ni, nautilus_window_end_location_change_callback, window, current_iid); -} - -/******** content view switching **********/ -static void -view_menu_switch_views_callback (GtkWidget *widget, gpointer data) -{ - NautilusWindow *window; - NautilusView *view; - NautilusDirectory *directory; - char *iid; - - g_return_if_fail (GTK_IS_MENU_ITEM (widget)); - g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); - g_return_if_fail (data != NULL); - - window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); - g_assert (window->ni != NULL); - - iid = (char *) data; - - directory = nautilus_directory_get (window->ni->requested_uri); - g_assert (directory != NULL); - nautilus_directory_set_metadata (directory, - NAUTILUS_METADATA_KEY_INITIAL_VIEW, - NULL, - iid); - nautilus_directory_unref (directory); - - nautilus_window_allow_stop (window, TRUE); - - view = nautilus_window_load_content_view (window, iid, window->ni, NULL); - nautilus_window_set_state_info (window, - (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, - (NautilusWindowStateItem)0); -} - -/* - * FIXME: Probably this should be moved to ntl-window.c with the rest of the UI. - * I was waiting until we had the framework settled before doing that. - */ -static void -nautilus_window_load_content_view_menu (NautilusWindow *window, - NautilusNavigationInfo *ni) -{ - GSList *p; - GtkWidget *new_menu; - int index, default_view_index; - GtkWidget *menu_item; - NautilusViewIdentifier *identifier; - char *menu_label; - - g_return_if_fail (NAUTILUS_IS_WINDOW (window)); - g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); - g_return_if_fail (ni != NULL); - - new_menu = gtk_menu_new (); - - /* Add a menu item for each available content view type */ - index = 0; - default_view_index = -1; - for (p = ni->content_identifiers; p != NULL; p = p->next) { - identifier = (NautilusViewIdentifier *) p->data; - menu_label = g_strdup_printf (_("View as %s"), identifier->name); - menu_item = gtk_menu_item_new_with_label (menu_label); - g_free (menu_label); - - if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { - default_view_index = index; - } - - /* Free copy of iid string when signal disconnected. */ - nautilus_gtk_signal_connect_free_data - (GTK_OBJECT (menu_item), - "activate", - GTK_SIGNAL_FUNC (view_menu_switch_views_callback), - g_strdup (identifier->iid)); - - /* Store reference to window in item; no need to free this. */ - gtk_object_set_user_data (GTK_OBJECT (menu_item), window); - gtk_menu_append (GTK_MENU (new_menu), menu_item); - gtk_widget_show (menu_item); - - ++index; - } - - /* - * We create and attach a new menu here because adding/removing - * items from existing menu screws up the size of the option menu. - */ - - gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), - new_menu); - - g_assert (default_view_index >= 0); - gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), - default_view_index); -} +}
\ No newline at end of file diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h index 63162b967..2c80ad742 100644 --- a/src/nautilus-window-private.h +++ b/src/nautilus-window-private.h @@ -43,6 +43,11 @@ void nautilus_window_begin_location_change(NautilusWindow *window, NautilusLocationChangeType type, guint distance); void nautilus_window_remove_meta_view_real(NautilusWindow *window, NautilusView *meta_view); +void nautilus_window_load_content_view_menu (NautilusWindow *window, NautilusNavigationInfo *ni); +NautilusView *nautilus_window_load_content_view(NautilusWindow *window, + const char *iid, + Nautilus_NavigationInfo *navinfo, + NautilusView **requesting_view); void nautilus_window_connect_content_view (NautilusWindow *window, NautilusContentView *view); void nautilus_window_connect_view (NautilusWindow *window, diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 22ae39dcc..05a1b2417 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -40,6 +40,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-string.h> #include "nautilus-zoom-control.h" #include <ctype.h> @@ -610,9 +611,9 @@ nautilus_window_realize (GtkWidget *widget) (* GTK_WIDGET_CLASS(parent_class)->realize) (widget); /* Set the mini icon */ - /* FIXME draw a real icon */ - /* FIXME The icon should be 16x16, we get garbage on the edges - since it's 12x12 */ + /* FIXME bugzilla.eazel.com 609: + * Need a real icon for Nautilus here. It should be 16x16. + */ filename = gnome_pixmap_file("panel-arrow-down.png"); if (filename != NULL) { @@ -634,7 +635,9 @@ nautilus_window_realize (GtkWidget *widget) pixmap, mask); - /* FIXME I think we are leaking the pixmap/mask here */ + /* FIXME bugzilla.eazel.com 610: + * I think we are leaking the pixmap/mask here. + */ } /* @@ -656,6 +659,97 @@ nautilus_window_send_show_properties(GtkWidget *dockitem, GdkEventButton *event, } #endif +static void +view_menu_switch_views_callback (GtkWidget *widget, gpointer data) +{ + NautilusWindow *window; + NautilusView *view; + NautilusDirectory *directory; + char *iid; + + g_return_if_fail (GTK_IS_MENU_ITEM (widget)); + g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); + g_return_if_fail (data != NULL); + + window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); + g_assert (window->ni != NULL); + + iid = (char *) data; + + directory = nautilus_directory_get (window->ni->requested_uri); + g_assert (directory != NULL); + nautilus_directory_set_metadata (directory, + NAUTILUS_METADATA_KEY_INITIAL_VIEW, + NULL, + iid); + nautilus_directory_unref (directory); + + nautilus_window_allow_stop (window, TRUE); + + view = nautilus_window_load_content_view (window, iid, window->ni, NULL); + nautilus_window_set_state_info (window, + (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, + (NautilusWindowStateItem)0); +} + +void +nautilus_window_load_content_view_menu (NautilusWindow *window, + NautilusNavigationInfo *ni) +{ + GSList *p; + GtkWidget *new_menu; + int index, default_view_index; + GtkWidget *menu_item; + NautilusViewIdentifier *identifier; + char *menu_label; + + g_return_if_fail (NAUTILUS_IS_WINDOW (window)); + g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); + g_return_if_fail (ni != NULL); + + new_menu = gtk_menu_new (); + + /* Add a menu item for each available content view type */ + index = 0; + default_view_index = -1; + for (p = ni->content_identifiers; p != NULL; p = p->next) { + identifier = (NautilusViewIdentifier *) p->data; + menu_label = g_strdup_printf (_("View as %s"), identifier->name); + menu_item = gtk_menu_item_new_with_label (menu_label); + g_free (menu_label); + + if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { + default_view_index = index; + } + + /* Free copy of iid string when signal disconnected. */ + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (menu_item), + "activate", + GTK_SIGNAL_FUNC (view_menu_switch_views_callback), + g_strdup (identifier->iid)); + + /* Store reference to window in item; no need to free this. */ + gtk_object_set_user_data (GTK_OBJECT (menu_item), window); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + gtk_widget_show (menu_item); + + ++index; + } + + /* + * We create and attach a new menu here because adding/removing + * items from existing menu screws up the size of the option menu. + */ + + gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), + new_menu); + + g_assert (default_view_index >= 0); + gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), + default_view_index); +} + void nautilus_window_set_content_view(NautilusWindow *window, NautilusView *content_view) { @@ -698,8 +792,10 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di g_assert (g_slist_length (list) > distance); memset(&nri, 0, sizeof(nri)); - /* FIXME: Have to cast away the const for nri.requested_uri. This field should be - * declared const. */ + /* FIXME bugzilla.eazel.com 608: + * Have to cast away the const for nri.requested_uri. This field should be + * declared const. + */ nri.requested_uri = (char *)nautilus_bookmark_get_uri (g_slist_nth_data (list, distance)); nri.new_window_requested = FALSE; diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c index 311db8fe1..8be44db50 100644 --- a/src/ntl-index-panel.c +++ b/src/ntl-index-panel.c @@ -247,13 +247,17 @@ hit_test (NautilusIndexPanel *index_panel, return NO_PART; } -/* FIXME: If passed a bogus URI this could block for a long time. */ +/* FIXME bugzilla.eazel.com 606: + * If passed a bogus URI this could block for a long time. + */ static gboolean uri_is_local_image (const char *uri) { GdkPixbuf *pixbuf; - /* FIXME: Perhaps this should not be hardcoded like this. */ + /* FIXME bugzilla.eazel.com 607: + * Perhaps this should not be hardcoded like this. + */ if (!nautilus_str_has_prefix (uri, "file://")) { return FALSE; } @@ -277,8 +281,9 @@ receive_dropped_uri_list (NautilusIndexPanel *index_panel, uris = g_strsplit (selection_data->data, "\r\n", 0); exactly_one = uris[0] != NULL && uris[1] == NULL; - /* FIXME: handle background images and keywords soon */ - /* FIXME: handle files by setting the location to the file */ + /* FIXME bugzilla.eazel.com 602: set keywords by drag-and-drop */ + /* FIXME bugzilla.eazel.com 603: handle background images soon */ + /* FIXME bugzilla.eazel.com 604: handle files by setting the location to the file */ switch (hit_test (index_panel, x, y)) { case NO_PART: @@ -288,7 +293,8 @@ receive_dropped_uri_list (NautilusIndexPanel *index_panel, break; case ICON_PART: /* handle images dropped on the logo specially */ - /* FIXME: Need feedback for cases where there is more than one URI + /* FIXME bugzilla.eazel.com 605: + * Need feedback for cases where there is more than one URI * and where the URI is not alocal image. */ if (exactly_one && uri_is_local_image (uris[0])) { @@ -402,7 +408,9 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie description = nautilus_meta_view_get_label (NAUTILUS_META_VIEW (meta_view)); if (description == NULL) { - /* FIXME: Why is a hex address better than an empty string? */ + /* FIXME bugzilla.eazel.com 599: + * Why is a hex address better than an empty string? + */ g_snprintf (cbuf, sizeof (cbuf), "%p", meta_view); description = cbuf; } @@ -650,7 +658,9 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) gtk_button_set_relief (GTK_BUTTON (temp_button), GTK_RELIEF_NORMAL); gtk_widget_set_usize (GTK_WIDGET (temp_button), 80, 20); - /* FIXME: we must quote the uri in case it has blanks */ + /* FIXME bugzilla.eazel.com 600: + * we must quote the uri in case it has blanks. + */ if (nautilus_str_has_prefix (index_panel->details->uri, "file://")) { temp_str = index_panel->details->uri + 7; } else { @@ -667,7 +677,9 @@ add_command_buttons(NautilusIndexPanel *index_panel, GList *command_list) } /* here's where we set up the command buttons, based on the mime-type of the associated URL */ -/* FIXME: eventually, we need a way to override/augment the type from info in the metadata */ +/* FIXME bugzilla.eazel.com 596: eventually, we need a way to + * override/augment the type from info in the metadata. + */ void nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel) diff --git a/src/ntl-window-msgs.c b/src/ntl-window-msgs.c index 680e13772..5e9cab1d9 100644 --- a/src/ntl-window-msgs.c +++ b/src/ntl-window-msgs.c @@ -41,7 +41,6 @@ #include <libnautilus-extensions/nautilus-file.h> #include <libnautilus-extensions/nautilus-string.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> -#include <libnautilus-extensions/nautilus-metadata.h> #include "ntl-app.h" #include "ntl-meta-view.h" #include "ntl-uri-map.h" @@ -62,8 +61,6 @@ static void nautilus_window_notify_selection_change (NautilusWindow *win NautilusView *view, Nautilus_SelectionInfo *loc, NautilusView *requesting_view); -static void nautilus_window_load_content_view_menu (NautilusWindow *window, - NautilusNavigationInfo *ni); typedef enum { PROGRESS_INITIAL, PROGRESS_VIEWS, PROGRESS_DONE, PROGRESS_ERROR } ProgressType; @@ -441,10 +438,10 @@ nautilus_window_update_internals (NautilusWindow *window, NautilusNavigationInfo nautilus_location_bar_set_location(NAUTILUS_LOCATION_BAR(window->ent_uri), window->ni->requested_uri); - /* - * Notify the index panel of the location change. FIXME: Eventually, - * this will not be necessary when we restructure the index panel to - * be a NautilusView. + /* Notify the index panel of the location change. */ + /* FIXME bugzilla.eazel.com 211: + * Eventually, this will not be necessary when we restructure the + * index panel to be a NautilusView. */ current_title = nautilus_window_get_current_location_title (window); nautilus_index_panel_set_uri (window->index_panel, window->ni->requested_uri, current_title); @@ -650,7 +647,7 @@ nautilus_window_request_location_change (NautilusWindow *window, } } -static NautilusView * +NautilusView * nautilus_window_load_content_view(NautilusWindow *window, const char *iid, Nautilus_NavigationInfo *navinfo, @@ -1191,100 +1188,4 @@ nautilus_window_begin_location_change (NautilusWindow *window, (loc, window->ni, nautilus_window_end_location_change_callback, window, current_iid); -} - -/******** content view switching **********/ -static void -view_menu_switch_views_callback (GtkWidget *widget, gpointer data) -{ - NautilusWindow *window; - NautilusView *view; - NautilusDirectory *directory; - char *iid; - - g_return_if_fail (GTK_IS_MENU_ITEM (widget)); - g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); - g_return_if_fail (data != NULL); - - window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); - g_assert (window->ni != NULL); - - iid = (char *) data; - - directory = nautilus_directory_get (window->ni->requested_uri); - g_assert (directory != NULL); - nautilus_directory_set_metadata (directory, - NAUTILUS_METADATA_KEY_INITIAL_VIEW, - NULL, - iid); - nautilus_directory_unref (directory); - - nautilus_window_allow_stop (window, TRUE); - - view = nautilus_window_load_content_view (window, iid, window->ni, NULL); - nautilus_window_set_state_info (window, - (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, - (NautilusWindowStateItem)0); -} - -/* - * FIXME: Probably this should be moved to ntl-window.c with the rest of the UI. - * I was waiting until we had the framework settled before doing that. - */ -static void -nautilus_window_load_content_view_menu (NautilusWindow *window, - NautilusNavigationInfo *ni) -{ - GSList *p; - GtkWidget *new_menu; - int index, default_view_index; - GtkWidget *menu_item; - NautilusViewIdentifier *identifier; - char *menu_label; - - g_return_if_fail (NAUTILUS_IS_WINDOW (window)); - g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); - g_return_if_fail (ni != NULL); - - new_menu = gtk_menu_new (); - - /* Add a menu item for each available content view type */ - index = 0; - default_view_index = -1; - for (p = ni->content_identifiers; p != NULL; p = p->next) { - identifier = (NautilusViewIdentifier *) p->data; - menu_label = g_strdup_printf (_("View as %s"), identifier->name); - menu_item = gtk_menu_item_new_with_label (menu_label); - g_free (menu_label); - - if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { - default_view_index = index; - } - - /* Free copy of iid string when signal disconnected. */ - nautilus_gtk_signal_connect_free_data - (GTK_OBJECT (menu_item), - "activate", - GTK_SIGNAL_FUNC (view_menu_switch_views_callback), - g_strdup (identifier->iid)); - - /* Store reference to window in item; no need to free this. */ - gtk_object_set_user_data (GTK_OBJECT (menu_item), window); - gtk_menu_append (GTK_MENU (new_menu), menu_item); - gtk_widget_show (menu_item); - - ++index; - } - - /* - * We create and attach a new menu here because adding/removing - * items from existing menu screws up the size of the option menu. - */ - - gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), - new_menu); - - g_assert (default_view_index >= 0); - gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), - default_view_index); -} +}
\ No newline at end of file diff --git a/src/ntl-window-private.h b/src/ntl-window-private.h index 63162b967..2c80ad742 100644 --- a/src/ntl-window-private.h +++ b/src/ntl-window-private.h @@ -43,6 +43,11 @@ void nautilus_window_begin_location_change(NautilusWindow *window, NautilusLocationChangeType type, guint distance); void nautilus_window_remove_meta_view_real(NautilusWindow *window, NautilusView *meta_view); +void nautilus_window_load_content_view_menu (NautilusWindow *window, NautilusNavigationInfo *ni); +NautilusView *nautilus_window_load_content_view(NautilusWindow *window, + const char *iid, + Nautilus_NavigationInfo *navinfo, + NautilusView **requesting_view); void nautilus_window_connect_content_view (NautilusWindow *window, NautilusContentView *view); void nautilus_window_connect_view (NautilusWindow *window, diff --git a/src/ntl-window.c b/src/ntl-window.c index 22ae39dcc..05a1b2417 100644 --- a/src/ntl-window.c +++ b/src/ntl-window.c @@ -40,6 +40,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-string.h> #include "nautilus-zoom-control.h" #include <ctype.h> @@ -610,9 +611,9 @@ nautilus_window_realize (GtkWidget *widget) (* GTK_WIDGET_CLASS(parent_class)->realize) (widget); /* Set the mini icon */ - /* FIXME draw a real icon */ - /* FIXME The icon should be 16x16, we get garbage on the edges - since it's 12x12 */ + /* FIXME bugzilla.eazel.com 609: + * Need a real icon for Nautilus here. It should be 16x16. + */ filename = gnome_pixmap_file("panel-arrow-down.png"); if (filename != NULL) { @@ -634,7 +635,9 @@ nautilus_window_realize (GtkWidget *widget) pixmap, mask); - /* FIXME I think we are leaking the pixmap/mask here */ + /* FIXME bugzilla.eazel.com 610: + * I think we are leaking the pixmap/mask here. + */ } /* @@ -656,6 +659,97 @@ nautilus_window_send_show_properties(GtkWidget *dockitem, GdkEventButton *event, } #endif +static void +view_menu_switch_views_callback (GtkWidget *widget, gpointer data) +{ + NautilusWindow *window; + NautilusView *view; + NautilusDirectory *directory; + char *iid; + + g_return_if_fail (GTK_IS_MENU_ITEM (widget)); + g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget)))); + g_return_if_fail (data != NULL); + + window = NAUTILUS_WINDOW (gtk_object_get_user_data (GTK_OBJECT (widget))); + g_assert (window->ni != NULL); + + iid = (char *) data; + + directory = nautilus_directory_get (window->ni->requested_uri); + g_assert (directory != NULL); + nautilus_directory_set_metadata (directory, + NAUTILUS_METADATA_KEY_INITIAL_VIEW, + NULL, + iid); + nautilus_directory_unref (directory); + + nautilus_window_allow_stop (window, TRUE); + + view = nautilus_window_load_content_view (window, iid, window->ni, NULL); + nautilus_window_set_state_info (window, + (NautilusWindowStateItem)NEW_CONTENT_VIEW_ACTIVATED, view, + (NautilusWindowStateItem)0); +} + +void +nautilus_window_load_content_view_menu (NautilusWindow *window, + NautilusNavigationInfo *ni) +{ + GSList *p; + GtkWidget *new_menu; + int index, default_view_index; + GtkWidget *menu_item; + NautilusViewIdentifier *identifier; + char *menu_label; + + g_return_if_fail (NAUTILUS_IS_WINDOW (window)); + g_return_if_fail (GTK_IS_OPTION_MENU (window->option_cvtype)); + g_return_if_fail (ni != NULL); + + new_menu = gtk_menu_new (); + + /* Add a menu item for each available content view type */ + index = 0; + default_view_index = -1; + for (p = ni->content_identifiers; p != NULL; p = p->next) { + identifier = (NautilusViewIdentifier *) p->data; + menu_label = g_strdup_printf (_("View as %s"), identifier->name); + menu_item = gtk_menu_item_new_with_label (menu_label); + g_free (menu_label); + + if (strcmp (identifier->iid, ni->initial_content_iid) == 0) { + default_view_index = index; + } + + /* Free copy of iid string when signal disconnected. */ + nautilus_gtk_signal_connect_free_data + (GTK_OBJECT (menu_item), + "activate", + GTK_SIGNAL_FUNC (view_menu_switch_views_callback), + g_strdup (identifier->iid)); + + /* Store reference to window in item; no need to free this. */ + gtk_object_set_user_data (GTK_OBJECT (menu_item), window); + gtk_menu_append (GTK_MENU (new_menu), menu_item); + gtk_widget_show (menu_item); + + ++index; + } + + /* + * We create and attach a new menu here because adding/removing + * items from existing menu screws up the size of the option menu. + */ + + gtk_option_menu_set_menu (GTK_OPTION_MENU (window->option_cvtype), + new_menu); + + g_assert (default_view_index >= 0); + gtk_option_menu_set_history (GTK_OPTION_MENU (window->option_cvtype), + default_view_index); +} + void nautilus_window_set_content_view(NautilusWindow *window, NautilusView *content_view) { @@ -698,8 +792,10 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di g_assert (g_slist_length (list) > distance); memset(&nri, 0, sizeof(nri)); - /* FIXME: Have to cast away the const for nri.requested_uri. This field should be - * declared const. */ + /* FIXME bugzilla.eazel.com 608: + * Have to cast away the const for nri.requested_uri. This field should be + * declared const. + */ nri.requested_uri = (char *)nautilus_bookmark_get_uri (g_slist_nth_data (list, distance)); nri.new_window_requested = FALSE; |