Commit c3c9fa60 authored by Cosimo Cecchi's avatar Cosimo Cecchi

bookmarks-window: make this a real GtkWindow subclass

This was long overdue, and in addition to making the whole code a
little cleaner, it also allows us to disconnect signals from objects
that outlive the window in dispose() (such as NautilusBookmarkList).

This also fixes the crasher reported in
https://bugzilla.gnome.org/show_bug.cgi?id=682916
parent b9f26a57
......@@ -112,7 +112,6 @@ struct _NautilusApplicationPriv {
NotifyNotification *unmount_notify;
GtkWidget *bookmarks_window;
NautilusBookmarkList *bookmark_list;
};
......@@ -128,18 +127,7 @@ nautilus_application_edit_bookmarks (NautilusApplication *application,
{
GtkWindow *bookmarks_window;
bookmarks_window = GTK_WINDOW (application->priv->bookmarks_window);
if (bookmarks_window == NULL) {
bookmarks_window = nautilus_bookmarks_window_new (window, application->priv->bookmark_list);
application->priv->bookmarks_window = GTK_WIDGET (bookmarks_window);
g_object_add_weak_pointer (G_OBJECT (bookmarks_window),
(gpointer *) &application->priv->bookmarks_window);
}
gtk_window_set_transient_for (bookmarks_window, GTK_WINDOW (window));
gtk_window_set_screen (bookmarks_window, gtk_window_get_screen (GTK_WINDOW (window)));
bookmarks_window = nautilus_bookmarks_window_new (window);
gtk_window_present (bookmarks_window);
}
......
This diff is collapsed.
......@@ -33,7 +33,32 @@
#include "nautilus-window.h"
#include "nautilus-bookmark-list.h"
GtkWindow *nautilus_bookmarks_window_new (NautilusWindow *parent_window,
NautilusBookmarkList *bookmarks);
#define NAUTILUS_TYPE_BOOKMARKS_WINDOW nautilus_bookmarks_window_get_type()
#define NAUTILUS_BOOKMARKS_WINDOW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_BOOKMARKS_WINDOW, NautilusBookmarksWindow))
#define NAUTILUS_BOOKMARKS_WINDOW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_BOOKMARKS_WINDOW, NautilusBookmarksWindowClass))
#define NAUTILUS_IS_BOOKMARKS_WINDOW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_BOOKMARKS_WINDOW))
#define NAUTILUS_IS_BOOKMARKS_WINDOW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_BOOKMARKS_WINDOW))
#define NAUTILUS_BOOKMARKS_WINDOW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_BOOKMARKS_WINDOW, NautilusBookmarksWindowClass))
typedef struct NautilusBookmarksWindowPrivate NautilusBookmarksWindowPrivate;
typedef struct {
GtkWindow parent;
NautilusBookmarksWindowPrivate *priv;
} NautilusBookmarksWindow;
typedef struct {
GtkWindowClass parent_class;
} NautilusBookmarksWindowClass;
GType nautilus_bookmarks_window_get_type (void);
GtkWindow *nautilus_bookmarks_window_new (NautilusWindow *parent_window);
#endif /* NAUTILUS_BOOKMARKS_WINDOW_H */
This diff is collapsed.
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