[Xfce4-commits] <thunar:jannis/desktop-extensions> Add ThunarDesktop class skeleton. Include new Thunarx headers.

Jannis Pohlmann noreply at xfce.org
Sun Mar 27 15:32:01 CEST 2011


Updating branch refs/heads/jannis/desktop-extensions
         to b3d4a2713b79a181cb22ce3ce823338ac8b7d20c (commit)
       from 206468dd3c4844b706d2afbc3cf167528e419831 (commit)

commit b3d4a2713b79a181cb22ce3ce823338ac8b7d20c
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Mar 27 15:30:48 2011 +0200

    Add ThunarDesktop class skeleton. Include new Thunarx headers.

 thunar/Makefile.am      |    2 +
 thunar/main.c           |   39 ++++++----
 thunar/thunar-desktop.c |  194 +++++++++++++++++++++++++++++++++++++++++++++++
 thunar/thunar-desktop.h |   42 ++++++++++
 thunarx/thunarx.h       |    2 +
 5 files changed, 265 insertions(+), 14 deletions(-)

diff --git a/thunar/Makefile.am b/thunar/Makefile.am
index b715fea..d8a07cc 100644
--- a/thunar/Makefile.am
+++ b/thunar/Makefile.am
@@ -70,6 +70,8 @@ Thunar_SOURCES =							\
 	thunar-debug.c							\
 	thunar-deep-count-job.h						\
 	thunar-deep-count-job.c						\
+	thunar-desktop.h						\
+	thunar-desktop.c						\
 	thunar-details-view-ui.h					\
 	thunar-details-view.c						\
 	thunar-details-view.h						\
diff --git a/thunar/main.c b/thunar/main.c
index 9de4bd3..9a0a04a 100644
--- a/thunar/main.c
+++ b/thunar/main.c
@@ -1,22 +1,23 @@
-/* $Id$ */
+/* vi:set et ai sw=2 sts=2 ts=2: */
 /*-
  * Copyright (c) 2005-2011 os-cillation e.K.
+ *   written by Benedikt Meurer <benny at xfce.org>
+ * Copyright (c) 2011 Jannis Pohlmann <jannis at xfce.org>
  *
- * Written by Benedikt Meurer <benny at xfce.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 2 of 
+ * the License, or (at your option) any later version.
  *
- * 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 2 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.
  *
- * 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, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA  02111-1307  USA
+ * You should have received a copy of the GNU General Public 
+ * License along with this program; if not, write to the Free 
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -40,6 +41,7 @@
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-dbus-client.h>
 #include <thunar/thunar-dbus-service.h>
+#include <thunar/thunar-desktop.h>
 #include <thunar/thunar-gobject-extensions.h>
 #include <thunar/thunar-private.h>
 #include <thunar/thunar-session-client.h>
@@ -116,6 +118,7 @@ main (int argc, char **argv)
   ThunarDBusService   *dbus_service = NULL;
 #endif
   ThunarApplication   *application;
+  ThunarDesktop       *desktop = NULL;
   GError              *error = NULL;
   gchar               *working_directory;
   gchar              **filenames = NULL;
@@ -275,6 +278,10 @@ error0:
   /* check if the application should run as a daemon */
   if (thunar_application_get_daemon (application))
     {
+      /* start the desktop subsystem that will take over the desktop if
+       * desired so by the user */
+      desktop = g_object_new (THUNAR_TYPE_DESKTOP, NULL);
+
 #ifdef HAVE_DBUS
       /* attach the D-Bus service */
       dbus_service = g_object_new (THUNAR_TYPE_DBUS_SERVICE, NULL);
@@ -293,6 +300,10 @@ error0:
   /* enter the main loop */
   gtk_main ();
 
+  /* shut down the desktop subsystem */
+  if (desktop != NULL)
+    g_object_unref (desktop);
+
 #ifdef HAVE_DBUS
   if (dbus_service != NULL)
     g_object_unref (G_OBJECT (dbus_service));
diff --git a/thunar/thunar-desktop.c b/thunar/thunar-desktop.c
new file mode 100644
index 0000000..744dea2
--- /dev/null
+++ b/thunar/thunar-desktop.c
@@ -0,0 +1,194 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2011 Jannis Pohlmann <jannis at xfce.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 2 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, write to the Free 
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <thunarx/thunarx.h>
+
+#include <thunar/thunar-desktop.h>
+
+
+
+/* property identifiers */
+enum
+{
+  PROP_0,
+};
+
+
+
+static void thunar_desktop_constructed  (GObject      *object);
+static void thunar_desktop_dispose      (GObject      *object);
+static void thunar_desktop_finalize     (GObject      *object);
+static void thunar_desktop_get_property (GObject      *object,
+                                         guint         prop_id,
+                                         GValue       *value,
+                                         GParamSpec   *pspec);
+static void thunar_desktop_set_property (GObject      *object,
+                                         guint         prop_id,
+                                         const GValue *value,
+                                         GParamSpec   *pspec);
+
+
+
+struct _ThunarDesktopClass
+{
+  GObjectClass __parent__;
+};
+
+struct _ThunarDesktop
+{
+  GObject __parent__;
+};
+
+
+
+G_DEFINE_TYPE (ThunarDesktop, thunar_desktop, G_TYPE_OBJECT)
+
+
+
+static void
+thunar_desktop_class_init (ThunarDesktopClass *klass)
+{
+  GObjectClass *gobject_class;
+
+  /* Determine the parent type class */
+  thunar_desktop_parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->constructed = thunar_desktop_constructed; 
+  gobject_class->dispose = thunar_desktop_dispose; 
+  gobject_class->finalize = thunar_desktop_finalize; 
+  gobject_class->get_property = thunar_desktop_get_property;
+  gobject_class->set_property = thunar_desktop_set_property;
+}
+
+
+
+static void
+thunar_desktop_init (ThunarDesktop *desktop)
+{
+  ThunarxProviderFactory *provider_factory;
+  GList                  *lp;
+  GList                  *providers;
+  GList                  *view_infos = NULL;
+
+  /* determine the list of available views (using the desktop view provider) */
+  provider_factory = thunarx_provider_factory_get_default ();
+  providers = thunarx_provider_factory_list_providers (provider_factory,
+                                                       THUNARX_TYPE_DESKTOP_VIEW_PROVIDER);
+  for (lp = providers; lp != NULL; lp = lp->next)
+    {
+      /* determine the view infos for this provider */
+      view_infos = 
+        g_list_concat (view_infos, 
+                       thunarx_desktop_view_provider_get_view_infos (lp->data));
+
+      /* release the provider */
+      g_object_unref (lp->data);
+    }
+  g_list_free (providers);
+  g_object_unref (provider_factory);
+
+  g_debug ("view infos:");
+  for (lp = view_infos; lp != NULL; lp = lp->next)
+    {
+      g_debug ("  %p", lp->data);
+    }
+}
+
+
+
+static void
+thunar_desktop_constructed (GObject *object)
+{
+#if 0
+  ThunarDesktop *desktop = THUNAR_DESKTOP (object);
+#endif
+}
+
+
+
+static void
+thunar_desktop_dispose (GObject *object)
+{
+#if 0
+  ThunarDesktop *desktop = THUNAR_DESKTOP (object);
+#endif
+
+  (*G_OBJECT_CLASS (thunar_desktop_parent_class)->dispose) (object);
+}
+
+
+
+static void
+thunar_desktop_finalize (GObject *object)
+{
+#if 0
+  ThunarDesktop *desktop = THUNAR_DESKTOP (object);
+#endif
+
+  (*G_OBJECT_CLASS (thunar_desktop_parent_class)->finalize) (object);
+}
+
+
+
+static void
+thunar_desktop_get_property (GObject    *object,
+                             guint       prop_id,
+                             GValue     *value,
+                             GParamSpec *pspec)
+{
+#if 0
+  ThunarDesktop *desktop = THUNAR_DESKTOP (object);
+#endif
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+
+static void
+thunar_desktop_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
+{
+#if 0
+  ThunarDesktop *desktop = THUNAR_DESKTOP (object);
+#endif
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
diff --git a/thunar/thunar-desktop.h b/thunar/thunar-desktop.h
new file mode 100644
index 0000000..ecbd00c
--- /dev/null
+++ b/thunar/thunar-desktop.h
@@ -0,0 +1,42 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2011 Jannis Pohlmann <jannis at xfce.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 2 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, write to the Free 
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __THUNAR_DESKTOP_H__
+#define __THUNAR_DESKTOP_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define THUNAR_TYPE_DESKTOP            (thunar_desktop_get_type ())
+#define THUNAR_DESKTOP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_DESKTOP, ThunarDesktop))
+#define THUNAR_DESKTOP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), THUNAR_TYPE_DESKTOP, ThunarDesktopClass))
+#define THUNAR_IS_DESKTOP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_DESKTOP))
+#define THUNAR_IS_DESKTOP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_DESKTOP)
+#define THUNAR_DESKTOP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_DESKTOP, ThunarDesktopClass))
+
+typedef struct _ThunarDesktopClass   ThunarDesktopClass;
+typedef struct _ThunarDesktop        ThunarDesktop;
+
+GType thunar_desktop_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* !__THUNAR_DESKTOP_H__ */
diff --git a/thunarx/thunarx.h b/thunarx/thunarx.h
index 73d86b9..2557fb7 100644
--- a/thunarx/thunarx.h
+++ b/thunarx/thunarx.h
@@ -24,6 +24,8 @@
 #define THUNARX_INSIDE_THUNARX_H
 
 #include <thunarx/thunarx-config.h>
+#include <thunarx/thunarx-desktop-view-provider.h>
+#include <thunarx/thunarx-desktop-view.h>
 #include <thunarx/thunarx-file-info.h>
 #include <thunarx/thunarx-menu-provider.h>
 #include <thunarx/thunarx-preferences-provider.h>



More information about the Xfce4-commits mailing list