Permalink
Browse files

libgpaste: rewrite gpaste-item in C + build it

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  • Loading branch information...
1 parent 617c36d commit a6e665ebfb291bec95b1ede8896c7260a72280cc @Keruspe committed Nov 29, 2011
Showing with 788 additions and 13 deletions.
  1. +7 −2 .gitignore
  2. +41 −3 Makefile.am
  3. +1 −1 NEWS
  4. +2 −1 README
  5. +0 −1 autogen.sh
  6. +20 −4 configure.ac
  7. +90 −0 libgpaste/gpaste-item-private.h
  8. +493 −0 libgpaste/gpaste-item.c
  9. +99 −0 libgpaste/gpaste-item.h
  10. +11 −0 libgpaste/gpaste.pc.in
  11. +22 −0 libgpaste/libgpaste.sym
  12. +1 −0 m4/.gitignore
  13. +1 −1 po/POTFILES.in
View
@@ -6,9 +6,10 @@ gpaste
!completions/gpaste
gpaste-applet
*.c
+!libgpaste/*.c
*.o
Makefile
-.aux
+build-aux
ABOUT-NLS
INSTALL
Makefile.in
@@ -18,7 +19,6 @@ config*
!configure.ac
!config.vapi
intl
-m4
.deps
*stamp*
Makefile.in.in
@@ -45,3 +45,8 @@ metadata.json
extension.js
*.anjuta*
.intltool-merge-cache
+libtool
+*.pc
+.libs
+*.la
+*.lo
View
@@ -18,9 +18,14 @@
DISTCHECK_CONFIGURE_FLAGS = \
--with-dbusservicesdir=$$dc_install_base/$(dbusservicesdir) \
--enable-applet
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AM_MAKEFLAGS = --no-print-directory
SUBDIRS = po
+LIBGPASTE_CURRENT=0
+LIBGPASTE_REVISION=0
+LIBGPASTE_AGE=0
+
# Directories
applicationsdir = $(datadir)/applications
@@ -56,13 +61,18 @@ dist_gnomeshell_DATA = \
nodist_gnomeshell_DATA = src/applets/gnome-shell/metadata.json
endif
+pkginclude_HEADERS = libgpaste/gpaste-item.h
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libgpaste/gpaste.pc
+
# Binaries
bin_PROGRAMS = gpaste
pkglibexec_PROGRAMS = gpasted gpaste-settings
if ENABLE_APPLET
pkglibexec_PROGRAMS += gpaste-applet
endif
+lib_LTLIBRARIES = libgpaste/libgpaste.la
# Sources
@@ -83,6 +93,9 @@ gpaste_applet_SOURCES = \
gpaste_settings_SOURCES = \
src/gpaste-settings/gpaste-settings.vala
+libgpaste_libgpaste_la_SOURCES = \
+ libgpaste/gpaste-item.c
+
# VALAFLAGS
AM_VALAFLAGS = \
@@ -116,11 +129,15 @@ endif
# CFLAGS
AM_CFLAGS = \
- --include config.h \
+ -include $(top_builddir)/config.h \
+ -I$(top_srcdir)/libgpaste \
+ -ffunction-sections \
+ -fdata-sections \
-DLOCALEDIR=\"${localedir}\" \
-DPKGLIBEXECDIR=\"${pkglibexecdir}\" \
$(GLIB_CFLAGS) \
$(GIO_CFLAGS)
+# -fvisibility=hidden
gpaste_CFLAGS = \
$(AM_CFLAGS)
@@ -140,12 +157,20 @@ gpaste_settings_CFLAGS = \
$(GTK_CFLAGS) \
$(AM_CFLAGS)
+libgpaste_libgpaste_la_CFLAGS = \
+ $(GDK_PIXBUF_CFLAGS) \
+ $(AM_CFLAGS)
+
# LDADD
AM_LIBS = \
$(GLIB_LIBS) \
$(GIO_LIBS)
+AM_LDFLAGS = \
+ -Wl,--gc-sections \
+ -Wl,--as-needed
+
gpaste_LDADD = \
$(AM_LIBS)
@@ -164,6 +189,18 @@ gpaste_applet_LDADD = \
$(GTK_LIBS) \
$(AM_LIBS)
+libgpaste_libgpaste_la_LIBADD = \
+ $(GDK_PIXBUF_LIBS) \
+ $(AM_LIBS)
+
+# LDFLAGS
+
+libgpaste_libgpaste_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ -version-info $(LIBGPASTE_CURRENT):$(LIBGPASTE_REVISION):$(LIBGPASTE_AGE) \
+ -Wl,--version-script=$(top_srcdir)/libgpaste/libgpaste.sym
+libgpaste_libgpaste_la_DEPENDENCIES = ${top_srcdir}/libgpaste/libgpaste.sym
+
# Distribution stuff
EXTRA_DIST = \
@@ -174,7 +211,8 @@ EXTRA_DIST = \
data/gpaste-applet.desktop.in.in \
data/gpaste-settings.desktop.in.in \
data/gpaste.1.part data/gpaste-applet.1.part \
- src/applets/gnome-shell/metadata.json.in
+ src/applets/gnome-shell/metadata.json.in \
+ libgpaste/libgpaste.sym
CLEANFILES = \
${gpaste_SOURCES:.vala=.c} \
View
@@ -1,4 +1,4 @@
-NEW in 2.1 (Not released yet)
+NEW in 2.5 (Not released yet)
=============
NEW in 2.0 (27/11/2011)
View
@@ -3,12 +3,13 @@ gpaste is its CLI client
gpaste settings is a tool to edit gpasted settings
gpaste applet is a tray icon to manage gpasted
There is also a gnome-shell native applet
+libgpaste is a library to manage the clipboard history (used by gpasted)
/!\ Don't forget to run "gpaste dr" aka "gpaste daemon-reexec" after upgrading gpaste to activate new functionalities ;)
Steps to install it after cloning:
./autogen.sh
-./configure --prefix=/usr --sysconfdir=/etc
+./configure --sysconfdir=/etc
make
sudo make install
View
@@ -1,5 +1,4 @@
#!/bin/sh
-mkdir -p m4
autoreconf -i -Wall
intltoolize --force --automake
View
@@ -16,23 +16,26 @@
# along with GPaste. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.68])
-AC_INIT([GPaste],[2.1],[Marc-Antoine@Perennou.com])
+AC_INIT([GPaste],[2.5],[Marc-Antoine@Perennou.com])
AC_SUBST([PACKAGE_NAME], ["$PACKAGE_NAME"])
AC_SUBST([PACKAGE_VERSION], ["$PACKAGE_VERSION"])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/])
AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_AUX_DIR([.aux])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_PREFIX_DEFAULT([/usr])
+LT_INIT([disable-static pic-only])
AM_INIT_AUTOMAKE([1.11 subdir-objects check-news foreign no-dist-gzip dist-xz tar-ustar -Wall])
AM_SILENT_RULES([yes])
AC_PROG_SED
AC_PROG_MKDIR_P
AC_PROG_INSTALL
AC_PROG_CC
+AC_PROG_CC_STDC
AM_PROG_CC_C_O
AM_PROG_VALAC([0.13.4])
@@ -52,6 +55,7 @@ PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0])
GTK_VALAFLAGS="--pkg=gtk+-3.0"
AC_SUBST(GTK_VALAFLAGS)
+PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0])
PKG_CHECK_MODULES(GDK, [gdk-x11-3.0 >= 3.0.0])
GDK_VALAFLAGS="--pkg=gdk-x11-3.0"
AC_SUBST(GDK_VALAFLAGS)
@@ -79,11 +83,23 @@ AC_CONFIG_FILES([
Makefile
po/Makefile.in
data/org.gnome.GPaste.gschema.xml.in
+ libgpaste/gpaste.pc
])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
+ ========
- Legacy applet: ${enable_applet}
- Gnome-Shell extension: ${enable_extension}
+ prefix: ${prefix}
+ exec_prefix: ${exec_prefix}
+ sysconfdir: ${sysconfdir}
+ libdir: ${libdir}
+ includedir: ${includedir}
+
+ compiler: ${CC}
+ cflags: ${CFLAGS}
+ ldflags: ${LDFLAGS}
+
+ Legacy applet: ${enable_applet}
+ Gnome-Shell extension: ${enable_extension}
])
@@ -0,0 +1,90 @@
+/*
+ * This file is part of GPaste.
+ *
+ * Copyright 2011 Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
+ *
+ * GPaste 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.
+ *
+ * GPaste 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 GPaste. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __G_PASTE_ITEM_PRIVATE_H__
+#define __G_PASTE_ITEM_PRIVATE_H__
+
+#include "gpaste-item.h"
+
+/* GPaste Item */
+
+/*< abstract >*/
+struct _GPasteItem
+{
+ GObject parent_instance;
+
+ /*< protected >*/
+ GPasteItemPrivate *priv;
+};
+
+struct _GPasteItemClass
+{
+ GObjectClass parent_class;
+
+ /*< virtual >*/
+ gboolean (*equals) (GPasteItem *self, GPasteItem *other);
+
+ /*< pure virtual >*/
+ gboolean (*has_value) (GPasteItem *self);
+ const gchar *(*get_kind) (GPasteItem *self);
+};
+
+/* GPaste TextItem */
+
+struct _GPasteTextItem
+{
+ GPasteItem parent_instance;
+};
+
+struct _GPasteTextItemClass
+{
+ GPasteItemClass parent_class;
+};
+
+/* GPaste UrisItem */
+
+struct _GPasteUrisItem
+{
+ GPasteTextItem parent_instance;
+
+ /*< private >*/
+ GPasteUrisItemPrivate *priv;
+};
+
+struct _GPasteUrisItemClass
+{
+ GPasteTextItemClass parent_class;
+};
+
+/* GPaste ImageItem */
+
+struct _GPasteImageItem
+{
+ GPasteItem parent_instance;
+
+ /*<private>*/
+ GPasteImageItemPrivate *priv;
+};
+
+struct _GPasteImageItemClass
+{
+ GPasteItemClass parent_class;
+};
+
+#endif /*__G_PASTE_ITEM_PRIVATE_H__*/
Oops, something went wrong.

0 comments on commit a6e665e

Please sign in to comment.