[Xfce4-commits] <ristretto:master> - Add gnome-wallpaper-manager skeleton code - Fix warning (could've segfaulted ristretto, evil bug) - Update picture-viewer when bgcolor-properties get updated
Stephan Arts
noreply at xfce.org
Mon Jul 12 22:58:01 CEST 2010
Updating branch refs/heads/master
to d9be1e3096ae3b487f08d7a09e8d88fee8b9948f (commit)
from da1b9a846a031e45dd83c367ba7e8e966f4d37e2 (commit)
commit d9be1e3096ae3b487f08d7a09e8d88fee8b9948f
Author: Stephan Arts <stephan at xfce.org>
Date: Mon Jul 12 21:52:11 2010 +0200
- Add gnome-wallpaper-manager skeleton code
- Fix warning (could've segfaulted ristretto, evil bug)
- Update picture-viewer when bgcolor-properties get updated
src/Makefile.am | 1 +
src/gnome_wallpaper_manager.c | 200 +++++++++++++++++++++++++++++++++++++++++
src/gnome_wallpaper_manager.h | 67 ++++++++++++++
src/main_window.c | 1 +
src/picture_viewer.c | 16 ++++
src/thumbnail_bar.c | 2 +-
6 files changed, 286 insertions(+), 1 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index e5e8a5f..814eb79 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,6 +11,7 @@ ristretto_SOURCES = \
main_window.c main_window.h \
wallpaper_manager.c wallpaper_manager.h \
xfce_wallpaper_manager.c xfce_wallpaper_manager.h \
+ gnome_wallpaper_manager.c gnome_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/gnome_wallpaper_manager.c b/src/gnome_wallpaper_manager.c
new file mode 100644
index 0000000..b33105b
--- /dev/null
+++ b/src/gnome_wallpaper_manager.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) Stephan Arts 2009-2010 <stephan at 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 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 <gio/gio.h>
+
+#include "image.h"
+
+#include "wallpaper_manager.h"
+#include "gnome_wallpaper_manager.h"
+
+#define XFDESKTOP_SELECTION_FMT "XFDESKTOP_SELECTION_%d"
+
+typedef struct {
+ gint16 r;
+ gint16 g;
+ gint16 b;
+ gint16 a;
+} RsttoColor;
+
+
+static void
+rstto_gnome_wallpaper_manager_init (GObject *);
+static void
+rstto_gnome_wallpaper_manager_class_init (GObjectClass *);
+
+static void
+rstto_gnome_wallpaper_manager_dispose (GObject *object);
+static void
+rstto_gnome_wallpaper_manager_finalize (GObject *object);
+
+static GObjectClass *parent_class = NULL;
+
+static RsttoGnomeWallpaperManager *gnome_wallpaper_manager_object;
+
+struct _RsttoGnomeWallpaperManagerPriv
+{
+};
+
+
+enum
+{
+ PROP_0,
+};
+
+static gint
+rstto_gnome_wallpaper_manager_configure_dialog_run (RsttoWallpaperManager *self, RsttoImage *image)
+{
+ RsttoGnomeWallpaperManager *manager = RSTTO_GNOME_WALLPAPER_MANAGER (self);
+ gint response = GTK_RESPONSE_OK;
+ return response;
+}
+
+static gboolean
+rstto_gnome_wallpaper_manager_check_running (RsttoWallpaperManager *self)
+{
+ return FALSE;
+}
+
+static gboolean
+rstto_gnome_wallpaper_manager_set (RsttoWallpaperManager *self, RsttoImage *image)
+{
+ RsttoGnomeWallpaperManager *manager = RSTTO_GNOME_WALLPAPER_MANAGER (self);
+
+ return FALSE;
+}
+
+static void
+rstto_gnome_wallpaper_manager_iface_init (RsttoWallpaperManagerIface *iface)
+{
+ iface->configure_dialog_run = rstto_gnome_wallpaper_manager_configure_dialog_run;
+ iface->check_running = rstto_gnome_wallpaper_manager_check_running;
+ iface->set = rstto_gnome_wallpaper_manager_set;
+}
+
+GType
+rstto_gnome_wallpaper_manager_get_type (void)
+{
+ static GType rstto_gnome_wallpaper_manager_type = 0;
+
+ if (!rstto_gnome_wallpaper_manager_type)
+ {
+ static const GTypeInfo rstto_gnome_wallpaper_manager_info =
+ {
+ sizeof (RsttoGnomeWallpaperManagerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) rstto_gnome_wallpaper_manager_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (RsttoGnomeWallpaperManager),
+ 0,
+ (GInstanceInitFunc) rstto_gnome_wallpaper_manager_init,
+ NULL
+ };
+
+ static const GInterfaceInfo wallpaper_manager_iface_info =
+ {
+ (GInterfaceInitFunc) rstto_gnome_wallpaper_manager_iface_init,
+ NULL,
+ NULL
+ };
+
+ rstto_gnome_wallpaper_manager_type = g_type_register_static (G_TYPE_OBJECT, "RsttoGnomeWallpaperManager", &rstto_gnome_wallpaper_manager_info, 0);
+ g_type_add_interface_static (rstto_gnome_wallpaper_manager_type, RSTTO_WALLPAPER_MANAGER_TYPE, &wallpaper_manager_iface_info);
+
+ }
+ return rstto_gnome_wallpaper_manager_type;
+}
+
+
+static void
+rstto_gnome_wallpaper_manager_init (GObject *object)
+{
+ RsttoGnomeWallpaperManager *gnome_wallpaper_manager = RSTTO_GNOME_WALLPAPER_MANAGER (object);
+
+ gnome_wallpaper_manager->priv = g_new0 (RsttoGnomeWallpaperManagerPriv, 1);
+}
+
+
+static void
+rstto_gnome_wallpaper_manager_class_init (GObjectClass *object_class)
+{
+ RsttoGnomeWallpaperManagerClass *gnome_wallpaper_manager_class = RSTTO_GNOME_WALLPAPER_MANAGER_CLASS (object_class);
+
+ parent_class = g_type_class_peek_parent (gnome_wallpaper_manager_class);
+
+ object_class->dispose = rstto_gnome_wallpaper_manager_dispose;
+ object_class->finalize = rstto_gnome_wallpaper_manager_finalize;
+}
+
+/**
+ * rstto_gnome_wallpaper_manager_dispose:
+ * @object:
+ *
+ */
+static void
+rstto_gnome_wallpaper_manager_dispose (GObject *object)
+{
+ RsttoGnomeWallpaperManager *gnome_wallpaper_manager = RSTTO_GNOME_WALLPAPER_MANAGER (object);
+
+ if (gnome_wallpaper_manager->priv)
+ {
+ g_free (gnome_wallpaper_manager->priv);
+ gnome_wallpaper_manager->priv = NULL;
+ }
+}
+
+/**
+ * rstto_gnome_wallpaper_manager_finalize:
+ * @object:
+ *
+ */
+static void
+rstto_gnome_wallpaper_manager_finalize (GObject *object)
+{
+}
+
+
+
+/**
+ * rstto_gnome_wallpaper_manager_new:
+ *
+ *
+ * Singleton
+ */
+RsttoGnomeWallpaperManager *
+rstto_gnome_wallpaper_manager_new (void)
+{
+ if (gnome_wallpaper_manager_object == NULL)
+ {
+ gnome_wallpaper_manager_object = g_object_new (RSTTO_TYPE_GNOME_WALLPAPER_MANAGER, NULL);
+ }
+ else
+ {
+ g_object_ref (gnome_wallpaper_manager_object);
+ }
+
+ return gnome_wallpaper_manager_object;
+}
diff --git a/src/gnome_wallpaper_manager.h b/src/gnome_wallpaper_manager.h
new file mode 100644
index 0000000..d6a2d67
--- /dev/null
+++ b/src/gnome_wallpaper_manager.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) Stephan Arts 2009-2010 <stephan at 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 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_GNOME_WALLPAPER_MANAGER_H__
+#define __RISTRETTO_GNOME_WALLPAPER_MANAGER_H__
+
+G_BEGIN_DECLS
+
+#define RSTTO_TYPE_GNOME_WALLPAPER_MANAGER rstto_gnome_wallpaper_manager_get_type()
+
+#define RSTTO_GNOME_WALLPAPER_MANAGER(obj)( \
+ G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ RSTTO_TYPE_GNOME_WALLPAPER_MANAGER, \
+ RsttoGnomeWallpaperManager))
+
+#define RSTTO_IS_GNOME_WALLPAPER_MANAGER(obj)( \
+ G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ RSTTO_TYPE_GNOME_WALLPAPER_MANAGER))
+
+#define RSTTO_GNOME_WALLPAPER_MANAGER_CLASS(klass)( \
+ G_TYPE_CHECK_CLASS_CAST ((klass), \
+ RSTTO_TYPE_GNOME_WALLPAPER_MANAGER, \
+ RsttoGnomeWallpaperManagerClass))
+
+#define RSTTO_IS_GNOME_WALLPAPER_MANAGER_CLASS(klass)( \
+ G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ RSTTO_TYPE_GNOME_WALLPAPER_MANAGER()))
+
+
+typedef struct _RsttoGnomeWallpaperManager RsttoGnomeWallpaperManager;
+typedef struct _RsttoGnomeWallpaperManagerPriv RsttoGnomeWallpaperManagerPriv;
+
+struct _RsttoGnomeWallpaperManager
+{
+ GObject parent;
+
+ RsttoGnomeWallpaperManagerPriv *priv;
+};
+
+typedef struct _RsttoGnomeWallpaperManagerClass RsttoGnomeWallpaperManagerClass;
+
+struct _RsttoGnomeWallpaperManagerClass
+{
+ GObjectClass parent_class;
+};
+
+RsttoGnomeWallpaperManager *rstto_gnome_wallpaper_manager_new (void);
+GType rstto_gnome_wallpaper_manager_get_type (void);
+
+G_END_DECLS
+
+#endif /* __RISTRETTO_GNOME_WALLPAPER_MANAGER_H__ */
diff --git a/src/main_window.c b/src/main_window.c
index 7807b11..2bace1e 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -40,6 +40,7 @@
#include "thumbnail_bar.h"
#include "wallpaper_manager.h"
#include "xfce_wallpaper_manager.h"
+#include "gnome_wallpaper_manager.h"
#include "preferences_dialog.h"
#include "app_menu_item.h"
diff --git a/src/picture_viewer.c b/src/picture_viewer.c
index 8e7e247..5c23703 100644
--- a/src/picture_viewer.c
+++ b/src/picture_viewer.c
@@ -161,6 +161,9 @@ cb_rstto_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer,
static void
cb_rstto_picture_viewer_popup_menu (RsttoPictureViewer *viewer, gboolean user_data);
+static void
+cb_rstto_picture_viewer_bgcolor_changed (GObject *settings, GParamSpec *pspec, gpointer user_data);
+
static GtkWidgetClass *parent_class = NULL;
GType
@@ -423,6 +426,12 @@ rstto_picture_viewer_paint (GtkWidget *widget)
g_value_init (&val_bg_color_fs, GDK_TYPE_COLOR);
g_value_init (&val_bg_color_override, G_TYPE_BOOLEAN);
+ g_signal_connect (G_OBJECT(viewer->priv->settings), "notify::bgcolor", G_CALLBACK (cb_rstto_picture_viewer_bgcolor_changed), viewer);
+ g_signal_connect (G_OBJECT(viewer->priv->settings), "notify::bgcolor-override", G_CALLBACK (cb_rstto_picture_viewer_bgcolor_changed), viewer);
+ /*
+ g_signal_connect (G_OBJECT(viewer->priv->settings), "notify::bgcolor-fullscreen", G_CALLBACK (cb_rstto_picture_viewer_bgcolor_changed), viewer);
+ */
+
g_object_get_property (G_OBJECT(viewer->priv->settings), "bgcolor", &val_bg_color);
g_object_get_property (G_OBJECT(viewer->priv->settings), "bgcolor-override", &val_bg_color_override);
@@ -1782,3 +1791,10 @@ cb_rstto_picture_viewer_nav_iter_changed (RsttoImageListIter *iter, gpointer use
RsttoPictureViewer *viewer = RSTTO_PICTURE_VIEWER (user_data);
rstto_picture_viewer_set_image (viewer, rstto_image_list_iter_get_image (iter));
}
+
+static void
+cb_rstto_picture_viewer_bgcolor_changed (GObject *settings, GParamSpec *pspec, gpointer user_data)
+{
+ RsttoPictureViewer *viewer = RSTTO_PICTURE_VIEWER (user_data);
+ rstto_picture_viewer_queued_repaint (viewer, TRUE);
+}
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index a955a93..282db14 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -678,7 +678,7 @@ rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child)
widget_was_visible = GTK_WIDGET_VISIBLE(child);
- rstto_thumbnailer_dequeue_image (bar->priv->thumbnailer, child);
+ rstto_thumbnailer_dequeue_image (bar->priv->thumbnailer, rstto_thumbnail_get_image(RSTTO_THUMBNAIL(child)));
bar->priv->thumbs = g_list_remove(bar->priv->thumbs, child);
More information about the Xfce4-commits
mailing list