Skip to content

Commit

Permalink
First version
Browse files Browse the repository at this point in the history
  • Loading branch information
rilian-la-te committed Feb 25, 2015
0 parents commit 0c1e83b
Show file tree
Hide file tree
Showing 24 changed files with 3,466 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
project(xfce4-sntray-plugin)
cmake_minimum_required(VERSION 2.8)
cmake_policy (VERSION 2.8)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)

include(ValaPrecompile)
include(GResource)

find_package(Vala)
find_package(PkgConfig)

add_definitions(-w) # Disable gcc warnings
pkg_check_modules(GTK+ REQUIRED gtk+-3.0)
pkg_check_modules(LIBXFCE4PANEL REQUIRED libxfce4panel-2.0)

add_subdirectory(data)
add_subdirectory(src)

set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-0.1)
set(CPACK_SOURCE_GENERATOR TXZ)
set(CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp)
INCLUDE(CPack)
675 changes: 675 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# xfce4-sntray-plugin
Plugin for xfce4-panel to show StatusNotifierItems (also known as AppIndicators).
Based on ValaPanel`s StatusNotifier and xfce4-snw-plugin by equiem (https://github.com/equeim/xfce4-snw-plugin)
70 changes: 70 additions & 0 deletions cmake/vala/FindVala.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
##
# Find module for the Vala compiler (valac)
#
# This module determines wheter a Vala compiler is installed on the current
# system and where its executable is.
#
# Call the module using "find_package(Vala) from within your CMakeLists.txt.
#
# The following variables will be set after an invocation:
#
# VALA_FOUND Whether the vala compiler has been found or not
# VALA_EXECUTABLE Full path to the valac executable if it has been found
# VALA_VERSION Version number of the available valac
# VALA_USE_FILE Include this file to define the vala_precompile function
##

##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
# Copyright 2010-2011 Daniel Pfeifer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of Jakob Westhoff
##

# Search for the valac executable in the usual system paths
# Some distributions rename the valac to contain the major.minor in the binary name
find_program(VALA_EXECUTABLE NAMES valac valac-0.26 valac-0.24 valac-0.22 valac-0.20 valac-0.18 valac-0.16 valac-0.14 valac-0.12 valac-0.10)
mark_as_advanced(VALA_EXECUTABLE)

# Determine the valac version
if(VALA_EXECUTABLE)
execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
OUTPUT_VARIABLE VALA_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
endif(VALA_EXECUTABLE)

# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
# VALA_EXECUTABLE is set)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vala
REQUIRED_VARS VALA_EXECUTABLE
VERSION_VAR VALA_VERSION)

set(VALA_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVala.cmake")

67 changes: 67 additions & 0 deletions cmake/vala/GResource.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Copyright (C) 2013 Venom authors and contributors
#
# This file is part of Venom.
#
# Venom 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.
#
# Venom 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 Venom. If not, see <http://www.gnu.org/licenses/>.
#

FIND_PROGRAM(GLIB_COMPILE_RESOURCES_EXECUTABLE NAMES glib-compile-resources)
MARK_AS_ADVANCED(GLIB_COMPILE_RESOURCES_EXECUTABLE)

INCLUDE(CMakeParseArguments)

FUNCTION(GLIB_COMPILE_RESOURCES output)
CMAKE_PARSE_ARGUMENTS(ARGS "" "SOURCE" ${ARGN})
SET(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
SET(out_files "")

FOREACH(src ${ARGS_SOURCE} ${ARGS_UNPARSED_ARGUMENTS})
SET(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
GET_FILENAME_COMPONENT(WORKING_DIR ${in_file} PATH)
STRING(REPLACE ".xml" ".c" src ${src})
SET(out_file "${DIRECTORY}/${src}")
GET_FILENAME_COMPONENT(OUPUT_DIR ${out_file} PATH)
FILE(MAKE_DIRECTORY ${OUPUT_DIR})
LIST(APPEND out_files "${DIRECTORY}/${src}")

#FIXME implicit depends currently not working
EXECUTE_PROCESS(
COMMAND
${GLIB_COMPILE_RESOURCES_EXECUTABLE}
"--generate-dependencies"
${in_file}
WORKING_DIRECTORY ${WORKING_DIR}
OUTPUT_VARIABLE in_file_dep
)
STRING(REGEX REPLACE "(\r?\n)" ";" in_file_dep "${in_file_dep}")
SET(in_file_dep_path "")
FOREACH(dep ${in_file_dep})
LIST(APPEND in_file_dep_path "${WORKING_DIR}/${dep}")
ENDFOREACH(dep ${in_file_dep})
ADD_CUSTOM_COMMAND(
OUTPUT ${out_file}
WORKING_DIRECTORY ${WORKING_DIR}
COMMAND
${GLIB_COMPILE_RESOURCES_EXECUTABLE}
ARGS
"--generate-source"
"--target=${out_file}"
${in_file}
DEPENDS
${in_file};${in_file_dep_path}
)
ENDFOREACH(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
SET(${output} ${out_files} PARENT_SCOPE)
ENDFUNCTION(GLIB_COMPILE_RESOURCES)
36 changes: 36 additions & 0 deletions cmake/vala/ParseArguments.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
##
# This is a helper Macro to parse optional arguments in Macros/Functions
# It has been taken from the public CMake wiki.
# See http://www.cmake.org/Wiki/CMakeMacroParseArguments for documentation and
# licensing.
##
macro(parse_arguments prefix arg_names option_names)
set(DEFAULT_ARGS)
foreach(arg_name ${arg_names})
set(${prefix}_${arg_name})
endforeach(arg_name)
foreach(option ${option_names})
set(${prefix}_${option} FALSE)
endforeach(option)

set(current_arg_name DEFAULT_ARGS)
set(current_arg_list)
foreach(arg ${ARGN})
set(larg_names ${arg_names})
list(FIND larg_names "${arg}" is_arg_name)
if(is_arg_name GREATER -1)
set(${prefix}_${current_arg_name} ${current_arg_list})
set(current_arg_name ${arg})
set(current_arg_list)
else(is_arg_name GREATER -1)
set(loption_names ${option_names})
list(FIND loption_names "${arg}" is_option)
if(is_option GREATER -1)
set(${prefix}_${arg} TRUE)
else(is_option GREATER -1)
set(current_arg_list ${current_arg_list} ${arg})
endif(is_option GREATER -1)
endif(is_arg_name GREATER -1)
endforeach(arg)
set(${prefix}_${current_arg_name} ${current_arg_list})
endmacro(parse_arguments)
Loading

0 comments on commit 0c1e83b

Please sign in to comment.