Skip to content

Commit

Permalink
add caja extension
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanheaven committed Sep 10, 2014
1 parent a01ad64 commit fadad94
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 22 deletions.
3 changes: 3 additions & 0 deletions NEWS
@@ -1,5 +1,8 @@
Summary of changes for each release:

0.8.0 -
* Added Caja (MATE file manageer) extension

0.7.0 - 2013-10-30
* Added optional Nemo (Cinnamon file manager) extension
* Added more commandline options
Expand Down
2 changes: 2 additions & 0 deletions README
Expand Up @@ -20,6 +20,8 @@ Dependencies:
Nettle
NSS
mhash
File managers:
Caja
Nautilus
Nemo
Thunar
Expand Down
60 changes: 40 additions & 20 deletions configure.ac
Expand Up @@ -33,7 +33,7 @@ for opt in \
-Wwrite-strings \
-Werror=implicit-function-declaration
do
AC_MSG_CHECKING([whether "${CC}" accepts option "${opt}"])
AC_MSG_CHECKING([whether ${CC} accepts option ${opt}])
ac_save_CFLAGS="${CFLAGS}"
CFLAGS="${GTKHASH_CFLAGS} ${opt} ${CFLAGS}"
AC_COMPILE_IFELSE(
Expand All @@ -54,7 +54,7 @@ AC_MSG_CHECKING([which GTK+ version to use])
AC_ARG_WITH([gtk],
[AS_HELP_STRING([--with-gtk=2.0|3.0], [GTK+ version to use [2.0]])],
[with_gtk="${withval}"], [with_gtk="2.0"])
AC_MSG_RESULT(["${with_gtk}"])
AC_MSG_RESULT([${with_gtk}])

PKG_CHECK_MODULES([GTK], ["gtk+-${with_gtk}" >= 2.24])
AC_SUBST([GTK_CFLAGS])
Expand All @@ -64,7 +64,7 @@ AC_MSG_CHECKING([whether to enable debugging])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [enable debugging])],
[enable_debug="${enableval}"], [enable_debug="no"])
AC_MSG_RESULT(["${enable_debug}"])
AC_MSG_RESULT([${enable_debug}])

if test "${enable_debug}" = "yes" ; then
AC_DEFINE([G_DISABLE_DEPRECATED], [1], [disable glib deprecated])
Expand All @@ -81,7 +81,7 @@ AC_MSG_CHECKING([whether to use zlib])
AC_ARG_ENABLE([zlib],
[AS_HELP_STRING([--disable-zlib], [do not use zlib])],
[enable_zlib="${enableval}"], [enable_zlib="yes"])
AC_MSG_RESULT(["${enable_zlib}"])
AC_MSG_RESULT([${enable_zlib}])
AM_CONDITIONAL([ENABLE_ZLIB], [test "${enable_zlib}" = "yes"])
AC_DEFINE([ENABLE_ZLIB], [0], [Use zlib])

Expand All @@ -97,7 +97,7 @@ AC_MSG_CHECKING([whether to use the Linux-2.6.38+ hash algorithm interface])
AC_ARG_ENABLE([linux-crypto],
[AS_HELP_STRING([--enable-linux-crypto], [use the Linux-2.6.38+ hash algorithm interface])],
[enable_linux_crypto="${enableval}"], [enable_linux_crypto="no"])
AC_MSG_RESULT(["${enable_linux_crypto}"])
AC_MSG_RESULT([${enable_linux_crypto}])
AM_CONDITIONAL([ENABLE_LINUX_CRYPTO], [test "${enable_linux_crypto}" = "yes"])
AC_DEFINE([ENABLE_LINUX_CRYPTO], [0], [Use Linux Crypto])

Expand All @@ -111,7 +111,7 @@ AC_MSG_CHECKING([whether to use Libgcrypt])
AC_ARG_ENABLE([gcrypt],
[AS_HELP_STRING([--enable-gcrypt], [use Libgcrypt])],
[enable_gcrypt="${enableval}"], [enable_gcrypt="no"])
AC_MSG_RESULT(["${enable_gcrypt}"])
AC_MSG_RESULT([${enable_gcrypt}])
AM_CONDITIONAL([ENABLE_GCRYPT], [test "${enable_gcrypt}" = "yes"])
AC_DEFINE([ENABLE_GCRYPT], [0], [Use Libgcrypt])

Expand All @@ -125,7 +125,7 @@ AC_MSG_CHECKING([whether to use libcrypto])
AC_ARG_ENABLE([libcrypto],
[AS_HELP_STRING([--enable-libcrypto], [use libcrypto])],
[enable_libcrypto="${enableval}"], [enable_libcrypto="no"])
AC_MSG_RESULT(["${enable_libcrypto}"])
AC_MSG_RESULT([${enable_libcrypto}])
AM_CONDITIONAL([ENABLE_LIBCRYPTO], [test "${enable_libcrypto}" = "yes"])
AC_DEFINE([ENABLE_LIBCRYPTO], [0], [Use libcrypto])

Expand All @@ -141,7 +141,7 @@ AC_MSG_CHECKING([whether to use PolarSSL])
AC_ARG_ENABLE([polarssl],
[AS_HELP_STRING([--enable-polarssl], [use PolarSSL])],
[enable_polarssl="${enableval}"], [enable_polarssl="no"])
AC_MSG_RESULT(["${enable_polarssl}"])
AC_MSG_RESULT([${enable_polarssl}])
AM_CONDITIONAL([ENABLE_POLARSSL], [test "${enable_polarssl}" = "yes"])
AC_DEFINE([ENABLE_POLARSSL], [0], [Use PolarSSL])

Expand All @@ -158,7 +158,7 @@ AC_MSG_CHECKING([whether to use Nettle])
AC_ARG_ENABLE([nettle],
[AS_HELP_STRING([--enable-nettle], [use Nettle])],
[enable_nettle="${enableval}"], [enable_nettle="no"])
AC_MSG_RESULT(["${enable_nettle}"])
AC_MSG_RESULT([${enable_nettle}])
AM_CONDITIONAL([ENABLE_NETTLE], [test "${enable_nettle}" = "yes"])
AC_DEFINE([ENABLE_NETTLE], [0], [Use Nettle])

Expand All @@ -174,7 +174,7 @@ AC_MSG_CHECKING([whether to use NSS])
AC_ARG_ENABLE([nss],
[AS_HELP_STRING([--enable-nss], [use NSS])],
[enable_nss="${enableval}"], [enable_nss="no"])
AC_MSG_RESULT(["${enable_nss}"])
AC_MSG_RESULT([${enable_nss}])
AM_CONDITIONAL([ENABLE_NSS], [test "${enable_nss}" = "yes"])
AC_DEFINE([ENABLE_NSS], [0], [Use NSS])

Expand All @@ -190,7 +190,7 @@ AC_MSG_CHECKING([whether to use the Glib Data Checksums API])
AC_ARG_ENABLE([glib-checksums],
[AS_HELP_STRING([--disable-glib-checksums], [do not use the Glib Data Checksums API])],
[enable_glib_checksums="${enableval}"], [enable_glib_checksums="yes"])
AC_MSG_RESULT(["${enable_glib_checksums}"])
AC_MSG_RESULT([${enable_glib_checksums}])
AM_CONDITIONAL([ENABLE_GLIB_CHECKSUMS], [test "${enable_glib_checksums}" = "yes"])
AC_DEFINE([ENABLE_GLIB_CHECKSUMS], [0], [Use Glib Checksums])

Expand All @@ -203,7 +203,7 @@ AC_MSG_CHECKING([whether to use the mhash library])
AC_ARG_ENABLE([mhash],
[AS_HELP_STRING([--enable-mhash], [use the mhash library])],
[enable_mhash="${enableval}"], [enable_mhash="no"])
AC_MSG_RESULT(["${enable_mhash}"])
AC_MSG_RESULT([${enable_mhash}])
AM_CONDITIONAL([ENABLE_MHASH], [test "${enable_mhash}" = "yes"])
AC_DEFINE([ENABLE_MHASH], [0], [Use mhash])

Expand All @@ -220,7 +220,7 @@ AC_MSG_CHECKING([whether to use the internal MD6 library])
AC_ARG_ENABLE([internal-md6],
[AS_HELP_STRING([--disable-internal-md6], [do not use the internal MD6 library])],
[enable_internal_md6="${enableval}"], [enable_internal_md6="yes"])
AC_MSG_RESULT(["${enable_internal_md6}"])
AC_MSG_RESULT([${enable_internal_md6}])
AM_CONDITIONAL([ENABLE_MD6], [test "${enable_internal_md6}" = "yes"])
AC_DEFINE([ENABLE_MD6], [0], [Use MD6])

Expand All @@ -235,14 +235,30 @@ AC_MSG_CHECKING([whether to build gtkhash])
AC_ARG_ENABLE([gtkhash],
[AS_HELP_STRING([--disable-gtkhash], [do not build gtkhash])],
[enable_gtkhash="${enableval}"], [enable_gtkhash="yes"])
AC_MSG_RESULT(["${enable_gtkhash}"])
AC_MSG_RESULT([${enable_gtkhash}])
AM_CONDITIONAL([ENABLE_GTKHASH], [test "${enable_gtkhash}" = "yes"])

AC_MSG_CHECKING([whether to build the Caja extension])
AC_ARG_ENABLE([caja],
[AS_HELP_STRING([--enable-caja], [build the Caja extension])],
[enable_caja="${enableval}"], [enable_caja="no"])
AC_MSG_RESULT([${enable_caja}])
AM_CONDITIONAL([ENABLE_CAJA], [test "${enable_caja}" = "yes"])

if test "${enable_caja}" = "yes" ; then
# Check for caja
PKG_CHECK_MODULES([CAJA], [libcaja-extension])
AC_SUBST([CAJA_CFLAGS])
AC_SUBST([CAJA_LIBS])
CAJA_EXTENSION_DIR=`${PKG_CONFIG} --variable=extensiondir libcaja-extension`
AC_SUBST([CAJA_EXTENSION_DIR])
fi

AC_MSG_CHECKING([whether to build the Nautilus extension])
AC_ARG_ENABLE([nautilus],
[AS_HELP_STRING([--enable-nautilus], [build the Nautilus extension])],
[enable_nautilus="${enableval}"], [enable_nautilus="no"])
AC_MSG_RESULT(["${enable_nautilus}"])
AC_MSG_RESULT([${enable_nautilus}])
AM_CONDITIONAL([ENABLE_NAUTILUS], [test "${enable_nautilus}" = "yes"])

if test "${enable_nautilus}" = "yes" ; then
Expand All @@ -258,7 +274,7 @@ AC_MSG_CHECKING([whether to build the Nemo extension])
AC_ARG_ENABLE([nemo],
[AS_HELP_STRING([--enable-nemo], [build the Nemo extension])],
[enable_nemo="${enableval}"], [enable_nemo="no"])
AC_MSG_RESULT(["${enable_nemo}"])
AC_MSG_RESULT([${enable_nemo}])
AM_CONDITIONAL([ENABLE_NEMO], [test "${enable_nemo}" = "yes"])

if test "${enable_nemo}" = "yes" ; then
Expand All @@ -274,7 +290,7 @@ AC_MSG_CHECKING([whether to build the Thunar extension])
AC_ARG_ENABLE([thunar],
[AS_HELP_STRING([--enable-thunar], [build the Thunar extension])],
[enable_thunar="${enableval}"], [enable_thunar="no"])
AC_MSG_RESULT(["${enable_thunar}"])
AC_MSG_RESULT([${enable_thunar}])
AM_CONDITIONAL([ENABLE_THUNAR], [test "${enable_thunar}" = "yes"])

if test "${enable_thunar}" = "yes" ; then
Expand All @@ -286,8 +302,11 @@ if test "${enable_thunar}" = "yes" ; then
AC_SUBST([THUNAR_EXTENSION_DIR])
fi

AM_CONDITIONAL([ENABLE_NAUTILUS_DATA],
[test "${enable_nautilus}" = "yes" || test "${enable_nemo}" == "yes" || test "${enable_thunar}" = "yes"])
AM_CONDITIONAL([ENABLE_NAUTILUS_DATA], [
test "${enable_caja}" = "yes" ||
test "${enable_nautilus}" = "yes" ||
test "${enable_nemo}" = "yes" ||
test "${enable_thunar}" = "yes"])
AM_CONDITIONAL([ENABLE_NLS], [test "${enable_nls}" != "no"])

if test "${enable_nls}" = "no" ; then
Expand All @@ -301,7 +320,6 @@ else
fi

AC_DEFINE_UNQUOTED([G_LOG_DOMAIN], ["${PACKAGE_NAME}"], [Define the Glib log domain])

AC_DEFINE([HASH_FILE_BUFFER_SIZE], [131072], [Define file read buffer size (bytes)])
AC_DEFINE([HASH_FILE_REPORT_INTERVAL], [166], [Define progress report interval (milliseconds)])

Expand All @@ -311,6 +329,7 @@ AC_CONFIG_FILES([data/nautilus/Makefile])
AC_CONFIG_FILES([po/Makefile.in])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/hash/Makefile])
AC_CONFIG_FILES([src/caja/Makefile])
AC_CONFIG_FILES([src/nautilus/Makefile])
AC_CONFIG_FILES([src/nemo/Makefile])
AC_CONFIG_FILES([src/thunar/Makefile])
Expand All @@ -319,6 +338,7 @@ AC_OUTPUT
echo
echo "Interfaces:"
echo " gtkhash: ${enable_gtkhash} (gtk+-${with_gtk})"
echo " gtkhash-caja: ${enable_caja}"
echo " gtkhash-nautilus: ${enable_nautilus}"
echo " gtkhash-nemo: ${enable_nemo}"
echo " gtkhash-thunar: ${enable_thunar}"
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.am
@@ -1,5 +1,9 @@
SUBDIRS = hash

if ENABLE_CAJA
SUBDIRS += caja
endif

if ENABLE_NAUTILUS
SUBDIRS += nautilus
endif
Expand Down
25 changes: 25 additions & 0 deletions src/caja/Makefile.am
@@ -0,0 +1,25 @@
cajadir = $(CAJA_EXTENSION_DIR)
caja_LTLIBRARIES = libgtkhash-properties.la

libgtkhash_properties_la_SOURCES = \
../nautilus/properties.c ../nautilus/properties.h \
../nautilus/properties-hash.c ../nautilus/properties-hash.h \
../nautilus/properties-list.c ../nautilus/properties-list.h \
../nautilus/properties-prefs.c ../nautilus/properties-prefs.h

libgtkhash_properties_la_CPPFLAGS = \
$(CAJA_CFLAGS) \
-DDATADIR="\"$(pkgdatadir)/nautilus\"" \
-DLOCALEDIR="\"$(localedir)\"" \
-DIN_CAJA_EXTENSION=1

libgtkhash_properties_la_CFLAGS = $(GTKHASH_CFLAGS)

libgtkhash_properties_la_LDFLAGS = \
-avoid-version \
-export-symbols-regex ^caja_module_ \
-module \
-shared

libgtkhash_properties_la_LIBADD = \
../hash/hash.la $(CAJA_LIBS)
23 changes: 21 additions & 2 deletions src/nautilus/properties.c
Expand Up @@ -29,6 +29,9 @@
#if IN_NAUTILUS_EXTENSION
#include <libnautilus-extension/nautilus-property-page.h>
#include <libnautilus-extension/nautilus-property-page-provider.h>
#elif IN_CAJA_EXTENSION
#include <libcaja-extension/caja-property-page.h>
#include <libcaja-extension/caja-property-page-provider.h>
#elif IN_NEMO_EXTENSION
#include <libnemo-extension/nemo-property-page.h>
#include <libnemo-extension/nemo-property-page-provider.h>
Expand Down Expand Up @@ -396,6 +399,8 @@ static struct page_s *gtkhash_properties_new_page(char *uri)
static GList *gtkhash_properties_get_pages(
#if IN_NAUTILUS_EXTENSION
G_GNUC_UNUSED NautilusPropertyPageProvider *provider,
#elif IN_CAJA_EXTENSION
G_GNUC_UNUSED CajaPropertyPageProvider *provider,
#elif IN_NEMO_EXTENSION
G_GNUC_UNUSED NemoPropertyPageProvider *provider,
#elif IN_THUNAR_EXTENSION
Expand All @@ -409,11 +414,12 @@ static GList *gtkhash_properties_get_pages(

#if IN_NAUTILUS_EXTENSION
GFileType type = nautilus_file_info_get_file_type(files->data);

char *uri = nautilus_file_info_get_uri(files->data);
#elif IN_CAJA_EXTENSION
GFileType type = caja_file_info_get_file_type(files->data);
char *uri = caja_file_info_get_uri(files->data);
#elif IN_NEMO_EXTENSION
GFileType type = nemo_file_info_get_file_type(files->data);

char *uri = nemo_file_info_get_uri(files->data);
#elif IN_THUNAR_EXTENSION
GFileInfo *info = thunarx_file_info_get_file_info(files->data);
Expand All @@ -434,6 +440,9 @@ static GList *gtkhash_properties_get_pages(
#if IN_NAUTILUS_EXTENSION
NautilusPropertyPage *ppage = nautilus_property_page_new(
"GtkHash::properties", gtk_label_new(_("Digests")), page->box);
#elif IN_CAJA_EXTENSION
CajaPropertyPage *ppage = caja_property_page_new(
"GtkHash::properties", gtk_label_new(_("Digests")), page->box);
#elif IN_NEMO_EXTENSION
NemoPropertyPage *ppage = nemo_property_page_new(
"GtkHash::properties", gtk_label_new(_("Digests")), page->box);
Expand All @@ -450,6 +459,8 @@ static GList *gtkhash_properties_get_pages(
static void gtkhash_properties_iface_init(
#if IN_NAUTILUS_EXTENSION
NautilusPropertyPageProviderIface *iface
#elif IN_CAJA_EXTENSION
CajaPropertyPageProviderIface *iface
#elif IN_NEMO_EXTENSION
NemoPropertyPageProviderIface *iface
#elif IN_THUNAR_EXTENSION
Expand Down Expand Up @@ -487,6 +498,8 @@ static void gtkhash_properties_register_type(GTypeModule *module)
g_type_module_add_interface(module, page_type,
#if IN_NAUTILUS_EXTENSION
NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
#elif IN_CAJA_EXTENSION
CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
#elif IN_NEMO_EXTENSION
NEMO_TYPE_PROPERTY_PAGE_PROVIDER,
#elif IN_THUNAR_EXTENSION
Expand All @@ -503,6 +516,8 @@ static void gtkhash_properties_register_type(GTypeModule *module)

#if IN_NAUTILUS_EXTENSION
PUBLIC void nautilus_module_initialize(GTypeModule *module)
#elif IN_CAJA_EXTENSION
PUBLIC void caja_module_initialize(GTypeModule *module)
#elif IN_NEMO_EXTENSION
PUBLIC void nemo_module_initialize(GTypeModule *module)
#elif IN_THUNAR_EXTENSION
Expand All @@ -520,6 +535,8 @@ PUBLIC void thunar_extension_initialize(GTypeModule *module)

#if IN_NAUTILUS_EXTENSION
PUBLIC void nautilus_module_shutdown(void)
#elif IN_CAJA_EXTENSION
PUBLIC void caja_module_shutdown(void)
#elif IN_NEMO_EXTENSION
PUBLIC void nemo_module_shutdown(void)
#elif IN_THUNAR_EXTENSION
Expand All @@ -531,6 +548,8 @@ PUBLIC void thunar_extension_shutdown(void)

#if IN_NAUTILUS_EXTENSION
PUBLIC void nautilus_module_list_types(const GType **types, int *num_types)
#elif IN_CAJA_EXTENSION
PUBLIC void caja_module_list_types(const GType **types, int *num_types)
#elif IN_NEMO_EXTENSION
PUBLIC void nemo_module_list_types(const GType **types, int *num_types)
#elif IN_THUNAR_EXTENSION
Expand Down

0 comments on commit fadad94

Please sign in to comment.