diff options
author | Stefano Karapetsas <[email protected]> | 2012-11-16 05:08:48 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-11-16 05:08:48 -0800 |
commit | dc66bc40724191f0068869773576dc4edf042c6f (patch) | |
tree | 74b9684feea188736b21f2c829f29befaaf2e9da /src/caja-desktop-window.c | |
parent | 935e1fed604f48e68d125d205c890a59f46f8f21 (diff) | |
parent | 1466df20591105550738a1d0784a623af9909abf (diff) | |
download | caja-dc66bc40724191f0068869773576dc4edf042c6f.tar.bz2 caja-dc66bc40724191f0068869773576dc4edf042c6f.tar.xz |
Merge pull request #42 from jasmineaura/develop
Bring Caja up to speed, stage1
Diffstat (limited to 'src/caja-desktop-window.c')
-rw-r--r-- | src/caja-desktop-window.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c index 08749cc2..aabc0468 100644 --- a/src/caja-desktop-window.c +++ b/src/caja-desktop-window.c @@ -30,7 +30,6 @@ #include <X11/Xatom.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> -#include <eel/eel-gtk-macros.h> #include <eel/eel-vfs-extensions.h> #include <libcaja-private/caja-file-utilities.h> #include <libcaja-private/caja-icon-names.h> @@ -39,10 +38,10 @@ struct CajaDesktopWindowDetails { - int dummy; -}; + gulong size_changed_id; -static void set_wmspec_desktop_hint (GdkWindow *window); + gboolean loaded; +}; G_DEFINE_TYPE (CajaDesktopWindow, caja_desktop_window, CAJA_TYPE_SPATIAL_WINDOW); @@ -53,7 +52,8 @@ caja_desktop_window_init (CajaDesktopWindow *window) GtkAction *action; AtkObject *accessible; - window->details = g_new0 (CajaDesktopWindowDetails, 1); + window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_DESKTOP_WINDOW, + CajaDesktopWindowDetails); gtk_window_move (GTK_WINDOW (window), 0, 0); @@ -76,8 +76,10 @@ caja_desktop_window_init (CajaDesktopWindow *window) /* Set the accessible name so that it doesn't inherit the cryptic desktop URI. */ accessible = gtk_widget_get_accessible (GTK_WIDGET (window)); - if (accessible) + + if (accessible) { atk_object_set_name (accessible, _("Desktop")); + } } static gint @@ -94,9 +96,10 @@ caja_desktop_window_update_directory (CajaDesktopWindow *window) g_assert (CAJA_IS_DESKTOP_WINDOW (window)); - CAJA_SPATIAL_WINDOW (window)->affect_spatial_window_on_next_location_change = TRUE; location = g_file_new_for_uri (EEL_DESKTOP_URI); caja_window_go_to (CAJA_WINDOW (window), location); + window->details->loaded = TRUE; + g_object_unref (location); } @@ -147,18 +150,6 @@ caja_desktop_window_new (CajaApplication *application, } static void -finalize (GObject *object) -{ - CajaDesktopWindow *window; - - window = CAJA_DESKTOP_WINDOW (object); - - g_free (window->details); - - G_OBJECT_CLASS (caja_desktop_window_parent_class)->finalize (object); -} - -static void map (GtkWidget *widget) { /* Chain up to realize our children */ @@ -166,14 +157,15 @@ map (GtkWidget *widget) gdk_window_lower (gtk_widget_get_window (widget)); } - static void unrealize (GtkWidget *widget) { CajaDesktopWindow *window; + CajaDesktopWindowDetails *details; GdkWindow *root_window; window = CAJA_DESKTOP_WINDOW (widget); + details = window->details; root_window = gdk_screen_get_root_window ( gtk_window_get_screen (GTK_WINDOW (window))); @@ -181,9 +173,11 @@ unrealize (GtkWidget *widget) gdk_property_delete (root_window, gdk_atom_intern ("CAJA_DESKTOP_WINDOW_ID", TRUE)); - g_signal_handlers_disconnect_by_func (gtk_window_get_screen (GTK_WINDOW (window)), - G_CALLBACK (caja_desktop_window_screen_size_changed), - window); + if (details->size_changed_id != 0) { + g_signal_handler_disconnect (gtk_window_get_screen (GTK_WINDOW (window)), + details->size_changed_id); + details->size_changed_id = 0; + } GTK_WIDGET_CLASS (caja_desktop_window_parent_class)->unrealize (widget); } @@ -225,8 +219,10 @@ static void realize (GtkWidget *widget) { CajaDesktopWindow *window; + CajaDesktopWindowDetails *details; window = CAJA_DESKTOP_WINDOW (widget); + details = window->details; /* Make sure we get keyboard events */ gtk_widget_set_events (widget, gtk_widget_get_events (widget) @@ -240,8 +236,9 @@ realize (GtkWidget *widget) set_desktop_window_id (window, gtk_widget_get_window (widget)); - g_signal_connect (gtk_window_get_screen (GTK_WINDOW (window)), "size_changed", - G_CALLBACK (caja_desktop_window_screen_size_changed), window); + details->size_changed_id = + g_signal_connect (gtk_window_get_screen (GTK_WINDOW (window)), "size_changed", + G_CALLBACK (caja_desktop_window_screen_size_changed), window); } static char * @@ -258,20 +255,25 @@ real_get_icon (CajaWindow *window, } static void -caja_desktop_window_class_init (CajaDesktopWindowClass *class) +caja_desktop_window_class_init (CajaDesktopWindowClass *klass) { - G_OBJECT_CLASS (class)->finalize = finalize; - GTK_WIDGET_CLASS (class)->realize = realize; - GTK_WIDGET_CLASS (class)->unrealize = unrealize; + GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass); + CajaWindowClass *nclass = CAJA_WINDOW_CLASS (klass); + wclass->realize = realize; + wclass->unrealize = unrealize; + wclass->map = map; - GTK_WIDGET_CLASS (class)->map = map; + nclass->window_type = CAJA_WINDOW_DESKTOP; + nclass->get_title = real_get_title; + nclass->get_icon = real_get_icon; - CAJA_WINDOW_CLASS (class)->window_type = CAJA_WINDOW_DESKTOP; - - CAJA_WINDOW_CLASS (class)->get_title - = real_get_title; - CAJA_WINDOW_CLASS (class)->get_icon - = real_get_icon; + g_type_class_add_private (klass, sizeof (CajaDesktopWindowDetails)); +} +gboolean +caja_desktop_window_loaded (CajaDesktopWindow *window) +{ + return window->details->loaded; } + |