[gnome-control-center/wip/background] Add initial implementation of background/screensaver panel



commit 5dca43e8049fc0bfad95ad4393e7b8f5509a0791
Author: Thomas Wood <thos gnome org>
Date:   Tue Jul 6 22:27:06 2010 +0100

    Add initial implementation of background/screensaver panel

 configure.ac                                       |    2 +
 panels/Makefile.am                                 |    4 +-
 panels/background-screensaver/Makefile.am          |   37 +++++
 .../background-screensaver-module.c                |   41 +++++
 .../background-screensaver.ui                      |  163 ++++++++++++++++++++
 .../cc-background-screensaver-panel.c              |  141 +++++++++++++++++
 .../cc-background-screensaver-panel.h              |   74 +++++++++
 ...nome-background-screensaver-panel.desktop.in.in |   11 ++
 8 files changed, 472 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d68fa00..b75dc31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -402,6 +402,8 @@ libgnome-control-center/libgnome-control-center.pc
 libwindow-settings/Makefile
 libwindow-settings/gnome-window-settings-2.0.pc
 panels/Makefile
+panels/background-screensaver/Makefile
+panels/background-screensaver/gnome-background-screensaver-panel.desktop.in
 panels/datetime/Makefile
 panels/datetime/gnome-datetime-panel.desktop.in
 panels/mouse/Makefile
diff --git a/panels/Makefile.am b/panels/Makefile.am
index 66a22e3..4a3b3cf 100644
--- a/panels/Makefile.am
+++ b/panels/Makefile.am
@@ -1,4 +1,6 @@
-SUBDIRS=display \
+SUBDIRS= \
+	background-screensaver \
+	display \
 	mouse \
 	keyboard \
 	network \
diff --git a/panels/background-screensaver/Makefile.am b/panels/background-screensaver/Makefile.am
new file mode 100644
index 0000000..65e7d37
--- /dev/null
+++ b/panels/background-screensaver/Makefile.am
@@ -0,0 +1,37 @@
+# This is used in GNOMECC_CAPPLETS_CFLAGS
+cappletname = background-screensaver
+
+uidir = $(pkgdatadir)/ui/background-screensaver
+dist_ui_DATA = \
+	background-screensaver.ui
+
+
+INCLUDES = 						\
+	$(PANEL_CFLAGS)					\
+	$(GNOMECC_CAPPLETS_CFLAGS)			\
+	$(DBUS_CFLAGS)					\
+	-DGNOMELOCALEDIR="\"$(datadir)/locale\""	\
+	-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""		\
+	-DDATADIR="\"$(uidir)\""			\
+	$(NULL)
+
+ccpanelsdir = $(PANELS_DIR)
+ccpanels_LTLIBRARIES = libbackground-screensaver.la
+
+libbackground_screensaver_la_SOURCES =		\
+	background-screensaver-module.c	\
+	cc-background-screensaver-panel.c	\
+	cc-background-screensaver-panel.h
+
+libbackground_screensaver_la_LIBADD = $(PANEL_LIBS) $(DBUS_LIBS)
+libbackground_screensaver_la_LDFLAGS = $(PANEL_LDFLAGS)
+
+ INTLTOOL_DESKTOP_RULE@
+
+desktopdir = $(datadir)/applications
+desktop_in_files = gnome-background-screensaver-panel.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+
+CLEANFILES = $(desktop_in_files) $(desktop_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/panels/background-screensaver/background-screensaver-module.c b/panels/background-screensaver/background-screensaver-module.c
new file mode 100644
index 0000000..efe12c2
--- /dev/null
+++ b/panels/background-screensaver/background-screensaver-module.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include <config.h>
+
+#include "cc-background-screensaver-panel.h"
+
+#include <glib/gi18n.h>
+
+void
+g_io_module_load (GIOModule *module)
+{
+  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+  /* register the panel */
+  cc_background_screensaver_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
diff --git a/panels/background-screensaver/background-screensaver.ui b/panels/background-screensaver/background-screensaver.ui
new file mode 100644
index 0000000..0605087
--- /dev/null
+++ b/panels/background-screensaver/background-screensaver.ui
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkListStore" id="backgrounds-liststore"/>
+  <object class="GtkListStore" id="style-liststore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Crop</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Tile</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Center</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="sources-liststore">
+    <columns>
+      <!-- column-name source-name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Wallpapers</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Pictures Folder</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkTreeModelFilter" id="wallpapers-filter">
+    <property name="child_model">backgrounds-liststore</property>
+  </object>
+  <object class="GtkWindow" id="window1">
+    <child>
+      <object class="GtkHBox" id="background-screensaver-panel">
+        <property name="visible">True</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkTreeView" id="sources-treeview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="headers_visible">False</property>
+                <child>
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                    <property name="title">Sources</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow2">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkIconView" id="backgrounds-iconview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkAspectFrame" id="aspectframe1">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <property name="ratio">1.7000000476837158</property>
+                <property name="obey_child">False</property>
+                <child>
+                  <object class="GtkDrawingArea" id="preview-area">
+                    <property name="width_request">128</property>
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkComboBox" id="combobox1">
+                    <property name="visible">True</property>
+                    <property name="model">style-liststore</property>
+                    <property name="active">0</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkColorButton" id="colorbutton1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="color">#000000000000</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/panels/background-screensaver/cc-background-screensaver-panel.c b/panels/background-screensaver/cc-background-screensaver-panel.c
new file mode 100644
index 0000000..ec4efcb
--- /dev/null
+++ b/panels/background-screensaver/cc-background-screensaver-panel.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+#include "cc-background-screensaver-panel.h"
+
+G_DEFINE_DYNAMIC_TYPE (CcBackgroundScreensaverPanel, cc_background_screensaver_panel, CC_TYPE_PANEL)
+
+#define BACKGROUND_SCREENSAVER_PANEL_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_SCREENSAVER_PANEL, CcBackgroundScreensaverPanelPrivate))
+
+struct _CcBackgroundScreensaverPanelPrivate
+{
+  GtkBuilder *builder;
+};
+
+
+static void
+cc_background_screensaver_panel_get_property (GObject    *object,
+                               guint       property_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_background_screensaver_panel_set_property (GObject      *object,
+                               guint         property_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+cc_background_screensaver_panel_dispose (GObject *object)
+{
+  CcBackgroundScreensaverPanelPrivate *priv = CC_BACKGROUND_SCREENSAVER_PANEL (object)->priv;
+  if (priv->builder)
+    {
+      g_object_unref (priv->builder);
+      priv->builder = NULL;
+    }
+
+  G_OBJECT_CLASS (cc_background_screensaver_panel_parent_class)->dispose (object);
+}
+
+static void
+cc_background_screensaver_panel_finalize (GObject *object)
+{
+  CcBackgroundScreensaverPanelPrivate *priv = CC_BACKGROUND_SCREENSAVER_PANEL (object)->priv;
+
+  G_OBJECT_CLASS (cc_background_screensaver_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_background_screensaver_panel_class_init (CcBackgroundScreensaverPanelClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (CcBackgroundScreensaverPanelPrivate));
+
+  object_class->get_property = cc_background_screensaver_panel_get_property;
+  object_class->set_property = cc_background_screensaver_panel_set_property;
+  object_class->dispose = cc_background_screensaver_panel_dispose;
+  object_class->finalize = cc_background_screensaver_panel_finalize;
+}
+
+static void
+cc_background_screensaver_panel_class_finalize (CcBackgroundScreensaverPanelClass *klass)
+{
+
+}
+
+
+static void
+cc_background_screensaver_panel_init (CcBackgroundScreensaverPanel *self)
+{
+  CcBackgroundScreensaverPanelPrivate *priv;
+  gchar *objects[] = { "background-screensaver-panel",
+      "backgrounds-liststore", "style-liststore", "sources-liststore",
+     "wallpapers-filter", NULL };
+  GtkWidget *widget;
+  GError *err = NULL;
+
+  priv = self->priv = BACKGROUND_SCREENSAVER_PANEL_PRIVATE (self);
+
+  priv->builder = gtk_builder_new ();
+
+  gtk_builder_add_objects_from_file (priv->builder, DATADIR"/background-screensaver.ui",
+                                     objects, &err);
+
+  if (err)
+    {
+      g_warning ("Could not load ui: %s", err->message);
+      g_error_free (err);
+      return;
+    }
+
+
+  gtk_container_add (GTK_CONTAINER (self),
+                     GTK_WIDGET (gtk_builder_get_object (priv->builder,
+                                                         "background-screensaver-panel")));
+  gtk_widget_show_all (self);
+}
+
+void
+cc_background_screensaver_panel_register (GIOModule *module)
+{
+  cc_background_screensaver_panel_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
+                                  CC_TYPE_BACKGROUND_SCREENSAVER_PANEL,
+                                  "background-screensaver", 0);
+}
+
diff --git a/panels/background-screensaver/cc-background-screensaver-panel.h b/panels/background-screensaver/cc-background-screensaver-panel.h
new file mode 100644
index 0000000..39f12e9
--- /dev/null
+++ b/panels/background-screensaver/cc-background-screensaver-panel.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Intel, Inc
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Thomas Wood <thomas wood intel com>
+ *
+ */
+
+
+#ifndef _CC_BACKGROUND_SCREENSAVER_PANEL_H
+#define _CC_BACKGROUND_SCREENSAVER_PANEL_H
+
+#include <libgnome-control-center/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_BACKGROUND_SCREENSAVER_PANEL cc_background_screensaver_panel_get_type()
+
+#define CC_BACKGROUND_SCREENSAVER_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  CC_TYPE_BACKGROUND_SCREENSAVER_PANEL, CcBackgroundScreensaverPanel))
+
+#define CC_BACKGROUND_SCREENSAVER_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  CC_TYPE_BACKGROUND_SCREENSAVER_PANEL, CcBackgroundScreensaverPanelClass))
+
+#define CC_IS_BACKGROUND_SCREENSAVER_PANEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  CC_TYPE_BACKGROUND_SCREENSAVER_PANEL))
+
+#define CC_IS_BACKGROUND_SCREENSAVER_PANEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  CC_TYPE_BACKGROUND_SCREENSAVER_PANEL))
+
+#define CC_BACKGROUND_SCREENSAVER_PANEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  CC_TYPE_BACKGROUND_SCREENSAVER_PANEL, CcBackgroundScreensaverPanelClass))
+
+typedef struct _CcBackgroundScreensaverPanel CcBackgroundScreensaverPanel;
+typedef struct _CcBackgroundScreensaverPanelClass CcBackgroundScreensaverPanelClass;
+typedef struct _CcBackgroundScreensaverPanelPrivate CcBackgroundScreensaverPanelPrivate;
+
+struct _CcBackgroundScreensaverPanel
+{
+  CcPanel parent;
+
+  CcBackgroundScreensaverPanelPrivate *priv;
+};
+
+struct _CcBackgroundScreensaverPanelClass
+{
+  CcPanelClass parent_class;
+};
+
+GType cc_background_screensaver_panel_get_type (void) G_GNUC_CONST;
+
+void  cc_background_screensaver_panel_register (GIOModule *module);
+
+G_END_DECLS
+
+#endif /* _CC_BACKGROUND_SCREENSAVER_PANEL_H */
diff --git a/panels/background-screensaver/gnome-background-screensaver-panel.desktop.in.in b/panels/background-screensaver/gnome-background-screensaver-panel.desktop.in.in
new file mode 100644
index 0000000..cb0d806
--- /dev/null
+++ b/panels/background-screensaver/gnome-background-screensaver-panel.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+_Name=Background and Screensaver
+_Comment=Date and Time preferences panel
+Exec=gnome-control-center background-screensaver
+Icon=application-x-executable
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=GNOME;GTK;Settings;DesktopSettings;
+OnlyShowIn=GNOME;
+X-GNOME-Settings-Panel=background-screensaver



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