[grilo] test-ui: make liboauth a conditional dependency
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] test-ui: make liboauth a conditional dependency
- Date: Wed, 15 May 2013 21:38:48 +0000 (UTC)
commit b3a806e1091d79d0264b6ca39a5b7ffe75fa88b0
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Wed May 15 21:37:31 2013 +0000
test-ui: make liboauth a conditional dependency
If liboauth is available, then add support in test-ui for authorizing Flickr
personal accounts.
configure.ac | 13 +++++++++----
tools/grilo-test-ui/Makefile.am | 20 +++++++++++++++-----
tools/grilo-test-ui/main.c | 18 ++++++++++++++++++
3 files changed, 42 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8bcc4d2..96b1ad2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,14 @@ PKG_CHECK_MODULES([GTU], [ gtk+-3.0 >= 3.0 ],
PKG_CHECK_MODULES(OAUTH, oauth, [HAVE_OAUTH=yes], [HAVE_OAUTH=no])
+AM_CONDITIONAL(HAVE_OAUTH, test "x$HAVE_OAUTH" = "xyes")
+
+if test "x$HAVE_OAUTH" = "xyes"; then
+ AC_DEFINE(HAVE_OAUTH, 1, [OAuth available])
+else
+ AC_MSG_WARN([oauth missing, unable to configure Flickr personal accounts])
+fi
+
AC_ARG_ENABLE(test-ui,
AS_HELP_STRING([--enable-test-ui],
[Build Test UI (default: auto)]),
@@ -146,9 +154,6 @@ AC_ARG_ENABLE(test-ui,
if test "x$HAVE_GTK" = "xno"; then
AC_MSG_ERROR([gtk+-3.0 >= 3.0 not found, install it or use --disable-test-ui])
fi
- if test "x$HAVE_OAUTH" = "xno"; then
- AC_MSG_ERROR([OAuth not found, install it or use --disable-test-ui])
- fi
;;
no)
HAVE_GTK=no
@@ -156,7 +161,7 @@ AC_ARG_ENABLE(test-ui,
esac
])
-AM_CONDITIONAL(BUILD_GRILO_TEST_UI, test "x$HAVE_GTK" = "xyes" -a "x$HAVE_OAUTH" = "xyes")
+AM_CONDITIONAL(BUILD_GRILO_TEST_UI, test "x$HAVE_GTK" = "xyes")
# ----------------------------------------------------------
# NET LIBRARY
diff --git a/tools/grilo-test-ui/Makefile.am b/tools/grilo-test-ui/Makefile.am
index f0bd832..952e2dc 100644
--- a/tools/grilo-test-ui/Makefile.am
+++ b/tools/grilo-test-ui/Makefile.am
@@ -10,14 +10,11 @@ INCLUDES = $(DEPS_CFLAGS)
bin_PROGRAMS = grilo-test-ui- GRL_MAJORMINOR@
grilo_test_ui_ GRL_MAJORMINOR@_SOURCES = \
- main.c \
- flickr-oauth.h \
- flickr-oauth.c
+ main.c
grilo_test_ui_ GRL_MAJORMINOR@_CFLAGS = \
-DPREFIX=$(prefix) \
$(GTU_CFLAGS) \
- $(OAUTH_CFLAGS) \
$(GRL_FLICKR_CFLAGS) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/data
@@ -25,10 +22,23 @@ grilo_test_ui_ GRL_MAJORMINOR@_CFLAGS = \
grilo_test_ui_ GRL_MAJORMINOR@_LDADD = \
$(DEPS_LIBS) \
$(GTU_LIBS) \
- $(OAUTH_LIBS) \
$(GRL_FLICKR_LIBS) \
$(top_builddir)/src/lib GRL_NAME@.la
+if HAVE_OAUTH
+
+grilo_test_ui_ GRL_MAJORMINOR@_SOURCES += \
+ flickr-oauth.h \
+ flickr-oauth.c
+
+grilo_test_ui_ GRL_MAJORMINOR@_CFLAGS += \
+ $(OAUTH_CFLAGS)
+
+grilo_test_ui_ GRL_MAJORMINOR@_LDADD += \
+ $(OAUTH_LIBS)
+
+endif
+
MAINTAINERCLEANFILES = \
*.in \
*~
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c
index 0586584..144bfb7 100644
--- a/tools/grilo-test-ui/main.c
+++ b/tools/grilo-test-ui/main.c
@@ -25,7 +25,9 @@
#include <config.h>
+#ifdef HAVE_OAUTH
#include "flickr-oauth.h"
+#endif
#include <gtk/gtk.h>
#include <gdk/gdk.h>
@@ -187,7 +189,9 @@ static const gchar *ui_definition =
"<ui>"
" <menubar name='MainMenu'>"
" <menu name='FileMenu' action='FileMenuAction' >"
+#ifdef HAVE_OAUTH
" <menuitem name='Authorize Flickr' action='AuthorizeFlickrAction' />"
+#endif
" <menuitem name='Shutdown plugins' action='ShutdownPluginsAction' />"
" <menuitem name='Load all plugins' action='LoadAllPluginsAction' />"
" <menuitem name='Changes notification' action='ChangesNotificationAction' />"
@@ -202,8 +206,10 @@ static GrlOperationOptions *default_resolve_options = NULL;
static void show_browsable_sources (void);
static void quit_cb (GtkAction *action);
+#ifdef HAVE_OAUTH
static gchar *authorize_flickr (void);
static void authorize_flickr_cb (GtkAction *action);
+#endif
static void shutdown_plugins_cb (GtkAction *action);
static void shutdown_plugins (gboolean ui_active);
@@ -220,8 +226,10 @@ static void content_changed_cb (GrlSource *source,
static GtkActionEntry entries[] = {
{ "FileMenuAction", NULL, "_File" },
+#ifdef HAVE_OAUTH
{ "AuthorizeFlickrAction", GTK_STOCK_CONNECT, "_Authorize Flickr", NULL,
"AuthorizeFlickr", G_CALLBACK (authorize_flickr_cb) },
+#endif
{ "ShutdownPluginsAction", GTK_STOCK_REFRESH, "_Shutdown Plugins", NULL,
"ShutdownPlugins", G_CALLBACK (shutdown_plugins_cb) },
{ "LoadAllPluginsAction", GTK_STOCK_REFRESH, "_Load All Plugins", NULL,
@@ -241,11 +249,13 @@ quit_cb (GtkAction *action)
gtk_main_quit ();
}
+#ifdef HAVE_OAUTH
static void
authorize_flickr_cb (GtkAction *action)
{
authorize_flickr ();
}
+#endif
static void
shutdown_plugins_cb (GtkAction *action)
@@ -1459,6 +1469,7 @@ save_flickr_token (const gchar *token, const gchar *secret)
g_key_file_free (keyfile);
}
+#ifdef HAVE_OAUTH
static void
activate_ok_button (GtkLabel *label,
gchar *uri,
@@ -1471,6 +1482,7 @@ activate_ok_button (GtkLabel *label,
NULL);
gtk_widget_set_sensitive (user_data, TRUE);
}
+#endif /* HAVE_OAUTH */
static void
load_file_config (void)
@@ -1489,6 +1501,7 @@ load_file_config (void)
g_free (config_file);
}
+#ifdef HAVE_OAUTH
static gchar *
authorize_flickr (void)
{
@@ -1578,6 +1591,7 @@ authorize_flickr (void)
return token;
}
+#endif /* HAVE_OAUTH */
static void
set_flickr_config (void)
@@ -1596,6 +1610,7 @@ set_flickr_config (void)
token = load_flickr_token (&secret);
+#ifdef HAVE_OAUTH
if (!token) {
token = authorize_flickr ();
if (!token) {
@@ -1603,6 +1618,9 @@ set_flickr_config (void)
save_flickr_token ("", "");
}
}
+#else
+ save_flickr_token("", "");
+#endif
if (token && token[0] != '\0') {
config = grl_config_new ("grl-flickr", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]