summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2000-01-07 21:48:58 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2000-01-07 21:48:58 +0000
commit9d0a6860f8550c4579e619f7e591803c037ffe16 (patch)
tree9c33f90e3e6292ea05463138ccff52fa3603f875 /src
parent076e9575fa9173e7997e97a63ab8b6b229810d1c (diff)
downloadnautilus-9d0a6860f8550c4579e619f7e591803c037ffe16.tar.gz
Made there be just one About window, and added a utility function for
presenting a window to the user regardless of its current state.
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-bookmarks-menu.c3
-rw-r--r--src/nautilus-bookmarks-window.c35
-rw-r--r--src/nautilus-bookmarks-window.h1
-rw-r--r--src/nautilus-navigation-window.c57
-rw-r--r--src/nautilus-object-window.c57
-rw-r--r--src/nautilus-spatial-window.c57
-rw-r--r--src/nautilus-window.c57
-rw-r--r--src/ntl-window.c57
8 files changed, 180 insertions, 144 deletions
diff --git a/src/nautilus-bookmarks-menu.c b/src/nautilus-bookmarks-menu.c
index 9388065fc..8fbf94ee6 100644
--- a/src/nautilus-bookmarks-menu.c
+++ b/src/nautilus-bookmarks-menu.c
@@ -27,6 +27,7 @@
#include "nautilus-bookmarklist.h"
#include "nautilus-bookmarks-window.h"
+#include <libnautilus/nautilus-gtk-extensions.h>
/* object data strings */
#define LAST_STATIC_ITEM "last static item"
@@ -139,7 +140,7 @@ bookmark_activated_cb(GtkMenuItem* item, gpointer func_data)
static void
edit_bookmarks_cb(GtkMenuItem* item, gpointer ignored)
{
- nautilus_bookmarks_window_present (get_bookmarks_window());
+ nautilus_gtk_window_present (GTK_WINDOW (get_bookmarks_window()));
}
static GtkWidget *
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index 157e20ea3..e879ce048 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -116,6 +116,7 @@ create_bookmarks_window(NautilusBookmarklist *list)
gtk_widget_set_usize (window,
BOOKMARKS_WINDOW_MIN_WIDTH,
BOOKMARKS_WINDOW_MIN_HEIGHT);
+ nautilus_bookmarks_window_restore_geometry (window);
gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);
content_area = gtk_hbox_new (TRUE, GNOME_PAD);
@@ -260,33 +261,6 @@ get_selection_exists ()
return GTK_CLIST(bookmark_list_widget)->rows > 0;
}
-/**
- * nautilus_bookmarks_window_present:
- *
- * Present the bookmarks window on screen in the saved position and size.
- * Brings window to front and activates it.
- * @window: The bookmarks window to present on screen.
- **/
-void
-nautilus_bookmarks_window_present (GtkWidget *window)
-{
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- if (GTK_WIDGET_VISIBLE(window))
- {
- /* Hide window first so it will reappear on top */
- nautilus_bookmarks_window_save_geometry (window);
- gtk_widget_hide (window);
- }
- else
- {
- gtk_widget_realize (window);
- }
-
- nautilus_bookmarks_window_restore_geometry (window);
- gtk_widget_show (window);
-}
-
static void
nautilus_bookmarks_window_restore_geometry (GtkWidget *window)
{
@@ -506,6 +480,13 @@ on_window_delete_event (GtkWidget *widget,
/* Hide but don't destroy */
gtk_widget_hide(widget);
+ /* Seems odd to restore the geometry just after saving it,
+ * and when the window is hidden, but this insures that
+ * the next time the window is shown it will have the
+ * right hints in it to appear in the correct place.
+ */
+ nautilus_bookmarks_window_restore_geometry (widget);
+
return TRUE;
}
diff --git a/src/nautilus-bookmarks-window.h b/src/nautilus-bookmarks-window.h
index 6240dcceb..ac7f4d61b 100644
--- a/src/nautilus-bookmarks-window.h
+++ b/src/nautilus-bookmarks-window.h
@@ -29,7 +29,6 @@
#include "nautilus-bookmarklist.h"
GtkWidget *create_bookmarks_window (NautilusBookmarklist *bookmarks);
-void nautilus_bookmarks_window_present (GtkWidget *window);
void nautilus_bookmarks_window_save_geometry (GtkWidget *window);
#endif /* NAUTILUS_BOOKMARKS_WINDOW_H */
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index e9b8c7876..003d605cd 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -33,6 +33,7 @@
#include "ntl-window-private.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libnautilus/nautilus-gtk-extensions.h>
static void nautilus_window_realize (GtkWidget *widget);
@@ -215,7 +216,6 @@ static GnomeUIInfo bookmarks_menu_info[] = {
GNOMEUIINFO_END
};
-/* FIXME: This needs implementation. */
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
@@ -524,10 +524,6 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_set_sensitive(edit_menu_info[5].widget, FALSE); /* Clear */
gtk_widget_set_sensitive(edit_menu_info[7].widget, FALSE); /* Select All */
- gtk_widget_set_sensitive(bookmarks_menu_info[0].widget, FALSE); /* Add Bookmark */
- gtk_widget_set_sensitive(bookmarks_menu_info[1].widget, FALSE); /* Edit Bookmarks */
- gtk_widget_set_sensitive(help_menu_info[0].widget, TRUE); /* About */
-
/* insert bookmarks menu */
gtk_menu_item_set_submenu(GTK_MENU_ITEM (main_menu[BOOKMARKS_MENU_INDEX].widget),
nautilus_bookmarks_menu_new(window));
@@ -863,28 +859,43 @@ nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
nautilus_window_end_location_change(window);
}
+/**
+ * nautilus_window_about_cb:
+ *
+ * Display about box, creating it first if necessary. Callback used when
+ * user selects "About Nautilus".
+ * @widget: ignored
+ * @window: ignored
+ **/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
- GtkWidget *aboot;
- const char *authors[] = {
- "Darin Adler",
- "Andy Hertzfeld",
- "Elliot Lee",
- "Ettore Perazzoli",
- "Maciej Stachowiak",
- "John Sullivan",
- NULL
- };
-
- aboot = gnome_about_new(_("Nautilus"),
- VERSION,
- "Copyright (C) 1999, 2000",
- authors,
- _("The Cool Shell Program"),
- "nautilus/nautilus3.jpg");
- gtk_widget_show(aboot);
+ static GtkWidget *aboot = NULL;
+
+ if (aboot == NULL)
+ {
+ const char *authors[] = {
+ "Darin Adler",
+ "Andy Hertzfeld",
+ "Elliot Lee",
+ "Ettore Perazzoli",
+ "Maciej Stachowiak",
+ "John Sullivan",
+ NULL
+ };
+
+ aboot = gnome_about_new(_("Nautilus"),
+ VERSION,
+ "Copyright (C) 1999, 2000",
+ authors,
+ _("The Cool Shell Program"),
+ "nautilus/nautilus3.jpg");
+
+ gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
+ }
+
+ nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
void
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index e9b8c7876..003d605cd 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -33,6 +33,7 @@
#include "ntl-window-private.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libnautilus/nautilus-gtk-extensions.h>
static void nautilus_window_realize (GtkWidget *widget);
@@ -215,7 +216,6 @@ static GnomeUIInfo bookmarks_menu_info[] = {
GNOMEUIINFO_END
};
-/* FIXME: This needs implementation. */
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
@@ -524,10 +524,6 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_set_sensitive(edit_menu_info[5].widget, FALSE); /* Clear */
gtk_widget_set_sensitive(edit_menu_info[7].widget, FALSE); /* Select All */
- gtk_widget_set_sensitive(bookmarks_menu_info[0].widget, FALSE); /* Add Bookmark */
- gtk_widget_set_sensitive(bookmarks_menu_info[1].widget, FALSE); /* Edit Bookmarks */
- gtk_widget_set_sensitive(help_menu_info[0].widget, TRUE); /* About */
-
/* insert bookmarks menu */
gtk_menu_item_set_submenu(GTK_MENU_ITEM (main_menu[BOOKMARKS_MENU_INDEX].widget),
nautilus_bookmarks_menu_new(window));
@@ -863,28 +859,43 @@ nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
nautilus_window_end_location_change(window);
}
+/**
+ * nautilus_window_about_cb:
+ *
+ * Display about box, creating it first if necessary. Callback used when
+ * user selects "About Nautilus".
+ * @widget: ignored
+ * @window: ignored
+ **/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
- GtkWidget *aboot;
- const char *authors[] = {
- "Darin Adler",
- "Andy Hertzfeld",
- "Elliot Lee",
- "Ettore Perazzoli",
- "Maciej Stachowiak",
- "John Sullivan",
- NULL
- };
-
- aboot = gnome_about_new(_("Nautilus"),
- VERSION,
- "Copyright (C) 1999, 2000",
- authors,
- _("The Cool Shell Program"),
- "nautilus/nautilus3.jpg");
- gtk_widget_show(aboot);
+ static GtkWidget *aboot = NULL;
+
+ if (aboot == NULL)
+ {
+ const char *authors[] = {
+ "Darin Adler",
+ "Andy Hertzfeld",
+ "Elliot Lee",
+ "Ettore Perazzoli",
+ "Maciej Stachowiak",
+ "John Sullivan",
+ NULL
+ };
+
+ aboot = gnome_about_new(_("Nautilus"),
+ VERSION,
+ "Copyright (C) 1999, 2000",
+ authors,
+ _("The Cool Shell Program"),
+ "nautilus/nautilus3.jpg");
+
+ gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
+ }
+
+ nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
void
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index e9b8c7876..003d605cd 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -33,6 +33,7 @@
#include "ntl-window-private.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libnautilus/nautilus-gtk-extensions.h>
static void nautilus_window_realize (GtkWidget *widget);
@@ -215,7 +216,6 @@ static GnomeUIInfo bookmarks_menu_info[] = {
GNOMEUIINFO_END
};
-/* FIXME: This needs implementation. */
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
@@ -524,10 +524,6 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_set_sensitive(edit_menu_info[5].widget, FALSE); /* Clear */
gtk_widget_set_sensitive(edit_menu_info[7].widget, FALSE); /* Select All */
- gtk_widget_set_sensitive(bookmarks_menu_info[0].widget, FALSE); /* Add Bookmark */
- gtk_widget_set_sensitive(bookmarks_menu_info[1].widget, FALSE); /* Edit Bookmarks */
- gtk_widget_set_sensitive(help_menu_info[0].widget, TRUE); /* About */
-
/* insert bookmarks menu */
gtk_menu_item_set_submenu(GTK_MENU_ITEM (main_menu[BOOKMARKS_MENU_INDEX].widget),
nautilus_bookmarks_menu_new(window));
@@ -863,28 +859,43 @@ nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
nautilus_window_end_location_change(window);
}
+/**
+ * nautilus_window_about_cb:
+ *
+ * Display about box, creating it first if necessary. Callback used when
+ * user selects "About Nautilus".
+ * @widget: ignored
+ * @window: ignored
+ **/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
- GtkWidget *aboot;
- const char *authors[] = {
- "Darin Adler",
- "Andy Hertzfeld",
- "Elliot Lee",
- "Ettore Perazzoli",
- "Maciej Stachowiak",
- "John Sullivan",
- NULL
- };
-
- aboot = gnome_about_new(_("Nautilus"),
- VERSION,
- "Copyright (C) 1999, 2000",
- authors,
- _("The Cool Shell Program"),
- "nautilus/nautilus3.jpg");
- gtk_widget_show(aboot);
+ static GtkWidget *aboot = NULL;
+
+ if (aboot == NULL)
+ {
+ const char *authors[] = {
+ "Darin Adler",
+ "Andy Hertzfeld",
+ "Elliot Lee",
+ "Ettore Perazzoli",
+ "Maciej Stachowiak",
+ "John Sullivan",
+ NULL
+ };
+
+ aboot = gnome_about_new(_("Nautilus"),
+ VERSION,
+ "Copyright (C) 1999, 2000",
+ authors,
+ _("The Cool Shell Program"),
+ "nautilus/nautilus3.jpg");
+
+ gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
+ }
+
+ nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index e9b8c7876..003d605cd 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -33,6 +33,7 @@
#include "ntl-window-private.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libnautilus/nautilus-gtk-extensions.h>
static void nautilus_window_realize (GtkWidget *widget);
@@ -215,7 +216,6 @@ static GnomeUIInfo bookmarks_menu_info[] = {
GNOMEUIINFO_END
};
-/* FIXME: This needs implementation. */
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
@@ -524,10 +524,6 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_set_sensitive(edit_menu_info[5].widget, FALSE); /* Clear */
gtk_widget_set_sensitive(edit_menu_info[7].widget, FALSE); /* Select All */
- gtk_widget_set_sensitive(bookmarks_menu_info[0].widget, FALSE); /* Add Bookmark */
- gtk_widget_set_sensitive(bookmarks_menu_info[1].widget, FALSE); /* Edit Bookmarks */
- gtk_widget_set_sensitive(help_menu_info[0].widget, TRUE); /* About */
-
/* insert bookmarks menu */
gtk_menu_item_set_submenu(GTK_MENU_ITEM (main_menu[BOOKMARKS_MENU_INDEX].widget),
nautilus_bookmarks_menu_new(window));
@@ -863,28 +859,43 @@ nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
nautilus_window_end_location_change(window);
}
+/**
+ * nautilus_window_about_cb:
+ *
+ * Display about box, creating it first if necessary. Callback used when
+ * user selects "About Nautilus".
+ * @widget: ignored
+ * @window: ignored
+ **/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
- GtkWidget *aboot;
- const char *authors[] = {
- "Darin Adler",
- "Andy Hertzfeld",
- "Elliot Lee",
- "Ettore Perazzoli",
- "Maciej Stachowiak",
- "John Sullivan",
- NULL
- };
-
- aboot = gnome_about_new(_("Nautilus"),
- VERSION,
- "Copyright (C) 1999, 2000",
- authors,
- _("The Cool Shell Program"),
- "nautilus/nautilus3.jpg");
- gtk_widget_show(aboot);
+ static GtkWidget *aboot = NULL;
+
+ if (aboot == NULL)
+ {
+ const char *authors[] = {
+ "Darin Adler",
+ "Andy Hertzfeld",
+ "Elliot Lee",
+ "Ettore Perazzoli",
+ "Maciej Stachowiak",
+ "John Sullivan",
+ NULL
+ };
+
+ aboot = gnome_about_new(_("Nautilus"),
+ VERSION,
+ "Copyright (C) 1999, 2000",
+ authors,
+ _("The Cool Shell Program"),
+ "nautilus/nautilus3.jpg");
+
+ gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
+ }
+
+ nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
void
diff --git a/src/ntl-window.c b/src/ntl-window.c
index e9b8c7876..003d605cd 100644
--- a/src/ntl-window.c
+++ b/src/ntl-window.c
@@ -33,6 +33,7 @@
#include "ntl-window-private.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libnautilus/nautilus-gtk-extensions.h>
static void nautilus_window_realize (GtkWidget *widget);
@@ -215,7 +216,6 @@ static GnomeUIInfo bookmarks_menu_info[] = {
GNOMEUIINFO_END
};
-/* FIXME: This needs implementation. */
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
@@ -524,10 +524,6 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_set_sensitive(edit_menu_info[5].widget, FALSE); /* Clear */
gtk_widget_set_sensitive(edit_menu_info[7].widget, FALSE); /* Select All */
- gtk_widget_set_sensitive(bookmarks_menu_info[0].widget, FALSE); /* Add Bookmark */
- gtk_widget_set_sensitive(bookmarks_menu_info[1].widget, FALSE); /* Edit Bookmarks */
- gtk_widget_set_sensitive(help_menu_info[0].widget, TRUE); /* About */
-
/* insert bookmarks menu */
gtk_menu_item_set_submenu(GTK_MENU_ITEM (main_menu[BOOKMARKS_MENU_INDEX].widget),
nautilus_bookmarks_menu_new(window));
@@ -863,28 +859,43 @@ nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
nautilus_window_end_location_change(window);
}
+/**
+ * nautilus_window_about_cb:
+ *
+ * Display about box, creating it first if necessary. Callback used when
+ * user selects "About Nautilus".
+ * @widget: ignored
+ * @window: ignored
+ **/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
- GtkWidget *aboot;
- const char *authors[] = {
- "Darin Adler",
- "Andy Hertzfeld",
- "Elliot Lee",
- "Ettore Perazzoli",
- "Maciej Stachowiak",
- "John Sullivan",
- NULL
- };
-
- aboot = gnome_about_new(_("Nautilus"),
- VERSION,
- "Copyright (C) 1999, 2000",
- authors,
- _("The Cool Shell Program"),
- "nautilus/nautilus3.jpg");
- gtk_widget_show(aboot);
+ static GtkWidget *aboot = NULL;
+
+ if (aboot == NULL)
+ {
+ const char *authors[] = {
+ "Darin Adler",
+ "Andy Hertzfeld",
+ "Elliot Lee",
+ "Ettore Perazzoli",
+ "Maciej Stachowiak",
+ "John Sullivan",
+ NULL
+ };
+
+ aboot = gnome_about_new(_("Nautilus"),
+ VERSION,
+ "Copyright (C) 1999, 2000",
+ authors,
+ _("The Cool Shell Program"),
+ "nautilus/nautilus3.jpg");
+
+ gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
+ }
+
+ nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
void