[gnome-initial-setup] Remove the old gd-based assistant and use GtkStack



commit 998b08a2bb6ef82ec78a9e91ca3d664afa9a9cd0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 24 11:49:07 2013 -0400

    Remove the old gd-based assistant and use GtkStack

 .gitmodules                                        |    3 -
 Makefile.am                                        |    3 +-
 autogen.sh                                         |    1 -
 configure.ac                                       |    3 -
 gnome-initial-setup/Makefile.am                    |    3 -
 gnome-initial-setup/gis-assistant-gd.c             |  116 --------------------
 gnome-initial-setup/gis-assistant-gd.h             |   60 ----------
 gnome-initial-setup/gis-assistant-gtk.c            |   54 ++++++---
 gnome-initial-setup/gis-driver.c                   |   17 +---
 gnome-initial-setup/pages/keyboard/Makefile.am     |    1 -
 .../pages/keyboard/gis-keyboard-page.c             |    1 -
 libgd                                              |    1 -
 12 files changed, 37 insertions(+), 226 deletions(-)
---
diff --git a/.gitmodules b/.gitmodules
index afb8a61..992c00b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
 [submodule "egg-list-box"]
        path = egg-list-box
        url = git://git.gnome.org/egg-list-box
-[submodule "libgd"]
-       path = libgd
-       url = git://git.gnome.org/libgd
diff --git a/Makefile.am b/Makefile.am
index 193daa2..2a2e94c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,7 @@
 
-ACLOCAL_AMFLAGS = -I m4 -I libgd ${ACLOCAL_FLAGS}
 AM_CFLAGS = ${WARN_CFLAGS}
 
-SUBDIRS = egg-list-box libgd data gnome-initial-setup player po
+SUBDIRS = egg-list-box data gnome-initial-setup player po
 
 EXTRA_DIST = \
     autogen.sh \
diff --git a/autogen.sh b/autogen.sh
index a6a2822..e0b53d5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,7 +5,6 @@ srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
 PKG_NAME="gnome-initial-setup"
-ACLOCAL_FLAGS="-I libgd $ACLOCAL_FLAGS"
 
 (test -f $srcdir/configure.ac \
   && test -f $srcdir/gnome-initial-setup.doap) || {
diff --git a/configure.ac b/configure.ac
index 648994d..8747ab3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,8 +94,6 @@ PKG_CHECK_MODULES(ISOCODES, iso-codes)
 AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
 ISO_CODES=iso-codes
 
-LIBGD_INIT([stack static])
-
 GLIB_VERSION_DEFINES="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 
'-DGLIB_VERSION_MAX_ALLOWED=G_ENCODE_VERSION(2,36)'"
 
 INITIAL_SETUP_CFLAGS="$INITIAL_SETUP_CFLAGS $GLIB_VERSION_DEFINES"
@@ -127,6 +125,5 @@ gnome-initial-setup/pages/summary/Makefile
 gnome-initial-setup/pages/keyboard/Makefile
 po/Makefile.in
 player/Makefile
-libgd/Makefile
 ])
 AC_OUTPUT
diff --git a/gnome-initial-setup/Makefile.am b/gnome-initial-setup/Makefile.am
index a38ed54..6111bb8 100644
--- a/gnome-initial-setup/Makefile.am
+++ b/gnome-initial-setup/Makefile.am
@@ -4,7 +4,6 @@ uidir = $(datadir)/gnome-initial-setup
 
 AM_CPPFLAGS = \
        $(INITIAL_SETUP_CFLAGS) \
-       -I$(top_srcdir)/libgd \
        -DUIDIR="\"$(uidir)\"" \
        -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
        -DLIBLOCALEDIR=\""$(prefix)/lib/locale"\" \
@@ -17,7 +16,6 @@ gnome_initial_setup_SOURCES = \
        gis-center-container.c gis-center-container.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
 
@@ -31,7 +29,6 @@ gnome_initial_setup_LDADD =   \
        pages/goa/libgisgoa.la \
        pages/summary/libgissummary.la \
        $(INITIAL_SETUP_LIBS) \
-       $(top_builddir)/libgd/libgd.la  \
        -lm
 
 gnome_initial_setup_copy_worker_SOURCES =              \
diff --git a/gnome-initial-setup/gis-assistant-gtk.c b/gnome-initial-setup/gis-assistant-gtk.c
index aac3f99..33be664 100644
--- a/gnome-initial-setup/gis-assistant-gtk.c
+++ b/gnome-initial-setup/gis-assistant-gtk.c
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2012 Red Hat
+ * 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
@@ -36,36 +36,51 @@ G_DEFINE_TYPE (GisAssistantGtk, gis_assistant_gtk, GIS_TYPE_ASSISTANT)
 
 struct _GisAssistantGtkPrivate
 {
-  GtkWidget *notebook;
+  GtkWidget *stack;
 };
 
 static void
-current_page_changed (GtkNotebook  *notebook,
-                      GtkWidget    *new_page,
-                      gint          new_page_num,
-                      GisAssistant *assistant)
+current_page_changed (GObject    *gobject,
+                      GParamSpec *pspec,
+                      gpointer    user_data)
 {
+  GtkStack *stack = GTK_STACK (gobject);
+  GisAssistant *assistant = GIS_ASSISTANT (user_data);
+  GtkWidget *new_page = gtk_stack_get_visible_child (stack);
   _gis_assistant_current_page_changed (assistant, GIS_PAGE (new_page));
 }
 
 static void
 gis_assistant_gtk_switch_to (GisAssistant          *assistant,
-                             GisAssistantDirection  direction,
-                             GisPage               *page)
+                            GisAssistantDirection  direction,
+                            GisPage               *page)
 {
   GisAssistantGtkPrivate *priv = GIS_ASSISTANT_GTK (assistant)->priv;
-  gint page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
-                                         GTK_WIDGET (page));
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page_num);
+  GtkStackTransitionType transition_type;
+
+  switch (direction) {
+  case GIS_ASSISTANT_NEXT:
+    transition_type = GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT;
+    break;
+  case GIS_ASSISTANT_PREV:
+    transition_type = GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT;
+    break;
+  default:
+    g_assert_not_reached ();
+  }
+
+  gtk_stack_set_transition_type (GTK_STACK (priv->stack), transition_type);
+
+  gtk_stack_set_visible_child (GTK_STACK (priv->stack),
+                              GTK_WIDGET (page));
 }
 
 static void
 gis_assistant_gtk_add_page (GisAssistant *assistant,
-                            GisPage      *page)
+                           GisPage      *page)
 {
   GisAssistantGtkPrivate *priv = GIS_ASSISTANT_GTK (assistant)->priv;
-  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
-                            GTK_WIDGET (page), NULL);
+  gtk_container_add (GTK_CONTAINER (priv->stack), GTK_WIDGET (page));
 }
 
 static void
@@ -78,13 +93,14 @@ gis_assistant_gtk_init (GisAssistantGtk *assistant_gtk)
   assistant_gtk->priv = priv;
 
   frame = _gis_assistant_get_frame (assistant);
-  priv->notebook = gtk_notebook_new ();
-  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
-  gtk_container_add (GTK_CONTAINER (frame), priv->notebook);
+  priv->stack = gtk_stack_new ();
+  gtk_stack_set_transition_type (GTK_STACK (priv->stack),
+                                GTK_STACK_TRANSITION_TYPE_CROSSFADE);
+  gtk_container_add (GTK_CONTAINER (frame), priv->stack);
 
-  gtk_widget_show (priv->notebook);
+  gtk_widget_show (priv->stack);
 
-  g_signal_connect (priv->notebook, "switch-page",
+  g_signal_connect (priv->stack, "notify::visible-child",
                     G_CALLBACK (current_page_changed), assistant);
 }
 
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index cf67ec4..407238c 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -29,7 +29,6 @@
 #include <locale.h>
 
 #include "gis-assistant-gtk.h"
-#include "gis-assistant-gd.h"
 
 #define GIS_TYPE_DRIVER_MODE (gis_driver_mode_get_type ())
 
@@ -199,20 +198,6 @@ gis_driver_get_mode (GisDriver *driver)
   return priv->mode;
 }
 
-static GType
-get_assistant_type (void)
-{
-  gboolean enable_animations;
-  g_object_get (gtk_settings_get_default (),
-                "gtk-enable-animations", &enable_animations,
-                NULL);
-
-  if (enable_animations && g_getenv ("GIS_DISABLE_GD") == NULL)
-    return GIS_TYPE_ASSISTANT_GD;
-  else
-    return GIS_TYPE_ASSISTANT_GTK;
-}
-
 static void
 gis_driver_get_property (GObject      *object,
                          guint         prop_id,
@@ -292,7 +277,7 @@ gis_driver_startup (GApplication *app)
                     G_CALLBACK (window_realize_cb),
                     (gpointer)app);
 
-  priv->assistant = g_object_new (get_assistant_type (), NULL);
+  priv->assistant = g_object_new (GIS_TYPE_ASSISTANT_GTK, NULL);
   gtk_container_add (GTK_CONTAINER (priv->main_window), GTK_WIDGET (priv->assistant));
 
   gtk_widget_show (GTK_WIDGET (priv->assistant));
diff --git a/gnome-initial-setup/pages/keyboard/Makefile.am b/gnome-initial-setup/pages/keyboard/Makefile.am
index ffefc55..1d8831d 100644
--- a/gnome-initial-setup/pages/keyboard/Makefile.am
+++ b/gnome-initial-setup/pages/keyboard/Makefile.am
@@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libgiskeyboard.la
 
 AM_CPPFLAGS = \
        $(INITIAL_SETUP_CFLAGS) \
-       -I$(top_srcdir)/libgd \
        -DLOCALSTATEDIR="\"$(localstatedir)\"" \
        -DUIDIR="\"$(uidir)\""
 
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c 
b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
index d27962a..7d89d87 100644
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
@@ -47,7 +47,6 @@
 #include <act/act.h>
 #include <unistd.h>
 #include <egg-list-box.h>
-#include <libgd/gd.h>
 
 #define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources"
 #define KEY_CURRENT_INPUT_SOURCE "current"


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