Skip to content

Commit

Permalink
[WIP] add nautilus extension support
Browse files Browse the repository at this point in the history
still in progress

Closes haiwen/seafile#1233.

- ci: add nautilus build
- improve client auotconnect handle
- autorefresh overlay icons
- fix memory leaks and bugs
  • Loading branch information
Chilledheart committed May 16, 2015
1 parent f1226a4 commit dcfb29d
Show file tree
Hide file tree
Showing 51 changed files with 788 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cscope*
core
*.pyc
.DS_Store
compile_commands.json

# CMake files goes here
build/
Expand Down
79 changes: 79 additions & 0 deletions nautilus-seafile/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(nautilus-seafile C)
SET(PROJECT_VERSION "1.0.0")
INCLUDE(FindPkgConfig)

IF (APPLE OR NOT UNIX)
MESSAGE(FATAL_ERROR "Nautilus extension is not supported on your platform")
ENDIF()

option(BUILD_ENABLE_WARNINGS "Enable compiler warnings." ON)

if(BUILD_ENABLE_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wsign-compare -Wno-long-long -Wno-unused-parameter")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-warning-option")
endif()
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")

## color diagnostics fix
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
execute_process(COMMAND ${CMAKE_C_COMPILER}
-dumpversion OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
endif()
endif()

FIND_PACKAGE(PkgConfig REQUIRED)

PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0>=2.15)

PKG_CHECK_MODULES(NAUTILUS REQUIRED libnautilus-extension>=2.0)

PKG_CHECK_MODULES(LIBCCNET REQUIRED libccnet>=1.3)

PKG_CHECK_MODULES(LIBSEARPC REQUIRED libsearpc>=1.0)

PKG_CHECK_MODULES(LIBSEAFILE REQUIRED libseafile>=1.7)

INCLUDE_DIRECTORIES(
${GLIB2_INCLUDE_DIRS}
${NAUTILUS_INCLUDE_DIRS}
${LIBCCNET_INCLUDE_DIRS}
${LIBSEARPC_INCLUDE_DIRS}
${LIBSEAFILE_INCLUDE_DIRS})

LINK_DIRECTORIES(
${GLIB2_LIBRARY_DIRS}
${NAUTILUS_LIBRARY_DIRS}
${LIBCCNET_LIBRARY_DIRS}
${LIBSEARPC_LIBRARY_DIRS}
${LIBSEAFILE_LIBRARY_DIRS})

ADD_LIBRARY(nautilus-seafile SHARED
seafile-module.c
nautilus-seafile.c
nautilus-seafile.h
seafile-rpc-client.c
seafile-rpc-client.h
)

TARGET_LINK_LIBRARIES(nautilus-seafile
${GLIB2_LIBRARIES}
${NAUTILUS_LIBRARIES}
${JANSSON_LIBRARIES}
${LIBCCNET_LIBRARIES}
${LIBSEARPC_LIBRARIES}
${LIBSEAFILE_LIBRARIES})

INSTALL(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/hicolor
DESTINATION share/icons
)
15 changes: 15 additions & 0 deletions nautilus-seafile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Nautilus Extension For Seafile


## Prerequirement

- libsearpc
- ccnet
- seafile

## Installation
- `sudo apt-get install cmake libnautilus-extension-dev`
- `./build.sh`
- copy `libnautilus-seafile.so` to `/usr/lib/nautilus/extensions-3.0/` or `/usr/lib/nautilus/extensions-2.0/` (up to your system)
- `make install` (or `ninja install`)
- `nautilus -q`
32 changes: 32 additions & 0 deletions nautilus-seafile/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

NINJA=$(which ninja)
GENERATOR=Ninja
WORKER=ninja
if [ -z $NINJA ]; then
GENERATOR="Unix Makefiles"
WORKER=make
fi

set -x
set -e

CURRENT_PWD="$(dirname "${BASH_SOURCE[0]}")"

if [ "$(uname -s)" != "Linux" ]; then
echo "don't run it if you are not using Linux"
exit -1
fi

pushd $CURRENT_PWD
CONFIG=Debug
if [ a"$1" != "adebug" ]; then
rm -rf CMakeCache.txt CMakeFiles
CONFIG=Release
fi
cmake -G "$GENERATOR" \
-DCMAKE_BUILD_TYPE="$CONFIG" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=on
$WORKER
popd

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dcfb29d

Please sign in to comment.