[gnome-initial-setup] gis-assistant: Replace the Clutter-based assistant with a Gd-based one



commit 795763f292c0e62b9a2119823fefbb597ea377a8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Feb 26 17:54:29 2013 -0500

    gis-assistant: Replace the Clutter-based assistant with a Gd-based one
    
    Right now, we'll simply cross-fade between pages rather than
    slide, but enhancements to GdStack to support sliding transitions
    are on the way.

 configure.ac                                |   12 -
 gnome-initial-setup/Makefile.am             |    8 +-
 gnome-initial-setup/cc-notebook.c           |  581 ---------------------------
 gnome-initial-setup/cc-notebook.h           |   70 ----
 gnome-initial-setup/gis-assistant-clutter.c |   95 -----
 gnome-initial-setup/gis-assistant-clutter.h |   60 ---
 gnome-initial-setup/gis-assistant-gd.c      |  100 +++++
 gnome-initial-setup/gis-assistant-gd.h      |   60 +++
 gnome-initial-setup/gis-driver.c            |   15 +-
 9 files changed, 167 insertions(+), 834 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8d7c29a..ff71cc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,6 @@ AM_GLIB_GNU_GETTEXT
 NETWORK_MANAGER_REQUIRED_VERSION=0.9.6.4
 GLIB_REQUIRED_VERSION=2.29.4
 GTK_REQUIRED_VERSION=3.7.7
-CLUTTER_REQUIRED_VERSION=1.11.3
 PANGO_REQUIRED_VERSION=1.32.5
 IBUS_REQUIRED_VERSION=1.4.99
 GNOME_DESKTOP_REQUIRED_VERSION=3.7.5
@@ -52,17 +51,6 @@ PKG_CHECK_MODULES(INITIAL_SETUP,
 
 PKG_CHECK_MODULES(COPY_WORKER, gio-2.0)
 
-PKG_CHECK_MODULES(CLUTTER,
-                  clutter-gtk-1.0
-                  clutter-1.0 >= $CLUTTER_REQUIRED_VERSION,
-                  have_clutter=yes, have_clutter=no)
-AM_CONDITIONAL(HAVE_CLUTTER, [test x$have_clutter = xyes])
-if test x$have_clutter = xyes; then
-  INITIAL_SETUP_CFLAGS="$INITIAL_SETUP_CFLAGS $CLUTTER_CFLAGS"
-  INITIAL_SETUP_LIBS="$INITIAL_SETUP_LIBS $CLUTTER_LIBS"
-  AC_DEFINE(HAVE_CLUTTER, 1, [Build with Clutter support?])
-fi
-
 AC_ARG_ENABLE(ibus,
         AS_HELP_STRING([--disable-ibus],
                        [Disable IBus support]),
diff --git a/gnome-initial-setup/Makefile.am b/gnome-initial-setup/Makefile.am
index bbee4d8..0b47232 100644
--- a/gnome-initial-setup/Makefile.am
+++ b/gnome-initial-setup/Makefile.am
@@ -4,6 +4,7 @@ uidir = $(datadir)/gnome-initial-setup
 
 AM_CPPFLAGS = \
        $(INITIAL_SETUP_CFLAGS) \
+       -I$(top_srcdir)/libgd \
        -DUIDIR="\"$(uidir)\"" \
        -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
        -DLIBLOCALEDIR=\""$(prefix)/lib/locale"\" \
@@ -15,15 +16,10 @@ gnome_initial_setup_SOURCES =       \
        gnome-initial-setup.c gnome-initial-setup.h \
        gis-assistant.c gis-assistant.h gis-assistant-private.h \
        gis-assistant-gtk.c gis-assistant-gtk.h \
+       gis-assistant-gd.c gis-assistant-gd.h \
        gis-page.c gis-page.h \
        gis-driver.c gis-driver.h
 
-if HAVE_CLUTTER
-gnome_initial_setup_SOURCES += \
-       gis-assistant-clutter.c gis-assistant-clutter.h \
-       cc-notebook.c cc-notebook.h
-endif
-
 gnome_initial_setup_LDADD =    \
        pages/welcome/libgiswelcome.la \
        pages/language/libgislanguage.la \
diff --git a/gnome-initial-setup/gis-assistant-gd.c b/gnome-initial-setup/gis-assistant-gd.c
new file mode 100644
index 0000000..e32b1af
--- /dev/null
+++ b/gnome-initial-setup/gis-assistant-gd.c
@@ -0,0 +1,100 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2013 Red Hat
+ *
+ * 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.
+ *
+ * Written by:
+ *     Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+#include <glib/gi18n.h>
+#include <libgd/gd.h>
+
+#include "gis-assistant-gd.h"
+#include "gis-assistant-private.h"
+
+G_DEFINE_TYPE (GisAssistantGd, gis_assistant_gd, GIS_TYPE_ASSISTANT)
+
+#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_ASSISTANT_GD, GisAssistantGdPrivate))
+
+struct _GisAssistantGdPrivate
+{
+  GtkWidget *stack;
+};
+
+static void
+current_page_changed (GObject    *gobject,
+                      GParamSpec *pspec,
+                      gpointer    user_data)
+{
+  GdStack *stack = GD_STACK (gobject);
+  GisAssistant *assistant = GIS_ASSISTANT (user_data);
+  GtkWidget *new_page = gd_stack_get_visible_child (stack);
+  _gis_assistant_current_page_changed (assistant, GIS_PAGE (new_page));
+}
+
+static void
+gis_assistant_gd_switch_to (GisAssistant *assistant,
+                            GisPage      *page)
+{
+  GisAssistantGdPrivate *priv = GIS_ASSISTANT_GD (assistant)->priv;
+  gd_stack_set_visible_child (GD_STACK (priv->stack),
+                              GTK_WIDGET (page));
+}
+
+static void
+gis_assistant_gd_add_page (GisAssistant *assistant,
+                           GisPage      *page)
+{
+  GisAssistantGdPrivate *priv = GIS_ASSISTANT_GD (assistant)->priv;
+  gtk_container_add (GTK_CONTAINER (priv->stack), GTK_WIDGET (page));
+}
+
+static void
+gis_assistant_gd_init (GisAssistantGd *assistant_gd)
+{
+  GisAssistantGdPrivate *priv = GET_PRIVATE (assistant_gd);
+  GisAssistant *assistant = GIS_ASSISTANT (assistant_gd);
+  GtkWidget *frame;
+
+  assistant_gd->priv = priv;
+
+  frame = _gis_assistant_get_frame (assistant);
+  priv->stack = gd_stack_new ();
+  gd_stack_set_transition_type (GD_STACK (priv->stack),
+                                GD_STACK_TRANSITION_TYPE_CROSSFADE);
+  gtk_container_add (GTK_CONTAINER (frame), priv->stack);
+
+  gtk_widget_show (priv->stack);
+
+  g_signal_connect (priv->stack, "notify::visible-child",
+                    G_CALLBACK (current_page_changed), assistant);
+}
+
+static void
+gis_assistant_gd_class_init (GisAssistantGdClass *klass)
+{
+  GisAssistantClass *assistant_class = GIS_ASSISTANT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GisAssistantGdPrivate));
+
+  assistant_class->add_page = gis_assistant_gd_add_page;
+  assistant_class->switch_to = gis_assistant_gd_switch_to;
+}
diff --git a/gnome-initial-setup/gis-assistant-gd.h b/gnome-initial-setup/gis-assistant-gd.h
new file mode 100644
index 0000000..07f2dfd
--- /dev/null
+++ b/gnome-initial-setup/gis-assistant-gd.h
@@ -0,0 +1,60 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2013 Red Hat
+ *
+ * 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.
+ *
+ * Written by:
+ *     Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#ifndef __GIS_ASSISTANT_GD_H__
+#define __GIS_ASSISTANT_GD_H__
+
+#include <glib-object.h>
+
+#include "gis-assistant.h"
+
+G_BEGIN_DECLS
+
+#define GIS_TYPE_ASSISTANT_GD             (gis_assistant_gd_get_type ())
+#define GIS_ASSISTANT_GD(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIS_TYPE_ASSISTANT_GD, 
GisAssistantGd))
+#define GIS_ASSISTANT_GD_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass),  GIS_TYPE_ASSISTANT_GD, 
GisAssistantGdClass))
+#define GIS_IS_ASSISTANT_GD(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIS_TYPE_ASSISTANT_GD))
+#define GIS_IS_ASSISTANT_GD_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass),   GIS_TYPE_ASSISTANT_GD))
+#define GIS_ASSISTANT_GD_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIS_TYPE_ASSISTANT_GD, 
GisAssistantGdClass))
+
+typedef struct _GisAssistantGd        GisAssistantGd;
+typedef struct _GisAssistantGdClass   GisAssistantGdClass;
+typedef struct _GisAssistantGdPrivate GisAssistantGdPrivate;
+
+struct _GisAssistantGd
+{
+  GisAssistant parent;
+
+  GisAssistantGdPrivate *priv;
+};
+
+struct _GisAssistantGdClass
+{
+  GisAssistantClass parent_class;
+};
+
+GType gis_assistant_gd_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GIS_ASSISTANT_GD_H__ */
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 01365fa..2802399 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -28,10 +28,7 @@
 #include <stdlib.h>
 
 #include "gis-assistant-gtk.h"
-
-#ifdef HAVE_CLUTTER
-#include "gis-assistant-clutter.h"
-#endif
+#include "gis-assistant-gd.h"
 
 #define GIS_TYPE_DRIVER_MODE (gis_driver_mode_get_type ())
 
@@ -176,17 +173,15 @@ gis_driver_get_mode (GisDriver *driver)
 static GType
 get_assistant_type (void)
 {
-#ifdef HAVE_CLUTTER
   gboolean enable_animations;
   g_object_get (gtk_settings_get_default (),
                 "gtk-enable-animations", &enable_animations,
                 NULL);
 
-  if (enable_animations && g_getenv ("GIS_DISABLE_CLUTTER") == NULL)
-    return GIS_TYPE_ASSISTANT_CLUTTER;
-#endif /* HAVE_CLUTTER */
-
-  return GIS_TYPE_ASSISTANT_GTK;
+  if (enable_animations && g_getenv ("GIS_DISABLE_GD") == NULL)
+    return GIS_TYPE_ASSISTANT_GD;
+  else
+    return GIS_TYPE_ASSISTANT_GTK;
 }
 
 static void


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