Webby fork

This commit is contained in:
Artem Anufrij 2017-07-31 20:27:03 +02:00
commit 87e243ccda
51 changed files with 5656 additions and 0 deletions

147
CMakeLists.txt Normal file
View file

@ -0,0 +1,147 @@
project(Webby)
cmake_minimum_required (VERSION 2.8)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)
#
# Base bits
#
set (CMAKE_C_FLAGS "-ggdb")
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
set (PKGDATADIR "${DATADIR}/webby")
set (GETTEXT_PACKAGE "webby")
set (RELEASE_NAME "Webby")
set (VERSION "1.0")
set (VERSION_INFO "Release")
#
# Niceties
#
set (ARCHIVE_NAME webby-${VERSION})
add_custom_target (dist
COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target (distcheck
COMMAND cd ${CMAKE_BINARY_DIR}
&& rm -rf ${ARCHIVE_NAME}
&& tar xf ${ARCHIVE_NAME}.tar.bz2
&& mkdir ${ARCHIVE_NAME}/build
&& cd ${ARCHIVE_NAME}/build
&& cmake -DCMAKE_INSTALL_PREFIX=../install -DGSETTINGS_LOCALINSTALL=ON .. -DCMAKE_MODULE_PATH=/usr/share/cmake
&& make -j8
&& make -j8 install
&& make check
)
add_dependencies(distcheck dist)
add_custom_target (uninstall "${CMAKE_COMMAND}" -P
"${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake")
#
# config.h
#
configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
add_definitions(-include config.h)
#
# Data
#
file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/data/files/*")
install (FILES ${_datafiles} DESTINATION ${PKGDATADIR}/files)
file (GLOB _imagefiles "${CMAKE_CURRENT_SOURCE_DIR}/data/icons/*")
install (FILES ${_imagefiles} DESTINATION ${PKGDATADIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/webby.desktop DESTINATION /usr/share/applications)
#
# Icons
#
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/icons/webby.svg DESTINATION share/icons/hicolor/scalable/apps/)
option (ICON_UPDATE "Run gtk-update-icon-cache after the install." ON)
if (ICON_UPDATE)
install (CODE "message(\"-- Updating icon cache...\")")
install (CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor)")
endif ()
#
# i18n
#
add_subdirectory(vapi)
add_subdirectory(po)
#
# SRC
#
find_package(PkgConfig)
pkg_check_modules(DEPS REQUIRED gobject-2.0 glib-2.0 gio-2.0 gtk+-3.0>=3.12 gthread-2.0 granite gee-0.8 webkit2gtk-3.0 libsoup-2.4 gdk-pixbuf-2.0)
add_definitions(${DEPS_CFLAGS})
link_libraries(${DEPS_LIBRARIES})
link_directories(${DEPS_LIBRARY_DIRS})
find_package(Vala REQUIRED)
include(ValaVersion)
ensure_vala_version("0.26.0" MINIMUM)
set(PKG_DEPS gtk+-3.0
granite
gio-2.0
gee-0.8
posix
webkit2gtk-3.0
libsoup-2.4
gdk-pixbuf-2.0)
set(SRC_FILES
src/Widgets/ApplicationIcon.vala
src/Widgets/ApplicationsView.vala
src/AppWindow.vala
src/Assistant.vala
src/DesktopFile.vala
src/InfoDialog.vala
src/Launcher.vala
src/Settings.vala
src/UrlEntry.vala
src/WebApp.vala
src/WebBar.vala
src/Webby.vala
src/WebAppWindow.vala)
#
# schema
#
add_subdirectory (schemas)
include(ValaPrecompile)
vala_precompile(VALA_C ${SRC_FILES} PACKAGES ${PKG_DEPS}
CUSTOM_VAPIS
vapi/config.vapi
OPTIONS
--vapidir=${CMAKE_SOURCE_DIR}/vapi
--thread
-g
--debug
--target-glib=2.32
)
add_definitions(${CFLAGS}-lm -Wall -Winit-self -Wwrite-strings -Wunreachable-code -Wstrict-prototypes)
add_executable(webby ${VALA_C})
target_link_libraries(webby ${SQLITE_LIBRARIES} ${CLUTTERGTK_LIBRARIES} -lm)
install(TARGETS webby RUNTIME DESTINATION bin)

24
INSTALL Normal file
View file

@ -0,0 +1,24 @@
--------------------------------------------------------------------------------
OPTIONAL
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
REQUIRED
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
DEPENDENCIES
--------------------------------------------------------------------------------
gtk+-3.0, granite, gio-2.0, gee-0.8, clutter-gtk-1.0, clutter-1.0, posix, webkit2gtk-3.0, libsoup-2.4
--------------------------------------------------------------------------------
BUILDING
--------------------------------------------------------------------------------
bzr branch lp:webby-browser
cd webby-browser
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

42
cmake/GSettings.cmake Normal file
View file

@ -0,0 +1,42 @@
# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" ON)
option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ${GSETTINGS_LOCALINSTALL})
if(GSETTINGS_LOCALINSTALL)
message(STATUS "GSettings schemas will be installed locally.")
endif()
if(GSETTINGS_COMPILE)
message(STATUS "GSettings shemas will be compiled.")
endif()
macro(add_schema SCHEMA_NAME)
set(PKG_CONFIG_EXECUTABLE pkg-config)
# Have an option to not install the schema into where GLib is
if (GSETTINGS_LOCALINSTALL)
SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
else (GSETTINGS_LOCALINSTALL)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
endif (GSETTINGS_LOCALINSTALL)
# Run the validator and error if it fails
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
if (_schemas_invalid)
message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
endif (_schemas_invalid)
# Actually install and recomple schemas
message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
if (GSETTINGS_COMPILE)
install (CODE "message (STATUS \"Compiling GSettings schemas\")")
install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
endif ()
endmacro()

286
cmake/Makefile Normal file
View file

@ -0,0 +1,286 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/mefrio/Scrivania/cmake
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/mefrio/Scrivania/cmake/cmake
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
/usr/bin/cmake -i .
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles /home/mefrio/Scrivania/cmake/cmake/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named scratch
# Build rule for target.
scratch: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 scratch
.PHONY : scratch
# fast build rule for target.
scratch/fast:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/build
.PHONY : scratch/fast
src/entry.o: src/entry.c.o
.PHONY : src/entry.o
# target to build an object file
src/entry.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.o
.PHONY : src/entry.c.o
src/entry.i: src/entry.c.i
.PHONY : src/entry.i
# target to preprocess a source file
src/entry.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.i
.PHONY : src/entry.c.i
src/entry.s: src/entry.c.s
.PHONY : src/entry.s
# target to generate assembly for a file
src/entry.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.s
.PHONY : src/entry.c.s
src/main_window.o: src/main_window.c.o
.PHONY : src/main_window.o
# target to build an object file
src/main_window.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.o
.PHONY : src/main_window.c.o
src/main_window.i: src/main_window.c.i
.PHONY : src/main_window.i
# target to preprocess a source file
src/main_window.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.i
.PHONY : src/main_window.c.i
src/main_window.s: src/main_window.c.s
.PHONY : src/main_window.s
# target to generate assembly for a file
src/main_window.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.s
.PHONY : src/main_window.c.s
src/menu.o: src/menu.c.o
.PHONY : src/menu.o
# target to build an object file
src/menu.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.o
.PHONY : src/menu.c.o
src/menu.i: src/menu.c.i
.PHONY : src/menu.i
# target to preprocess a source file
src/menu.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.i
.PHONY : src/menu.c.i
src/menu.s: src/menu.c.s
.PHONY : src/menu.s
# target to generate assembly for a file
src/menu.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.s
.PHONY : src/menu.c.s
src/notebook.o: src/notebook.c.o
.PHONY : src/notebook.o
# target to build an object file
src/notebook.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.o
.PHONY : src/notebook.c.o
src/notebook.i: src/notebook.c.i
.PHONY : src/notebook.i
# target to preprocess a source file
src/notebook.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.i
.PHONY : src/notebook.c.i
src/notebook.s: src/notebook.c.s
.PHONY : src/notebook.s
# target to generate assembly for a file
src/notebook.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.s
.PHONY : src/notebook.c.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... rebuild_cache"
@echo "... scratch"
@echo "... src/entry.o"
@echo "... src/entry.i"
@echo "... src/entry.s"
@echo "... src/main_window.o"
@echo "... src/main_window.i"
@echo "... src/main_window.s"
@echo "... src/menu.o"
@echo "... src/menu.i"
@echo "... src/menu.s"
@echo "... src/notebook.o"
@echo "... src/notebook.i"
@echo "... src/notebook.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

10
cmake/README Normal file
View file

@ -0,0 +1,10 @@
Elementary CMake modules
This is a set of CMake modules: Translations, GSettings, and Vala modules.
For all the Vala related modules see README.Vala.rst:
- ParseArguments.cmake
- ValaPrecompile.cmake
- ValaVersion.cmake
- FindVala.cmake

173
cmake/README.Vala.rst Normal file
View file

@ -0,0 +1,173 @@
==========
Vala CMake
==========
:Author:
Jakob Westhoff
:Version:
Draft
Overview
========
Vala CMake is a collection of macros for the CMake_ build system to allow the
creation and management of projects developed using the Vala_ programming
language or its "Genie" flavor (less tested).
Installation
============
To use the Vala macros in your own project you need to copy the macro files to
an arbitrary folder in your projects directory and reference them in your
``CMakeLists.txt`` file.
Assuming the macros are stored under ``cmake/vala`` in your projects folder you
need to add the following information to your base ``CMakeLists.txt``::
list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake/vala
)
After the new module path as been added you can simply include the provided
modules or use the provided find routines.
Finding Vala
============
The find module for vala works like any other Find module in CMake.
You can use it by simply calling the usual ``find_package`` function. Default
parameters like ``REQUIRED`` and ``QUIETLY`` are supported.
::
find_package(Vala REQUIRED)
After a successful call to the find_package function the following variables
will be set:
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
Precompiling Vala sources
=========================
CMake is mainly supposed to handle c or c++ based projects. Luckily every vala
program is translated into plain c code using the vala compiler, followed by
normal compilation of the generated c program using gcc.
The macro ``vala_precompile`` uses that fact to create c files from your .vala
sources for further CMake processing.
The first parameter provided is a variable, which will be filled with a list of
c files outputted by the vala compiler. This list can than be used in
conjunction with functions like ``add_executable`` or others to create the
necessary compile rules with CMake.
The initial variable is followed by a list of .vala files to be compiled.
Please take care to add every vala file belonging to the currently compiled
project or library as Vala will otherwise not be able to resolve all
dependencies.
The following sections may be specified afterwards to provide certain options
to the vala compiler:
PACKAGES
A list of vala packages/libraries to be used during the compile cycle. The
package names are exactly the same, as they would be passed to the valac
"--pkg=" option.
OPTIONS
A list of optional options to be passed to the valac executable. This can be
used to pass "--thread" for example to enable multi-threading support.
DIRECTORY
Specify the directory where the output source files will be stored. If
ommitted, the source files will be stored in CMAKE_CURRENT_BINARY_DIR.
CUSTOM_VAPIS
A list of custom vapi files to be included for compilation. This can be
useful to include freshly created vala libraries without having to install
them in the system.
GENERATE_VAPI
Pass all the needed flags to the compiler to create an internal vapi for
the compiled library. The provided name will be used for this and a
<provided_name>.vapi file will be created.
GENERATE_HEADER
Let the compiler generate a header file for the compiled code. There will
be a header file as well as an internal header file being generated called
<provided_name>.h and <provided_name>_internal.h
The following call is a simple example to the vala_precompile macro showing an
example to every of the optional sections::
vala_precompile(VALA_C
source1.vala
source2.vala
source3.vala
PACKAGES
gtk+-2.0
gio-1.0
posix
OPTIONS
--thread
CUSTOM_VAPIS
some_vapi.vapi
GENERATE_VAPI
myvapi
GENERATE_HEADER
myheader
)
Most important is the variable VALA_C which will contain all the generated c
file names after the call. The easiest way to use this information is to tell
CMake to create an executable out of it.
::
add_executable(myexecutable ${VALA_C})
Further reading
===============
The `Pdf Presenter Console`__ , which is a vala based project of mine, makes
heavy usage of the here described macros. To look at a real world example of
these macros the mentioned project is the right place to take a look. The svn
trunk of it can be found at::
svn://pureenergy.cc/pdf_presenter_console/trunk
__ http://westhoffswelt.de/projects/pdf_presenter_console.html
Acknowledgments
===============
Thanks go out to Florian Sowade, a fellow local PHP-Usergroupie, who helped me
a lot with the initial version of this macros and always answered my mostly
dumb CMake questions.
.. _CMake: http://cmake.org
.. _Vala: http://live.gnome.org/Vala
.. _Genie: http://live.gnome.org/Genie
..
Local Variables:
mode: rst
fill-column: 79
End:
vim: et syn=rst tw=79

41
cmake/Translations.cmake Normal file
View file

@ -0,0 +1,41 @@
# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
macro(add_translations_directory NLS_PACKAGE)
add_custom_target (i18n ALL COMMENT “Building i18n messages.”)
find_program (MSGFMT_EXECUTABLE msgfmt)
file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
foreach (PO_INPUT ${PO_FILES})
get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
install (FILES ${MO_OUTPUT} DESTINATION
share/locale/${PO_INPUT_BASE}/LC_MESSAGES
RENAME ${NLS_PACKAGE}.mo)
endforeach (PO_INPUT ${PO_FILES})
endmacro(add_translations_directory)
macro(add_translations_catalog NLS_PACKAGE)
add_custom_target (pot COMMENT “Building translation catalog.”)
find_program (XGETTEXT_EXECUTABLE xgettext)
set(C_SOURCE "")
foreach(FILES_INPUT ${ARGN})
file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
foreach(C_FILE ${SOURCE_FILES})
set(C_SOURCE ${C_SOURCE} ${C_FILE})
endforeach()
file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
foreach(C_FILE ${SOURCE_FILES})
set(C_SOURCE ${C_SOURCE} ${C_FILE})
endforeach()
endforeach()
add_custom_command (TARGET pot COMMAND
${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
${VALA_SOURCE} ${C_SOURCE} --keyword="_" --from-code=UTF-8
)
endmacro()

21
cmake/uninstall.cmake Normal file
View file

@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif()
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if(EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif()
else(EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif()
endforeach()

65
cmake/vala/FindVala.cmake Normal file
View file

@ -0,0 +1,65 @@
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
#
# 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
##
##
# 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
##
# Search for the valac executable in the usual system paths.
find_program(VALA_EXECUTABLE
NAMES valac)
# 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 DEFAULT_MSG VALA_EXECUTABLE)
mark_as_advanced(VALA_EXECUTABLE)
# Determine the valac version
if(VALA_FOUND)
execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
OUTPUT_VARIABLE "VALA_VERSION")
string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
string(STRIP ${VALA_VERSION} "VALA_VERSION")
endif(VALA_FOUND)

View file

@ -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)

View file

@ -0,0 +1,175 @@
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
#
# 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
##
include(ParseArguments)
find_package(Vala REQUIRED)
##
# Compile vala files to their c equivalents for further processing.
#
# The "vala_precompile" macro takes care of calling the valac executable on the
# given source to produce c files which can then be processed further using
# default cmake functions.
#
# The first parameter provided is a variable, which will be filled with a list
# of c files outputted by the vala compiler. This list can than be used in
# conjuction with functions like "add_executable" or others to create the
# neccessary compile rules with CMake.
#
# The initial variable is followed by a list of .vala files to be compiled.
# Please take care to add every vala file belonging to the currently compiled
# project or library as Vala will otherwise not be able to resolve all
# dependencies.
#
# The following sections may be specified afterwards to provide certain options
# to the vala compiler:
#
# PACKAGES
# A list of vala packages/libraries to be used during the compile cycle. The
# package names are exactly the same, as they would be passed to the valac
# "--pkg=" option.
#
# OPTIONS
# A list of optional options to be passed to the valac executable. This can be
# used to pass "--thread" for example to enable multi-threading support.
#
# CUSTOM_VAPIS
# A list of custom vapi files to be included for compilation. This can be
# useful to include freshly created vala libraries without having to install
# them in the system.
#
# GENERATE_VAPI
# Pass all the needed flags to the compiler to create an internal vapi for
# the compiled library. The provided name will be used for this and a
# <provided_name>.vapi file will be created.
#
# GENERATE_HEADER
# Let the compiler generate a header file for the compiled code. There will
# be a header file as well as an internal header file being generated called
# <provided_name>.h and <provided_name>_internal.h
#
# The following call is a simple example to the vala_precompile macro showing
# an example to every of the optional sections:
#
# vala_precompile(VALA_C
# source1.vala
# source2.vala
# source3.vala
# PACKAGES
# gtk+-2.0
# gio-1.0
# posix
# DIRECTORY
# gen
# OPTIONS
# --thread
# CUSTOM_VAPIS
# some_vapi.vapi
# GENERATE_VAPI
# myvapi
# GENERATE_HEADER
# myheader
# )
#
# Most important is the variable VALA_C which will contain all the generated c
# file names after the call.
##
macro(vala_precompile output)
parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
if(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
else(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(ARGS_DIRECTORY)
include_directories(${DIRECTORY})
set(vala_pkg_opts "")
foreach(pkg ${ARGS_PACKAGES})
list(APPEND vala_pkg_opts "--pkg=${pkg}")
endforeach(pkg ${ARGS_PACKAGES})
set(in_files "")
set(out_files "")
set(${output} "")
foreach(src ${ARGS_DEFAULT_ARGS})
list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
string(REPLACE ".vala" ".c" src ${src})
string(REPLACE ".gs" ".c" src ${src})
set(out_file "${DIRECTORY}/${src}")
list(APPEND out_files "${DIRECTORY}/${src}")
list(APPEND ${output} ${out_file})
endforeach(src ${ARGS_DEFAULT_ARGS})
set(custom_vapi_arguments "")
if(ARGS_CUSTOM_VAPIS)
foreach(vapi ${ARGS_CUSTOM_VAPIS})
if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
list(APPEND custom_vapi_arguments ${vapi})
else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
endforeach(vapi ${ARGS_CUSTOM_VAPIS})
endif(ARGS_CUSTOM_VAPIS)
set(vapi_arguments "")
if(ARGS_GENERATE_VAPI)
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
# Header and internal header is needed to generate internal vapi
if (NOT ARGS_GENERATE_HEADER)
set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
endif(NOT ARGS_GENERATE_HEADER)
endif(ARGS_GENERATE_VAPI)
set(header_arguments "")
if(ARGS_GENERATE_HEADER)
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
endif(ARGS_GENERATE_HEADER)
add_custom_command(OUTPUT ${out_files}
COMMAND
${VALA_EXECUTABLE}
ARGS
"-C"
${header_arguments}
${vapi_arguments}
"-b" ${CMAKE_CURRENT_SOURCE_DIR}
"-d" ${DIRECTORY}
${vala_pkg_opts}
${ARGS_OPTIONS}
${in_files}
${custom_vapi_arguments}
DEPENDS
${in_files}
${ARGS_CUSTOM_VAPIS}
)
endmacro(vala_precompile)

View file

@ -0,0 +1,96 @@
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
#
# 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
##
include(ParseArguments)
find_package(Vala REQUIRED)
##
# Ensure a certain valac version is available
#
# The initial argument is the version to check for
#
# It may be followed by a optional parameter to specifiy a version range. The
# following options are valid:
#
# EXACT
# Vala needs to be available in the exact version given
#
# MINIMUM
# The provided version is the minimum version. Therefore Vala needs to be
# available in the given version or any higher version
#
# MAXIMUM
# The provided version is the maximum. Therefore Vala needs to be available
# in the given version or any version older than this
#
# If no option is specified the version will be treated as a minimal version.
##
macro(ensure_vala_version version)
parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN})
set(compare_message "")
set(error_message "")
if(ARGS_MINIMUM)
set(compare_message "a minimum ")
set(error_message "or greater ")
elseif(ARGS_MAXIMUM)
set(compare_message "a maximum ")
set(error_message "or less ")
endif(ARGS_MINIMUM)
message(STATUS
"checking for ${compare_message}Vala version of ${version}"
)
unset(version_accepted)
# MINIMUM is the default if no option is specified
if(ARGS_EXACT)
if(${VALA_VERSION} VERSION_EQUAL ${version} )
set(version_accepted TRUE)
endif(${VALA_VERSION} VERSION_EQUAL ${version})
elseif(ARGS_MAXIMUM)
if(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
set(version_accepted TRUE)
endif(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
else(ARGS_MAXIMUM)
if(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
set(version_accepted TRUE)
endif(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
endif(ARGS_EXACT)
if (NOT version_accepted)
message(FATAL_ERROR
"Vala version ${version} ${error_message}is required."
)
endif(NOT version_accepted)
message(STATUS
" found Vala, version ${VALA_VERSION}"
)
endmacro(ensure_vala_version)

11
config.h.cmake Normal file
View file

@ -0,0 +1,11 @@
#ifndef CONFIG_H
#define CONFIG_H
#cmakedefine DATADIR "@DATADIR@"
#cmakedefine PKGDATADIR "@PKGDATADIR@"
#cmakedefine GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
#cmakedefine RELEASE_NAME "@RELEASE_NAME@"
#cmakedefine VERSION "@VERSION@"
#cmakedefine VERSION_INFO "@VERSION_INFO@"
#endif // CONFIG_H

759
data/icons/webby.svg Normal file
View file

@ -0,0 +1,759 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="128"
height="128"
id="svg3049"
inkscape:version="0.48.4 r9939"
sodipodi:docname="webby.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="713"
id="namedview51"
showgrid="false"
inkscape:zoom="2.8284271"
inkscape:cx="73.655329"
inkscape:cy="86.427124"
inkscape:window-x="0"
inkscape:window-y="30"
inkscape:window-maximized="1"
inkscape:current-layer="svg3049">
<inkscape:grid
type="xygrid"
id="grid3942"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<defs
id="defs3051">
<linearGradient
id="linearGradient4040">
<stop
offset="0"
style="stop-color:#ff7a35;stop-opacity:1"
id="stop4042" />
<stop
offset="1"
style="stop-color:#f0431a;stop-opacity:1"
id="stop4044" />
</linearGradient>
<linearGradient
x1="167.98311"
y1="8.50811"
x2="167.98311"
y2="54.780239"
id="linearGradient5228"
xlink:href="#linearGradient5803"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.832495,0,0,1.8439152,-232.17581,-55.441403)" />
<linearGradient
id="linearGradient5803">
<stop
id="stop5805"
style="stop-color:#fff5ef;stop-opacity:1"
offset="0" />
<stop
id="stop5807"
style="stop-color:#fef8dd;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="23.99999"
y1="4.999989"
x2="23.99999"
y2="43"
id="linearGradient4136"
xlink:href="#linearGradient3924"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.7297298,0,0,2.7297298,-1.5135175,-62.511681)" />
<linearGradient
id="linearGradient3924">
<stop
id="stop3926"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop3928"
style="stop-color:#ffffff;stop-opacity:0.23529412"
offset="0.06316455" />
<stop
id="stop3930"
style="stop-color:#ffffff;stop-opacity:0.15686275"
offset="0.95056331" />
<stop
id="stop3932"
style="stop-color:#ffffff;stop-opacity:0.39215687"
offset="1" />
</linearGradient>
<radialGradient
cx="6.7304144"
cy="9.9571075"
r="12.671875"
fx="6.2001843"
fy="9.9571075"
id="radialGradient5264-4"
xlink:href="#linearGradient2867-449-88-871-390-598-476-591-434-148-57-177-8-3-3-6-4-8-8-8"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,25.083279,-30.794253,0,372.81656,-272.08999)" />
<linearGradient
id="linearGradient2867-449-88-871-390-598-476-591-434-148-57-177-8-3-3-6-4-8-8-8">
<stop
id="stop3750-1-0-7-6-6-1-3-9"
style="stop-color:#ffcd7d;stop-opacity:1"
offset="0" />
<stop
id="stop3752-3-7-4-0-32-8-923-0"
style="stop-color:#fc8f36;stop-opacity:1"
offset="0.26238" />
<stop
id="stop3754-1-8-5-2-7-6-7-1"
style="stop-color:#e23a0e;stop-opacity:1"
offset="0.704952" />
<stop
id="stop3756-1-6-2-6-6-1-96-6"
style="stop-color:#ac441f;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="4.9929786"
cy="43.5"
r="2.5"
fx="4.9929786"
fy="43.5"
id="radialGradient4093"
xlink:href="#linearGradient3688-166-749-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)" />
<linearGradient
id="linearGradient3688-166-749-5">
<stop
id="stop2883-0"
style="stop-color:#181818;stop-opacity:1"
offset="0" />
<stop
id="stop2885-5"
style="stop-color:#181818;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="4.9929786"
cy="43.5"
r="2.5"
fx="4.9929786"
fy="43.5"
id="radialGradient4095"
xlink:href="#linearGradient3688-464-309-8"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)" />
<linearGradient
id="linearGradient3688-464-309-8">
<stop
id="stop2889-9"
style="stop-color:#181818;stop-opacity:1"
offset="0" />
<stop
id="stop2891-4"
style="stop-color:#181818;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="25.058096"
y1="47.027729"
x2="25.058096"
y2="39.999443"
id="linearGradient4097"
xlink:href="#linearGradient3702-501-757-0"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3702-501-757-0">
<stop
id="stop2895-0"
style="stop-color:#181818;stop-opacity:0"
offset="0" />
<stop
id="stop2897-2"
style="stop-color:#181818;stop-opacity:1"
offset="0.5" />
<stop
id="stop2899-6"
style="stop-color:#181818;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3811">
<stop
id="stop3813"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop3815"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="-4.0287771"
cy="93.467628"
r="35.338131"
fx="-4.0287771"
fy="93.467628"
id="radialGradient6276"
xlink:href="#linearGradient3811"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.5563924,0,0,0.16978827,70.270355,38.132099)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3811"
id="radialGradient3944"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.5563924,0,0,0.16978827,70.270355,38.132099)"
cx="-4.0287771"
cy="93.467628"
fx="-4.0287771"
fy="93.467628"
r="35.338131" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3688-166-749-5"
id="radialGradient3946"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)"
cx="4.9929786"
cy="43.5"
fx="4.9929786"
fy="43.5"
r="2.5" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3688-464-309-8"
id="radialGradient3948"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)"
cx="4.9929786"
cy="43.5"
fx="4.9929786"
fy="43.5"
r="2.5" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3702-501-757-0"
id="linearGradient3950"
gradientUnits="userSpaceOnUse"
x1="25.058096"
y1="47.027729"
x2="25.058096"
y2="39.999443" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2867-449-88-871-390-598-476-591-434-148-57-177-8-3-3-6-4-8-8-8"
id="radialGradient3952"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,25.083279,-30.794253,0,372.81656,-272.08999)"
cx="6.7304144"
cy="9.9571075"
fx="6.2001843"
fy="9.9571075"
r="12.671875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3924"
id="linearGradient3954"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.7297298,0,0,2.7297298,-1.5135175,-62.511681)"
x1="23.99999"
y1="4.999989"
x2="23.99999"
y2="43" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5803"
id="linearGradient3956"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.832495,0,0,1.8439152,-232.17581,-55.441403)"
x1="167.98311"
y1="8.50811"
x2="167.98311"
y2="54.780239" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5803"
id="linearGradient3959"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.832495,0,0,1.8439152,-232.17581,8.558597)"
x1="167.98311"
y1="8.50811"
x2="167.98311"
y2="54.780239" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3924"
id="linearGradient3965"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.7297298,0,0,2.7297298,-1.5135175,1.488319)"
x1="23.99999"
y1="4.999989"
x2="23.99999"
y2="43" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4040"
id="radialGradient3968"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,25.083279,-30.794253,0,372.81656,-208.08999)"
cx="6.7304144"
cy="9.9571075"
fx="6.2001843"
fy="9.9571075"
r="12.671875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3811"
id="radialGradient3976"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.5563924,0,0,0.16978827,70.270355,102.1321)"
cx="-4.0287771"
cy="93.467628"
fx="-4.0287771"
fy="93.467628"
r="35.338131" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3924-4-8"
id="linearGradient3007"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.2972973,0,0,0.2972973,-0.13513027,-0.1351298)"
x1="23.99999"
y1="4.999989"
x2="23.99999"
y2="43" />
<linearGradient
id="linearGradient3924-4-8">
<stop
id="stop3926-0-4"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop3928-6-8"
style="stop-color:#ffffff;stop-opacity:0.23529412"
offset="0.06316455" />
<stop
id="stop3930-2-1"
style="stop-color:#ffffff;stop-opacity:0.15686275"
offset="0.95056331" />
<stop
id="stop3932-9-0"
style="stop-color:#ffffff;stop-opacity:0.39215687"
offset="1" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4067-0-2"
id="radialGradient3879"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,3.1658508,-3.8866533,0,45.97684,-27.720323)"
cx="6.7304144"
cy="9.9571075"
fx="6.2001843"
fy="9.9571075"
r="12.671875" />
<linearGradient
id="linearGradient4067-0-2">
<stop
id="stop4069-2-9"
style="stop-color:#ffe452;stop-opacity:1"
offset="0" />
<stop
id="stop4071-8-9"
style="stop-color:#ffeb41;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4644-104-3-3-6-2-0"
id="radialGradient3015"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,3.1658508,-3.8866533,0,46.97684,-26.720326)"
cx="6.7304144"
cy="9.9571075"
fx="6.2001843"
fy="9.9571075"
r="12.671875" />
<linearGradient
id="linearGradient4644-104-3-3-6-2-0">
<stop
id="stop5237-6-5-1-7-8"
style="stop-color:#ff7a35;stop-opacity:1"
offset="0" />
<stop
id="stop5239-4-6-4-8-5"
style="stop-color:#f0431a;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
r="12.671875"
fy="9.9571075"
fx="6.2001843"
cy="9.9571075"
cx="6.7304144"
gradientTransform="matrix(0,3.1658508,-3.8866533,0,45.97684,-27.720323)"
gradientUnits="userSpaceOnUse"
id="radialGradient3100"
xlink:href="#linearGradient4644-104-3-3-6-2-0"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4644-104-3-3-6-2-0"
id="radialGradient4034"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,3.1658508,-3.8866533,0,203.97684,62.279676)"
cx="6.7304144"
cy="9.9571075"
fx="6.2001843"
fy="9.9571075"
r="12.671875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4067-0-2"
id="radialGradient4036"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,3.1658508,-3.8866533,0,203.97684,62.279676)"
cx="6.7304144"
cy="9.9571075"
fx="6.2001843"
fy="9.9571075"
r="12.671875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3924-4-8"
id="linearGradient4038"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.2972973,0,0,0.2972973,157.86487,89.864869)"
x1="23.99999"
y1="4.999989"
x2="23.99999"
y2="43" />
<radialGradient
cx="4.9929786"
cy="43.5"
r="2.5"
fx="4.9929786"
fy="43.5"
id="radialGradient3176"
xlink:href="#linearGradient3688-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)" />
<linearGradient
id="linearGradient3688-5">
<stop
id="stop3690-8"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop3692-6"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="4.9929786"
cy="43.5"
r="2.5"
fx="4.9929786"
fy="43.5"
id="radialGradient3178"
xlink:href="#linearGradient3688-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)" />
<linearGradient
id="linearGradient3037">
<stop
id="stop3039"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop3041"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="25.058096"
y1="47.027729"
x2="25.058096"
y2="39.999443"
id="linearGradient3180"
xlink:href="#linearGradient3702-4-7"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3702-4-7">
<stop
id="stop3704-7-8"
style="stop-color:#000000;stop-opacity:0"
offset="0" />
<stop
id="stop3710-0-0"
style="stop-color:#000000;stop-opacity:1"
offset="0.5" />
<stop
id="stop3706-7-2"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="676"
cy="-233.5"
r="29.5"
fx="680.40613"
fy="-249.59378"
id="radialGradient3169"
xlink:href="#linearGradient4747-3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.81780319,1.9067797e-8,-1.5649504e-8,0.65951858,-536.83494,170.99757)" />
<linearGradient
id="linearGradient4747-3">
<stop
id="stop4749-7"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop9072-8"
style="stop-color:#f7f7f7;stop-opacity:1"
offset="0.5" />
<stop
id="stop4751-3"
style="stop-color:#dbe0e1;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="680.5658"
cy="365.6579"
r="12.052631"
fx="680.60205"
fy="355.25784"
id="radialGradient3164"
xlink:href="#linearGradient9165-59"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.59927171,0,0,0.59403611,-389.15478,-205.61691)" />
<linearGradient
id="linearGradient9165-59">
<stop
id="stop9167-6"
style="stop-color:#b6c5cc;stop-opacity:1"
offset="0" />
<stop
id="stop9169-9"
style="stop-color:#e5f0f6;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="680.5658"
cy="365.6579"
r="12.052631"
fx="681.32629"
fy="354.21619"
id="radialGradient3182"
xlink:href="#linearGradient9165-5-1"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient9165-5-1">
<stop
id="stop9167-7-12"
style="stop-color:#acb9bf;stop-opacity:1"
offset="0" />
<stop
id="stop9169-0-4"
style="stop-color:#acb9bf;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="20.153708"
y1="3.0216999"
x2="20.153708"
y2="26.666777"
id="linearGradient4015"
xlink:href="#linearGradient4017"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4017">
<stop
id="stop4019"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop4021"
style="stop-color:#ffffff;stop-opacity:0.23529412"
offset="0.49550432" />
<stop
id="stop4023"
style="stop-color:#ffffff;stop-opacity:0.15686275"
offset="0.88038814" />
<stop
id="stop4025"
style="stop-color:#ffffff;stop-opacity:0.39215687"
offset="1" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4747-3-8"
id="radialGradient3107"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.81780319,1.9067797e-8,-1.5649504e-8,0.65951858,-540.08917,170.72639)"
cx="676"
cy="-233.5"
fx="680.40613"
fy="-249.59378"
r="29.5" />
<linearGradient
id="linearGradient4747-3-8">
<stop
id="stop4749-7-5"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop9072-8-6"
style="stop-color:#f7f7f7;stop-opacity:1"
offset="0.5" />
<stop
id="stop4751-3-4"
style="stop-color:#dbe0e1;stop-opacity:1"
offset="1" />
</linearGradient>
</defs>
<metadata
id="metadata3054">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<path
style="opacity:0.2;color:#000000;fill:url(#radialGradient3976);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path3041"
inkscape:connector-curvature="0"
d="m 119,118.00181 a 55,6 0 0 1 -109.9999975,0 55,6 0 1 1 109.9999975,0 z" />
<g
style="display:inline"
id="g2036"
transform="matrix(2.6999989,0,0,0.55555607,-0.8000075,94.890689)">
<g
style="opacity:0.4"
id="g3712"
transform="matrix(1.052632,0,0,1.285713,-1.263158,-13.42854)">
<rect
style="fill:url(#radialGradient3946);fill-opacity:1;stroke:none"
id="rect2801"
y="40"
x="38"
height="7"
width="5" />
<rect
style="fill:url(#radialGradient3948);fill-opacity:1;stroke:none"
id="rect3696"
transform="scale(-1,-1)"
y="-47"
x="-10"
height="7"
width="5" />
<rect
style="fill:url(#linearGradient3950);fill-opacity:1;stroke:none"
id="rect3700"
y="40"
x="10"
height="7.0000005"
width="28" />
</g>
</g>
<rect
style="color:#000000;fill:url(#radialGradient3968);fill-opacity:1.0;fill-rule:nonzero;stroke:none;stroke-width:0.99999994000000003;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect5505-21-3"
y="15.501808"
x="12.499989"
ry="6.0545406"
rx="6.0545406"
height="103"
width="103" />
<rect
style="opacity:0.5;fill:none;stroke:url(#linearGradient3965);stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect6741-7"
y="16.501808"
x="13.499989"
ry="5"
rx="5"
height="101"
width="101" />
<rect
width="103"
height="103"
rx="6.0545406"
ry="6.0545406"
x="12.499989"
y="15.501808"
id="rect4046"
style="color:#000000;fill:#0000f0;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994000000003;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;opacity:0.40000000000000002" />
<path
style="color:#000000;fill:#ffffff;fill-opacity:0.27311829;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect4519"
inkscape:connector-curvature="0"
d="m 71.40068,31.000738 c -9.03158,0 -16.85327,5.255219 -20.730283,12.882677 -2.512849,-1.622352 -5.487481,-2.576487 -8.685195,-2.576487 -8.963115,0 -16.229212,7.382582 -16.229212,16.489769 0,1.44791 0.22545,2.848711 0.570544,4.186761 -6.47349,4.436287 -10.713834,11.983466 -10.713834,20.547748 0,13.703007 10.857345,24.734764 24.343832,24.734764 l 46.659055,0 c 13.486503,0 24.343833,-11.031757 24.343833,-24.734764 0,-10.942388 -6.95249,-20.167863 -16.609645,-23.446375 0.262049,-1.422142 0.380371,-2.880522 0.380371,-4.379949 0,-13.091533 -10.444925,-23.704144 -23.329466,-23.704144 z" />
<rect
style="opacity:0.40000000000000002;color:#000000;fill:none;stroke:#ba3d12;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect5505-21-3-1"
y="15.501808"
x="12.499989"
ry="6.0545406"
rx="6.0545406"
height="103"
width="103" />
<g
id="g3990"
transform="matrix(0.9961947,0.08715574,-0.08715574,0.9961947,6.1992275,-5.2617219)">
<text
transform="scale(1.194324,0.83729373)"
sodipodi:linespacing="125%"
id="text3843"
y="119.05046"
x="22.915268"
style="font-size:120.53004456px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#692d56;fill-opacity:1;stroke:none;font-family:Sans"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#692d56;fill-opacity:1;font-family:Ubuntu Mono;-inkscape-font-specification:Ubuntu Mono Bold"
y="119.05046"
x="22.915268"
id="tspan3845"
sodipodi:role="line">W</tspan></text>
<text
transform="scale(1.1857255,0.84336551)"
sodipodi:linespacing="125%"
id="text3843-8"
y="115.6232"
x="23.701387"
style="font-size:115.83119202px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#ffffff;fill-opacity:1;font-family:Ubuntu Mono;-inkscape-font-specification:Ubuntu Mono Bold"
y="115.6232"
x="23.701387"
id="tspan3845-3"
sodipodi:role="line">W</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 24 KiB

20
data/webby.desktop Normal file
View file

@ -0,0 +1,20 @@
[Desktop Entry]
Version=1.0
Name=Webby
GenericName=Webby
Comment=Create your apps
Keywords=internet;webapp;
Exec=webby %u
Icon=webby
Terminal=false
Type=Application
Categories=Network;GNOME;GTK;
X-GIO-NoFuse=true
X-GNOME-Gettext-Domain=webby
X-GNOME-FullName=Webby
StartupWMClass=Webby
Actions=AboutDialog;
[Desktop Action AboutDialog]
Exec=webby --about
Name=About Webby

6
po/CMakeLists.txt Normal file
View file

@ -0,0 +1,6 @@
include (Translations)
add_translations_directory ("webby")
add_translations_catalog ("webby"
../src
../data
)

75
po/de.po Normal file
View file

@ -0,0 +1,75 @@
# German translation for webby-browser
# Copyright (c) 2015 Rosetta Contributors and Canonical Ltd 2015
# This file is distributed under the same license as the webby-browser package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: webby-browser\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2015-02-26 23:57-0300\n"
"PO-Revision-Date: 2015-03-08 14:47+0000\n"
"Last-Translator: Tobias Bannert <Unknown>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2015-03-24 00:16+0000\n"
"X-Generator: Launchpad (build 17413)\n"
msgid "Remove Application"
msgstr "Anwendung entfernen"
msgid "Accept"
msgstr "Bestätigen"
msgid "Create a new web app with webby"
msgstr "Erstelle eine neue Webanwendung mit Webby"
msgid "Application name"
msgstr "Anwendungsname"
msgid "http://myapp.domain"
msgstr "http://myapp.domain"
msgid "theme icon name"
msgstr "Themasymbolname"
msgid "or"
msgstr "oder"
msgid "Set from file..."
msgstr "Datei auswählen …"
msgid "Save cookies"
msgstr "Cookies speichern"
msgid "Save login information"
msgstr "Anmeldeinformation speichern"
msgid "Create app"
msgstr "Anwendung erstellen"
msgid "url must start with http:// or https://"
msgstr "Adresse muss mit http:// oder https:// beginnen"
msgid "App already exist"
msgstr "Anwendung ist bereits vorhanden"
msgid "Images"
msgstr "Bilder"
msgid "Cancel"
msgstr "Abbrechen"
msgid "Open"
msgstr "Öffnen"
msgid "App created"
msgstr "Anwendung wurde erstellt"
msgid "The application shortcut was successfully created"
msgstr "Tastenkürzel für die Anwendung wurde erfolgreich erstellt"
msgid "Applications"
msgstr "Anwendungen"

75
po/es.po Normal file
View file

@ -0,0 +1,75 @@
# Spanish translation for webby-browser
# Copyright (c) 2015 Rosetta Contributors and Canonical Ltd 2015
# This file is distributed under the same license as the webby-browser package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: webby-browser\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2015-02-26 23:57-0300\n"
"PO-Revision-Date: 2015-02-27 03:18+0000\n"
"Last-Translator: Erasmo Marín <Unknown>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2015-03-24 00:16+0000\n"
"X-Generator: Launchpad (build 17413)\n"
msgid "Remove Application"
msgstr "Quitar aplicación"
msgid "Accept"
msgstr "Aceptar"
msgid "Create a new web app with webby"
msgstr "Crear una nueva aplicación web con webby"
msgid "Application name"
msgstr "Nombre de la aplicación"
msgid "http://myapp.domain"
msgstr "http://miapp.dominio"
msgid "theme icon name"
msgstr "nombre de ícono del tema"
msgid "or"
msgstr "o"
msgid "Set from file..."
msgstr "Establecer desde archivo..."
msgid "Save cookies"
msgstr "Guardar cookies"
msgid "Save login information"
msgstr "Guardar información de sesión"
msgid "Create app"
msgstr "Crear aplicación"
msgid "url must start with http:// or https://"
msgstr "La url debe comenzar con http:// o https://"
msgid "App already exist"
msgstr "La aplicación ya existe"
msgid "Images"
msgstr "Imágenes"
msgid "Cancel"
msgstr "Cancelar"
msgid "Open"
msgstr "Abrir"
msgid "App created"
msgstr "Aplicación creada"
msgid "The application shortcut was successfully created"
msgstr "El atajo a la aplicación fue creado exitosamente"
msgid "Applications"
msgstr "Aplicaciones"

75
po/gl.po Normal file
View file

@ -0,0 +1,75 @@
# Galician translation for webby-browser
# Copyright (c) 2015 Rosetta Contributors and Canonical Ltd 2015
# This file is distributed under the same license as the webby-browser package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: webby-browser\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2015-02-26 23:57-0300\n"
"PO-Revision-Date: 2015-03-11 07:29+0000\n"
"Last-Translator: Miguel Anxo Bouzada <mbouzada@gmail.com>\n"
"Language-Team: Galician <gl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2015-03-24 00:16+0000\n"
"X-Generator: Launchpad (build 17413)\n"
msgid "Remove Application"
msgstr "Retirar a aplicación"
msgid "Accept"
msgstr "Aceptar"
msgid "Create a new web app with webby"
msgstr "Crear unha nova aplicación web con Webby"
msgid "Application name"
msgstr "Nome da aplicación"
msgid "http://myapp.domain"
msgstr "http://amiñapp.dominio"
msgid "theme icon name"
msgstr "Nome da icona do tema"
msgid "or"
msgstr "ou"
msgid "Set from file..."
msgstr "Estabelecer desde un ficheiro..."
msgid "Save cookies"
msgstr "Gardar as cookies"
msgid "Save login information"
msgstr "Gardar a información da sesión"
msgid "Create app"
msgstr "Crear a aplicación"
msgid "url must start with http:// or https://"
msgstr "O URL debe comezar con http:// ou https://"
msgid "App already exist"
msgstr "Xa existe a aplicación"
msgid "Images"
msgstr "Imaxes"
msgid "Cancel"
msgstr "Carcelar"
msgid "Open"
msgstr "Abrir"
msgid "App created"
msgstr "Creouse a aplicación"
msgid "The application shortcut was successfully created"
msgstr "Creouse satisfactoriamente o atallo á aplicación"
msgid "Applications"
msgstr "Aplicacións"

75
po/ru.po Normal file
View file

@ -0,0 +1,75 @@
# Russian translation for webby-browser
# Copyright (c) 2015 Rosetta Contributors and Canonical Ltd 2015
# This file is distributed under the same license as the webby-browser package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: webby-browser\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2015-02-26 23:57-0300\n"
"PO-Revision-Date: 2015-02-27 20:39+0000\n"
"Last-Translator: Artem Anufrij <Unknown>\n"
"Language-Team: Russian <ru@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2015-03-24 00:16+0000\n"
"X-Generator: Launchpad (build 17413)\n"
msgid "Remove Application"
msgstr "Удалить приложение"
msgid "Accept"
msgstr ""
msgid "Create a new web app with webby"
msgstr ""
msgid "Application name"
msgstr "Имя приложения"
msgid "http://myapp.domain"
msgstr "http://myapp.domain"
msgid "theme icon name"
msgstr ""
msgid "or"
msgstr "или"
msgid "Set from file..."
msgstr ""
msgid "Save cookies"
msgstr ""
msgid "Save login information"
msgstr ""
msgid "Create app"
msgstr ""
msgid "url must start with http:// or https://"
msgstr ""
msgid "App already exist"
msgstr ""
msgid "Images"
msgstr ""
msgid "Cancel"
msgstr "Отменить"
msgid "Open"
msgstr "Открыть"
msgid "App created"
msgstr ""
msgid "The application shortcut was successfully created"
msgstr ""
msgid "Applications"
msgstr "Приложения"

75
po/vi.po Normal file
View file

@ -0,0 +1,75 @@
# Vietnamese translation for webby-browser
# Copyright (c) 2015 Rosetta Contributors and Canonical Ltd 2015
# This file is distributed under the same license as the webby-browser package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: webby-browser\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2015-02-26 23:57-0300\n"
"PO-Revision-Date: 2015-03-15 13:06+0000\n"
"Last-Translator: Nguyễn Thanh Tài <Unknown>\n"
"Language-Team: Vietnamese <vi@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2015-03-24 00:16+0000\n"
"X-Generator: Launchpad (build 17413)\n"
msgid "Remove Application"
msgstr "Gỡ ứng dụng"
msgid "Accept"
msgstr "Đồng ý"
msgid "Create a new web app with webby"
msgstr "Tạo ứng dụng web mới với webby"
msgid "Application name"
msgstr "Tên ứng dụng"
msgid "http://myapp.domain"
msgstr "http://ungdung.tenmien"
msgid "theme icon name"
msgstr "tên biểu tượng chủ dụng"
msgid "or"
msgstr "hoặc"
msgid "Set from file..."
msgstr "Đặt từ tập tin..."
msgid "Save cookies"
msgstr "Lưu cookie"
msgid "Save login information"
msgstr "Lưu thông tin đăng nhập"
msgid "Create app"
msgstr "Tạo ứng dụng"
msgid "url must start with http:// or https://"
msgstr "url phải bắt đầu với http:// hoặc https://"
msgid "App already exist"
msgstr "Ứng dụng đã tồn tại"
msgid "Images"
msgstr "Hình ảnh"
msgid "Cancel"
msgstr "Huỷ"
msgid "Open"
msgstr "Mở"
msgid "App created"
msgstr "Đã tạo ứng dụng"
msgid "The application shortcut was successfully created"
msgstr "Đã tạo lối tắt ứng dụng thành công"
msgid "Applications"
msgstr "Ứng dụng"

102
po/webby.pot Normal file
View file

@ -0,0 +1,102 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-16 23:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: /home/artem/Launchpad/webby-browser/po/../src/InfoDialog.vala:16
msgid "Accept"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/AppWindow.vala:70
msgid "Applications"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/AppWindow.vala:76
msgid "Add a new Web App"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/AppWindow.vala:79
msgid "No Web Apps Availible"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/AppWindow.vala:79
msgid "Create a new Webby Web App."
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/AppWindow.vala:80
msgid "Create App"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/AppWindow.vala:80
msgid "Create a new Webby web app."
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:45
msgid "Create a new web app with webby"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:53
msgid "Application name"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:56
msgid "http://myapp.domain"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:66
msgid "theme icon name"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:68
msgid "or"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:69
msgid "Set from file..."
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:85
msgid "Save cookies"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:87
msgid "Save login information"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:110
msgid "Save app"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:132
msgid "url must start with http:// or https://"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:145
msgid "App already exist"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:198
msgid "Images"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:210
msgid "Cancel"
msgstr ""
#: /home/artem/Launchpad/webby-browser/po/../src/Assistant.vala:211
msgid "Open"
msgstr ""

5
schemas/CMakeLists.txt Normal file
View file

@ -0,0 +1,5 @@
#
# GSettings Schema
#
include(GSettings)
add_schema(org.pantheon.Webby.gschema.xml)

View file

@ -0,0 +1,24 @@
<schemalist>
<enum id="org.pantheon.webby.SavedState.window-state">
<value nick="Normal" value="0" />
<value nick="Maximized" value="1" />
<value nick="Fullscreen" value="2" />
</enum>
<schema path="/org/pantheon/webby/saved-state/" id="org.pantheon.webby.SavedState" gettext-domain="webby">
<key name="window-width" type="i">
<default>800</default>
<summary>The saved width of the window.</summary>
<description>The saved width of the window.</description>
</key>
<key name="window-height" type="i">
<default>650</default>
<summary>The saved height of the window.</summary>
<description>The saved height of the window.</description>
</key>
<key name="window-state" enum="org.pantheon.webby.SavedState.window-state">
<default>"Normal"</default>
<summary>The saved state of the window.</summary>
<description>The saved state of the window.</description>
</key>
</schema>
</schemalist>

200
src/AppWindow.vala Normal file
View file

@ -0,0 +1,200 @@
public class AppWindow : Granite.Application {
private Settings settings;
public Gtk.Window mainwindow;
private Gtk.Stack stack;
private Gtk.HeaderBar headerbar;
private Gtk.Button back_button;
private Gtk.Button add_button;
private WebbyAssistant assistant;
private ApplicationsView apps_view;
construct {
program_name = "Webby";
exec_name = "webby";
app_years = "2015";
app_icon = "webby";
app_launcher = "webby.desktop";
application_id = "net.launchpad.webby-browser";
main_url = "https://code.launchpad.net/webby-browser";
bug_url = "https://bugs.launchpad.net/webby-browser";
help_url = "https://code.launchpad.net/webby-browser";
translate_url = "https://translations.launchpad.net/webby-browser";
about_authors = {"Erasmo Marín <erasmo.marin@gmail.com>",
"Artem Anufrij <artem.anufrij@live.de>"};
about_documenters = {"Erasmo Marín",
"Artem Anufrij <artem.anufrij@live.de>"};
about_artists = {"Erasmo Marín <erasmo.marin@gmail.com>",
"Artem Anufrij <artem.anufrij@live.de>"};
about_comments = "Development release, not all features implemented";
about_translators = "";
about_license_type = Gtk.License.GPL_3_0;
}
public static AppWindow _instance = null;
public static AppWindow instance {
get {
if (_instance == null)
_instance = new AppWindow ();
return _instance;
}
}
protected override void activate () {
if (mainwindow != null) {
mainwindow.present (); // present window if app is already running
return;
}
settings = Settings.get_default ();
mainwindow = new Gtk.Window ();
mainwindow.set_default_size (700, 500);
mainwindow.set_wmclass ("Webby", "Webby");
//headerbar
headerbar = new Gtk.HeaderBar ();
headerbar.show_close_button = true;
headerbar.title = "Webby";
mainwindow.set_titlebar (headerbar);
back_button = new Gtk.Button.with_label (_("Applications"));
back_button.get_style_context ().add_class ("back-button");
headerbar.pack_start (back_button);
add_button = new Gtk.Button ();
add_button.image = new Gtk.Image.from_icon_name ("add", Gtk.IconSize.LARGE_TOOLBAR);
add_button.tooltip_text = _("Add a new Web App");
headerbar.pack_start (add_button);
var welcome = new Granite.Widgets.Welcome (_("No Web Apps Availible"), _("Create a new Webby Web App."));
welcome.append ("add", _("Create App"), _("Create a new Webby web app."));
welcome.activated.connect ((index) => {
switch (index) {
case 0:
show_assistant ();
break;
}
});
apps_view = new ApplicationsView();
assistant = new WebbyAssistant();
stack = new Gtk.Stack ();
stack.set_transition_duration (500);
stack.add_named (welcome, "welcome");
stack.add_named (apps_view, "apps_view");
stack.add_named (assistant, "assistant");
mainwindow.add (stack);
apps_view.add_request.connect (() => {
show_assistant ();
});
apps_view.edit_request.connect ((desktop_file) => {
show_assistant (desktop_file);
});
apps_view.app_deleted.connect (() => {
if (!apps_view.has_items) {
show_welcome_view (Gtk.StackTransitionType.NONE);
}
});
assistant.application_created.connect ((new_file) => {
apps_view.add_button (new_file);
apps_view.select_last_item ();
show_apps_view ();
});
assistant.application_edited.connect ((edited_file) => {
apps_view.update_button (edited_file);
show_apps_view ();
});
back_button.clicked.connect (() => {
if (apps_view.has_items)
show_apps_view ();
else
show_welcome_view ();
});
add_button.clicked.connect (() => {
show_assistant ();
});
mainwindow.delete_event.connect (() => {
this.store_settings ();
return false;
});
mainwindow.destroy.connect (Gtk.main_quit);
this.restore_settings ();
mainwindow.show_all ();
if (apps_view.has_items)
show_apps_view (Gtk.StackTransitionType.NONE);
else
show_welcome_view (Gtk.StackTransitionType.NONE);
Gtk.main ();
}
private void show_assistant (DesktopFile? desktop_file = null) {
stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT);
stack.set_visible_child_name("assistant");
back_button.show_all ();
add_button.hide ();
//fix ugly border at the bottom of headerbar
mainwindow.queue_draw ();
if (desktop_file != null)
assistant.edit_desktop_file (desktop_file);
}
private void show_apps_view (Gtk.StackTransitionType slide = Gtk.StackTransitionType.SLIDE_RIGHT) {
stack.set_transition_type (slide);
stack.set_visible_child_name ("apps_view");
back_button.hide ();
add_button.show_all ();
assistant.reset_fields ();
//fix ugly border at the bottom of headerbar
mainwindow.queue_draw ();
}
private void show_welcome_view (Gtk.StackTransitionType slide = Gtk.StackTransitionType.SLIDE_RIGHT) {
stack.set_transition_type (slide);
stack.set_visible_child_name ("welcome");
back_button.hide ();
add_button.hide ();
assistant.reset_fields ();
//fix ugly border at the bottom of headerbar
mainwindow.queue_draw ();
}
private void restore_settings () {
this.mainwindow.set_default_size (settings.window_width, settings.window_height);
if (settings.window_state == Settings.WindowState.MAXIMIZED)
this.mainwindow.maximize ();
}
private void store_settings () {
settings.window_state = (this.mainwindow.is_maximized ? Settings.WindowState.MAXIMIZED: Settings.WindowState.NORMAL);
if (settings.window_state == Settings.WindowState.NORMAL) {
settings.window_height = this.mainwindow.get_allocated_height ();
settings.window_width = this.mainwindow.get_allocated_width ();
}
}
}

299
src/Assistant.vala Normal file
View file

@ -0,0 +1,299 @@
public class WebbyAssistant : Gtk.Box {
public enum assistant_mode { new_app, edit_app }
public signal void application_created (GLib.DesktopAppInfo? new_file);
public signal void application_edited (GLib.DesktopAppInfo? new_file);
private Gtk.Label message;
private Gtk.Button icon_button;
private Gtk.Entry app_name_entry;
private Gtk.Entry app_url_entry;
private Gtk.Entry icon_name_entry;
private Gtk.ComboBox app_category_combo;
private Gtk.CheckButton save_cookies_check;
private Gtk.CheckButton save_password_check;
private Gtk.Popover icon_selector_popover;
private Gtk.FileChooserDialog file_chooser;
private Gtk.Button accept_button;
private GLib.Regex protocol_regex;
private Gee.HashMap<string, GLib.AppInfo> apps;
private string default_app_icon = "application-default-icon";
private bool app_name_valid = false;
private bool app_url_valid = false;
private bool app_icon_valid = true;
private assistant_mode mode { get; set; default = assistant_mode.new_app; }
public WebbyAssistant () {
GLib.Object (orientation: Gtk.Orientation.VERTICAL);
apps = DesktopFile.get_applications ();
this.margin = 15;
try {
//http(s)://(words or numbers)(port and numbers)
this.protocol_regex = new Regex ("""https?\:\/\/[\w+\d+]((\:\d+)?\/\S*)?""");
} catch (RegexError e) {
critical ("%s", e.message);
}
//welcome message
message = new Gtk.Label (_("Create a new web app with webby"));
//app information
icon_button = new Gtk.Button ();
icon_button.set_image (new Gtk.Image.from_icon_name (default_app_icon, Gtk.IconSize.DIALOG) );
icon_button.halign = Gtk.Align.END;
app_name_entry = new Gtk.Entry ();
app_name_entry.set_placeholder_text (_("Application name"));
app_url_entry = new Gtk.Entry ();
app_url_entry.set_placeholder_text (_("http://myapp.domain"));
//icon selector popover
icon_selector_popover = new Gtk.Popover (icon_button);
icon_selector_popover.modal = true;
icon_selector_popover.position = Gtk.PositionType.BOTTOM;
var popover_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5);
icon_name_entry = new Gtk.Entry ();
icon_name_entry.set_placeholder_text (_("theme icon name"));
var or_label = new Gtk.Label (_("or"));
var icon_chooser_button = new Gtk.Button.with_label(_("Set from file..."));
icon_chooser_button.get_style_context ().add_class ("suggested-action");
popover_box.margin = 10;
popover_box.pack_start (icon_name_entry, true, false, 0);
popover_box.pack_start (or_label, true, false, 0);
popover_box.pack_end (icon_chooser_button, true, false, 0);
icon_chooser_button.grab_focus ();
icon_selector_popover.add (popover_box);
//TODO: categories
//combobox
//checkbuttons
save_cookies_check = new Gtk.CheckButton.with_label (_("Save cookies"));
save_cookies_check.active = true;
save_password_check = new Gtk.CheckButton.with_label (_("Save login information"));
save_password_check.active = false;
//app information section
var app_input_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 5);
app_input_box.halign = Gtk.Align.START;
app_input_box.pack_start (app_name_entry, false, false, 0);
app_input_box.pack_start (app_url_entry, false, false, 0);
//app_input_box.pack_start (app_category_combo, true, false, 0);
var app_info_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 5);
app_info_box.pack_start (icon_button, false, false, 3);
app_info_box.pack_start (app_input_box, false, false, 3);
app_info_box.halign = Gtk.Align.CENTER;
//app options
var app_options_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 5);
app_options_box.pack_start (save_cookies_check, true, false, 0);
app_options_box.pack_start (save_password_check, true, false, 0);
app_options_box.halign = Gtk.Align.CENTER;
//create button
accept_button = new Gtk.Button.with_label(_("Save app"));
accept_button.halign = Gtk.Align.END;
accept_button.get_style_context ().add_class ("suggested-action");
accept_button.set_sensitive (false);
accept_button.activate.connect (on_accept);
accept_button.clicked.connect (on_accept);
//all sections together
pack_start (message, true, false, 0);
pack_start (app_info_box, true, false, 0);
pack_start (app_options_box, true, false, 0);
pack_end (accept_button, false, false, 0);
//signals and handlers
icon_button.clicked.connect(() => {
icon_selector_popover.show_all();
});
app_url_entry.changed.connect (()=>{
if (!this.protocol_regex.match (app_url_entry.get_text())) {
app_url_entry.get_style_context ().add_class ("error");
app_url_entry.set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "dialog-information");
app_url_entry.set_icon_tooltip_text(Gtk.EntryIconPosition.SECONDARY, _("url must start with http:// or https://"));
app_url_valid = false;
} else {
app_url_entry.get_style_context ().remove_class ("error");
app_url_valid = true;
}
validate ();
});
app_name_entry.changed.connect (()=>{
if (mode == assistant_mode.new_app && DesktopFile.get_applications().has_key (app_name_entry.get_text()) ) {
app_name_entry.get_style_context ().add_class ("error");
app_name_entry.set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "dialog-information");
app_name_entry.set_icon_tooltip_text (Gtk.EntryIconPosition.SECONDARY, _("App already exist"));
app_name_valid = false;
} else {
app_name_entry.get_style_context ().remove_class ("error");
app_name_valid = true;
}
validate ();
});
icon_chooser_button.activate.connect (on_icon_chooser_activate);
icon_chooser_button.clicked.connect (on_icon_chooser_activate);
icon_name_entry.changed.connect (update_app_icon);
}
private void update_app_icon () {
string icon = icon_name_entry.get_text ();
if (icon == "") {
app_icon_valid = true;
validate ();
return;
}
//if is a file uri
if (icon.contains("/")) {
Gdk.Pixbuf pix = null;
try {
pix = new Gdk.Pixbuf.from_file_at_size (icon, 48, 48);
app_icon_valid = true;
} catch (GLib.Error error) {
app_icon_valid = false;
try {
Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default ();
pix = icon_theme.load_icon ("image-missing", 48, Gtk.IconLookupFlags.FORCE_SIZE);
} catch (GLib.Error err) {
warning ("Getting selection-checked icon from theme failed");
}
} finally {
if (pix != null)
icon_button.set_image (new Gtk.Image.from_pixbuf (pix));
}
} else {
icon_button.set_image (new Gtk.Image.from_icon_name (icon, Gtk.IconSize.DIALOG) );
}
validate ();
}
private void on_icon_chooser_activate () {
var filter = new Gtk.FileFilter ();
filter.set_filter_name (_("Images"));
filter.add_pattern ("*.png");
filter.add_pattern ("*.svg");
filter.add_pattern ("*.jpg");
filter.add_pattern ("*.jpeg");
filter.add_pattern ("*.PNG");
filter.add_pattern ("*.SVG");
filter.add_pattern ("*.JPG");
filter.add_pattern ("*.JPEG");
file_chooser = new Gtk.FileChooserDialog ("", null,
Gtk.FileChooserAction.OPEN,
_("Cancel"), Gtk.ResponseType.CANCEL,
_("Open"), Gtk.ResponseType.ACCEPT);
file_chooser.set_select_multiple(false);
file_chooser.add_filter (filter);
var preview = new Gtk.Image();
preview.valign = Gtk.Align.START;
file_chooser.update_preview.connect ( ()=> {
string filename = file_chooser.get_preview_filename();
Gdk.Pixbuf pix = null;
if (filename != null) {
try {
pix = new Gdk.Pixbuf.from_file_at_size (filename, 128, 128);
} catch (GLib.Error error) {
warning ("There was a problem loading preview.");
}
}
if (pix!=null){
preview.set_from_pixbuf (pix);
file_chooser.set_preview_widget_active (true);
file_chooser.set_preview_widget (preview);
} else {
file_chooser.set_preview_widget (null);
}
});
if (file_chooser.run () == Gtk.ResponseType.ACCEPT) {
icon_name_entry.set_text(file_chooser.get_filename ());
file_chooser.destroy ();
}
file_chooser.destroy ();
}
private void validate () {
if (app_icon_valid && app_name_valid && app_url_valid) {
accept_button.set_sensitive (true);
return;
}
accept_button.set_sensitive (false);
}
public void reset_fields () {
icon_name_entry.set_text ("");
app_name_entry.set_text ("");
app_name_entry.set_sensitive (true);
app_url_entry.set_text ("");
app_name_entry.get_style_context ().remove_class ("error");
app_url_entry.get_style_context ().remove_class ("error");
icon_button.set_image (new Gtk.Image.from_icon_name (default_app_icon, Gtk.IconSize.DIALOG) );
mode = assistant_mode.new_app;
}
private void on_accept () {
string icon = icon_name_entry.get_text ();
string name = app_name_entry.get_text ();
string url = app_url_entry.get_text ();
if (icon == "")
icon = default_app_icon;
if (app_icon_valid && app_name_valid && app_url_valid) {
var desktop_file = new DesktopFile (name, url, icon);
switch (mode) {
case assistant_mode.new_app:
application_created (desktop_file.save_to_file ());
break;
case assistant_mode.edit_app:
application_edited (desktop_file.save_to_file ());
break;
}
}
}
public void edit_desktop_file (DesktopFile desktop_file) {
mode = assistant_mode.edit_app;
app_name_entry.text = desktop_file.name;
app_name_entry.set_sensitive (false);
app_url_entry.text = desktop_file.url;
icon_name_entry.text = desktop_file.icon;
update_app_icon ();
}
}

121
src/DesktopFile.vala Normal file
View file

@ -0,0 +1,121 @@
public class DesktopFile : GLib.Object {
private string template = """
[Desktop Entry]
Version=1.0
Name=Webby
GenericName=Web app
Comment=Webby web app
Exec=webby
Keywords=webby;webapp;internet;
Icon=application-default-icon
Terminal=false
Type=Application
Categories=Network;
X-GNOME-FullName=Webby
StartupWMClass=Webby
WebbyThemeColor=none""";
private GLib.KeyFile file;
public string name { get; private set; }
public string url { get; private set; }
public string icon { get; private set; }
public DesktopFile (string name, string url, string icon) {
this.name = name;
this.url = url;
this.icon = icon;
file = new GLib.KeyFile();
file.load_from_data (template, -1, GLib.KeyFileFlags.NONE);
//TODO: Category
file.set_string ("Desktop Entry", "Name", name);
file.set_string ("Desktop Entry", "GenericName", name);
file.set_string ("Desktop Entry", "X-GNOME-FullName", name);
file.set_string ("Desktop Entry", "Exec", "webby " + url);
file.set_string ("Desktop Entry", "Icon", icon);
file.set_string ("Desktop Entry", "StartupWMClass", url);
}
public DesktopFile.from_desktopappinfo(GLib.DesktopAppInfo info) {
file = new GLib.KeyFile();
file.load_from_file (info.filename, KeyFileFlags.NONE);
this.name = info.get_display_name ();
this.icon = info.get_icon ().to_string ();
this.url = file.get_string ("Desktop Entry", "Exec").substring (6);
}
public bool edit_propertie (string propertie, string val) {
string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webby.desktop";
file = new GLib.KeyFile();
file.load_from_file (filename, KeyFileFlags.NONE);
file.set_string ("Desktop Entry", propertie, val);
return file.save_to_file (filename);
}
public GLib.DesktopAppInfo save_to_file () {
string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webby.desktop";
print("Desktop file created: " + filename);
file.save_to_file (filename);
return new GLib.DesktopAppInfo.from_filename (filename);
}
public bool delete_file () {
string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webby.desktop";
File file = File.new_for_path (filename);
try {
file.delete ();
} catch (Error e) {
print(e.message + "\n");
return false;
}
return true;
}
public static Gee.HashMap<string, GLib.DesktopAppInfo> get_webby_applications () {
var list = new Gee.HashMap<string, GLib.DesktopAppInfo>();
foreach (GLib.AppInfo app in GLib.AppInfo.get_all()) {
var desktop_app = new GLib.DesktopAppInfo(app.get_id ());
//FIXME: This is not working, vala problem?
//var keywords = desktop_app.get_keywords ();
string keywords = desktop_app.get_string ("Keywords");
if (keywords != null && keywords.contains ("webby")) {
list.set(desktop_app.get_name(), desktop_app);
}
}
return list;
}
public static GLib.DesktopAppInfo? get_app_by_url (string url) {
foreach (GLib.AppInfo app in GLib.AppInfo.get_all()) {
var desktop_app = new GLib.DesktopAppInfo(app.get_id ());
var exec = desktop_app.get_string ("Exec");
if (exec != null && exec.contains (url)) {
return desktop_app;
}
}
return null;
}
public static Gee.HashMap<string, GLib.AppInfo> get_applications() {
var list = new Gee.HashMap<string, GLib.AppInfo>();
foreach (GLib.AppInfo app in GLib.AppInfo.get_all()) {
list.set(app.get_name(), app);
}
return list;
}
}

18
src/InfoDialog.vala Normal file
View file

@ -0,0 +1,18 @@
public class InfoDialog : Gtk.Dialog {
public InfoDialog (string title, string label, string icon_name) {
this.title = title;
set_default_size (350, 100);
var box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 5);
box.pack_start (new Gtk.Image.from_icon_name(icon_name, Gtk.IconSize.DIALOG), false, false, 0);
box.pack_start (new Gtk.Label (label), true, false, 0);
box.margin = 15;
Gtk.Box content = get_content_area () as Gtk.Box;
content.pack_start (box, true, true, 0);
add_button (_("Accept"), Gtk.ResponseType.ACCEPT);
}
}

0
src/Launcher.vala Normal file
View file

23
src/Settings.vala Normal file
View file

@ -0,0 +1,23 @@
public class Settings : Granite.Services.Settings {
private static Settings settings;
public static Settings get_default () {
if (settings == null)
settings = new Settings ();
return settings;
}
public int window_width { get; set; }
public int window_height { get; set; }
public WindowState window_state { get; set; }
private Settings () {
base ("org.pantheon.webby.SavedState");
}
public enum WindowState {
NORMAL,
MAXIMIZED,
FULLSCREEN
}
}

15
src/UrlEntry.vala Normal file
View file

@ -0,0 +1,15 @@
public class UrlEntry : Gtk.Entry {
public UrlEntry () {
editable = false;
set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "view-refresh-symbolic");
set_icon_from_icon_name (Gtk.EntryIconPosition.PRIMARY, "text-html-symbolic");
}
public override void get_preferred_width (out int minimum_width, out int natural_width) {
minimum_width = -1;
natural_width = 3000;
}
}

152
src/WebApp.vala Normal file
View file

@ -0,0 +1,152 @@
public class WebApp : Gtk.Stack {
public WebKit.WebView app_view;
public WebKit.WebView external_view;
public string ui_color = "none";
private string app_url;
private GLib.DesktopAppInfo info;
private DesktopFile file;
private WebKit.CookieManager cookie_manager;
private Gtk.Box container; //the spinner container
public signal void external_request ();
public signal void theme_color_changed(string color);
public WebApp (string webapp_name, string app_url) {
this.app_url = app_url;
set_transition_duration (1000);
//configure cookies settings
cookie_manager = WebKit.WebContext.get_default ().get_cookie_manager ();
cookie_manager.set_accept_policy (WebKit.CookieAcceptPolicy.ALWAYS);
string cookie_db = Environment.get_user_cache_dir () + "/webby/cookies/";
var dir = GLib.File.new_for_path (cookie_db);
if (!dir.query_exists (null)) {
try {
dir.make_directory_with_parents (null);
GLib.debug ("Directory '%s' created", dir.get_path ());
} catch (Error e) {
GLib.error ("Could not create caching directory.");
}
}
cookie_manager.set_persistent_storage (cookie_db + "cookies.db", WebKit.CookiePersistentStorage.SQLITE);
//load app viewer
app_view = new WebKit.WebView.with_context (WebKit.WebContext.get_default ());
app_view.load_uri (app_url);
//create external viewer
this.external_view = new WebKit.WebView ();
//loading view
var spinner = new Gtk.Spinner();
spinner.active = true;
spinner.halign = Gtk.Align.CENTER;
spinner.valign = Gtk.Align.CENTER;
spinner.set_size_request (24, 24);
container = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
container.halign = Gtk.Align.FILL;
container.valign = Gtk.Align.FILL;
container.pack_start(spinner, true, true, 0);
//overlay trick to make snapshot work even with the spinner
var overlay = new Gtk.Overlay ();
overlay.add(app_view);
overlay.add_overlay(container);
add_titled(overlay, "app", "app");
add_titled(external_view, "external", "external");
set_visible_child_name ("app");
app_view.create.connect ( () => {
print("external request");
external_request ();
return external_view;
});
external_view.create.connect ( () => {
print("external request");
set_visible_child_name ("external");
return external_view;
});
info = DesktopFile.get_app_by_url(app_url);
file = new DesktopFile.from_desktopappinfo(info);
//load theme color saved in desktop file
if (info != null && info.has_key("WebbyThemeColor")) {
var color = info.get_string("WebbyThemeColor");
print("COLOR: " + color+"\n");
if(color != "none") {
ui_color = color;
}
}
Gdk.RGBA background = {};
if (!background.parse (ui_color)){
background = {1,1,1,1};
}
container.override_background_color (Gtk.StateFlags.NORMAL, background);
//update theme color if changed
app_view.load_changed.connect ( (load_event) => {
if (load_event == WebKit.LoadEvent.FINISHED) {
print("determine color");
determine_theme_color.begin();
} else {
container.set_visible(true);
}
});
}
public DesktopFile get_desktop_file () {
return this.file;
}
/**Taken from WebView.vala in lp:midori
* Check for the theme-color meta tag in the page and if that one can't be
* found grabs the color from the current page and uses the first 3 rows
* of pixels to get a good representative color of the page
*/
public async void determine_theme_color () {
//FIXME: This is useless without JSCore
/*string script = "var t = document.getElementsByTagName('meta').filter(function(e){return e.name == 'theme-color';)[0]; t ? t.value : null;";
app_view.run_javascript.begin (script, null, (obj, res)=> {
});*/
var snap = (Cairo.ImageSurface) yield app_view.get_snapshot (WebKit.SnapshotRegion.VISIBLE,
WebKit.SnapshotOptions.NONE, null);
// data ist in BGRA apparently (according to testing). Docs said ARGB, but that
// appears not to be the case
unowned uint8[] data = snap.get_data ();
uint8 r = data[2];
uint8 g = data[1];
uint8 b = data[0];
for (var i = 4; i < snap.get_width () * 3 * 4; i += 4) {
r = (r + data[i + 2]) / 2;
g = (g + data[i + 1]) / 2;
b = (b + data[i + 0]) / 2;
}
var color = "#%02x%02x%02x".printf (r, g, b);
if (color != ui_color) {
ui_color = color;
Gdk.RGBA background = {};
background.parse (ui_color);
container.override_background_color (Gtk.StateFlags.NORMAL, background);
theme_color_changed(ui_color);
if (file != null)
file.edit_propertie ("WebbyThemeColor", ui_color);
}
container.set_visible(false);
}
}

142
src/WebAppWindow.vala Normal file
View file

@ -0,0 +1,142 @@
public class WebAppWindow : Gtk.ApplicationWindow {
private bool is_full_screen = false;
private string style_str = """@define-color titlebar_color @titlebar_color;""";
//widgets
private WebApp web_app;
private WebBar headerbar;
public WebAppWindow (string webapp_name, string webapp_uri) {
set_wmclass(webapp_uri, webapp_uri);
web_app = new WebApp(webapp_name, webapp_uri);
headerbar = new WebBar(web_app.external_view);
headerbar.show_close_button = true;
headerbar.title = webapp_name;
headerbar.set_title_mode (WebBar.title_mode.TITLE);
//style
if (web_app.ui_color != "none") {
try {
print("set color");
var style_cp = style_str.replace ("@titlebar_color", web_app.ui_color);
var style_provider = new Gtk.CssProvider ();
style_provider.load_from_data (style_cp, -1);
headerbar.get_style_context ().add_provider (style_provider, -1);
Gtk.Settings.get_default ().set ("gtk-application-prefer-dark-theme", should_use_dark_theme (web_app.ui_color));
} catch (GLib.Error err) {
warning("Loading style failed");
}
}
web_app.theme_color_changed.connect( (color)=> {
try {
print("set color");
var style_cp = style_str.replace ("@titlebar_color", color);
var style_provider = new Gtk.CssProvider ();
style_provider.load_from_data (style_cp, -1);
headerbar.get_style_context ().add_provider (style_provider, -1);
Gtk.Settings.get_default ().set ("gtk-application-prefer-dark-theme", should_use_dark_theme (color));
} catch (GLib.Error err) {
warning("Loading style failed");
}
});
this.set_titlebar (headerbar);
var info = DesktopFile.get_app_by_url(webapp_uri);
var width = info.get_string("WebbyWindowWidth");
var height = info.get_string("WebbyWindowHeight");
if(width !=null && height != null)
set_default_size (int.parse(width), int.parse(height));
else
set_default_size (1000, 600);
this.delete_event.connect (() => {
update_window_state(this.get_allocated_width (), this.get_allocated_height () );
return false;
});
this.destroy.connect(Gtk.main_quit);
web_app.external_request.connect ( () => {
print("Web app external request\n");
web_app.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT);
headerbar.set_title_mode (WebBar.title_mode.BROWSER);
web_app.set_visible_child_name ("external");
});
headerbar.back_event.connect ( () => {
print ("back");
headerbar.set_title_mode (WebBar.title_mode.TITLE);
web_app.set_transition_type (Gtk.StackTransitionType.SLIDE_RIGHT);
web_app.set_visible_child_name ("app");
//wait the animation to end before "cleaning" the web view
GLib.Timeout.add(web_app.get_transition_duration(), () => {
web_app.external_view.load_uri ("about:blank");
return false;
});
});
add(web_app);
show_all();
}
public new void fullscreen () {
is_full_screen = true;
base.fullscreen();
}
public new void unfullscreen () {
is_full_screen = false;
base.unfullscreen();
}
public void toggle_fullscreen() {
if(is_full_screen)
unfullscreen();
else
fullscreen();
is_full_screen = !is_full_screen;
}
public void update_window_state (int width, int height) {
var file = web_app.get_desktop_file();
file.edit_propertie ("WebbyWindowWidth", width.to_string());
file.edit_propertie ("WebbyWindowHeight", height.to_string());
}
public override bool key_press_event (Gdk.EventKey event) {
bool handled = true;
switch (event.keyval) {
case Gdk.Key.Escape:
unfullscreen();
break;
case Gdk.Key.F11:
toggle_fullscreen();
break;
default:
handled = false;
break;
}
if (handled)
return true;
return (base.key_press_event != null) ? base.key_press_event (event) : true;
}
private bool should_use_dark_theme (string theme_color) {
Gdk.RGBA color = {};
color.parse (theme_color);
double prom = (color.red + color.blue + color.green)/3;
if (prom < 0.5)
return true;
return false;
}
}

72
src/WebBar.vala Normal file
View file

@ -0,0 +1,72 @@
public class WebBar : Gtk.HeaderBar {
public enum title_mode {
TITLE,
BROWSER;
}
UrlEntry url_entry;
Gtk.Button share_button;
Gtk.Button back_button;
WebKit.WebView webview;
public signal void back_event();
public WebBar (WebKit.WebView webview) {
this.get_style_context ().remove_class ("header-bar");
this.webview = webview;
url_entry = new UrlEntry();
url_entry.show_all();
share_button = new Gtk.Button.from_icon_name ("application-menu-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
share_button.margin_left = 15;
share_button.show_all ();
back_button = new Gtk.Button.from_icon_name ("go-next-symbolic-rtl", Gtk.IconSize.SMALL_TOOLBAR);
back_button.margin_right = 15;
back_button.show_all ();
pack_start (back_button);
pack_start (url_entry);
pack_end (share_button);
custom_title = new Gtk.Label(null);
connect_signals ();
show();
}
private void connect_signals () {
webview.load_changed.connect ( (event) => {
if (event == WebKit.LoadEvent.STARTED)
url_entry.set_text (webview.uri);
});
back_button.clicked.connect( () => { back_event(); });
back_button.activate.connect( () => { back_event(); });
}
public void set_title_mode (title_mode mode) {
if (mode == title_mode.TITLE) {
custom_title = null;
remove (share_button);
remove (back_button);
remove (url_entry);
this.get_style_context ().remove_class ("header-bar");
} else {
pack_start (back_button);
pack_start (url_entry);
pack_end (share_button);
custom_title = new Gtk.Label(null);
this.get_style_context ().add_class ("header-bar");
}
}
}

15
src/Webby.vala Normal file
View file

@ -0,0 +1,15 @@
static int main (string[] args) {
Gtk.init (ref args);
if (args.length < 2 || args[1] == "--about" || args[1] == "-d") {
return AppWindow.instance.run (args);
} else {
var app_info = DesktopFile.get_app_by_url (args[1]);
var app = new WebAppWindow(app_info.get_display_name (), args[1]);
app.show_all ();
}
Gtk.main ();
return 0;
}

View file

@ -0,0 +1,129 @@
public class ApplicationIcon : Gtk.Overlay {
Gtk.Image image;
Gtk.Label label;
Gtk.MenuButton conf_btn;
Gtk.Box box;
Gtk.ActionGroup action_group;
internal DesktopFile desktop_file { get; private set; }
public signal void deleted (Gtk.Container? parent);
public signal void edit_request (DesktopFile desktop_file);
public ApplicationIcon (GLib.DesktopAppInfo app) {
this.desktop_file = new DesktopFile.from_desktopappinfo (app);
hexpand = false;
vexpand = false;
label = new Gtk.Label (this.desktop_file.name);
set_icon (this.desktop_file.icon);
this.margin = 6;
this.margin_start = 20;
this.margin_end = 20;
var menu = new ActionMenu ();
menu.halign = Gtk.Align.CENTER;
menu.delete_clicked.connect (() => { remove_application (); });
menu.edit_clicked.connect (() => { edit_request (desktop_file); });
box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
box.pack_start (image, false, false, 0);
box.pack_start (label, false, false, 0);
box.pack_start (menu, false, false, 0);
box.hexpand = false;
box.vexpand = false;
var event_box = new Gtk.EventBox ();
event_box.add (box);
event_box.events |= Gdk.EventMask.ENTER_NOTIFY_MASK|Gdk.EventMask.LEAVE_NOTIFY_MASK;
event_box.enter_notify_event.connect ((event) => {
menu.set_reveal_child (true);
return false;
});
event_box.leave_notify_event.connect ((event) => {
if (event.detail == Gdk.NotifyType.INFERIOR)
return false;
menu.set_reveal_child (false);
return false;
});
this.add (event_box);
}
public void set_new_desktopfile (DesktopFile desktop_file) {
this.desktop_file = desktop_file;
set_icon (this.desktop_file.icon);
}
private void set_icon (string icon) {
if (File.new_for_path (icon).query_exists ()) {
var pix = new Gdk.Pixbuf.from_file (icon);
int new_height = 64;
int new_width = 64;
int margin_vertical = 0;
int margin_horizontal = 0;
if (pix.height > pix.width) {
new_width = new_width * pix.width / pix.height;
margin_horizontal = (new_height - new_width) / 2;
} else if (pix.height < pix.width) {
new_height = new_height * pix.height / pix.width;
margin_vertical = (new_width - new_height) / 2;
}
if (image == null)
image = new Gtk.Image.from_pixbuf (pix.scale_simple (new_width, new_height, Gdk.InterpType.BILINEAR));
else
image.set_from_pixbuf (pix.scale_simple (new_width, new_height, Gdk.InterpType.BILINEAR));
image.margin_top = margin_vertical;
image.margin_bottom = margin_vertical;
image.margin_right = margin_horizontal;
image.margin_left = margin_horizontal;
} else {
image = new Gtk.Image ();
image.icon_name = icon;
image.pixel_size = 64;
}
}
private void remove_application () {
desktop_file.delete_file ();
deleted (this.get_parent());
this.destroy ();
}
}
public class ActionMenu : Gtk.Revealer {
public signal void delete_clicked ();
public signal void edit_clicked ();
public ActionMenu () {
var delete_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic", Gtk.IconSize.BUTTON);
delete_button.tooltip_text = _("Delete Webapp");
delete_button.relief = Gtk.ReliefStyle.NONE;
delete_button.clicked.connect (() => { delete_clicked (); });
var edit_button = new Gtk.Button.from_icon_name ("edit-symbolic", Gtk.IconSize.BUTTON);
edit_button.tooltip_text = _("Edit Webapp Properties");
edit_button.relief = Gtk.ReliefStyle.NONE;
edit_button.clicked.connect (() => { edit_clicked (); });
var buttons = new Gtk.Grid ();
buttons.orientation = Gtk.Orientation.HORIZONTAL;
buttons.add (edit_button);
buttons.add (delete_button);
buttons.opacity = 0.5;
this.transition_type = Gtk.RevealerTransitionType.CROSSFADE;
this.add (buttons);
}
}

View file

@ -0,0 +1,86 @@
public class ApplicationsView : Gtk.Box {
public signal void add_request();
public signal void edit_request(DesktopFile desktop_file);
public signal void app_deleted ();
private Gtk.FlowBox icon_view;
private Gee.HashMap<string, GLib.DesktopAppInfo> applications;
public bool has_items { get { return icon_view.get_children ().length () > 0; } }
public ApplicationsView () {
GLib.Object (orientation: Gtk.Orientation.VERTICAL);
var scrolled = new Gtk.ScrolledWindow (null, null);
scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER;
icon_view = new Gtk.FlowBox();
icon_view.valign = Gtk.Align.START;
icon_view.vexpand = false;
icon_view.homogeneous = true;
icon_view.column_spacing = 15;
icon_view.row_spacing = 15;
icon_view.margin = 15;
icon_view.activate_on_single_click = false;
icon_view.child_activated.connect ((child) => {
if ((child as Gtk.FlowBoxChild).get_child () is ApplicationIcon) {
var app_icon = (child as Gtk.FlowBoxChild).get_child () as ApplicationIcon;
try {
Process.spawn_command_line_async ("webby " + app_icon.desktop_file.url);
} catch (SpawnError e) {
debug ("Error: %s\n", e.message);
}
}
});
load_applications ();
scrolled.add(icon_view);
this.pack_start(scrolled, true, true, 0);
}
public void load_applications () {
applications = DesktopFile.get_webby_applications();
foreach (GLib.DesktopAppInfo app in applications.values) {
this.add_button (app);
}
}
public void add_button (GLib.DesktopAppInfo app) {
var image = new ApplicationIcon (app);
image.edit_request.connect ((desktop_file) => {
edit_request (desktop_file);
icon_view.unselect_all ();
});
image.deleted.connect ((parent) => {
this.icon_view.remove (parent);
app_deleted ();
});
icon_view.add (image);
icon_view.show_all ();
}
public void select_last_item () {
icon_view.select_child (icon_view.get_child_at_index ((int)icon_view.get_children ().length () - 1));
}
public void select_first_item () {
icon_view.select_child (icon_view.get_child_at_index (0));
}
public void update_button (GLib.DesktopAppInfo app) {
foreach (var item in icon_view.get_children ()) {
if ((item as Gtk.FlowBoxChild).get_child () is ApplicationIcon) {
var app_icon = (item as Gtk.FlowBoxChild).get_child () as ApplicationIcon;
if (app_icon.desktop_file.name == app.get_display_name ()) {
app_icon.set_new_desktopfile (new DesktopFile.from_desktopappinfo (app));
icon_view.select_child (item as Gtk.FlowBoxChild);
break;
}
}
}
}
}

2
vapi/CMakeLists.txt Normal file
View file

@ -0,0 +1,2 @@
install(FILES webkit2gtk-3.0.deps webkit2gtk-3.0.vapi DESTINATION share/vala-0.26/vapi)

View file

@ -0,0 +1,42 @@
# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" ON)
option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ${GSETTINGS_LOCALINSTALL})
if(GSETTINGS_LOCALINSTALL)
message(STATUS "GSettings schemas will be installed locally.")
endif()
if(GSETTINGS_COMPILE)
message(STATUS "GSettings shemas will be compiled.")
endif()
macro(add_schema SCHEMA_NAME)
set(PKG_CONFIG_EXECUTABLE pkg-config)
# Have an option to not install the schema into where GLib is
if (GSETTINGS_LOCALINSTALL)
SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
else (GSETTINGS_LOCALINSTALL)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
endif (GSETTINGS_LOCALINSTALL)
# Run the validator and error if it fails
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
if (_schemas_invalid)
message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
endif (_schemas_invalid)
# Actually install and recomple schemas
message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
if (GSETTINGS_COMPILE)
install (CODE "message (STATUS \"Compiling GSettings schemas\")")
install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
endif ()
endmacro()

286
vapi/cmake/Makefile Normal file
View file

@ -0,0 +1,286 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/mefrio/Scrivania/cmake
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/mefrio/Scrivania/cmake/cmake
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
/usr/bin/cmake -i .
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles /home/mefrio/Scrivania/cmake/cmake/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named scratch
# Build rule for target.
scratch: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 scratch
.PHONY : scratch
# fast build rule for target.
scratch/fast:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/build
.PHONY : scratch/fast
src/entry.o: src/entry.c.o
.PHONY : src/entry.o
# target to build an object file
src/entry.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.o
.PHONY : src/entry.c.o
src/entry.i: src/entry.c.i
.PHONY : src/entry.i
# target to preprocess a source file
src/entry.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.i
.PHONY : src/entry.c.i
src/entry.s: src/entry.c.s
.PHONY : src/entry.s
# target to generate assembly for a file
src/entry.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.s
.PHONY : src/entry.c.s
src/main_window.o: src/main_window.c.o
.PHONY : src/main_window.o
# target to build an object file
src/main_window.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.o
.PHONY : src/main_window.c.o
src/main_window.i: src/main_window.c.i
.PHONY : src/main_window.i
# target to preprocess a source file
src/main_window.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.i
.PHONY : src/main_window.c.i
src/main_window.s: src/main_window.c.s
.PHONY : src/main_window.s
# target to generate assembly for a file
src/main_window.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.s
.PHONY : src/main_window.c.s
src/menu.o: src/menu.c.o
.PHONY : src/menu.o
# target to build an object file
src/menu.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.o
.PHONY : src/menu.c.o
src/menu.i: src/menu.c.i
.PHONY : src/menu.i
# target to preprocess a source file
src/menu.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.i
.PHONY : src/menu.c.i
src/menu.s: src/menu.c.s
.PHONY : src/menu.s
# target to generate assembly for a file
src/menu.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.s
.PHONY : src/menu.c.s
src/notebook.o: src/notebook.c.o
.PHONY : src/notebook.o
# target to build an object file
src/notebook.c.o:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.o
.PHONY : src/notebook.c.o
src/notebook.i: src/notebook.c.i
.PHONY : src/notebook.i
# target to preprocess a source file
src/notebook.c.i:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.i
.PHONY : src/notebook.c.i
src/notebook.s: src/notebook.c.s
.PHONY : src/notebook.s
# target to generate assembly for a file
src/notebook.c.s:
$(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.s
.PHONY : src/notebook.c.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... rebuild_cache"
@echo "... scratch"
@echo "... src/entry.o"
@echo "... src/entry.i"
@echo "... src/entry.s"
@echo "... src/main_window.o"
@echo "... src/main_window.i"
@echo "... src/main_window.s"
@echo "... src/menu.o"
@echo "... src/menu.i"
@echo "... src/menu.s"
@echo "... src/notebook.o"
@echo "... src/notebook.i"
@echo "... src/notebook.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

10
vapi/cmake/README Normal file
View file

@ -0,0 +1,10 @@
Elementary CMake modules
This is a set of CMake modules: Translations, GSettings, and Vala modules.
For all the Vala related modules see README.Vala.rst:
- ParseArguments.cmake
- ValaPrecompile.cmake
- ValaVersion.cmake
- FindVala.cmake

173
vapi/cmake/README.Vala.rst Normal file
View file

@ -0,0 +1,173 @@
==========
Vala CMake
==========
:Author:
Jakob Westhoff
:Version:
Draft
Overview
========
Vala CMake is a collection of macros for the CMake_ build system to allow the
creation and management of projects developed using the Vala_ programming
language or its "Genie" flavor (less tested).
Installation
============
To use the Vala macros in your own project you need to copy the macro files to
an arbitrary folder in your projects directory and reference them in your
``CMakeLists.txt`` file.
Assuming the macros are stored under ``cmake/vala`` in your projects folder you
need to add the following information to your base ``CMakeLists.txt``::
list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake/vala
)
After the new module path as been added you can simply include the provided
modules or use the provided find routines.
Finding Vala
============
The find module for vala works like any other Find module in CMake.
You can use it by simply calling the usual ``find_package`` function. Default
parameters like ``REQUIRED`` and ``QUIETLY`` are supported.
::
find_package(Vala REQUIRED)
After a successful call to the find_package function the following variables
will be set:
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
Precompiling Vala sources
=========================
CMake is mainly supposed to handle c or c++ based projects. Luckily every vala
program is translated into plain c code using the vala compiler, followed by
normal compilation of the generated c program using gcc.
The macro ``vala_precompile`` uses that fact to create c files from your .vala
sources for further CMake processing.
The first parameter provided is a variable, which will be filled with a list of
c files outputted by the vala compiler. This list can than be used in
conjunction with functions like ``add_executable`` or others to create the
necessary compile rules with CMake.
The initial variable is followed by a list of .vala files to be compiled.
Please take care to add every vala file belonging to the currently compiled
project or library as Vala will otherwise not be able to resolve all
dependencies.
The following sections may be specified afterwards to provide certain options
to the vala compiler:
PACKAGES
A list of vala packages/libraries to be used during the compile cycle. The
package names are exactly the same, as they would be passed to the valac
"--pkg=" option.
OPTIONS
A list of optional options to be passed to the valac executable. This can be
used to pass "--thread" for example to enable multi-threading support.
DIRECTORY
Specify the directory where the output source files will be stored. If
ommitted, the source files will be stored in CMAKE_CURRENT_BINARY_DIR.
CUSTOM_VAPIS
A list of custom vapi files to be included for compilation. This can be
useful to include freshly created vala libraries without having to install
them in the system.
GENERATE_VAPI
Pass all the needed flags to the compiler to create an internal vapi for
the compiled library. The provided name will be used for this and a
<provided_name>.vapi file will be created.
GENERATE_HEADER
Let the compiler generate a header file for the compiled code. There will
be a header file as well as an internal header file being generated called
<provided_name>.h and <provided_name>_internal.h
The following call is a simple example to the vala_precompile macro showing an
example to every of the optional sections::
vala_precompile(VALA_C
source1.vala
source2.vala
source3.vala
PACKAGES
gtk+-2.0
gio-1.0
posix
OPTIONS
--thread
CUSTOM_VAPIS
some_vapi.vapi
GENERATE_VAPI
myvapi
GENERATE_HEADER
myheader
)
Most important is the variable VALA_C which will contain all the generated c
file names after the call. The easiest way to use this information is to tell
CMake to create an executable out of it.
::
add_executable(myexecutable ${VALA_C})
Further reading
===============
The `Pdf Presenter Console`__ , which is a vala based project of mine, makes
heavy usage of the here described macros. To look at a real world example of
these macros the mentioned project is the right place to take a look. The svn
trunk of it can be found at::
svn://pureenergy.cc/pdf_presenter_console/trunk
__ http://westhoffswelt.de/projects/pdf_presenter_console.html
Acknowledgments
===============
Thanks go out to Florian Sowade, a fellow local PHP-Usergroupie, who helped me
a lot with the initial version of this macros and always answered my mostly
dumb CMake questions.
.. _CMake: http://cmake.org
.. _Vala: http://live.gnome.org/Vala
.. _Genie: http://live.gnome.org/Genie
..
Local Variables:
mode: rst
fill-column: 79
End:
vim: et syn=rst tw=79

View file

@ -0,0 +1,41 @@
# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
macro(add_translations_directory NLS_PACKAGE)
add_custom_target (i18n ALL COMMENT “Building i18n messages.”)
find_program (MSGFMT_EXECUTABLE msgfmt)
file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
foreach (PO_INPUT ${PO_FILES})
get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
install (FILES ${MO_OUTPUT} DESTINATION
share/locale/${PO_INPUT_BASE}/LC_MESSAGES
RENAME ${NLS_PACKAGE}.mo)
endforeach (PO_INPUT ${PO_FILES})
endmacro(add_translations_directory)
macro(add_translations_catalog NLS_PACKAGE)
add_custom_target (pot COMMENT “Building translation catalog.”)
find_program (XGETTEXT_EXECUTABLE xgettext)
set(C_SOURCE "")
foreach(FILES_INPUT ${ARGN})
file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
foreach(C_FILE ${SOURCE_FILES})
set(C_SOURCE ${C_SOURCE} ${C_FILE})
endforeach()
file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
foreach(C_FILE ${SOURCE_FILES})
set(C_SOURCE ${C_SOURCE} ${C_FILE})
endforeach()
endforeach()
add_custom_command (TARGET pot COMMAND
${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
${VALA_SOURCE} ${C_SOURCE} --keyword="_" --from-code=UTF-8
)
endmacro()

View file

@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif()
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if(EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif()
else(EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif()
endforeach()

View file

@ -0,0 +1,65 @@
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
#
# 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
##
##
# 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
##
# Search for the valac executable in the usual system paths.
find_program(VALA_EXECUTABLE
NAMES valac)
# 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 DEFAULT_MSG VALA_EXECUTABLE)
mark_as_advanced(VALA_EXECUTABLE)
# Determine the valac version
if(VALA_FOUND)
execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
OUTPUT_VARIABLE "VALA_VERSION")
string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
string(STRIP ${VALA_VERSION} "VALA_VERSION")
endif(VALA_FOUND)

View file

@ -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)

View file

@ -0,0 +1,175 @@
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
#
# 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
##
include(ParseArguments)
find_package(Vala REQUIRED)
##
# Compile vala files to their c equivalents for further processing.
#
# The "vala_precompile" macro takes care of calling the valac executable on the
# given source to produce c files which can then be processed further using
# default cmake functions.
#
# The first parameter provided is a variable, which will be filled with a list
# of c files outputted by the vala compiler. This list can than be used in
# conjuction with functions like "add_executable" or others to create the
# neccessary compile rules with CMake.
#
# The initial variable is followed by a list of .vala files to be compiled.
# Please take care to add every vala file belonging to the currently compiled
# project or library as Vala will otherwise not be able to resolve all
# dependencies.
#
# The following sections may be specified afterwards to provide certain options
# to the vala compiler:
#
# PACKAGES
# A list of vala packages/libraries to be used during the compile cycle. The
# package names are exactly the same, as they would be passed to the valac
# "--pkg=" option.
#
# OPTIONS
# A list of optional options to be passed to the valac executable. This can be
# used to pass "--thread" for example to enable multi-threading support.
#
# CUSTOM_VAPIS
# A list of custom vapi files to be included for compilation. This can be
# useful to include freshly created vala libraries without having to install
# them in the system.
#
# GENERATE_VAPI
# Pass all the needed flags to the compiler to create an internal vapi for
# the compiled library. The provided name will be used for this and a
# <provided_name>.vapi file will be created.
#
# GENERATE_HEADER
# Let the compiler generate a header file for the compiled code. There will
# be a header file as well as an internal header file being generated called
# <provided_name>.h and <provided_name>_internal.h
#
# The following call is a simple example to the vala_precompile macro showing
# an example to every of the optional sections:
#
# vala_precompile(VALA_C
# source1.vala
# source2.vala
# source3.vala
# PACKAGES
# gtk+-2.0
# gio-1.0
# posix
# DIRECTORY
# gen
# OPTIONS
# --thread
# CUSTOM_VAPIS
# some_vapi.vapi
# GENERATE_VAPI
# myvapi
# GENERATE_HEADER
# myheader
# )
#
# Most important is the variable VALA_C which will contain all the generated c
# file names after the call.
##
macro(vala_precompile output)
parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
if(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
else(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(ARGS_DIRECTORY)
include_directories(${DIRECTORY})
set(vala_pkg_opts "")
foreach(pkg ${ARGS_PACKAGES})
list(APPEND vala_pkg_opts "--pkg=${pkg}")
endforeach(pkg ${ARGS_PACKAGES})
set(in_files "")
set(out_files "")
set(${output} "")
foreach(src ${ARGS_DEFAULT_ARGS})
list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
string(REPLACE ".vala" ".c" src ${src})
string(REPLACE ".gs" ".c" src ${src})
set(out_file "${DIRECTORY}/${src}")
list(APPEND out_files "${DIRECTORY}/${src}")
list(APPEND ${output} ${out_file})
endforeach(src ${ARGS_DEFAULT_ARGS})
set(custom_vapi_arguments "")
if(ARGS_CUSTOM_VAPIS)
foreach(vapi ${ARGS_CUSTOM_VAPIS})
if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
list(APPEND custom_vapi_arguments ${vapi})
else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
endforeach(vapi ${ARGS_CUSTOM_VAPIS})
endif(ARGS_CUSTOM_VAPIS)
set(vapi_arguments "")
if(ARGS_GENERATE_VAPI)
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
# Header and internal header is needed to generate internal vapi
if (NOT ARGS_GENERATE_HEADER)
set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
endif(NOT ARGS_GENERATE_HEADER)
endif(ARGS_GENERATE_VAPI)
set(header_arguments "")
if(ARGS_GENERATE_HEADER)
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
endif(ARGS_GENERATE_HEADER)
add_custom_command(OUTPUT ${out_files}
COMMAND
${VALA_EXECUTABLE}
ARGS
"-C"
${header_arguments}
${vapi_arguments}
"-b" ${CMAKE_CURRENT_SOURCE_DIR}
"-d" ${DIRECTORY}
${vala_pkg_opts}
${ARGS_OPTIONS}
${in_files}
${custom_vapi_arguments}
DEPENDS
${in_files}
${ARGS_CUSTOM_VAPIS}
)
endmacro(vala_precompile)

View file

@ -0,0 +1,96 @@
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
#
# 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
##
include(ParseArguments)
find_package(Vala REQUIRED)
##
# Ensure a certain valac version is available
#
# The initial argument is the version to check for
#
# It may be followed by a optional parameter to specifiy a version range. The
# following options are valid:
#
# EXACT
# Vala needs to be available in the exact version given
#
# MINIMUM
# The provided version is the minimum version. Therefore Vala needs to be
# available in the given version or any higher version
#
# MAXIMUM
# The provided version is the maximum. Therefore Vala needs to be available
# in the given version or any version older than this
#
# If no option is specified the version will be treated as a minimal version.
##
macro(ensure_vala_version version)
parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN})
set(compare_message "")
set(error_message "")
if(ARGS_MINIMUM)
set(compare_message "a minimum ")
set(error_message "or greater ")
elseif(ARGS_MAXIMUM)
set(compare_message "a maximum ")
set(error_message "or less ")
endif(ARGS_MINIMUM)
message(STATUS
"checking for ${compare_message}Vala version of ${version}"
)
unset(version_accepted)
# MINIMUM is the default if no option is specified
if(ARGS_EXACT)
if(${VALA_VERSION} VERSION_EQUAL ${version} )
set(version_accepted TRUE)
endif(${VALA_VERSION} VERSION_EQUAL ${version})
elseif(ARGS_MAXIMUM)
if(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
set(version_accepted TRUE)
endif(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
else(ARGS_MAXIMUM)
if(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
set(version_accepted TRUE)
endif(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
endif(ARGS_EXACT)
if (NOT version_accepted)
message(FATAL_ERROR
"Vala version ${version} ${error_message}is required."
)
endif(NOT version_accepted)
message(STATUS
" found Vala, version ${VALA_VERSION}"
)
endmacro(ensure_vala_version)

9
vapi/config.vapi Normal file
View file

@ -0,0 +1,9 @@
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Build {
public const string DATADIR;
public const string PKGDATADIR;
public const string GETTEXT_PACKAGE;
public const string RELEASE_NAME;
public const string VERSION;
public const string VERSION_INFO;
}

7
vapi/webkit2gtk-3.0.deps Normal file
View file

@ -0,0 +1,7 @@
atk
gio-2.0
cairo
pango
gdk-pixbuf-2.0
libsoup-2.4
gtk+-3.0

1003
vapi/webkit2gtk-3.0.vapi Normal file

File diff suppressed because it is too large Load diff