libfriends-0.1.2+14.04.20131108.1/0000755000015700001700000000000012237216007016325 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/po/0000755000015700001700000000000012237216007016743 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/po/Makevars.template0000644000015700001700000000341612237215640022257 0ustar pbuserpbgroup00000000000000# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Free Software Foundation, Inc. # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = libfriends-0.1.2+14.04.20131108.1/po/LINGUAS0000644000015700001700000000000112237215640017761 0ustar pbuserpbgroup00000000000000 libfriends-0.1.2+14.04.20131108.1/po/POTFILES.skip0000644000015700001700000000000012237215640021050 0ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/po/POTFILES.in0000644000015700001700000000003012237215640020513 0ustar pbuserpbgroup00000000000000src/utils.c gtk/entry.c libfriends-0.1.2+14.04.20131108.1/po/Makefile.in.in0000644000015700001700000001604612237215640021426 0ustar pbuserpbgroup00000000000000# Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # Copyright (C) 2004-2008 Rodney Dawes # # This file may be copied and used freely without restrictions. It may # be used in projects which are not available under a GNU Public License, # but which still want to provide support for the GNU gettext functionality. # # - Modified by Owen Taylor to use GETTEXT_PACKAGE # instead of PACKAGE and to look for po2tbl in ./ not in intl/ # # - Modified by jacob berkman to install # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize # # - Modified by Rodney Dawes for use with intltool # # We have the following line for use by intltoolize: # INTLTOOL_MAKEFILE GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ datarootdir = @datarootdir@ libdir = @libdir@ DATADIRNAME = @DATADIRNAME@ itlocaledir = $(prefix)/$(DATADIRNAME)/locale subdir = po install_sh = @install_sh@ # Automake >= 1.8 provides @mkdir_p@. # Until it can be supposed, use the safe fallback: mkdir_p = $(install_sh) -d INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist GENPOT = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot ALL_LINGUAS = @ALL_LINGUAS@ PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi) USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi) USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) DISTFILES = Makefile.in.in POTFILES.in $(POFILES) EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS POTFILES = \ # This comment gets stripped out CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) .SUFFIXES: .SUFFIXES: .po .pox .gmo .mo .msg .cat AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V)) INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY)) INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@; .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $< .po.gmo: $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) -o $$file $< .po.cat: sed -f ../intl/po2msg.sed < $< > $*.msg \ && rm -f $@ && gencat $@ $*.msg all: all-@USE_NLS@ all-yes: $(CATALOGS) all-no: $(GETTEXT_PACKAGE).pot: $(POTFILES) $(GENPOT) install: install-data install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $$dir; \ if test -r $$lang.gmo; then \ $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ else \ $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ echo "installing $(srcdir)/$$lang.gmo as" \ "$$dir/$(GETTEXT_PACKAGE).mo"; \ fi; \ if test -r $$lang.gmo.m; then \ $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ else \ if test -r $(srcdir)/$$lang.gmo.m ; then \ $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ $$dir/$(GETTEXT_PACKAGE).mo.m; \ echo "installing $(srcdir)/$$lang.gmo.m as" \ "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ else \ true; \ fi; \ fi; \ done # Empty stubs to satisfy archaic automake needs dvi info ctags tags CTAGS TAGS ID: # Define this as empty until I found a useful application. install-exec installcheck: uninstall: linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ done check: all $(GETTEXT_PACKAGE).pot rm -f missing notexist srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m if [ -r missing -o -r notexist ]; then \ exit 1; \ fi mostlyclean: rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp rm -f .intltool-merge-cache clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES stamp-it rm -f *.mo *.msg *.cat *.cat.m *.gmo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f Makefile.in.in distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ extra_dists="$(EXTRA_DISTFILES)"; \ for file in $$extra_dists; do \ test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ done; \ for file in $$dists; do \ test -f $$file || file="$(srcdir)/$$file"; \ ln $$file $(distdir) 2> /dev/null \ || cp -p $$file $(distdir); \ done update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ echo "$$lang:"; \ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ if $$result; then \ if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.gmo failed!"; \ rm -f $$tmpdir/$$lang.new.po; \ fi; \ done Makefile POTFILES: stamp-it @if test ! -f $@; then \ rm -f stamp-it; \ $(MAKE) stamp-it; \ fi stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ $(SHELL) ./config.status # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: libfriends-0.1.2+14.04.20131108.1/friends-gtk-0.1.pc.in0000644000015700001700000000054312237215640021773 0ustar pbuserpbgroup00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/libfriends-@LIBFRIENDS_API_VERSION@ Name: libfriends-gtk Description: A library Gtk widgets for Friends Version: @VERSION@ Libs: -L${libdir} -lfriends-gtk Cflags: -I${includedir} Requires: glib-2.0 gthread-2.0 gobject-2.0 gio-2.0 gtk+-3.0 friends-@LIBFRIENDS_API_VERSION@ libfriends-0.1.2+14.04.20131108.1/README0000644000015700001700000000000012237215640017175 0ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/configure.ac0000644000015700001700000001730412237215640020622 0ustar pbuserpbgroup00000000000000m4_define([libfriends_major], [0]) m4_define([libfriends_minor], [1]) m4_define([libfriends_micro], [0]) m4_define([libfriends_version], [libfriends_major.libfriends_minor.libfriends_micro]) m4_define([libfriends_api_version], [0.1]) AC_PREREQ(2.65) AC_INIT([libfriends], [libfriends_version]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE AC_COPYRIGHT([Copyright 2012 Canonical]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) dnl Get version number into Autoconf LIBFRIENDS_MAJOR_VERSION=libfriends_major LIBFRIENDS_MINOR_VERSION=libfriends_minor LIBFRIENDS_MICRO_VERSION=libfriends_micro LIBFRIENDS_API_VERSION=libfriends_api_version LIBFRIENDS_VERSION=libfriends_version API_VERSION=libfriends_api_version AC_SUBST(LIBFRIENDS_MAJOR_VERSION) AC_SUBST(LIBFRIENDS_MINOR_VERSION) AC_SUBST(LIBFRIENDS_MICRO_VERSION) AC_SUBST(LIBFRIENDS_API_VERSION) AC_SUBST(LIBFRIENDS_VERSION) AC_SUBST(API_VERSION) dnl Init the other things we depend on AM_MAINTAINER_MODE AM_PROG_VALAC([0.17]) AS_IF([test -z "$VALAC"], [AC_MSG_ERROR(["No valac compiler found."])]) AC_PROG_CC AM_PROG_CC_C_O AC_HEADER_STDC AC_PROG_LIBTOOL LT_INIT AC_CONFIG_MACRO_DIR([m4]) ########################### # Internationalization ########################### GETTEXT_PACKAGE="${PACKAGE}" AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default get text domain]) localedir='$(prefix)/$(DATADIRNAME)/locale' AC_SUBST(localedir) IT_PROG_INTLTOOL(0.50.0) ########################### # Lib versioning ########################### LIBFRIENDS_CURRENT=0 LIBFRIENDS_REVISION=1 LIBFRIENDS_AGE=0 AC_SUBST(LIBFRIENDS_CURRENT) AC_SUBST(LIBFRIENDS_REVISION) AC_SUBST(LIBFRIENDS_AGE) GLIB_GSETTINGS # Setup a few consts if test "x${prefix}" = "xNONE"; then PREFIX="${ac_default_prefix}" else PREFIX="${prefix}" fi AC_DEFINE_UNQUOTED(LOCALE_DIR, "${PREFIX}/${DATADIRNAME}/locale",[Locale directory]) AC_DEFINE_UNQUOTED(PKGDATADIR, "${PREFIX}/${DATADIRNAME}/${PACKAGE}", [Package data directory]) ###################################################### # intltool rule for generating translated .lens file ###################################################### INTLTOOL_LENS_RULE='%.lens: %.lens.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' AC_SUBST(INTLTOOL_LENS_RULE) dnl Use strict compiler flags only on development releases m4_define([maintainer_flags_default], [m4_if(m4_eval(libfriends_minor % 2), [1], [yes], [no])]) AC_ARG_ENABLE([maintainer-flags], [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>:],[Use string compiler flags @<:@default=no@:>@])], [], [enable_maintainer_flags=maintainer_flags_default]) MAINTAINER_CFLAGS="" MAINTAINER_VALAFLAGS="" AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"], [ MAINTAINER_CFLAGS="-g -Wall -Werror -Wshadow -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self -Wno-unused-but-set-variable -Wno-unused-variable -Wno-error" MAINTAINER_VALAFLAGS="-g --save-temps" ] ) AC_SUBST(MAINTAINER_CFLAGS) AC_SUBST(MAINTAINER_VALAFLAGS) dnl disable deprecated APIs DEPRECATED_CFLAGS="" AC_ARG_ENABLE([deprecated], [AC_HELP_STRING([--disable-deprecated], [Add extra compiler flags disabling deprecated APIs])], [disable_deprecated=$enableval], [disable_deprecated='yes']) if test "$disable_deprecated" = 'no'; then DEPRECATED_CFLAGS="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGSEAL_ENABLE -DG_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES" fi AC_SUBST(DEPRECATED_CFLAGS) dnl Check for module and library dependancies VALADOC_REQUIRED=0.3.1 GLIB_REQUIRED=2.26 GTK_REQUIRED=3.2 DEE_REQUIRED=1.0.0 PKG_CHECK_MODULES(BASE, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 libaccounts-glib dee-1.0 >= $DEE_REQUIRED gee-1.0 json-glib-1.0 gmodule-2.0) AC_SUBST(BASE_CFLAGS) AC_SUBST(BASE_LIBS) # valadoc only looks in the vapidir for libvala-0.14 but we need # libvala-0.16 or libvala-0.18. This checks for either libvala dev # package and sets the package to check for to set the vapidir # if documentation is enabled PKG_CHECK_MODULES([VALADEV], [libvala-0.18], [LIBVALADEVPKG="libvala-0.18"], [PKG_CHECK_MODULES([VALADEV], [libvala-0.16], [LIBVALADEVPKG="libvala-0.16"])]) ########################### # Documentation ########################### AC_ARG_ENABLE([docs], AS_HELP_STRING([--enable-docs],[Enable documentation generation]), [enable_docs=$enableval], [enable_docs=no]) AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes]) have_valadoc=no AS_IF([test x$enable_docs = xyes], [ # make sure the library is new enough and the program exists PKG_CHECK_MODULES([VALADOC], [valadoc-1.0 >= $VALADOC_REQUIRED]) AC_PATH_PROG([VALADOC], [valadoc], [:]) AS_IF([test "$VALADOC" != :], have_valadoc=yes) ]) AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes]) AS_IF([test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"], [ AC_MSG_ERROR([Doc building requested but valadoc not installed.]) ]) AS_IF([test "x$enable_docs" = "xyes" -a "x$have_valadoc" = "xyes"], [ VALADOCVAPIDIR=`$PKG_CONFIG --variable=vapidir $LIBVALADEVPKG` AC_SUBST(VALADOCVAPIDIR) ]) ########################### # GTK SPELL ########################### AC_ARG_ENABLE([spell], AS_HELP_STRING([--enable-spell], [enable gtkspell @<:@default=yes@:>@]), enable_spell=$enableval, enable_spell=yes) if test "x$enable_spell" = "xyes"; then PKG_CHECK_MODULES(GTKSPELL, gtkspell3-3.0) AC_SUBST(GTKSPELL_CFLAGS) AC_SUBST(GTKSPELL_CFLAGS) GTKSPELL_PKG="--pkg gtkspell3-3.0" AC_SUBST(GTKSPELL_PKG) fi AM_CONDITIONAL(HAVE_GTKSPELL, [test "x$enable_spell" = "xyes"]) ########################### # GObject Introspection ########################### GOBJECT_INTROSPECTION_CHECK([0.6.7]) PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.10], introspection_ten=yes, introspection_ten=no) AM_CONDITIONAL(INTROSPECTION_TEN, [test "x$introspection_ten" = "xyes"]) ########################### # DBus Service Info ########################### if test "x$with_localinstall" = "xyes"; then DBUSSERVICEDIR="${datadir}/dbus-1/services/" else DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1` fi AC_SUBST(DBUSSERVICEDIR) dnl local install for distcheck and stand-alone running with_localinstall="no" AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [Install all of the files locally instead of in system directories (for distcheck)]), with_localinstall=$enableval, with_localinstall=no) AM_CONDITIONAL([HAVE_LOCALINSTALL], [test "x$with_localinstall" = "xyes"]) dnl Create the Makefiles AC_CONFIG_FILES([ Makefile docs/Makefile src/Makefile gtk/Makefile vapi/Makefile friends-$API_VERSION.pc friends-gtk-$API_VERSION.pc po/Makefile.in tests/Makefile tests/vala/Makefile examples/Makefile ]) AC_OUTPUT dnl Output the results AC_MSG_NOTICE([ libfriends $VERSION ---------------------- Prefix : ${prefix} Localinstall : ${with_localinstall} Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS $DEPRECATED_CFLAGS Extra ValaFlags: ${CPPFLAGS} $MAINTAINER_VALAFLAGS Documentation : ${have_valadoc} ]) libfriends-0.1.2+14.04.20131108.1/tests/0000755000015700001700000000000012237216007017467 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/tests/vala/0000755000015700001700000000000012237216007020412 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/tests/vala/test-vala.vala0000644000015700001700000000177712237215640023175 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Ken VanDine */ static int main (string[] args) { Test.init (ref args); /* Friends.Dispatcher test */ DispatcherSuite dispatcher_suite; dispatcher_suite = new DispatcherSuite (); /* Friends.Utils test */ UtilsSuite utils_suite; utils_suite = new UtilsSuite (); Test.run (); return 0; } libfriends-0.1.2+14.04.20131108.1/tests/vala/Makefile.am0000644000015700001700000000230512237215640022450 0ustar pbuserpbgroup00000000000000DBUS_RUNNER=dbus-test-runner --max-wait=0 noinst_PROGRAMS = $(TEST_PROGS) TEST_PROGS = test-vala test_vala_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ -DTESTDIR=\"$(abs_top_srcdir)/tests\" \ -DTESTVALADIR=\"$(abs_top_srcdir)/tests/vala\" \ $(BASE_CFLAGS) test_vala_LDADD = \ $(top_builddir)/src/libfriends.la \ $(BASE_LIBS) \ $(MAINTAINER_LIBS) test_vala_VALAFLAGS = \ --vapidir=$(top_srcdir)/src \ --vapidir=$(top_srcdir)/tests \ --vapidir=$(top_srcdir)/tests/vala \ --vapidir=$(top_srcdir)/vapi \ --pkg config \ --pkg friends-0.1 \ --pkg gobject-2.0 \ --pkg gio-2.0 \ --pkg gtk+-3.0 \ --pkg libaccounts-glib \ --pkg posix \ $(BASE_PACKAGES) \ $(MAINTAINER_VALAFLAGS) test_vala_SOURCES = \ test-utils.vala \ test-dispatcher.vala \ test-vala.vala TESTS = test-runner test-runner: test-vala Makefile.am @echo "#!/bin/sh" > $@ @echo export G_DEBUG=fatal_criticals >> $@ @echo xvfb-run -a $(DBUS_RUNNER) --task friends-dispatcher -p --test --task-name DBusService --ignore-return --task ./test-vala --wait-for com.canonical.Friends.Dispatcher --task-name Dispatcher >> $@ @chmod +x $@ CLEANFILES = \ *.stamp \ $(test_vala_SOURCES:.vala=.c) \ $(TESTS) \ $(TEST_PROGS) libfriends-0.1.2+14.04.20131108.1/tests/vala/test-dispatcher.vala0000644000015700001700000003236112237215640024371 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Ken VanDine */ class DispatcherSuite : Object { private Friends.Dispatcher dispatcher; public DispatcherSuite () { dispatcher = new Friends.Dispatcher (); // Synchronous tests... GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Refresh", test_refresh); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Features", test_features); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Upload", test_upload); // FIXME: Why won't this test pass? // GLib.Test.add_data_func ( // "/Unit/Friends/Dispatcher/SendMessage", // test_send_message); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/SendMessageAccount", test_send_message_with_account); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/SendReply", test_send_reply); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Retweet", test_retweet); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Home", test_home); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Wall", test_wall); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Search", test_search); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Like", test_like); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Unlike", test_unlike); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Delete", test_delete); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/Contacts", test_contacts); // FIXME: I need to figure out how to assert that an // exception gets raised before I can make this test work. // GLib.Test.add_data_func ( // "/Unit/Friends/Dispatcher/ClearIndicators", // test_clear_indicators); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/URLShorten", test_url_shorten); // Asynchronous tests... GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/UploadAsync", test_upload_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/SendMessageAsync", test_send_message_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/SendReplyAsync", test_send_reply_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/RetweetAsync", test_retweet_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/HomeAsync", test_home_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/WallAsync", test_wall_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/SearchAsync", test_search_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/LikeAsync", test_like_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/UnlikeAsync", test_unlike_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/DeleteAsync", test_delete_async); GLib.Test.add_data_func ( "/Unit/Friends/Dispatcher/ContactsAsync", test_contacts_async); } internal void test_refresh () { dispatcher.refresh (); // FIXME: find a way to test this... } internal void test_features () { string[] features = dispatcher.features ("protocol name here"); assert (features != null); assert (features[0] == "protocol"); assert (features[1] == "name"); assert (features[2] == "here"); assert (features.length == 3); } internal void test_upload () { uint acct = 1; string uri = "file:///tmp/foo.png"; string desc = "Something interesting to say"; var result = dispatcher.upload (acct, uri, desc); assert (result == "Called with: account_id=1, uri=file:///tmp/foo.png, " + "description=Something interesting to say"); } internal void test_upload_async () { var loop = new MainLoop (); uint acct = 1; string uri = "file:///tmp/foo.png"; string desc = "Something interesting to say"; string result = ""; dispatcher.upload_async.begin ( acct, uri, desc, (obj, res) => { dispatcher.upload_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: account_id=1, uri=file:///tmp/foo.png, " + "description=Something interesting to say"); } internal void test_send_message () { var result = dispatcher.send_message (null, "Hello"); assert (result == "Called with: action=send, account_id=, arg=Hello"); } internal void test_send_message_async () { var loop = new MainLoop (); string result = ""; dispatcher.send_message_async.begin ( 3, "Goodbye", (obj, res) => { dispatcher.send_message_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=send, account_id=3, arg=Goodbye"); } internal void test_send_message_with_account () { var result = dispatcher.send_message (12, "Testing..."); assert (result == "Called with: action=send, account_id=12, arg=Testing..."); } internal void test_send_reply () { var result = dispatcher.send_reply (1, "100B", "Response!"); assert (result == "Called with: account_id=1, message_id=100B, msg=Response!"); } internal void test_send_reply_async () { var loop = new MainLoop (); string result = ""; dispatcher.send_reply_async.begin ( 4, "msgid42", "LOL", (obj, res) => { dispatcher.send_reply_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: account_id=4, message_id=msgid42, msg=LOL"); } internal void test_retweet () { var result = dispatcher.retweet (1, "messageid1234"); assert (result == "Called with: action=retweet, account_id=1, arg=messageid1234"); } internal void test_retweet_async () { var loop = new MainLoop (); string result = ""; dispatcher.retweet_async.begin ( 4, "msgid69", (obj, res) => { dispatcher.retweet_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=retweet, account_id=4, arg=msgid69"); } internal void test_home () { var result = dispatcher.home (10); assert (result == "Called with: action=home, account_id=10, arg="); result = dispatcher.home (null); assert (result == "Called with: action=home, account_id=, arg="); } internal void test_home_async () { var loop = new MainLoop (); string result = ""; dispatcher.home_async.begin ( 23, (obj, res) => { dispatcher.home_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=home, account_id=23, arg="); } internal void test_wall () { var result = dispatcher.wall (10); assert (result == "Called with: action=wall, account_id=10, arg="); result = dispatcher.wall (null); assert (result == "Called with: action=wall, account_id=, arg="); } internal void test_wall_async () { var loop = new MainLoop (); string result = ""; dispatcher.wall_async.begin ( 12, (obj, res) => { dispatcher.wall_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=wall, account_id=12, arg="); } internal void test_search () { var result = dispatcher.search (10, "terms"); assert (result == "Called with: action=search, account_id=10, arg=terms"); result = dispatcher.search (null, "terms"); assert (result == "Called with: action=search, account_id=, arg=terms"); } internal void test_search_async () { var loop = new MainLoop (); string result = ""; dispatcher.search_async.begin ( 8, "what i want", (obj, res) => { dispatcher.search_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=search, account_id=8, arg=what i want"); } internal void test_like () { var result = dispatcher.like (10, "msgid9876"); assert (result == "Called with: action=like, account_id=10, arg=msgid9876"); } internal void test_like_async () { var loop = new MainLoop (); string result = ""; dispatcher.like_async.begin ( 7, "msgid9000", (obj, res) => { dispatcher.like_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=like, account_id=7, arg=msgid9000"); } internal void test_unlike () { var result = dispatcher.unlike (5, "msgid9876"); assert (result == "Called with: action=unlike, account_id=5, arg=msgid9876"); } internal void test_unlike_async () { var loop = new MainLoop (); string result = ""; dispatcher.unlike_async.begin ( 6, "msgid9001", (obj, res) => { dispatcher.unlike_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=unlike, account_id=6, arg=msgid9001"); } internal void test_delete () { var result = dispatcher.delete (15, "msgid3456"); assert (result == "Called with: action=delete, account_id=15, arg=msgid3456"); } internal void test_delete_async () { var loop = new MainLoop (); string result = ""; dispatcher.delete_async.begin ( 5, "msgid9002", (obj, res) => { dispatcher.delete_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=delete, account_id=5, arg=msgid9002"); } internal void test_contacts () { var result = dispatcher.contacts (15); assert (result == "Called with: action=contacts, account_id=15, arg="); result = dispatcher.contacts (null); assert (result == "Called with: action=contacts, account_id=, arg="); } internal void test_contacts_async () { var loop = new MainLoop (); string result = ""; dispatcher.contacts_async.begin ( 5, (obj, res) => { dispatcher.contacts_async.end (res, out result); loop.quit (); } ); loop.run (); assert (result == "Called with: action=contacts, account_id=5, arg="); } internal void test_clear_indicators () { /* * In the mocked out friends-dispatcher, this method * switches a flip that causes everything else to * deliberately fail, so if we call this and then * everything breaks, we know the correct dbus method has * been called. */ bool failure = false; try { dispatcher.messaging_menu_clear (); dispatcher.send_reply(1, "two", "three"); } catch (GLib.Error e) { failure = true; } assert (failure); } internal void test_url_shorten () { var result = dispatcher.shorten ( "http://example.com/really/really/long"); // The mock dispatcher returns the length of your URL as a string; assert (result == "37"); } } libfriends-0.1.2+14.04.20131108.1/tests/vala/test-utils.vala0000644000015700001700000000506712237215640023406 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Ken VanDine */ class UtilsSuite : Object { private Friends.Utils utils; public UtilsSuite () { utils = new Friends.Utils (); GLib.Test.add_data_func ("/Unit/Friends/Utils/time_string_seconds", test_time_string_seconds); GLib.Test.add_data_func ("/Unit/Friends/Utils/time_string_minute", test_time_string_minute); GLib.Test.add_data_func ("/Unit/Friends/Utils/time_string_minutes", test_time_string_minutes); GLib.Test.add_data_func ("/Unit/Friends/Utils/time_string_hour", test_time_string_hour); } internal void test_time_string_seconds () { TimeVal time = TimeVal (); time.get_current_time (); time.tv_sec -= 59; string timestring = time.to_iso8601 (); string ts = utils.create_time_string (timestring); assert (ts == "a few seconds ago"); } internal void test_time_string_minute () { TimeVal time = TimeVal (); time.get_current_time (); time.tv_sec -= 60; string timestring = time.to_iso8601 (); string ts = utils.create_time_string (timestring); assert (ts == "1 minute ago"); } internal void test_time_string_minutes () { TimeVal time = TimeVal (); time.get_current_time (); time.tv_sec -= 3559; string timestring = time.to_iso8601 (); string ts = utils.create_time_string (timestring); assert (ts.contains ("minutes ago")); } internal void test_time_string_hour () { TimeVal time = TimeVal (); time.get_current_time (); time.tv_sec -= 3601; string timestring = time.to_iso8601 (); string ts = utils.create_time_string (timestring); assert (ts == "1 hour ago"); } } libfriends-0.1.2+14.04.20131108.1/tests/Makefile.am0000644000015700001700000000001712237215640021523 0ustar pbuserpbgroup00000000000000SUBDIRS = vala libfriends-0.1.2+14.04.20131108.1/src/0000755000015700001700000000000012237216007017114 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/src/friends-0.1.deps0000644000015700001700000000006612237215640021723 0ustar pbuserpbgroup00000000000000gobject-2.0 glib-2.0 dee-1.0 gio-2.0 libaccounts-glib libfriends-0.1.2+14.04.20131108.1/src/Makefile.am0000644000015700001700000000352312237215640021155 0ustar pbuserpbgroup00000000000000CLEANFILES = lib_LTLIBRARIES = \ libfriends.la \ $(NULL) libfriends_la_SOURCES = \ dispatcher.vala \ utils.vala \ $(NULL) if HAVE_INTROSPECTION GIR_VALAFLAGS = \ --gir Friends-@API_VERSION@.gir \ --library friends-@API_VERSION@ \ $(NULL) else GIR_VALAFLAGS = endif libfriends_la_VALAFLAGS = \ $(GIR_VALAFLAGS) \ --vapi friends-@API_VERSION@.vapi \ -H friends.h \ --use-header \ --vapidir $(top_srcdir)/vapi \ --pkg config \ --pkg gobject-2.0 \ --pkg dee-1.0 \ --pkg gio-2.0 \ --pkg json-glib-1.0 \ --pkg libaccounts-glib \ $(MAINTAINER_VALAFLAGS) \ $(NULL) libfriends_la_CFLAGS = \ $(BASE_CFLAGS) \ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" $(NULL) libfriends_la_LDFLAGS = \ $(BASE_LIBS) \ -version-info $(LIBFRIENDS_CURRENT):$(LIBFRIENDS_REVISION):$(LIBFRIENDS_AGE) \ -no-undefined \ -export-symbols-regex "^friends_.*" \ $(NULL) libfriendsincludedir = $(includedir)/libfriends-$(API_VERSION) libfriendsinclude_HEADERS = \ friends.h \ $(NULL) vapidir = $(datadir)/vala/vapi vapi_DATA = \ friends-@API_VERSION@.vapi \ friends-@API_VERSION@.deps \ $(NULL) if HAVE_INTROSPECTION girdir = $(datadir)/gir-1.0 gir_DATA = Friends-$(API_VERSION).gir typelibsdir = $(libdir)/girepository-1.0 typelibs_DATA = $(gir_DATA:.gir=.typelib) %.typelib: %.gir $(INTROSPECTION_COMPILER) LD_LIBRARY_PATH=.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \ $(INTROSPECTION_COMPILER) \ --shared-library libfriends.so.$(LIBFRIENDS_CURRENT) \ --includedir=$(srcdir) \ $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F) VALASOURCES = $(libfriends_la_SOURCES) CLEANFILES += \ $(VALASOURCES:.vala=.c) \ $(typelibs_DATA) \ $(NULL) endif # HAVE_INTROSPECTION MAINTAINERCLEANFILES = \ friends.h \ Friends-@API_VERSION@.gir \ friends-@API_VERSION@.vapi \ $(NULL) EXTRA_DIST = \ friends-@API_VERSION@.vapi \ friends-@API_VERSION@.deps \ $(NULL) libfriends-0.1.2+14.04.20131108.1/src/dispatcher.vala0000644000015700001700000006057012237215640022121 0ustar pbuserpbgroup00000000000000/* * Copyright(C) 2010-2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Neil Jagdish Patel * Authored by Ken VaDine */ [DBus (name = "com.canonical.Friends.Dispatcher")] private interface DispatcherInterface : GLib.Object { public abstract void Refresh () throws GLib.IOError; public abstract void ClearIndicators () throws GLib.IOError; public abstract async void Do (string action, string account_id, string message_id, out string result) throws GLib.IOError; public abstract async string SendMessage (string message, out string result_) throws GLib.IOError; public abstract async void SendReply (string account_id, string message_id, string message, out string result) throws GLib.IOError; public abstract async void Upload (string account_id, string uri, string description, out string result_url) throws GLib.IOError; public abstract string GetFeatures (string protocol) throws GLib.IOError; public abstract void Quit () throws GLib.IOError; public abstract string URLShorten (string url) throws GLib.IOError; } namespace Friends { /** * An interface to the Friends Dispatcher. */ public class Dispatcher : Object { private const string service_name = "com.canonical.Friends.Dispatcher"; private const string service_path = "/com/canonical/friends/Dispatcher"; private DispatcherInterface service; /** * Establish a connection to the local Friends Dispatcher daemon. * @return a new Dispatcher * @throws GLib.IOError if failed to connect to the * Friends Dispatcher daemon. */ public Dispatcher () throws IOError { try { service = Bus.get_proxy_sync( BusType.SESSION, service_name, service_path); } catch (GLib.IOError e) { warning ("Unable to get Friends dispatcher: " + e.message); throw (e); } } /** * Send some arbitrary command to the friends-service * dispatcher over DBus. This API was chosen in order to avoid * a large degree of code duplication between this file and * the python code implementing the dispatcher interface. * * @param action Can be `like`, `search`, `delete`, etc. * @param account_id Must be the {@link Ag.Account.id} to act upon. * @param argument Will often be a message_id, but can also be * a search query. Depends upon the value of `action` * parameter and is rather arbitrary. * * @since 0.1 * @throws GLib.IOError if action failed. */ private string do_sync ( string action, uint? account_id, string argument ) throws IOError { var loop = new MainLoop (); string result = ""; string account_id_str = ""; if (account_id != null) account_id_str = account_id.to_string (); service.Do.begin ( action, account_id_str, argument, (obj, res) => { try { service.Do.end (res, out result); } catch (GLib.IOError e) { warning (e.message); throw (e); } loop.quit (); } ); loop.run (); return result; } /** * Send some arbitrary command to the friends-service * dispatcher over DBus, asynchronously. This API was chosen * in order to avoid a large degree of code duplication * between this file and the python code implementing the * dispatcher interface. * * @param action Can be `like`, `search`, `delete`, etc. * @param account_id Must be the {@link Ag.Account.id} to act upon. * @param argument Will often be a message_id, but can also be * a search query. Depends upon the value of `action` * parameter and is rather arbitrary. * * @since 0.1 * @throws GLib.IOError if action failed. */ private async void do_async ( string action, uint? account_id, string argument, out string result ) throws IOError { string account_id_str = ""; if (account_id != null) account_id_str = account_id.to_string (); yield service.Do (action, account_id_str, argument, out result); } /** * Perform a refresh of all enabled accounts. * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Refresh fails. */ public void refresh () throws IOError { service.Refresh (); } /** * Upload an image to the specified account_id. * * Currently this is only supported on Facebook, but we plan to * support other protocols soon. * * @param account_id The {@link Ag.Account.id} to post from. * @param uri Local or remote URI of a file to upload. * @param description Description or caption to include for the * uploaded photo. * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Upload fails. */ public string upload ( uint account_id, string uri, string description ) throws IOError { var loop = new MainLoop (); string result_url = ""; service.Upload.begin ( account_id.to_string (), uri, description, (obj, res) => { try { service.Upload.end (res, out result_url); } catch (IOError e) { warning (e.message); throw (e); } loop.quit (); } ); loop.run (); return result_url; } /** * Upload an image to the specified account_id, asynchronously. * * @param account_id The {@link Ag.Account.id} to post from. * @param uri Local or remote URI of a file to upload. * @param description Description or caption to include for the * uploaded photo. * @param result_url The destintion URL of the successfully * uploaded file. * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Upload fails. */ public async void upload_async ( uint account_id, string uri, string description, out string result_url ) throws IOError { yield service.Upload ( account_id.to_string (), uri, description, out result_url); } /** * Reply to an existing message. * * Note that twitter will require you to @mention the name of * the person you are replying to in order for it to appear * correctly as a reply. Otherwise, the message will post * successfully but it will simply appear as a normal message, * without any conversation threading. * * @param account_id The {@link Ag.Account.id} to post from. * @param message_id The ID of the message that you are replying to. * @param message The text of the reply that you want to send. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.SendReply fails. */ public string send_reply ( uint account_id, string message_id, string message ) throws IOError { var loop = new MainLoop (); string result = ""; service.SendReply.begin ( account_id.to_string (), message_id, message, (obj, res) => { try { service.SendReply.end (res, out result); } catch (GLib.IOError e) { warning (e.message); throw (e); } loop.quit (); } ); loop.run (); return result; } /** * Reply to an existing message, asynchronously. * * Note that twitter will require you to @mention the name of * the person you are replying to in order for it to appear * correctly as a reply. Otherwise, the message will post * successfully but it will simply appear as a normal message, * without any conversation threading. * * @param account_id The {@link Ag.Account.id} to post from. * @param message_id The ID of the message that you are replying to. * @param message The text of the reply that you want to send. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.SendReply fails. */ public async void send_reply_async ( uint account_id, string message_id, string message, out string result ) throws IOError { yield service.SendReply ( account_id.to_string (), message_id, message, out result); } /** * Write a public message to the specified account. * * @param account_id The {@link Ag.Account.id} to post from. * @param message The text of the message to post publicly. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.SendMessage fails. */ public string send_message ( uint? account_id, string message ) throws IOError { if (account_id != null) return do_sync ("send", account_id, message); else { var loop = new MainLoop (); string result = ""; service.SendMessage.begin (message, (obj, res) => { try { service.SendMessage.end (res, out result); } catch (IOError e) { warning (e.message); throw (e); } loop.quit (); } ); loop.run (); return result; } } /** * Write a public message to the specified account, asynchronously. * * @param account_id The {@link Ag.Account.id} to post from. * @param message The text of the message to post publicly. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.SendMessage fails. */ public async void send_message_async ( uint? account_id, string message, out string result ) throws IOError { if (account_id != null) yield do_async ("send", account_id, message, out result); else yield service.SendMessage (message, out result); } /** * Retweet an existing tweet. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you want to reshare. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Do fails. */ public string retweet ( uint account_id, string message_id ) throws IOError { return do_sync ("retweet", account_id, message_id); } /** * Retweet an existing tweet, asynchronously. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you want to reshare. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void retweet_async ( uint account_id, string message_id, out string result ) throws IOError { yield do_async ( "retweet", account_id, message_id, out result); } /** * Fetch the messages from the user's "home" screen. On * Facebook and Twitter this maps to the main feed you see on * the front page; public posts by people you follow but not * necessarily addressed directly to you. * * @param account_id The {@link Ag.Account.id} to fetch. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Do fails. */ public string home (uint? account_id) throws IOError { return do_sync ("home", account_id, ""); } /** * Fetch the messages from the user's "home" screen, * asynchronously. On Facebook and Twitter this maps to the * main feed you see on the front page; public posts by people * you follow but not necessarily addressed directly to you. * * @param account_id The {@link Ag.Account.id} to fetch. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void home_async ( uint? account_id, out string result ) throws IOError { yield do_async ("home", account_id, "", out result); } /** * Fetch the messages from the user's "wall" screen. On * Facebook this fetches the messages directly posted on your * wall, on Twitter this maps to the public messages that have * directly @mentioned you. Not all protocols are expected to * support this feature. * * @param account_id The {@link Ag.Account.id} to fetch. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Do fails. */ public string wall (uint? account_id) throws IOError { return do_sync ("wall", account_id, ""); } /** * Fetch the messages from the user's "wall" screen, * asynchronously. On Facebook this fetches the messages * directly posted on your wall, on Twitter this maps to the * public messages that have directly @mentioned you. Not all * protocols are expected to support this feature. * * @param account_id The {@link Ag.Account.id} to fetch. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void wall_async ( uint? account_id, out string result ) throws IOError { yield do_async ("wall", account_id, "", out result); } /** * Search public messages on a specific protocol. If * account_id is Null, then all accounts are searched. * * @param account_id The {@link Ag.Account.id} to fetch. * @param query The text you want to search for. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Do fails. */ public string search (uint? account_id, string query) throws IOError { return do_sync ("search", account_id, query); } /** * Search public messages on a specific protocol, * asynchronously. If account_id is Null, then all accounts * are searched. * * @param account_id The {@link Ag.Account.id} to fetch. * @param query The text you want to search for. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void search_async ( uint? account_id, string query, out string result ) throws IOError { yield do_async ("search", account_id, query, out result); } /** * Assert your approval of a specific message on a specific * protocol. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you appove of. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public string like (uint account_id, string message_id) throws IOError { return do_sync ("like", account_id, message_id); } /** * Assert your approval of a specific message on a specific * protocol, asynchronously. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you appove of. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void like_async ( uint account_id, string message_id, out string result ) throws IOError { yield do_async ("like", account_id, message_id, out result); } /** * Revoke your approval of a specific message on a specific * protocol. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you appove of. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public string unlike (uint account_id, string message_id) throws IOError { return do_sync ("unlike", account_id, message_id); } /** * Revoke your approval of a specific message on a specific * protocol, asynchronously. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you appove of. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void unlike_async ( uint account_id, string message_id, out string result ) throws IOError { yield do_async ("unlike", account_id, message_id, out result); } /** * Delete a specific message on a specific protocol. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you wish to * obliterate. Must be owned by you. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Do fails. */ public string delete (uint account_id, string message_id) throws IOError { return do_sync ("delete", account_id, message_id); } /** * Delete a specific message on a specific protocol, asynchronously. * * @param account_id The {@link Ag.Account.id} to fetch. * @param message_id The id of the message you wish to * obliterate. Must be owned by you. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void delete_async ( uint account_id, string message_id, out string result ) throws IOError { yield do_async ("delete", account_id, message_id, out result); } /** * Fetch the contacts from the specified account and store * them in Evolution Data Server. * * @param account_id The {@link Ag.Account.id} to fetch. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.Do fails. */ public string contacts (uint? account_id) throws IOError { return do_sync ("contacts", account_id, ""); } /** * Fetch the contacts from the specified account and store * them in Evolution Data Server, asynchronously. * * @param account_id The {@link Ag.Account.id} to fetch. * @return ``true`` for success, ``false`` otherwise * * @since 0.1 * @throws GLib.IOError if the call to Friends.Service.Do fails. */ public async void contacts_async ( uint? account_id, out string result ) throws IOError { yield do_async ("contacts", account_id, "", out result); } /** * Pass any URL to this method and it will shorten it for you. * * @param url The long URL you need shortened. * @return The shortened URL. * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.URLShorten fails. */ public string shorten (string url) throws IOError { return service.URLShorten (url); } /** * This method returns a list of all the possible actions * supported by a given protocol. This can be used to * determine what actions are available for the requested * protocol. * * @param protocol One of ``facebook``, ``flickr``, * ``foursquare``, ``identica``, or ``twitter``. * @return an array of features for ``protocol`` or ``null`` (i.e. no * features) if there are no features found for ``protocol``. * * @since 0.1 * @throws GLib.Error if the call to Friends.Dispatcher.GetFeatures fails. */ public string[] features (string protocol) throws Error { string[] _features = null; var parser = new Json.Parser (); parser.load_from_data (service.GetFeatures (protocol), -1); var nodes = parser.get_root ().get_array ().get_elements (); foreach (var node in nodes) _features += node.dup_string (); return _features; } /** * Clear all notifications from the messaging menu. * * @since 0.1 * @throws GLib.IOError if the call to Friends.Dispatcher.ClearIndicators * fails. */ public void messaging_menu_clear () throws IOError { service.ClearIndicators (); } } } libfriends-0.1.2+14.04.20131108.1/src/utils.vala0000644000015700001700000000406012237215640021123 0ustar pbuserpbgroup00000000000000/* * Copyright(C) 2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Ken VaDine */ namespace Friends { public class Utils : Object { construct { } /** * Convert the timestamp into a string ending in 'ago'. * @param t The timestamp as a string. */ public string create_time_string(string t) { string nt = t + "ZZ"; var dtime = new DateTime.now_utc (); TimeVal ctime = TimeVal (); dtime.to_timeval (out ctime); TimeVal time = TimeVal (); time.from_iso8601 (nt); int d = (int)(ctime.tv_sec - time.tv_sec); if(d < 60) return _("a few seconds ago"); if(d < 3600) return ngettext("%i minute ago", "%i minutes ago", (int) d/60).printf(d/60); if(d < 86400) return ngettext("%i hour ago", "%i hours ago", (int) d/3600).printf(d/3600); return ngettext("%i day ago", "%i days ago", (int) d/86400).printf(d/86400); } public string? get_avatar_path(string url) { string _avatar_cache_image = Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_cache_dir(), "friends/avatars", GLib.Checksum.compute_for_string (GLib.ChecksumType.SHA1, url)); debug ("AVATAR PATH: %s", _avatar_cache_image); return _avatar_cache_image; } } } libfriends-0.1.2+14.04.20131108.1/examples/0000755000015700001700000000000012237216007020143 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/examples/entry-python.py0000755000015700001700000000231412237215640023202 0ustar pbuserpbgroup00000000000000#!/usr/bin/python3 # # Copyright (C) 2012 Canonical Ltd. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License # version 3.0 as published by the Free Software Foundation. # # This library 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 Lesser General Public License version 3.0 for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see # . # # Authored by Ken VanDine # from gi.repository import Gtk from gi.repository import FriendsGtk class FriendsEntry: def __init__(self): window = Gtk.Window() window.set_title("Friends Poster") window.set_icon_name("gwibber") window.resize(400,150) entry = FriendsGtk.Entry() window.add(entry) window.show_all() window.present() window.connect("destroy", self.on_close) def on_close(self, w): Gtk.main_quit() entry = FriendsEntry() Gtk.main() libfriends-0.1.2+14.04.20131108.1/examples/example-vala.vala0000644000015700001700000002600312237215640023367 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Ken VanDine */ /* * build with: * valac -X -I../src -X -L../src/.libs -X -lfriends ../src/friends-0.1.vapi --basedir ./ --pkg glib-2.0 --pkg dee-1.0 example-vala.vala -o example-vala */ public class Example { public Friends.Dispatcher dispatcher; public bool waiting = false; public Example (MainLoop loop) { try { dispatcher = new Friends.Dispatcher (); } catch (GLib.IOError e) { warning (e.message); dispatcher = null; } } public void run_example (string[] args) { if (args.length < 2) { PrintUsage (); return; } switch (args[1]) { case "--refresh": stdout.printf ("Refreshing friends\n"); try { dispatcher.refresh (); } catch (GLib.IOError e) { warning (e.message); } return; case "--features": if (args.length < 3) { PrintUsage (); return; } stdout.printf ("Getting features for %s\n", args[2]); try { var features = dispatcher.features (args[2]); foreach (string feature in features) stdout.printf ("%s\n", feature); } catch (GLib.IOError e) { warning (e.message); } return; case "--like": if (args.length < 3) { PrintUsage (); return; } waiting = true; for (int i=1; i { string result = ""; try { dispatcher.like_async.end (res, out result); } catch (GLib.IOError e) { warning (e.message); } stdout.printf ("Liked: %s\n", result); waiting = false; } ); } else { PrintUsage (); } } return; case "--unlike": waiting = true; for (int i=1; i { string result = ""; try { dispatcher.unlike_async.end (res, out result); } catch (GLib.IOError e) { warning (e.message); } stdout.printf ("Unliked: %s\n", result); waiting = false; } ); } else { PrintUsage (); } } return; case "--delete": waiting = true; for (int i=1; i { string result = ""; try { dispatcher.delete_async.end (res, out result); } catch (GLib.IOError e) { warning (e.message); } stdout.printf ("Deleted: %s\n", result); waiting = false; } ); } else { PrintUsage (); } } return; case "--retweet": waiting = true; for (int i=1; i { string result = ""; try { dispatcher.retweet_async.end (res, out result); } catch (GLib.IOError e) { warning (e.message); } stdout.printf ("Retweeted: %s\n", result); waiting = false; } ); } else { PrintUsage (); } } return; case "--upload": uint acct = int.parse (args[2]); string desc = args[3]; string uri = args[4]; stdout.printf ("Uploading %s\n", uri); string result_url = ""; waiting = true; dispatcher.upload_async.begin (acct, uri, desc, (obj, res) => { try { dispatcher.upload_async.end (res, out result_url); stdout.printf ("Uploaded, resulting URL is %s\n", result_url); waiting = false; } catch (IOError e) { warning (e.message); waiting = false; } }); return; case "--send-message": if (args.length < 3) { PrintUsage (); return; } for (int i=1; i { try { dispatcher.send_message_async.end ( res, out result); } catch (GLib.IOError e) { warning (e.message); } stdout.printf ("Sent: %s\n", result); waiting = false; } ); } else { PrintUsage (); } } return; case "--send-reply": if (args.length < 3) { PrintUsage (); return; } for (int i=1; i { try { dispatcher.send_reply_async.end ( res, out result); } catch (GLib.IOError e) { warning (e.message); } stdout.printf ("Sent: %s\n", result); waiting = false; } ); } else { PrintUsage (); } } return; case "--help": PrintUsage (); return; default: return; } } private static void PrintUsage () { string usage = "Usage:\n" + " --help\t\t\t\t\t\tPrint this usage message.\n" + " --refresh\t\t\t\t\t\tRefresh the friends-dispatcher\n" + " --like [account id] [message_id]\t\t\tLike a post\n" + " --unlike [account id] [message_id]\t\t\tUnlike a post\n" + " --delete [account id] [message_id]\t\t\tDelete a post\n" + " --retweet [account id] [message_id]\t\t\tRetweet\n" + " --send-message [account id] [message]\t\t\tMessage to post\n" + " --send-reply [account id] [message_id] [message]\tReply to post\n" + " --upload [account id] [description] [URI]\tUpload phone\n" + " \n"; stdout.printf ("%s\n".printf (usage)); } } static void main (string[] args) { var loop = new MainLoop (); Example e = new Example (loop); Timeout.add (100, () => { e.run_example (args); Idle.add ( () => { if (!e.waiting) loop.quit (); return true; }); return false; }); loop.run (); } libfriends-0.1.2+14.04.20131108.1/examples/entry-vala.vala0000644000015700001700000000253412237215640023100 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 Neil Jagdish Patel * Copyright (C) 2010 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Neil Jagdish Patel * Authored by Ken VanDine */ public class Entry : Gtk.Window { public Entry () { } construct { set_name("Friends"); set_title("Friends Poster (Vala)"); set_default_size (400, 150); set_icon_name ("gwibber"); var entry = new FriendsGtk.Entry (); this.add (entry); this.show_all (); } } static void on_close () { Gtk.main_quit(); } public static void main (string[] args) { Gtk.init (ref args); var w = new Entry (); w.show (); w.set_position (Gtk.WindowPosition.CENTER); w.destroy.connect(on_close); Gtk.main (); } libfriends-0.1.2+14.04.20131108.1/examples/Makefile.am0000644000015700001700000000216712237215640022207 0ustar pbuserpbgroup00000000000000noinst_PROGRAMS = \ example-vala \ entry-vala \ $(NULL) example_vala_SOURCES = \ example-vala.vala example_vala_CFLAGS = \ $(BASE_CFLAGS) \ -I$(top_srcdir)/src example_vala_VALAFLAGS = \ -X -I$(top_srcdir)/src \ -X -L../src/.libs \ ../src/friends-@API_VERSION@.vapi \ --vapidir $(top_srcdir)/vapi \ --pkg gio-2.0 \ --pkg libaccounts-glib \ --basedir ./ example_vala_LDADD = \ $(BASE_LIBS) \ -L../src/.libs -lfriends entry_vala_SOURCES = \ entry-vala.vala entry_vala_CFLAGS = \ $(BASE_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/gtk entry_vala_VALAFLAGS = \ -X -I$(top_srcdir)/src \ -X -L../src/.libs \ -X -I$(top_srcdir)/gtk \ -X -L../gtk/.libs \ ../src/friends-@API_VERSION@.vapi \ ../gtk/friends-gtk-@API_VERSION@.vapi \ --vapidir $(top_srcdir)/vapi \ --pkg json-glib-1.0 \ --pkg gtk+-3.0 \ --pkg gee-1.0 \ --pkg libaccounts-glib \ --pkg pango \ --basedir ./ entry_vala_LDADD = \ $(BASE_LIBS) \ -L../src/.libs -lfriends \ -L../gtk/.libs -lfriends-gtk VALASOURCES = \ $(example_vala_SOURCES) \ $(entry_vala_SOURCES) \ $(NULL) CLEANFILES = \ *.stamp \ *.vapi \ $(VALASOURCES:.vala=.c) libfriends-0.1.2+14.04.20131108.1/vapi/0000755000015700001700000000000012237216007017264 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/vapi/config.vapi0000644000015700001700000000256012237215640021417 0ustar pbuserpbgroup00000000000000/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- *//* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * idst under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * 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, see . * * Authored by Ken VanDine * */ [CCode (gir_namespace = "Friends", gir_version = "0.1")] namespace Friends { public const string foo; } [CCode (gir_namespace = "FriendsGtk", gir_version = "0.1")] namespace FriendsGtk { } [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] namespace Config { public const string DATADIR; public const string PKGDATADIR; public const string GETTEXT_PACKAGE; public const string LOCALE_DIR; public const string VERSION; public const string PACKAGE; public const string PREFIX; } namespace G { [CCode (cname = "g_get_monotonic_time")] static int64 get_monotonic_time (); } libfriends-0.1.2+14.04.20131108.1/vapi/Makefile.am0000644000015700001700000000003412237215640021317 0ustar pbuserpbgroup00000000000000EXTRA_DIST = \ config.vapi libfriends-0.1.2+14.04.20131108.1/AUTHORS0000644000015700001700000000000012237215640017365 0ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/Makefile.am0000644000015700001700000000256112237215640020367 0ustar pbuserpbgroup00000000000000ACLOCAL_AMFLAGS = -I m4 SUBDIRS = \ vapi \ src \ gtk \ po \ tests \ examples \ $(NULL) if HAVE_VALADOC SUBDIRS += docs endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = \ friends-@API_VERSION@.pc \ friends-gtk-@API_VERSION@.pc \ $(NULL) # Test reports .PHONY: check-report check-report: $(MAKE) -C tests/ $(@) # Distribute pot file update-pot: $(MAKE) -C po "$(GETTEXT_PACKAGE).pot" DISTCHECK_CONFIGURE_FLAGS = \ --enable-docs \ --enable-localinstall \ --enable-introspection \ --enable-maintainer-flags=no DIST_SUBDIRS = \ docs \ gtk \ po \ src \ tests \ examples \ vapi \ $(NULL) DISTCLEANFILES = \ friends-@API_VERSION@.pc \ friends-gtk-@API_VERSION@.pc \ intltool-extract \ intltool-merge \ intltool-update EXTRA_DIST = \ friends-@API_VERSION@.pc.in \ friends-gtk-@API_VERSION@.pc.in \ autogen.sh \ COPYING \ intltool-extract.in \ intltool-merge.in \ intltool-update.in dist-hook: update-pot @if test -d "$(top_srcdir)/.bzr"; \ then \ echo Creating ChangeLog && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ || (rm -f ChangeLog.tmp; \ echo Failed to generate ChangeLog >&2 ); \ else \ echo Failed to generate ChangeLog: not a branch >&2; \ fi libfriends-0.1.2+14.04.20131108.1/ChangeLog0000644000015700001700000000000012237215640020067 0ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/autogen.sh0000755000015700001700000000230512237215640020330 0ustar pbuserpbgroup00000000000000#!/bin/sh # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. PKG_NAME="libfriends" (test -f $srcdir/configure.ac \ && test -f $srcdir/autogen.sh) || { echo -n "**Error**: Directory \`$srcdir' does not look like the" echo " top-level $PKG_NAME directory" exit 1 } if which gnome-autogen.sh ; then REQUIRED_AUTOMAKE_VERSION=1.9 . gnome-autogen.sh else if which intltoolize && which gtkdocize && which autoreconf ; then intltoolize --copy --force --automake || \ (echo "There was an error in running intltoolize." > /dev/stderr; exit 1) autoreconf --force --install || \ (echo "There was an error in running autoreconf." > /dev/stderr; exit 1) else echo "No build script available. You have two choices:" echo "1. You need to install the gnome-common module and make" echo " sure the gnome-autogen.sh script is in your \$PATH." echo "2. You need to install the following scripts:" echo " * intltool" echo " * libtool" echo " * automake" echo " * autoconf" echo " Additionally, you need to make" echo " sure that they are in your \$PATH." exit 1 fi fi libfriends-0.1.2+14.04.20131108.1/docs/0000755000015700001700000000000012237216007017255 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/docs/Makefile.am0000644000015700001700000000750112237215640021316 0ustar pbuserpbgroup00000000000000distclean_dirs = \ vala-doc \ gtk-doc \ $(NULL) phony_deps = \ friends-vala-doc \ friendsgtk-vala-doc \ friends-gtk-doc \ friends-gtk-gtk-doc \ $(NULL) friendsvaladocdir=$(datadir)/devhelp/references/friends friendsimgdir=$(datadir)/devhelp/references/friends/img friendsgtkvaladocdir=$(datadir)/devhelp/references/friends friendsgtkimgdir=$(datadir)/devhelp/references/friends/img friendsgtkdocdir=$(datadir)/gtk-doc/html/friends friendsgtkgtkdocdir=$(datadir)/gtk-doc/html/friends common_doc_files = \ *.css \ *.png \ *.js \ index.htm \ *.html \ $(NULL) friendsvaladoc_DATA = \ vala-doc/friends/friends.devhelp2 \ $(addprefix vala-doc/friends/,$(common_doc_files)) \ $(NULL) friendsgtkvaladoc_DATA = \ vala-doc/friends-gtk/friends-gtk.devhelp2 \ $(addprefix vala-doc/friends-gtk/,$(common_doc_files)) \ $(NULL) friendsgtkdoc_DATA = gtk-doc/friends/html/* friendsgtkgtkdoc_DATA = gtk-doc/friends-gtk/html/* friendsimg_DATA = \ vala-doc/friends/img/*.png \ $(NULL) $(friendsvaladoc_DATA) $(friendsimg_DATA): friends-vala-doc $(friendsgtkvaladoc_DATA) $(friendsgtkimg_DATA): friends-gtk-vala-doc $(friendsgtkdoc_DATA): friends-gtk-doc $(friendsgtkgtkdoc_DATA): friends-gtk-gtk-doc valadoc_flags = \ --force \ --package-version $(PACKAGE_VERSION) \ --no-protected \ $(NULL) # friends documentation # blacklist of files, added .vala files here that need to be excluded friends_vala_doc_files_blacklist = \ $(NULL) friends_gtk_vala_doc_files_blacklist = \ $(NULL) # this expands the list of files, so we can filter out elements friends_vala_doc_files_all = \ $(wildcard $(top_srcdir)/src/*.vala) \ $(NULL) friends_gtk_vala_doc_files_all = \ $(wildcard $(top_srcdir)/gtk/*.vala) \ $(NULL) # FIXME: sort the files manually to work around the native doclet portion of # bgo#662784 friends_vala_doc_files = \ $(sort \ $(filter-out $(friends_vala_doc_files_blacklist),$(friends_vala_doc_files_all))) friends_gtk_vala_doc_files = \ $(sort \ $(filter-out $(friends_gtk_vala_doc_files_blacklist),$(friends_gtk_vala_doc_files_all))) friends_vala_doc_deps = \ config \ gobject-2.0 \ gio-2.0 \ json-glib-1.0 \ gee-1.0 \ libaccounts-glib \ $(NULL) friends_gtk_vala_doc_deps = \ $(friends_vala_doc_deps) \ dee-1.0 \ gdk-3.0 \ gtk+-3.0 \ atk \ libsoup-2.4 \ libnotify \ $(NULL) valadoc_flags_friends = \ $(valadoc_flags) \ -X $(top_srcdir)/src/friends.h \ $(addprefix --pkg=,$(friends_vala_doc_deps)) \ --vapidir=$(VALADOCVAPIDIR) \ --vapidir=$(top_srcdir)/vapi \ --vapidir=$(top_srcdir)/src \ $(friends_vala_doc_files) \ $(NULL) valadoc_flags_friendsgtk = \ $(valadoc_flags) \ -X $(top_srcdir)/src/friends.h \ -X $(top_srcdir)/gtk/friends-gtk.h \ $(addprefix --pkg=,$(friends_gtk_vala_doc_deps)) \ --pkg=friends-0.1 \ --vapidir=$(VALADOCVAPIDIR) \ --vapidir=$(top_srcdir)/vapi \ --vapidir=$(top_srcdir)/src \ --vapidir=$(top_srcdir)/gtk \ $(friends_gtk_vala_doc_files) \ $(NULL) friends-vala-doc: $(friends_vala_doc_files) $(AM_V_GEN)$(VALADOC) \ -o vala-doc/friends \ --doclet=devhelp \ $(valadoc_flags_friends) \ $(NULL) friends-gtk-vala-doc: $(friends_gtk_vala_doc_files) $(AM_V_GEN)$(VALADOC) \ -o vala-doc/friends-gtk \ --doclet=devhelp \ $(valadoc_flags_friendsgtk) \ $(NULL) friends-gtk-doc: $(friends_vala_doc_files) $(AM_V_GEN)$(VALADOC) \ -X -l -X $(top_builddir)/src/.libs/libfriends.so \ -X -l -X $(top_builddir)/gtk/.libs/libfriends-gtk.so \ -o gtk-doc/friends \ --doclet=gtkdoc \ $(valadoc_flags_friends) \ $(NULL) friends-gtk-gtk-doc: $(friends_gtk_vala_doc_files) $(AM_V_GEN)$(VALADOC) \ -X -l -X $(top_builddir)/src/.libs/libfriends.so \ -X -l -X $(top_builddir)/gtk/.libs/libfriends-gtk.so \ -o gtk-doc/friends-gtk \ --doclet=gtkdoc \ $(valadoc_flags_friendsgtk) \ $(NULL) .PHONY: $(phony_deps) distclean-local: distclean-docs distclean-docs: rm -rf $(distclean_dirs) libfriends-0.1.2+14.04.20131108.1/friends-0.1.pc.in0000644000015700001700000000047312237215640021212 0ustar pbuserpbgroup00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/libfriends-@LIBFRIENDS_API_VERSION@ Name: libfriends Description: A library for accessing the Friends service Version: @VERSION@ Libs: -L${libdir} -lfriends Cflags: -I${includedir} Requires: glib-2.0 gthread-2.0 gobject-2.0 gio-2.0 libfriends-0.1.2+14.04.20131108.1/COPYING0000644000015700001700000001674312237215640017375 0ustar pbuserpbgroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. libfriends-0.1.2+14.04.20131108.1/NEWS0000644000015700001700000000000012237215640017014 0ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/gtk/0000755000015700001700000000000012237216007017112 5ustar pbuserpbgroup00000000000000libfriends-0.1.2+14.04.20131108.1/gtk/account.vala0000644000015700001700000001364612237215640021427 0ustar pbuserpbgroup00000000000000/* * Copyright(C) 2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Ken VaDine */ /** * This is a thin wrapper around {@link Ag.Account}. * * @since 0.1 */ class FriendsAccount : GLib.Object { private Ag.Account _account = null; /** * String that uniquely identifies the account. It takes the * form of '#/protocol', where # is the {@link Ag.Account.id} * and protocol is the lowercase name of the social network * that the account is from. Possible values include * '6/facebook' or '2/twitter'. The number on it's own is * unique (so you'd never see '1/twitter' and '1/facebook' on * the same system), but we do support registering multiple * accounts per protocol, so finding '1/twitter', '2/twitter', * and '3/twitter' is perfectly acceptable. * * @since 0.1 */ public uint id { get { return unique_id; } } /** * This is the username that the social network uses to * identify the user. For example on twitter, this is the name * that people use to @mention you in their tweets. * * @since 0.1 */ public string username { get { return _account.get_display_name(); } } /** * This is the bare name of the protocol. Possible values are * ``facebook``, ``foursquare``, ``flickr``, ``identica``, and * ``twitter``. * * @since 0.1 */ public string service { get { return _account.get_provider_name(); } } /** * A single, solid color used to represent the given protocol. * This is stored as a familiar HTML style hex triplet, in the * form of 'RRGGBB'. * * @since 0.1 */ private string _color; public string color { get { GLib.Value t = ""; _account.get_value("friends/color", ref t); _color = t.get_string(); return _color; } set { GLib.Value t = value; try { _account.set_value("friends/color", t); _account.store_blocking(); } catch (Ag.AccountsError e) { warning (e.message); } } } /** * Controls whether this account should be included in the * global ``send_message`` call. If you want to send a * particular message to some, but not all accounts, you can * use this to effectively 'disable' the account. * * Set to the string "1" to enable and the string "0" to disable. * * @since 0.1 * @see toggle_send_enabled */ private string? _send_enabled; public string? send_enabled { get { GLib.Value t = false; var res = _account.get_value("friends/send_enabled", ref t); if (res == Ag.SettingSource.NONE) { _send_enabled = null; return _send_enabled; } if (t.get_boolean()) _send_enabled = "1"; else _send_enabled = "0"; return _send_enabled; } set { GLib.Value t = false; if (value == "1") t = true; try { _account.set_value("friends/send_enabled", t); _account.store_blocking(); } catch (Ag.AccountsError e) { warning (e.message); } } } private Ag.AccountService account_service; private uint unique_id; /** * Emitted when the account has changed, most useful for being * notified of changes to {@link send_enabled}. * * @since 0.1 */ public signal void updated(); /** * Emitted when the account has been deleted. This happens * when the user deletes the account from the Ubuntu Online * Accounts screen. * * @since 0.1 */ public signal void deleted(); /** * Construct a new FriendsAccount object. * * @params account_service The {@link Ag.AccountService} * object that our FriendsAccount will be wrapping. * * @since 0.1 */ public FriendsAccount (Ag.AccountService account_service) { this.account_service = account_service; _account = account_service.get_account(); unique_id = _account.id; account_service.changed.connect(() => { updated(); }); _account.deleted.connect(() => { deleted(); }); } /** * Toggle the value of send_enabled for the account. * * @since 0.1 * @see send_enabled */ public void toggle_send_enabled() { if (send_enabled == "1") send_enabled = "0"; else send_enabled = "1"; } } libfriends-0.1.2+14.04.20131108.1/gtk/accounts.vala0000644000015700001700000000373712237215640021612 0ustar pbuserpbgroup00000000000000/* * Copyright(C) 2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Neil Jagdish Patel * Authored by Ken VaDine * Authored by Alberto Mardegan */ internal class FriendsAccounts : Object { private Ag.Manager manager; internal signal void created(FriendsAccount account); internal FriendsAccounts() { manager = new Ag.Manager.for_service_type("microblogging"); manager.account_created.connect(on_account_created); } internal GLib.List list() { GLib.List accounts = null; foreach (var account_service in manager.get_account_services()) { var account = new FriendsAccount (account_service); accounts.append(account); } return accounts; } internal void on_account_created(uint account_id) { var account = manager.get_account(account_id); if (!account.supports_service("microblogging")) return; var services = account.list_services(); foreach (var service in services) { var account_service = new Ag.AccountService(account, service); created(new FriendsAccount(account_service)); } } } libfriends-0.1.2+14.04.20131108.1/gtk/friends-gtk-0.1.deps0000644000015700001700000000005012237215640022475 0ustar pbuserpbgroup00000000000000gtk+-3.0 gdk-3.0 pango glib-2.0 gee-1.0 libfriends-0.1.2+14.04.20131108.1/gtk/Makefile.am0000644000015700001700000000454012237215640021153 0ustar pbuserpbgroup00000000000000NULL = CLEANFILES = VALAFLAGS = lib_LTLIBRARIES = \ libfriends-gtk.la \ $(NULL) libfriends_gtk_la_SOURCES = \ entry.vala \ accounts.vala \ account.vala \ $(NULL) if HAVE_GTKSPELL VALAFLAGS += -D HAVE_GTKSPELL endif if HAVE_INTROSPECTION GIR_VALAFLAGS = \ --gir FriendsGtk-@API_VERSION@.gir \ --library friends-gtk-@API_VERSION@ \ $(NULL) else GIR_VALAFLAGS = endif libfriends_gtk_la_VALAFLAGS = \ $(GIR_VALAFLAGS) \ $(VALAFLAGS) \ --vapi friends-gtk-@API_VERSION@.vapi \ -H friends-gtk.h \ --use-header \ --vapidir $(top_srcdir)/vapi \ --pkg config \ --pkg gobject-2.0 \ --pkg gdk-3.0 \ --pkg gtk+-3.0 \ --pkg atk \ --pkg pangocairo \ --pkg dee-1.0 \ --pkg gee-1.0 \ --pkg libaccounts-glib \ --pkg libsoup-2.4 \ --pkg libnotify \ --pkg json-glib-1.0 \ $(GTKSPELL_PKG) \ ../src/friends-@API_VERSION@.vapi \ $(MAINTAINER_VALAFLAGS) \ $(NULL) libfriends_gtk_la_CFLAGS = \ $(BASE_CFLAGS) \ $(GTKSPELL_CFLAGS) \ -I$(top_srcdir)/src \ -DDATADIR=\"$(DATADIR)\" \ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \ $(NULL) libfriends_gtk_la_LDFLAGS = \ $(BASE_LIBS) \ $(GTKSPELL_LIBS) \ -L../src/.libs -lfriends \ -version-info $(LIBFRIENDS_CURRENT):$(LIBFRIENDS_REVISION):$(LIBFRIENDS_AGE) \ -no-undefined \ -export-symbols-regex "^friends_gtk_.*" \ $(NULL) libfriends_gtkincludedir = $(includedir)/libfriends-$(API_VERSION) libfriends_gtkinclude_HEADERS = \ friends-gtk.h \ $(NULL) vapidir = $(datadir)/vala/vapi vapi_DATA = \ friends-gtk-@API_VERSION@.vapi \ friends-gtk-@API_VERSION@.deps \ $(NULL) if HAVE_INTROSPECTION girdir = $(datadir)/gir-1.0 gir_DATA = FriendsGtk-$(API_VERSION).gir typelibsdir = $(libdir)/girepository-1.0 typelibs_DATA = $(gir_DATA:.gir=.typelib) %.typelib: %.gir $(INTROSPECTION_COMPILER) LD_LIBRARY_PATH=.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \ $(INTROSPECTION_COMPILER) \ --shared-library libfriends-gtk.so.$(LIBFRIENDS_CURRENT) \ --includedir=$(srcdir) \ --includedir=$(top_srcdir)/src \ $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F) VALASOURCES = $(libfriends_gtk_la_SOURCES) CLEANFILES += \ $(VALASOURCES:.vala=.c) \ $(typelibs_DATA) \ $(NULL) endif # HAVE_INTROSPECTION MAINTAINERCLEANFILES = \ friends-gtk.h \ FriendsGtk-@API_VERSION@.gir \ friends-gtk-@API_VERSION@.vapi \ $(NULL) EXTRA_DIST = \ friends-gtk-@API_VERSION@.vapi \ friends-gtk-@API_VERSION@.deps \ $(NULL) libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala0000644000015700001700000004663412237215640021137 0ustar pbuserpbgroup00000000000000/* * Copyright(C) 2012 Canonical Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * version 3.0 as published by the Free Software Foundation. * * This library 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 Lesser General Public License version 3.0 for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * * Authored by Neil Jagdish Patel * Authored by Ken VaDine */ namespace FriendsGtk { public static const int MAX_MESSAGE_LENGTH = 140; /** * Widget that displays an entry which posts status updates to your * social network accounts using friends-dispatcher. The entry includes * a text entry, character count, and account selection buttons. * * @since 0.1 */ public class Entry : Gtk.Box { /** * {@link Friends.Dispatcher} */ private Friends.Dispatcher dispatcher; public InputTextView text_view; private AccountTargetBar target_bar; public Entry () { Object (); } construct { set_orientation (Gtk.Orientation.VERTICAL); try { dispatcher = new Friends.Dispatcher (); } catch (GLib.IOError e) { warning (e.message); return; } text_view = new InputTextView (dispatcher); target_bar = new AccountTargetBar (); add_with_properties (text_view,"expand", true); add_with_properties (target_bar,"expand", false); text_view.show (); target_bar.show (); target_bar.submit.connect(() => { text_view.submit (); }); // Stick a couple pixels at the bottom to keep the buttons from // hitting the edge var spacer = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); add_with_properties (spacer, "padding", 2, "expand", false); text_view.get_buffer ().changed.connect (() => { target_bar.set_counter(text_view.get_buffer ().get_char_count ()); }); } } /** * Widget that displays an entry which posts status updates to * your social network accounts using friends-dispatcher. The entry * is very simple and does not include any of the frills * of {@link FriendsGtk.Entry}. * * @since 0.1 */ public class SimpleEntry : Gtk.Box { /** * {@link Friends.Dispatcher} */ private Friends.Dispatcher dispatcher; private InputTextView text_view; private SendBar send_bar; public SimpleEntry () { Object (); } construct { try { dispatcher = new Friends.Dispatcher (); } catch (GLib.IOError e) { warning (e.message); return; } text_view = new InputTextView (dispatcher); send_bar = new SendBar (); add (text_view); add_with_properties(send_bar,"expand", false); text_view.show (); send_bar.show (); send_bar.submit.connect(() => { text_view.submit ();}); } } /** * Just the text box. * * @since 0.1 */ public class InputTextView : Gtk.TextView { /** * {@link Friends.Dispatcher} */ private Friends.Dispatcher dispatcher; /** * The {@link Gdk.RGBA} for the foreground */ public Gdk.RGBA fg_color; /** * The {@link Gdk.RGBA} for the error state */ public Gdk.RGBA error_color; bool last_was_shortened = false; private string _mid = null; private string _action = null; public InputTextView (Friends.Dispatcher dispatcher) { Object (border_width:5, accepts_tab:true, editable:true, cursor_visible:true, wrap_mode:Gtk.WrapMode.WORD_CHAR, left_margin:2, right_margin:2, pixels_above_lines:2, pixels_below_lines:2); } construct { try { dispatcher = new Friends.Dispatcher (); } catch (GLib.IOError e) { warning (e.message); return; } unowned Gtk.BindingSet binding_set; binding_set = Gtk.BindingSet.by_class (typeof (InputTextView).class_ref ()); Gtk.BindingEntry.add_signal (binding_set, Gdk.keyval_from_name ("Return"), 0, "submit", 0); Gtk.BindingEntry.add_signal (binding_set, Gdk.keyval_from_name ("KP_Enter"), 0, "submit", 0); Gtk.BindingEntry.add_signal (binding_set, Gdk.keyval_from_name ("Escape"), 0, "clear", 0); // FIXME: this is getting white, no matter what? fg_color = get_style_context ().get_color (Gtk.StateFlags.NORMAL); error_color = Gdk.RGBA (); error_color.parse("indianred"); get_buffer ().changed.connect (on_text_changed); get_buffer ().insert_text.connect (on_text_inserted); // FIXME //set_sensitive (dispatcher.is_connected ()); //dispatcher.connection_changed.connect((source) => { // on_connection_changed (source);}); #if HAVE_GTKSPELL try { var spell = new GtkSpell.Checker().attach(this); } catch (Error e) { } #endif } public void reset () { Timeout.add(100, () => { mid = null; action = null; clear (); return false; }); } public string? mid { get { return _mid; } set { if (_mid != value) { _mid = value; } } } public string? action { get { return _action; } set { if (_action != value) { _action = value; } } } [Signal (action=true)] public virtual signal void clear() { buffer.set_text(""); } [Signal (action=true)] public virtual signal void submit () { string msg = buffer.text; if (msg.length < 1) { debug ("SEND FAILED, empty post"); return; } /* FIXME if ((mid != null)) { debug ("Sending %s for %s", action, mid); dispatcher.send_message(msg, mid, action, null); mid = null; action = null; } else { dispatcher.send_message(msg, null, null, null); } */ try { dispatcher.send_message(null, msg); debug ("(submit) Message: %s posted", msg); } catch (GLib.IOError e) { warning (e.message); } reset(); } private void on_connection_changed (bool is_connected) { set_sensitive(is_connected); } private void on_text_changed () { var chars = get_buffer ().get_char_count (); override_color ( Gtk.StateFlags.NORMAL, chars > MAX_MESSAGE_LENGTH ? error_color : fg_color ); } private void on_text_inserted (ref Gtk.TextIter iter, string text, int len) { if (last_was_shortened == false && len > 30 && text != null && text[0:4] == "http") { var buf = get_buffer (); Signal.stop_emission_by_name (buf, "insert-text") ; try { var shrt = dispatcher.shorten (text); last_was_shortened = true; buf.insert (ref iter, shrt, -1); } catch (GLib.IOError e) { warning (e.message); return; } } else { last_was_shortened = false; } } } /** * This toggle button toggles an individual account on or off. * * @since 0.1 */ public class AccountToggleButton : Gtk.ToggleButton { /** * The color is used to differentiate accounts. * * @since 0.1 */ public string color { get; construct;} public AccountToggleButton (string color) { Object (color:color); } construct { set_size_request (24, 24); } internal override bool draw (Cairo.Context context) { double factor = 0.3; if (get_active()) { context.translate(-1, -1); factor = 1.0; } else if (get_state_flags () == Gtk.StateFlags.PRELIGHT) { factor = 0.3; } else if (get_state_flags () == Gtk.StateFlags.ACTIVE) { factor = 0.5; } context.push_group (); Gtk.Allocation a; get_allocation (out a); Gdk.RGBA c = Gdk.RGBA (); c.red = 1.0f; c.green = 1.0f; c.blue = 1.0f; c.alpha = 1.0f; c.parse (color); context.set_source_rgba (c.red, c.green, c.blue, 1.0f); context.rectangle (a.width - 2, a.height - 6, 2, 6); context.rectangle (a.width - 6, a.height - 2, 6, 2); context.fill (); propagate_draw (get_child (), context); context.pop_group_to_source (); context.paint_with_alpha (factor); return true; } } /** * The target bar displays a row of {@link AccountToggleButton}s * to allow the user to choose which accounts to send the message * to. * * @since 0.1 */ public class AccountTargetBar : Gtk.Box { private Friends.Dispatcher dispatcher; private FriendsAccounts accounts_service; private Gtk.Button send; public Gtk.Label count; private Gee.HashMap accounts_buttons_map; private Gtk.Box abox; private uint? _selected = null; public AccountTargetBar () { Object (spacing:0); } /* * The {@Ag.Account.id} of the account button to be displayed * This is used in the case of replies or private messages * where the post will only go to a single account */ public uint? selected { get { return _selected; } set { if (_selected != value); { _selected = value; if (_selected != null) { foreach (var k in accounts_buttons_map.keys) { if (_selected != k) accounts_buttons_map[k].hide (); else { accounts_buttons_map[k].active = true; accounts_buttons_map[k].sensitive = false; } accounts_buttons_map[_selected].show_all (); } } else { foreach (var k in accounts_buttons_map.keys) accounts_buttons_map[k].sensitive = true; show_all (); } } } } construct { var icon_theme = Gtk.IconTheme.get_default (); icon_theme.prepend_search_path (Config.PKGDATADIR + "/ui/icons"); // Prepend local icon path if running from a source checkout var local_icon_path = GLib.Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_current_dir (), "data/icons"); if (GLib.FileUtils.test (local_icon_path, GLib.FileTest.IS_DIR)) icon_theme.prepend_search_path (local_icon_path); local_icon_path = GLib.Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_current_dir (), "../data/icons"); if (GLib.FileUtils.test (local_icon_path, GLib.FileTest.IS_DIR)) icon_theme.prepend_search_path (local_icon_path); try { dispatcher = new Friends.Dispatcher (); } catch (GLib.IOError e) { warning (e.message); return; } accounts_service = new FriendsAccounts(); // Add buttons to button area at the bottom var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 12); var send_with_label = new Gtk.Label(_("Send with:")); //box.pack_start(send_with_label, false, false, 0); accounts_buttons_map = new Gee.HashMap (); var accounts_list = accounts_service.list (); abox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); abox.set_homogeneous (true); box.pack_start (abox, false, false, 0); for (int i = 0; i < accounts_list.length(); i++) { FriendsAccount account = accounts_list.nth_data(i); if (account == null) { continue; } // If there is no send_enabled key, don't display an icon if (account.send_enabled == null) { continue; } var account_button = create_button (account); accounts_buttons_map[account.id] = account_button; } send = new Gtk.Button.with_label(_("Send")); send.clicked.connect(() => { submit (); }); box.pack_end(send, false, false, 0); count = new Gtk.Label (""); count.set_markup ("" + MAX_MESSAGE_LENGTH.to_string () + ""); box.pack_end(count, false, false, 0); pack_start (box, true, true, 0); // FIXME //send.set_sensitive (dispatcher.is_connected ()); //dispatcher.connection_changed.connect((source) => { // on_connection_changed (source);}); accounts_service.created.connect((source) => { account_created(accounts_buttons_map, source);}); } /** * Signal emitted when submitted to the dispatcher. */ public signal void submit (); private AccountToggleButton create_button (FriendsAccount account) { Gtk.Image icon_service = new Gtk.Image.from_icon_name(account.service, Gtk.IconSize.MENU); icon_service.show(); AccountToggleButton account_button = new AccountToggleButton(account.color); account_button.set_active((account.send_enabled == "1")?true:false); if (account.send_enabled != "1") { account_button.tooltip_text = (account.service + " (" + account.username + ") - " + _("Disabled")); } else { account_button.tooltip_text = (account.service + " (" + account.username + ")"); } account_button.set_image(icon_service); account_button.clicked.connect((source) => { on_account_toggled(account_button, account);}); account.updated.connect(() => { account_updated(accounts_buttons_map, account);}); //account.notify["send_enabled"].connect (()=> { // account_updated(accounts_buttons_map, account);}); account.deleted.connect(() => { account_deleted(accounts_buttons_map, account.id);}); abox.pack_start(account_button, false, false, 0); account_button.show_all (); return account_button; } /* * Set the number of remaining characters allowed to post * @param chars Number of characters remaining */ public void set_counter (int chars) { if (chars > MAX_MESSAGE_LENGTH) { count.set_markup (" -" + (chars - MAX_MESSAGE_LENGTH).to_string () + ""); } else { count.set_markup ("" + (MAX_MESSAGE_LENGTH - chars).to_string () + ""); } } private void on_account_toggled(AccountToggleButton account_button, FriendsAccount account) { if (((account.send_enabled == "1")?true:false) != (account_button.get_active())) { account.toggle_send_enabled(); } } private void account_updated(Gee.HashMap accounts_buttons_map, FriendsAccount account) { if (!accounts_buttons_map.has_key(account.id)) return; AccountToggleButton account_button = accounts_buttons_map[account.id]; if (account.send_enabled != "1") { account_button.tooltip_text = (account.service + " (" + account.username + ") - " + _("Disabled")); } else { account_button.tooltip_text = (account.service + " (" + account.username + ")"); } if (((account.send_enabled == "1")?true:false) != (account_button.get_active())) { account_button.set_active((account.send_enabled == "1")?true:false); } } private void account_created(Gee.HashMap accounts_buttons_map, FriendsAccount account) { if (accounts_buttons_map.has_key(account.id)) { account_updated (accounts_buttons_map, account); return; } AccountToggleButton account_button = create_button (account); accounts_buttons_map[account.id] = account_button; } private void account_deleted(Gee.HashMap accounts_buttons_map, uint id) { if (!accounts_buttons_map.has_key(id)) return; AccountToggleButton account_button = accounts_buttons_map[id]; account_button.destroy (); accounts_buttons_map.unset(id, out account_button); } private void on_connection_changed (bool is_connected) { send.set_sensitive(is_connected); } } public class SendBar : Gtk.Box { private Gtk.Button send; public SendBar () { Object (spacing:5); } construct { // Add buttons to button area at the bottom var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); send = new Gtk.Button.with_label(_("Send")); send.clicked.connect(() => { submit (); }); box.pack_end(send, false, false, 0); add(box); } /** * Signal emitted when submitted to the dispatcher. */ public signal void submit (); } } libfriends-0.1.2+14.04.20131108.1/INSTALL0000644000015700001700000003660012237215640017365 0ustar pbuserpbgroup00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details.