summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-03-22 13:14:09 +0100
committerCarlos Soriano <csoriano@gnome.org>2016-04-06 10:38:08 +0200
commit90ede7bc1e06ead1a6d7335264f9b57f6f4a411d (patch)
tree46f66e3d08613ec78812dd4b8e1b965c6ecc9253
parent416f83227014b182e80694e32b734a211cc1814c (diff)
downloadnautilus-90ede7bc1e06ead1a6d7335264f9b57f6f4a411d.tar.gz
desktop-window: create custom slot
We want to control few code paths, like the creation of the desktop canvas, which currently is done by special casting in the window slot instead of subclassing. So create a window slot subclass that will serve for these purposes.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/nautilus-desktop-window-slot.c44
-rw-r--r--src/nautilus-desktop-window-slot.h36
-rw-r--r--src/nautilus-desktop-window.c8
4 files changed, 90 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6445aa09e..b4a3d7e7b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -156,6 +156,8 @@ nautilus_no_main_sources = \
nautilus-desktop-item-properties.h \
nautilus-desktop-window.c \
nautilus-desktop-window.h \
+ nautilus-desktop-window-slot.c \
+ nautilus-desktop-window-slot.h \
nautilus-error-reporting.c \
nautilus-error-reporting.h \
nautilus-preferences-window.c \
diff --git a/src/nautilus-desktop-window-slot.c b/src/nautilus-desktop-window-slot.c
new file mode 100644
index 000000000..5a2d4f1ea
--- /dev/null
+++ b/src/nautilus-desktop-window-slot.c
@@ -0,0 +1,44 @@
+/* nautilus-desktop-window-slot.c
+ *
+ * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "nautilus-desktop-window-slot.h"
+
+struct _NautilusDesktopWindowSlot
+{
+ NautilusWindowSlot parent_instance;
+};
+
+G_DEFINE_TYPE (NautilusDesktopWindowSlot, nautilus_desktop_window_slot, NAUTILUS_TYPE_WINDOW_SLOT)
+
+NautilusDesktopWindowSlot *
+nautilus_desktop_window_slot_new (NautilusWindow *window)
+{
+ return g_object_new (NAUTILUS_TYPE_DESKTOP_WINDOW_SLOT,
+ "window", window,
+ NULL);
+}
+
+static void
+nautilus_desktop_window_slot_class_init (NautilusDesktopWindowSlotClass *klass)
+{
+}
+
+static void
+nautilus_desktop_window_slot_init (NautilusDesktopWindowSlot *self)
+{
+}
diff --git a/src/nautilus-desktop-window-slot.h b/src/nautilus-desktop-window-slot.h
new file mode 100644
index 000000000..fc895ce63
--- /dev/null
+++ b/src/nautilus-desktop-window-slot.h
@@ -0,0 +1,36 @@
+/* nautilus-window-desktop-slot.h
+ *
+ * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef NAUTILUS_DESKTOP_WINDOW_SLOT_H
+#define NAUTILUS_DESKTOP_WINDOW_SLOT_H
+
+#include "nautilus-window-slot.h"
+#include "nautilus-window.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_DESKTOP_WINDOW_SLOT (nautilus_desktop_window_slot_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusDesktopWindowSlot, nautilus_desktop_window_slot, NAUTILUS, DESKTOP_WINDOW_SLOT, NautilusWindowSlot)
+
+
+NautilusDesktopWindowSlot *nautilus_desktop_window_slot_new (NautilusWindow *window);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_DESKTOP_WINDOW_SLOT_H */
+
diff --git a/src/nautilus-desktop-window.c b/src/nautilus-desktop-window.c
index 7398aaaef..45a2c19fa 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -24,6 +24,7 @@
#include "nautilus-desktop-window.h"
#include "nautilus-window.h"
#include "nautilus-application.h"
+#include "nautilus-desktop-window-slot.h"
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
@@ -378,6 +379,12 @@ real_window_close (NautilusWindow *window)
return;
}
+static NautilusWindowSlot *
+real_create_slot (NautilusWindow *window)
+{
+ return NAUTILUS_WINDOW_SLOT (nautilus_desktop_window_slot_new (window));
+}
+
static void
nautilus_desktop_window_class_init (NautilusDesktopWindowClass *klass)
{
@@ -395,6 +402,7 @@ nautilus_desktop_window_class_init (NautilusDesktopWindowClass *klass)
nclass->sync_title = real_sync_title;
nclass->close = real_window_close;
+ nclass->create_slot = real_create_slot;
g_type_class_add_private (klass, sizeof (NautilusDesktopWindowDetails));
}