[gnome-initial-setup/shell/4765: 268/362] summary: change how the tutorial is activated
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 268/362] summary: change how the tutorial is activated
- Date: Thu, 19 Mar 2015 01:43:36 +0000 (UTC)
commit 960a9b9fb26e78cdb95554591cf2071cbe900ac2
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Wed Oct 8 16:35:48 2014 -0700
summary: change how the tutorial is activated
Instead of exposing a method ourselves, make the tutorial activate upon
calling a method on its interface, and log the user in regardless of the
result, when that is finished.
This should make the whole process more robust to crashes or random
errors in the tutorial.
[endlessm/eos-shell#3939]
.gitignore | 2 +-
gnome-initial-setup/pages/summary/Makefile.am | 12 +-
...FBE.xml => com.endlessm.Tutorial.FBERemote.xml} | 4 +-
.../pages/summary/gis-summary-page.c | 139 +++++++-------------
4 files changed, 55 insertions(+), 102 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2e32179..49e9cf9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,7 +59,7 @@ gnome-initial-setup/pages/location/cc-datetime-resources.[ch]
gnome-initial-setup/pages/location/location-resources.[ch]
gnome-initial-setup/pages/goa/goa-resources.[ch]
gnome-initial-setup/pages/summary/summary-resources.[ch]
-gnome-initial-setup/pages/summary/fbe-generated.[ch]
+gnome-initial-setup/pages/summary/fbe-remote-generated.[ch]
gnome-initial-setup/pages/endless-eula/endless-eula-resources.[ch]
gnome-initial-setup/pages/location/geoclue.[ch]
diff --git a/gnome-initial-setup/pages/summary/Makefile.am b/gnome-initial-setup/pages/summary/Makefile.am
index b6e135a..90a4e2c 100644
--- a/gnome-initial-setup/pages/summary/Makefile.am
+++ b/gnome-initial-setup/pages/summary/Makefile.am
@@ -8,12 +8,12 @@ AM_CPPFLAGS = \
BUILT_SOURCES =
-fbe-generated.c: fbe-generated.h
-fbe-generated.h: $(srcdir)/com.endlessm.FBE.xml
+fbe-remote-generated.c: fbe-remote-generated.h
+fbe-remote-generated.h: $(srcdir)/com.endlessm.Tutorial.FBERemote.xml
$(AM_V_GEN) gdbus-codegen \
- --interface-prefix=com.endlessm \
- --generate-c-code=fbe-generated $<
-BUILT_SOURCES += fbe-generated.c fbe-generated.h
+ --interface-prefix=com.endlessm.Tutorial \
+ --generate-c-code=fbe-remote-generated $<
+BUILT_SOURCES += fbe-remote-generated.c fbe-remote-generated.h
resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies
$(srcdir)/summary.gresource.xml)
summary-resources.c: summary.gresource.xml $(resource_files)
@@ -31,6 +31,6 @@ libgissummary_la_LIBADD = $(INITIAL_SETUP_LIBS)
libgissummary_la_LDFLAGS = -export_dynamic -avoid-version -module -no-undefined
EXTRA_DIST = \
- com.endlessm.FBE.xml \
+ com.endlessm.Tutorial.FBERemote.xml \
summary.gresource.xml \
$(resource_files)
diff --git a/gnome-initial-setup/pages/summary/com.endlessm.FBE.xml
b/gnome-initial-setup/pages/summary/com.endlessm.Tutorial.FBERemote.xml
similarity index 66%
rename from gnome-initial-setup/pages/summary/com.endlessm.FBE.xml
rename to gnome-initial-setup/pages/summary/com.endlessm.Tutorial.FBERemote.xml
index 26e345e..ff4d38d 100644
--- a/gnome-initial-setup/pages/summary/com.endlessm.FBE.xml
+++ b/gnome-initial-setup/pages/summary/com.endlessm.Tutorial.FBERemote.xml
@@ -1,7 +1,7 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
- <interface name="com.endlessm.FBE">
- <method name="TutorialExit" />
+ <interface name="com.endlessm.Tutorial.FBERemote">
+ <method name="PlayTutorial" />
</interface>
</node>
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 82a1da4..e8ad213 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -26,9 +26,9 @@
#define PAGE_ID "summary"
#include "config.h"
+#include "fbe-remote-generated.h"
#include "summary-resources.h"
#include "gis-summary-page.h"
-#include "fbe-generated.h"
#include <glib/gstdio.h>
#include <glib/gi18n.h>
@@ -46,9 +46,6 @@
struct _GisSummaryPagePrivate {
ActUser *user_account;
const gchar *user_password;
-
- FBE *fbe_skeleton;
- guint fbe_bus_name_id;
};
typedef struct _GisSummaryPagePrivate GisSummaryPagePrivate;
@@ -225,12 +222,53 @@ log_user_in (GisSummaryPage *page)
}
static void
+play_tutorial_ready_callback (GObject *fbe_remote,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GError *error = NULL;
+ GisSummaryPage *summary = user_data;
+
+ fberemote_call_play_tutorial_finish (FBEREMOTE (fbe_remote), res, &error);
+ if (error != NULL)
+ {
+ g_critical ("Can't play tutorial from FBE remote: %s\n", error->message);
+ g_error_free (error);
+ }
+
+ log_user_in (summary);
+}
+
+static void
launch_tutorial (GisSummaryPage *summary)
{
- GAppInfo *app = G_APP_INFO (g_desktop_app_info_new ("com.endlessm.Tutorial.desktop"));
- GAppLaunchContext *launch_context = G_APP_LAUNCH_CONTEXT (gdk_display_get_app_launch_context
(gdk_display_get_default ()));
- g_app_info_launch (app, NULL, launch_context, NULL);
- g_object_unref (launch_context);
+ FBERemote *fbe_remote;
+ GError *error = NULL;
+
+ fbe_remote = fberemote_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "com.endlessm.Tutorial",
+ "/com/endlessm/Tutorial/FBERemote",
+ NULL, &error);
+
+ if (error != NULL)
+ {
+ g_critical ("Could not get DBus proxy for tutorial FBE remote: %s\n", error->message);
+ g_error_free (error);
+
+ log_user_in (summary);
+ return;
+ }
+
+ /* use g_dbus_proxy_call() to specify a custom timeout */
+ g_dbus_proxy_call (G_DBUS_PROXY (fbe_remote),
+ "PlayTutorial",
+ g_variant_new ("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL, /* cancellable */
+ play_tutorial_ready_callback, summary);
+ g_object_unref (fbe_remote);
}
static void
@@ -342,67 +380,6 @@ update_distro_name (GisSummaryPage *page)
}
}
-static gboolean
-handle_tutorial_exit (GDBusInterfaceSkeleton *skeleton,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- GisSummaryPage *summary = user_data;
-
- log_user_in (summary);
-
- fbe_complete_tutorial_exit (FBE (skeleton), invocation);
- return TRUE;
-}
-
-static void
-fbe_name_lost (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- GisSummaryPage *summary = user_data;
- GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (summary);
- g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (priv->fbe_skeleton));
-}
-
-static void
-fbe_bus_acquired (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- GError *error = NULL;
- GisSummaryPage *summary = user_data;
- GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (summary);
- g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->fbe_skeleton),
- connection,
- "/com/endlessm/FBE",
- &error);
-
- if (error != NULL)
- {
- g_critical ("Cannot export FBE proxy skeleton on session bus: %s\n", error->message);
- g_error_free (error);
- }
-}
-
-static void
-export_on_dbus (GisSummaryPage *summary)
-{
- GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (summary);
-
- priv->fbe_bus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION,
- "com.endlessm.FBE",
- G_BUS_NAME_OWNER_FLAGS_NONE,
- fbe_bus_acquired,
- NULL, /* name_acquired handler */
- fbe_name_lost,
- summary, NULL);
-
- priv->fbe_skeleton = fbe_skeleton_new ();
- g_signal_connect (priv->fbe_skeleton, "handle-tutorial-exit",
- G_CALLBACK (handle_tutorial_exit), summary);
-}
-
static void
gis_summary_page_constructed (GObject *object)
{
@@ -412,7 +389,6 @@ gis_summary_page_constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (page), WID ("summary-page"));
update_distro_name (page);
- export_on_dbus (page);
g_signal_connect (WID("summary-start-button"), "clicked", G_CALLBACK (done_cb), page);
gis_page_set_complete (GIS_PAGE (page), TRUE);
@@ -421,28 +397,6 @@ gis_summary_page_constructed (GObject *object)
}
static void
-gis_summary_page_dispose (GObject *object)
-{
- GisSummaryPage *page = GIS_SUMMARY_PAGE (object);
- GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (page);
-
- G_OBJECT_CLASS (gis_summary_page_parent_class)->dispose (object);
-
- if (priv->fbe_skeleton)
- {
- g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (priv->fbe_skeleton));
- g_object_unref (priv->fbe_skeleton);
- priv->fbe_skeleton = NULL;
- }
-
- if (priv->fbe_bus_name_id != 0)
- {
- g_bus_unown_name (priv->fbe_bus_name_id);
- priv->fbe_bus_name_id = 0;
- }
-}
-
-static void
gis_summary_page_locale_changed (GisPage *page)
{
gis_page_set_title (page, _("Thank You"));
@@ -460,7 +414,6 @@ gis_summary_page_class_init (GisSummaryPageClass *klass)
page_class->locale_changed = gis_summary_page_locale_changed;
page_class->shown = gis_summary_page_shown;
object_class->constructed = gis_summary_page_constructed;
- object_class->dispose = gis_summary_page_dispose;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]