[nautilus/wip/csoriano/destktop-split2: 23/47] desktop-window: create custom slot



commit 8f4ea3892060c6aeb93dc99d875e3b9f016780bd
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Mar 22 13:14:09 2016 +0100

    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.

 src/Makefile.am                    |    2 +
 src/nautilus-desktop-window-slot.c |   44 ++++++++++++++++++++++++++++++++++++
 src/nautilus-desktop-window-slot.h |   36 +++++++++++++++++++++++++++++
 src/nautilus-desktop-window.c      |    8 ++++++
 4 files changed, 90 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 6445aa0..b4a3d7e 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 0000000..5a2d4f1
--- /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 0000000..fc895ce
--- /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 72467a6..1ceb1f2 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -25,6 +25,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>
@@ -379,6 +380,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)
 {
@@ -396,6 +403,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));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]