Commit b3c30a53 authored by Éloi Bail's avatar Éloi Bail Committed by Gerrit Code Review

daemon: remove plugins dir

Refs #69286

Change-Id: I317c222ba8e34977917c3bf0b791b53a2e4bd784
parent 89809ab7
m4
aclocal.m4
.cproject
.project
.settings/*
active
autom4te.cache/*
compile
config.guess
config.*
configure
depcomp
gnome-doc-utils.make
install-sh
ltmain.sh
missing
gnome.schemas
ring.desktop
ring.desktop.*
stamp-h.in
stamp-h1
This diff is collapsed.
SUBDIRS = addressbook
CFLAGS=-Wall -Werror -Wextra
ACLOCAL_AMFLAGS = -I m4
Welcome to Ring!
Refer to the development site for further information: https://projects.savoirfairelinux.com/projects/show/sflphone
Thank you
include ../../globals.mak
noinst_PROGRAMS = libevladdrbook.so
libevladdrbook_so_SOURCES = eds.c eds.h addressbook.c addressbook.h
libevladdrbook_so_LDFLAGS = --shared $(GLIB_LDFLAGS) $(GTK_LDFLAGS) $(LIBEDATASERVER_LDFLAGS) $(LIBEBOOK_LDFLAGS)
libevladdrbook_so_LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(LIBEDATASERVER_LIBS) $(LIBEBOOK_LIBS)
libevladdrbook_so_CFLAGS = -fPIC -g -Wall $(GTK_CFLAGS) $(LIBEDATASERVER_CFLAGS) $(LIBEBOOK_CFLAGS)
install-exec-local: install-libplugin_libevladdrbook_so
uninstall-local: uninstall-libplugin_libevladdrbook_so
install-libplugin_libevladdrbook_so: libevladdrbook.so
mkdir -p $(sflplugindir)
$(INSTALL_PROGRAM) libevladdrbook.so $(sflplugindir)
uninstall-libplugin_libevladdrbook_so:
rm -f $(sflplugindir)/libevladdrbook.so
rmdir $(sflplugindir)
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "eds.h"
#include "addressbook.h"
/**
* Perform a search on address book
*/
void
addressbook_search (void (*search_cb)(GList *, gpointer), GtkEntry* entry, AddressBook_Config *addressbook_config)
{
const gint max_results = addressbook_config ? addressbook_config->max_results : 10;
search_async_by_contacts (gtk_entry_get_text(entry),
max_results,
search_cb,
addressbook_config);
}
/**
* Return addressbook state
*/
gboolean
addressbook_is_ready()
{
return books_ready();
}
/**
* Return TRUE if at least one addressbook is active
*/
gboolean
addressbook_is_active()
{
return books_active();
}
/**
* Good method to get books_data
*/
GSList *
addressbook_get_books_data()
{
determine_default_addressbook();
return get_books_data();
}
book_data_t *
addressbook_get_book_data_by_uid(gchar *uid)
{
return books_get_book_data_by_uid(uid);
}
/**
* Initialize books.
* Set active/inactive status depending on config.
*/
void
addressbook_init()
{
fill_books_data();
determine_default_addressbook();
// Call books initialization
init_eds();
}
void addressbook_set_search_type(AddrbookSearchType searchType) {
if (searchType > ABOOK_QUERY_CONTAINS)
return;
static const EBookQueryTest map[] = {
[ABOOK_QUERY_IS] = E_BOOK_QUERY_IS,
[ABOOK_QUERY_BEGINS_WITH] = E_BOOK_QUERY_BEGINS_WITH,
[ABOOK_QUERY_CONTAINS] = E_BOOK_QUERY_CONTAINS
};
set_current_addressbook_test(map[searchType]);
}
void addressbook_set_current_book(const gchar *current) {
set_current_addressbook(current);
}
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
/**
* This file contains functions specific for addressbook.
* It is used as a "mapping" between real search implementation
* and search bar.
*/
#ifndef __ADDRESSBOOK_H__
#define __ADDRESSBOOK_H__
#include <gtk/gtk.h>
typedef enum {
ABOOK_QUERY_IS,
ABOOK_QUERY_BEGINS_WITH,
ABOOK_QUERY_CONTAINS
} AddrbookSearchType;
/**
* Represent a contact entry
*/
typedef struct _Hit {
gchar *name;
GdkPixbuf *photo;
gchar *phone_business;
gchar *phone_home;
gchar *phone_mobile;
} Hit;
/**
* Book structure for "outside world"
*/
typedef struct {
gchar *uid;
gchar *uri;
gchar *name;
gboolean active;
} book_data_t;
typedef struct _AddressBook_Config {
// gint64: a signed integer guaranteed to be 64 bits on all platforms
// To print or scan values of this type, use G_GINT64_MODIFIER and/or G_GINT64_FORMAT
gint enable;
gint max_results;
gint display_contact_photo;
gint search_phone_home;
gint search_phone_business;
gint search_phone_mobile;
} AddressBook_Config;
/**
* Initialize addressbook
*/
void addressbook_init();
/**
* Return addressbook state
*/
gboolean addressbook_is_ready();
/**
* Return addressbook state
*/
gboolean addressbook_is_enabled();
/**
* Return if at least one addressbook is active
*/
gboolean addressbook_is_active();
/**
* Perform a search in addressbook
*/
void addressbook_search(void (*search_cb)(GList *, gpointer), GtkEntry *, AddressBook_Config *);
/**
* Get a list of addressbook book
*/
GSList *addressbook_get_books_data();
book_data_t *addressbook_get_book_data_by_uid(gchar *);
void addressbook_set_current_book(const gchar *);
void addressbook_set_search_type(AddrbookSearchType);
#endif
This diff is collapsed.
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
*
* File originally copied from evolution module of deskbar-applet 2.24.1
* Authors :
* Nigel Tao <nigel.tao@myrealbox.com>
* Raphaël Slinckx <raphael@slinckx.net>
* Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk>
* Sebastian Pölsterl <marduk@k-d-w.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef __EDS_H__
#define __EDS_H__
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libedataserver/eds-version.h>
#if EDS_CHECK_VERSION(3,5,3)
#include <libebook/libebook.h>
#else
#include <libebook/e-book.h>
#include <libebook/e-book-query.h>
#endif
#include "addressbook.h"
G_BEGIN_DECLS
/**
* Template callback function for the asynchronous search
*/
typedef void
(* SearchAsyncHandler)(GList *hits, gpointer user_data);
/**
* Initialize the address book.
* Connection to evolution data server
*/
void
init_eds();
/**
* Fill list of addressbooks
*/
void
fill_books_data(void);
/**
* Asynchronous query to EDS using get contact method.
*/
void
search_async_by_contacts(const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data);
GSList*
get_books(void);
book_data_t *
books_get_book_data_by_uid(gchar *uid);
/**
* Public way to know if we can perform a search
*/
gboolean
books_ready();
/**
* Public way to know if we enabled an address book
*/
gboolean
books_active();
/**
* Good method to retrieve books_data (handle async)
*/
GSList *
addressbook_get_books_data();
/**
* Set the current address book
*/
void
set_current_addressbook(const gchar *name);
void
set_current_addressbook_test(EBookQueryTest test);
GSList *
get_books_data();
void
determine_default_addressbook();
G_END_DECLS
#endif /* __EDS_H__ */
check_PROGRAMS=test_addressbook
test_addressbook_CFLAGS=-g @GTK_CFLAGS@ -I../evolution/
test_addressbook_LDADD=@GTK_LIBS@ $(top_builddir)/addressbook/evolution/libevladdrbook.so
#include <gtk/gtk.h>
#include "addressbook.h"
/**
* Callback called after all book have been processed
*/
enum {
COLUMN_NAME,
COLUMN_PHONE,
COLUMN_PIXBUF,
N_COLUMNS
};
// Evil!
static GtkListStore *list_store;
static void
add_contact(const gchar *name, const char *phone, GdkPixbuf *photo)
{
if (g_strcmp0(phone, "") == 0)
return;
g_print("name: %s, phone: %s, photo: %p\n", name, phone, photo);
GtkTreeIter iter;
// Add a new row to the model
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter,
COLUMN_NAME, name,
COLUMN_PHONE, phone,
COLUMN_PIXBUF, photo,
-1);
}
static void
handler_async_search(GList *hits, G_GNUC_UNUSED gpointer data)
{
for (GList *i = hits; i != NULL; i = i->next) {
Hit *hit = i->data;
if (!hit)
continue;
const gchar *phone = hit->phone_business ? hit->phone_business :
hit->phone_mobile ? hit->phone_mobile :
hit->phone_home ? hit->phone_home : "";
add_contact(hit->name, phone, hit->photo);
g_free(hit->name);
g_free(hit->phone_home);
g_free(hit->phone_mobile);
g_free(hit->phone_business);
g_free(hit);
}
g_list_free(hits);
}
static void
text_changed_cb(GtkEntry *entry)
{
g_print("Text changed to %s\n", gtk_entry_get_text(entry));
gtk_list_store_clear(list_store);
addressbook_search(handler_async_search, entry, NULL);
}
int
main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
list_store = gtk_list_store_new(N_COLUMNS,
G_TYPE_STRING,
G_TYPE_STRING,
GDK_TYPE_PIXBUF);
GtkWidget *tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store));
GtkCellRenderer *text_renderer = gtk_cell_renderer_text_new();
GtkCellRenderer *pixbuf_renderer = gtk_cell_renderer_pixbuf_new();
GtkCellRenderer *renderers[] = {text_renderer, text_renderer, pixbuf_renderer};
const char *column_header[]= {"Name", "Phone", "Photo"};
const char *column_type[]= {"text", "text", "pixbuf"};
for (gint col = 0; col < N_COLUMNS; ++col) {
GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(column_header[col],
renderers[col], column_type[col],
col,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
}
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
addressbook_init();
addressbook_set_current_book("Contacts");
GtkWidget *entry = gtk_entry_new();
gtk_container_add(GTK_CONTAINER(vbox), tree_view);
gtk_container_add(GTK_CONTAINER(vbox), entry);
gtk_container_add(GTK_CONTAINER(window), vbox);
addressbook_search(handler_async_search, GTK_ENTRY(entry), NULL);
g_signal_connect(entry, "notify::text", G_CALLBACK(text_changed_cb), NULL);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
#!/bin/sh -e
# Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565663
[ ! -e m4 ] && mkdir m4
autoreconf --force --install --verbose -Wall -I m4
AC_INIT([Ring],[2.0.0],[sflphoneteam@savoirfairelinux.com],[ring-plugins])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
dnl Silent build by default. Use make V=1 to increase verbosity
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_ARG_WITH(debug,
AS_HELP_STRING(
[--with-debug],
[Set 'full' to enable debugging information @<:@default=no@:>@]
),
[with_debug=${withval}],
[with_debug=no]
)
AC_PROG_CC_C99
dnl For target specific flags
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_HEADER_STDC
LT_PREREQ([2.2])
LT_INIT
MIGRATION_FLAGS="-DE_BOOK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
if test "x$with_debug" = "xfull" -o "x$with_debug" = "xyes"; then
CFLAGS="-g -O0 -DDEBUG -Wall -Wextra $MIGRATION_FLAGS"
else
CFLAGS="$CFLAGS -g -Wall -Wextra -Wshadow $MIGRATION_FLAGS"
fi
PKG_CHECK_MODULES(GTK, gtk+-3.0)
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2)
PKG_CHECK_MODULES(LIBEBOOK, libebook-1.2 >= 1.4)
PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 2.32],
[AC_DEFINE([LIBEDATASERVER_VERSION_2_32], [], [Using libedataserver-1.2 version 2.32 or higher])],
[PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 1.4])]
)
AC_CONFIG_FILES([
Makefile
addressbook/evolution/Makefile
addressbook/Makefile
addressbook/test/Makefile
])
AC_OUTPUT
# Global variables
src = $(top_srcdir)
ASTYLERC="$(top_srcdir)/../astylerc"
indent="/usr/bin/astyle"
sfllibdir=$(DESTDIR)$(libdir)/ring
sflplugindir=$(sfllibdir)/plugins
# Preprocessor flags
AM_CPPFLAGS = $(DEPS_CFLAGS) \
$(LIBSEXY_CFLAGS) \
-I$(src)/src \
-I$(src)/src/config \
-I$(src)/src/dbus \
-I$(src)/src/contacts \
-I$(src)/src/addressbook \
-DDATA_DIR=\""$(prefix)/share/ring"\" \
-DICONS_DIR=\""$(prefix)/share/ring"\" \
-DCODECS_DIR=\""$(prefix)/lib/ring/codecs"\" \
-DPREFIX=\"$(prefix)\" \
-DENABLE_TRACE \
-DPREFIX=\""$(prefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DRING_UIDIR=\""$(datadir)/ring/ui"\" \
-DPLUGINS_DIR=\""$(sflplugindir)"\"
indent:
@echo "Indenting code:"
if [ -f $(ASTYLERC) ] ; then \
find $(top_srcdir)/src/ -regex ".*\.\(h\|c\)" -exec $(indent) --options=$(ASTYLERC) {} \; ; \
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment