Commit a1714db8 authored by John Sullivan's avatar John Sullivan

Stored pointers to all buttons & menu items that are accessed later; fixed

off-by-two bug in directory item-counting hack.
parent c45c00a7
2000-02-11 John Sullivan <sullivan@eazel.com>
* src/ntl-window.h:
Return of the stored widgets for toolbar buttons that need
sensitivity changes, only this time do them all and add
the new menu items too.
* src/ntl-window.c:
(nautilus_window_constructed): Save away pointers to all the
widgets that need accessing later.
(nautilus_window_allow_back), (nautilus_window_allow_forward),
(nautilus_window_allow_up), (nautilus_window_allow_reload),
(nautilus_window_allow_stop): Use stored widget pointers rather
than GnomeUIInfo arrays to access the buttons and menu items.
Getting the widget from the array only worked until another
window was created.
* libnautilus/nautilus-directory.c: (get_directory_item_count_hack):
Subtract 2 from item count before returning, to account for . and ..
2000-02-11 John Sullivan <sullivan@eazel.com>
Sensitized "Open" context menu item, and added
......
......@@ -1664,8 +1664,9 @@ get_directory_item_count_hack (NautilusFile *file, gboolean ignore_invisible_ite
count += 1;
closedir(directory);
return count;
/* This way of getting the count includes . and .., so we subtract those out */
return count - 2;
}
......
......@@ -1664,8 +1664,9 @@ get_directory_item_count_hack (NautilusFile *file, gboolean ignore_invisible_ite
count += 1;
closedir(directory);
return count;
/* This way of getting the count includes . and .., so we subtract those out */
return count - 2;
}
......
......@@ -1664,8 +1664,9 @@ get_directory_item_count_hack (NautilusFile *file, gboolean ignore_invisible_ite
count += 1;
closedir(directory);
return count;
/* This way of getting the count includes . and .., so we subtract those out */
return count - 2;
}
......
......@@ -563,6 +563,18 @@ nautilus_window_constructed(NautilusWindow *window)
after the statusbar
creation */
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
window->back_menu_item = go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget;
window->forward_menu_item = go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget;
window->up_menu_item = go_menu_info[GO_MENU_UP_ITEM_INDEX].widget;
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
*/
......@@ -943,34 +955,34 @@ nautilus_window_about_cb (GtkWidget *widget,
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->back_button, allow);
gtk_widget_set_sensitive(window->back_menu_item, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->forward_button, allow);
gtk_widget_set_sensitive(window->forward_menu_item, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_UP_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->up_button, allow);
gtk_widget_set_sensitive(window->up_menu_item, allow);
}
void
nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->reload_button, allow);
}
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->stop_button, allow);
}
......
......@@ -77,6 +77,16 @@ struct _NautilusWindow {
NautilusView *content_view;
GSList *meta_views;
/* Widgets to keep track of (for state changes, etc) */
GtkWidget *back_button;
GtkWidget *forward_button;
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *back_menu_item;
GtkWidget *forward_menu_item;
GtkWidget *up_menu_item;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
......
......@@ -563,6 +563,18 @@ nautilus_window_constructed(NautilusWindow *window)
after the statusbar
creation */
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
window->back_menu_item = go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget;
window->forward_menu_item = go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget;
window->up_menu_item = go_menu_info[GO_MENU_UP_ITEM_INDEX].widget;
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
*/
......@@ -943,34 +955,34 @@ nautilus_window_about_cb (GtkWidget *widget,
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->back_button, allow);
gtk_widget_set_sensitive(window->back_menu_item, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->forward_button, allow);
gtk_widget_set_sensitive(window->forward_menu_item, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_UP_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->up_button, allow);
gtk_widget_set_sensitive(window->up_menu_item, allow);
}
void
nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->reload_button, allow);
}
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->stop_button, allow);
}
......
......@@ -77,6 +77,16 @@ struct _NautilusWindow {
NautilusView *content_view;
GSList *meta_views;
/* Widgets to keep track of (for state changes, etc) */
GtkWidget *back_button;
GtkWidget *forward_button;
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *back_menu_item;
GtkWidget *forward_menu_item;
GtkWidget *up_menu_item;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
......
......@@ -563,6 +563,18 @@ nautilus_window_constructed(NautilusWindow *window)
after the statusbar
creation */
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
window->back_menu_item = go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget;
window->forward_menu_item = go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget;
window->up_menu_item = go_menu_info[GO_MENU_UP_ITEM_INDEX].widget;
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
*/
......@@ -943,34 +955,34 @@ nautilus_window_about_cb (GtkWidget *widget,
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->back_button, allow);
gtk_widget_set_sensitive(window->back_menu_item, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->forward_button, allow);
gtk_widget_set_sensitive(window->forward_menu_item, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_UP_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->up_button, allow);
gtk_widget_set_sensitive(window->up_menu_item, allow);
}
void
nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->reload_button, allow);
}
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->stop_button, allow);
}
......
......@@ -77,6 +77,16 @@ struct _NautilusWindow {
NautilusView *content_view;
GSList *meta_views;
/* Widgets to keep track of (for state changes, etc) */
GtkWidget *back_button;
GtkWidget *forward_button;
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *back_menu_item;
GtkWidget *forward_menu_item;
GtkWidget *up_menu_item;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
......
......@@ -563,6 +563,18 @@ nautilus_window_constructed(NautilusWindow *window)
after the statusbar
creation */
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
window->back_menu_item = go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget;
window->forward_menu_item = go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget;
window->up_menu_item = go_menu_info[GO_MENU_UP_ITEM_INDEX].widget;
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
*/
......@@ -943,34 +955,34 @@ nautilus_window_about_cb (GtkWidget *widget,
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->back_button, allow);
gtk_widget_set_sensitive(window->back_menu_item, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->forward_button, allow);
gtk_widget_set_sensitive(window->forward_menu_item, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_UP_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->up_button, allow);
gtk_widget_set_sensitive(window->up_menu_item, allow);
}
void
nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->reload_button, allow);
}
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->stop_button, allow);
}
......
......@@ -77,6 +77,16 @@ struct _NautilusWindow {
NautilusView *content_view;
GSList *meta_views;
/* Widgets to keep track of (for state changes, etc) */
GtkWidget *back_button;
GtkWidget *forward_button;
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *back_menu_item;
GtkWidget *forward_menu_item;
GtkWidget *up_menu_item;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
......
......@@ -563,6 +563,18 @@ nautilus_window_constructed(NautilusWindow *window)
after the statusbar
creation */
/* Remember some widgets now so their state can be changed later */
window->back_button = toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget;
window->forward_button = toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget;
window->up_button = toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget;
window->reload_button = toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget;
window->stop_button = toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget;
window->back_menu_item = go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget;
window->forward_menu_item = go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget;
window->up_menu_item = go_menu_info[GO_MENU_UP_ITEM_INDEX].widget;
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
*/
......@@ -943,34 +955,34 @@ nautilus_window_about_cb (GtkWidget *widget,
void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_BACK_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_BACK_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->back_button, allow);
gtk_widget_set_sensitive(window->back_menu_item, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_FORWARD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_FORWARD_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->forward_button, allow);
gtk_widget_set_sensitive(window->forward_menu_item, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_UP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(go_menu_info[GO_MENU_UP_ITEM_INDEX].widget, allow);
gtk_widget_set_sensitive(window->up_button, allow);
gtk_widget_set_sensitive(window->up_menu_item, allow);
}
void
nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_RELOAD_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->reload_button, allow);
}
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[TOOLBAR_STOP_BUTTON_INDEX].widget, allow);
gtk_widget_set_sensitive(window->stop_button, allow);
}
......
......@@ -77,6 +77,16 @@ struct _NautilusWindow {
NautilusView *content_view;
GSList *meta_views;
/* Widgets to keep track of (for state changes, etc) */
GtkWidget *back_button;
GtkWidget *forward_button;
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *back_menu_item;
GtkWidget *forward_menu_item;
GtkWidget *up_menu_item;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment