summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquinn <quinn@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-10-14 10:56:03 +0000
committerquinn <quinn@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-10-14 10:56:03 +0000
commitb7310c6bc74925dcfb599943b041fb6bcfc4ac1a (patch)
tree6e92fcd8ef752c4f1905861e9b777b56cf3f662c
parent4f38f8d0050a0c12a604f73568128f8952fe3543 (diff)
downloadmarex-dev-b7310c6bc74925dcfb599943b041fb6bcfc4ac1a.tar.gz
marex-dev-b7310c6bc74925dcfb599943b041fb6bcfc4ac1a.tar.bz2
emerald-themer: use libsvn instead of svn command-line for checkout of theme repository
git-svn-id: file:///beryl/trunk@631 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--emerald/configure.ac150
-rw-r--r--emerald/themer/Makefile.am2
-rw-r--r--emerald/themer/main.c95
3 files changed, 225 insertions, 22 deletions
diff --git a/emerald/configure.ac b/emerald/configure.ac
index cd75d50..96a31a8 100644
--- a/emerald/configure.ac
+++ b/emerald/configure.ac
@@ -52,6 +52,156 @@ AM_CONDITIONAL(MIMEUPDATE, test x$mime_update = xtrue)
AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database)
AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, update-desktop-database)
AC_PATH_PROG(UPDATE_ICON_CACHE, gtk-update-icon-cache)
+
+dnl
+dnl APR
+dnl
+
+APR_CONFIGS="apr-config /usr/local/apr/bin/apr-config"
+AC_ARG_WITH(apr-config,
+[[ --with-apr-config=FILE Use the given path to apr-config when determining
+ APR configuration; defaults to "apr-config"]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ APR_CONFIGS=$withval
+ fi
+])
+AC_MSG_CHECKING([for APR])
+APR_CONFIG=""
+for VALUE in $APR_CONFIGS ; do
+ if $VALUE --cflags >/dev/null 2>&1; then
+ APR_CONFIG=$VALUE
+ break
+ fi
+done
+if test $APR_CONFIG ; then
+ AC_MSG_RESULT([found])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([APR is required. Try --with-apr-config.])
+fi
+
+CPPFLAGS="$CPPFLAGS `$APR_CONFIG --cppflags` `$APR_CONFIG --includes`"
+APR_LIBS="`$APR_CONFIG --link-ld --libs`"
+
+dnl
+dnl APR util
+dnl
+
+APU_CONFIGS="apu-config /usr/local/apr/bin/apu-config"
+AC_ARG_WITH(apu-config,
+[[ --with-apu-config=FILE Use the given path to apu-config when determining
+ APR util configuration; defaults to "apu-config"]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ APU_CONFIGS=$withval
+ fi
+])
+AC_MSG_CHECKING([for APR util])
+APU_CONFIG=""
+for VALUE in $APU_CONFIGS ; do
+ if $VALUE --includes >/dev/null 2>&1; then
+ APU_CONFIG=$VALUE
+ break
+ fi
+done
+if test $APU_CONFIG ; then
+ AC_MSG_RESULT([found])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([APR util is required. Try --with-apu-config.])
+fi
+CPPFLAGS="$CPPFLAGS `$APU_CONFIG --includes`"
+APR_LIBS="$APR_LIBS `$APU_CONFIG --link-ld --libs`"
+
+
+dnl
+dnl Neon
+dnl
+SEARCH="neon-config"
+AC_ARG_WITH(neon-config,
+[[ --with-neon-config=FILE Use the given path to neon-config when determining
+ Neon configuration; defaults to "neon-config"]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ SEARCH=$withval
+ fi
+])
+AC_MSG_CHECKING([Neon])
+NEON_CONFIG=""
+for VALUE in $SEARCH ; do
+ if CHECK=`$VALUE --version 2>&1` ; then
+ NEON_CONFIG=$VALUE
+ break
+ fi
+done
+if test $NEON_CONFIG ; then
+ AC_MSG_RESULT([found])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Neon is required. Try --with-neon-config.])
+fi
+#CPPFLAGS="$CPPFLAGS `$NEON_CONFIG --cflags`"
+#NEON_LIBS="`$NEON_CONFIG --libs`"
+
+
+dnl
+dnl Subversion
+dnl
+
+SVN_INCLUDES="/usr/local/include /usr/include"
+AC_ARG_WITH(svn-include,
+[[ --with-svn-include=DIR Use the given path to the subversion headers.]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ SVN_INCLUDES=$withval
+ fi
+])
+AC_MSG_CHECKING([for Subversion headers])
+SVN_INCLUDE=""
+for VALUE in $SVN_INCLUDES ; do
+ if test -f $VALUE/subversion-1/svn_types.h ; then
+ SVN_INCLUDE=$VALUE
+ break
+ fi
+done
+if test $SVN_INCLUDE ; then
+ AC_MSG_RESULT([found])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Subversion headers are required. Try --with-svn-include.])
+fi
+CPPFLAGS="$CPPFLAGS -I$SVN_INCLUDE/subversion-1"
+
+SVN_LIBS="/usr/local/lib /usr/lib"
+AC_ARG_WITH(svn-lib,
+[[ --with-svn-lib=DIR Use the given path to the subversion libraries.]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ SVN_LIBS=$withval
+ fi
+])
+AC_MSG_CHECKING([for Subversion libraries])
+SVN_LIB=""
+for VALUE in $SVN_LIBS ; do
+ if ls $VALUE/libsvn_client-1.* >/dev/null 2>&1; then
+ SVN_LIB=$VALUE
+ break
+ fi
+done
+if test $SVN_LIB ; then
+ AC_MSG_RESULT([found])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Subversion libraries are required. Try --with-svn-lib.])
+fi
+SVN_LIBS="-L$SVN_LIB -lsvn_client-1 -lsvn_wc-1 -lsvn_ra-1 -lsvn_delta-1 -lsvn_subr-1"
+
+AC_SUBST(APR_LIBS)
+AC_SUBST(SVN_LIBS)
+AC_SUBST(NEON_LIBS)
+
+
AC_OUTPUT([
libengine/emeraldengine.pc
Makefile
diff --git a/emerald/themer/Makefile.am b/emerald/themer/Makefile.am
index 3be72b0..df42169 100644
--- a/emerald/themer/Makefile.am
+++ b/emerald/themer/Makefile.am
@@ -1,5 +1,5 @@
emerald_theme_manager_SOURCES = main.c
-emerald_theme_manager_LDADD = $(EMERALD_LIBS) $(top_srcdir)/libengine/libemeraldengine.la
+emerald_theme_manager_LDADD = $(APR_LIBS) $(SVN_LIBS) $(NEON_LIBS) $(EMERALD_LIBS) $(top_srcdir)/libengine/libemeraldengine.la
bin_PROGRAMS = emerald-theme-manager
diff --git a/emerald/themer/main.c b/emerald/themer/main.c
index 43d4dbd..f6e5424 100644
--- a/emerald/themer/main.c
+++ b/emerald/themer/main.c
@@ -6,6 +6,7 @@
#define NEED_TITLEBAR_ACTION_NAMES
#include <emerald.h>
#include <engine.h>
+#include <svn_client.h>
#define LAST_COMPAT_VER "0.1.0"
@@ -13,7 +14,7 @@ typedef struct _FetcherInfo
{
GtkWidget * dialog;
GtkWidget * progbar;
- GPid pd;
+ GtkWidget * filelabel;
} FetcherInfo;
GtkWidget * ThemeSelector;
@@ -1406,29 +1407,51 @@ void import_cache(GtkWidget * progbar)
g_dir_close(d);
}
}
-gboolean watcher_func(gpointer p)
+void svn_notified(void * dat, svn_wc_notify_t * n, apr_pool_t * pool)
{
- FetcherInfo * f = p;
+ FetcherInfo * f = dat;
int stat;
+ if (n->path)
+ gtk_label_set_text(GTK_LABEL(f->filelabel),n->path);
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(f->progbar));
- if (waitpid(f->pd,NULL,WNOHANG)!=0)
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ /*if (waitpid(f->pd,NULL,WNOHANG)!=0)
{
- import_cache(f->progbar);
- gtk_widget_destroy(f->dialog);
- free(p);
return FALSE;
}
- return TRUE;
+ return TRUE;*/
}
void cb_fetch()
{
gchar * svnpath="http://svn.beryl-project.org/trunk/emerald-themes-repo";
- gchar* themefetcher[] = {
- "svn", "co", svnpath, g_strconcat(g_get_home_dir(),"/.emerald/themecache",NULL), NULL };
+ gchar * destpath = g_strconcat(g_get_home_dir(),"/.emerald/themecache",NULL);
GtkWidget * w;
GtkWidget * l;
- GPid pd;
- FetcherInfo * fe = malloc(sizeof(FetcherInfo));
+ FetcherInfo fe;
+
+ //set up subversion context
+ svn_auth_baton_t * ab;
+ apr_pool_t * pool;
+ svn_client_ctx_t * svnctx;
+ svn_error_t * svne=NULL;
+ svn_opt_revision_t rev;
+ svn_auth_provider_object_t *provider;
+ apr_pool_create(&pool,NULL);
+ apr_array_header_t *providers
+ = apr_array_make (pool, 11, sizeof (svn_auth_provider_object_t *));
+ svne=svn_client_create_context(&svnctx,pool);
+ if (svne)
+ {
+ svn_error_clear(svne);
+ svne=NULL;
+ }
+ svn_client_get_simple_provider (&provider, pool);
+ APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) = provider;
+ svn_auth_open (&ab, providers, pool);
+ svnctx->auth_baton = ab;
+
+ //create the dialog
w = gtk_dialog_new_with_buttons(_("Fetching Themes"),
GTK_WINDOW(mainWindow),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, NULL);
@@ -1436,17 +1459,45 @@ void cb_fetch()
"This may take time depending on \n"
"internet connection speed."));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(w)->vbox),l,FALSE,FALSE,0);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(w)->vbox),gtk_hseparator_new(),FALSE,FALSE,0);
+ fe.filelabel = gtk_label_new("");
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(w)->vbox),fe.filelabel,FALSE,FALSE,0);
l = gtk_progress_bar_new();
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(w)->action_area),l,TRUE,TRUE,0);
gtk_widget_show_all(w);
- g_spawn_async(NULL,themefetcher,NULL,
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- NULL,NULL,&pd,NULL);
- g_free(themefetcher[3]);
- fe->dialog=w;
- fe->progbar=l;
- fe->pd=pd;
- g_timeout_add(100,watcher_func,fe);
+ fe.dialog=w;
+ fe.progbar=l;
+
+ //ensure the dialog is visible
+ while (gtk_events_pending())
+ gtk_main_iteration();
+
+ //jump into the svn call
+ rev.kind = svn_opt_revision_head;
+ svnctx->notify_func2=(svn_wc_notify_func2_t) svn_notified;
+ svnctx->notify_baton2=&fe;
+ svne=svn_client_checkout2(
+ NULL, // result rev
+ (const char *) svnpath, // source
+ (const char *) destpath, // dest
+ &rev, // 'peg' revision
+ &rev, // regular revision
+ TRUE, // recurse
+ TRUE, // ignore svn:externals
+ svnctx, // context
+ pool // memory pool
+ );
+ if (svne)
+ {
+ svn_error_clear(svne);
+ svne=NULL;
+ }
+
+ //clean up and call import
+ apr_pool_destroy(pool);
+ g_free(destpath);
+ import_cache(fe.progbar);
+ gtk_widget_destroy(fe.dialog);
}
void cb_quit(GtkWidget * w, gpointer p)
{
@@ -1549,6 +1600,8 @@ void layout_main_window()
}
int main (int argc, char * argv[])
{
+ apr_app_initialize(&argc,&argv,NULL);
+ atexit(apr_terminate);
set_changed(FALSE);
set_apply(FALSE);
gchar *input_file=NULL;
@@ -1558,7 +1611,7 @@ int main (int argc, char * argv[])
textdomain (GETTEXT_PACKAGE);
int install_file = 0;
int loop_count = 0;
-
+
while (loop_count < argc) {
if (strcmp(argv[loop_count],"-i") == 0) {
//-i arg found so next option should be the file to install