[Xfce4-commits] <ristretto:ristretto-0.0> Add template code for meego wallpaper manager
Stephan Arts
noreply at xfce.org
Sun Oct 23 19:30:04 CEST 2011
Updating branch refs/heads/ristretto-0.0
to b92bfe40e12d8fc563f4e7caf5aecaef423ae367 (commit)
from 048812613c8e8a77d1afb9b9cceb9fc8ed864572 (commit)
commit b92bfe40e12d8fc563f4e7caf5aecaef423ae367
Author: Stephan Arts <stephan at xfce.org>
Date: Thu Sep 23 08:18:29 2010 +0200
Add template code for meego wallpaper manager
src/Makefile.am | 1 +
src/main_window.c | 1 +
src/meego_wallpaper_manager.c | 225 +++++++++++++++++++++++++++++++++++++++++
src/meego_wallpaper_manager.h | 67 ++++++++++++
src/settings.c | 21 ++++-
5 files changed, 314 insertions(+), 1 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8c8a376..d429a81 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,7 @@ ristretto_SOURCES = \
wallpaper_manager.c wallpaper_manager.h \
xfce_wallpaper_manager.c xfce_wallpaper_manager.h \
gnome_wallpaper_manager.c gnome_wallpaper_manager.h \
+ meego_wallpaper_manager.c meego_wallpaper_manager.h \
app_menu_item.c app_menu_item.h \
thumbnail_bar.c thumbnail_bar.h \
thumbnail.c thumbnail.h \
diff --git a/src/main_window.c b/src/main_window.c
index 747496f..49c0b9a 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -41,6 +41,7 @@
#include "wallpaper_manager.h"
#include "xfce_wallpaper_manager.h"
#include "gnome_wallpaper_manager.h"
+#include "meego_wallpaper_manager.h"
#include "preferences_dialog.h"
#include "app_menu_item.h"
diff --git a/src/meego_wallpaper_manager.c b/src/meego_wallpaper_manager.c
new file mode 100644
index 0000000..18f7189
--- /dev/null
+++ b/src/meego_wallpaper_manager.c
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) Stephan Arts 2009-2010 <stephan at meego.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 Library 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.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xproto.h>
+#include <gio/gio.h>
+
+#include "image.h"
+
+#include "wallpaper_manager.h"
+#include "meego_wallpaper_manager.h"
+
+#define XFDESKTOP_SELECTION_FMT "XFDESKTOP_SELECTION_%d"
+
+typedef struct {
+ gint16 r;
+ gint16 g;
+ gint16 b;
+ gint16 a;
+} RsttoColor;
+
+
+static void
+rstto_meego_wallpaper_manager_init (GObject *);
+static void
+rstto_meego_wallpaper_manager_class_init (GObjectClass *);
+
+static void
+rstto_meego_wallpaper_manager_dispose (GObject *object);
+static void
+rstto_meego_wallpaper_manager_finalize (GObject *object);
+
+static GObjectClass *parent_class = NULL;
+
+static RsttoMeegoWallpaperManager *meego_wallpaper_manager_object;
+
+struct _RsttoMeegoWallpaperManagerPriv
+{
+};
+
+
+enum
+{
+ PROP_0,
+};
+
+static gint
+rstto_meego_wallpaper_manager_configure_dialog_run (RsttoWallpaperManager *self, RsttoImage *image)
+{
+ RsttoMeegoWallpaperManager *manager = RSTTO_MEEGO_WALLPAPER_MANAGER (self);
+ gint response = GTK_RESPONSE_OK;
+ return response;
+}
+
+static gboolean
+rstto_meego_wallpaper_manager_check_running (RsttoWallpaperManager *self)
+{
+ GdkScreen *gdk_screen = gdk_screen_get_default();
+ GdkAtom meego_selection_atom;
+ GdkAtom actual_type;
+ gint actual_format;
+ gint actual_length;
+ guchar *data;
+
+ meego_selection_atom = gdk_atom_intern("NAUTILUS_DESKTOP_WINDOW_ID", FALSE);
+
+ if (gdk_property_get(gdk_screen_get_root_window(gdk_screen),
+ meego_selection_atom,
+ GDK_NONE,
+ 0,
+ 1,
+ FALSE,
+ &actual_type,
+ &actual_format,
+ &actual_length,
+ &data))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+rstto_meego_wallpaper_manager_set (RsttoWallpaperManager *self, RsttoImage *image)
+{
+ RsttoMeegoWallpaperManager *manager = RSTTO_MEEGO_WALLPAPER_MANAGER (self);
+
+ return FALSE;
+}
+
+static void
+rstto_meego_wallpaper_manager_iface_init (RsttoWallpaperManagerIface *iface)
+{
+ iface->configure_dialog_run = rstto_meego_wallpaper_manager_configure_dialog_run;
+ iface->check_running = rstto_meego_wallpaper_manager_check_running;
+ iface->set = rstto_meego_wallpaper_manager_set;
+}
+
+GType
+rstto_meego_wallpaper_manager_get_type (void)
+{
+ static GType rstto_meego_wallpaper_manager_type = 0;
+
+ if (!rstto_meego_wallpaper_manager_type)
+ {
+ static const GTypeInfo rstto_meego_wallpaper_manager_info =
+ {
+ sizeof (RsttoMeegoWallpaperManagerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) rstto_meego_wallpaper_manager_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (RsttoMeegoWallpaperManager),
+ 0,
+ (GInstanceInitFunc) rstto_meego_wallpaper_manager_init,
+ NULL
+ };
+
+ static const GInterfaceInfo wallpaper_manager_iface_info =
+ {
+ (GInterfaceInitFunc) rstto_meego_wallpaper_manager_iface_init,
+ NULL,
+ NULL
+ };
+
+ rstto_meego_wallpaper_manager_type = g_type_register_static (G_TYPE_OBJECT, "RsttoMeegoWallpaperManager", &rstto_meego_wallpaper_manager_info, 0);
+ g_type_add_interface_static (rstto_meego_wallpaper_manager_type, RSTTO_WALLPAPER_MANAGER_TYPE, &wallpaper_manager_iface_info);
+
+ }
+ return rstto_meego_wallpaper_manager_type;
+}
+
+
+static void
+rstto_meego_wallpaper_manager_init (GObject *object)
+{
+ RsttoMeegoWallpaperManager *meego_wallpaper_manager = RSTTO_MEEGO_WALLPAPER_MANAGER (object);
+
+ meego_wallpaper_manager->priv = g_new0 (RsttoMeegoWallpaperManagerPriv, 1);
+}
+
+
+static void
+rstto_meego_wallpaper_manager_class_init (GObjectClass *object_class)
+{
+ RsttoMeegoWallpaperManagerClass *meego_wallpaper_manager_class = RSTTO_MEEGO_WALLPAPER_MANAGER_CLASS (object_class);
+
+ parent_class = g_type_class_peek_parent (meego_wallpaper_manager_class);
+
+ object_class->dispose = rstto_meego_wallpaper_manager_dispose;
+ object_class->finalize = rstto_meego_wallpaper_manager_finalize;
+}
+
+/**
+ * rstto_meego_wallpaper_manager_dispose:
+ * @object:
+ *
+ */
+static void
+rstto_meego_wallpaper_manager_dispose (GObject *object)
+{
+ RsttoMeegoWallpaperManager *meego_wallpaper_manager = RSTTO_MEEGO_WALLPAPER_MANAGER (object);
+
+ if (meego_wallpaper_manager->priv)
+ {
+ g_free (meego_wallpaper_manager->priv);
+ meego_wallpaper_manager->priv = NULL;
+ }
+}
+
+/**
+ * rstto_meego_wallpaper_manager_finalize:
+ * @object:
+ *
+ */
+static void
+rstto_meego_wallpaper_manager_finalize (GObject *object)
+{
+}
+
+
+
+/**
+ * rstto_meego_wallpaper_manager_new:
+ *
+ *
+ * Singleton
+ */
+RsttoMeegoWallpaperManager *
+rstto_meego_wallpaper_manager_new (void)
+{
+ if (meego_wallpaper_manager_object == NULL)
+ {
+ meego_wallpaper_manager_object = g_object_new (RSTTO_TYPE_MEEGO_WALLPAPER_MANAGER, NULL);
+ }
+ else
+ {
+ g_object_ref (meego_wallpaper_manager_object);
+ }
+
+ return meego_wallpaper_manager_object;
+}
diff --git a/src/meego_wallpaper_manager.h b/src/meego_wallpaper_manager.h
new file mode 100644
index 0000000..112996a
--- /dev/null
+++ b/src/meego_wallpaper_manager.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) Stephan Arts 2009-2010 <stephan at meego.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 Library 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.
+ */
+
+#ifndef __RISTRETTO_MEEGO_WALLPAPER_MANAGER_H__
+#define __RISTRETTO_MEEGO_WALLPAPER_MANAGER_H__
+
+G_BEGIN_DECLS
+
+#define RSTTO_TYPE_MEEGO_WALLPAPER_MANAGER rstto_meego_wallpaper_manager_get_type()
+
+#define RSTTO_MEEGO_WALLPAPER_MANAGER(obj)( \
+ G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ RSTTO_TYPE_MEEGO_WALLPAPER_MANAGER, \
+ RsttoMeegoWallpaperManager))
+
+#define RSTTO_IS_MEEGO_WALLPAPER_MANAGER(obj)( \
+ G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ RSTTO_TYPE_MEEGO_WALLPAPER_MANAGER))
+
+#define RSTTO_MEEGO_WALLPAPER_MANAGER_CLASS(klass)( \
+ G_TYPE_CHECK_CLASS_CAST ((klass), \
+ RSTTO_TYPE_MEEGO_WALLPAPER_MANAGER, \
+ RsttoMeegoWallpaperManagerClass))
+
+#define RSTTO_IS_MEEGO_WALLPAPER_MANAGER_CLASS(klass)( \
+ G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ RSTTO_TYPE_MEEGO_WALLPAPER_MANAGER()))
+
+
+typedef struct _RsttoMeegoWallpaperManager RsttoMeegoWallpaperManager;
+typedef struct _RsttoMeegoWallpaperManagerPriv RsttoMeegoWallpaperManagerPriv;
+
+struct _RsttoMeegoWallpaperManager
+{
+ GObject parent;
+
+ RsttoMeegoWallpaperManagerPriv *priv;
+};
+
+typedef struct _RsttoMeegoWallpaperManagerClass RsttoMeegoWallpaperManagerClass;
+
+struct _RsttoMeegoWallpaperManagerClass
+{
+ GObjectClass parent_class;
+};
+
+RsttoMeegoWallpaperManager *rstto_meego_wallpaper_manager_new (void);
+GType rstto_meego_wallpaper_manager_get_type (void);
+
+G_END_DECLS
+
+#endif /* __RISTRETTO_MEEGO_WALLPAPER_MANAGER_H__ */
diff --git a/src/settings.c b/src/settings.c
index a602b97..ac5f5c2 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -76,6 +76,7 @@ enum
PROP_OPEN_ENTIRE_FOLDER,
PROP_WRAP_IMAGES,
PROP_THUMBNAILBAR_SIZE,
+ PROP_DESKTOP_TYPE,
};
GType
@@ -129,7 +130,8 @@ struct _RsttoSettingsPriv
gchar *scrollwheel_primary_action;
gchar *scrollwheel_secondary_action;
gboolean wrap_images;
- gint thumbnailbar_size;
+ gint thumbnailbar_size;
+ gchar *desktop_type;
};
@@ -416,6 +418,15 @@ rstto_settings_class_init (GObjectClass *object_class)
g_object_class_install_property (object_class,
PROP_THUMBNAILBAR_SIZE,
pspec);
+
+ pspec = g_param_spec_string ("desktop-type",
+ "",
+ "",
+ "xfce",
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class,
+ PROP_DESKTOP_TYPE,
+ pspec);
}
/**
@@ -580,6 +591,11 @@ rstto_settings_set_property (GObject *object,
case PROP_THUMBNAILBAR_SIZE:
settings->priv->thumbnailbar_size = g_value_get_int (value);
break;
+ case PROP_DESKTOP_TYPE:
+ if (settings->priv->desktop_type)
+ g_free (settings->priv->desktop_type);
+ settings->priv->desktop_type = g_value_dup_string (value);
+ break;
default:
break;
}
@@ -661,6 +677,9 @@ rstto_settings_get_property (GObject *object,
case PROP_THUMBNAILBAR_SIZE:
g_value_set_int (value, settings->priv->thumbnailbar_size);
break;
+ case PROP_DESKTOP_TYPE:
+ g_value_set_string (value, settings->priv->desktop_type);
+ break;
default:
break;
More information about the Xfce4-commits
mailing list