From 66edc177867c09e696552a73862c29485194e704 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 11 Feb 2014 20:52:49 -0600 Subject: Switch the build to have a library of all the vala components --- src/CMakeLists.txt | 29 ++++++++++++++++++++--------- src/main.c | 32 ++++++++++++++++++++++++++++++++ src/main.vala | 14 -------------- 3 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 src/main.c delete mode 100644 src/main.vala (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3ee6a65..ca1eb82 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,11 +46,6 @@ vala_add(indicator-sound-service mpris2-interfaces accounts-service-user ) -vala_add(indicator-sound-service - main.vala - DEPENDS - service -) vala_add(indicator-sound-service volume-control.vala ) @@ -110,16 +105,33 @@ set( ) ########################### -# Executable +# Lib ########################### add_definitions( -w ) +add_library( + indicator-sound-service-lib STATIC + ${INDICATOR_SOUND_SOURCES} +) + +target_link_libraries( + indicator-sound-service-lib + ${PULSEAUDIO_LIBRARIES} + ${SOUNDSERVICE_LIBRARIES} +) + +########################### +# Executable +########################### + +include_directories(${CMAKE_BINARY_DIR}) + add_executable( indicator-sound-service-bin - ${INDICATOR_SOUND_SOURCES} + main.c ) set_target_properties( @@ -130,8 +142,7 @@ set_target_properties( target_link_libraries( indicator-sound-service-bin - ${PULSEAUDIO_LIBRARIES} - ${SOUNDSERVICE_LIBRARIES} + indicator-sound-service-lib ) ########################### diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..f8635c8 --- /dev/null +++ b/src/main.c @@ -0,0 +1,32 @@ +/* main.c generated by valac 0.22.1, the Vala compiler + * generated from main.vala, do not modify */ + + +#include +#include +#include + +#include "indicator-sound-service.h" +#include "config.h" + +int +main (int argc, char ** argv) { + gint result = 0; + IndicatorSoundService* service = NULL; + + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + + /* Initialize libnotify */ + notify_init ("indicator-sound"); + + + service = indicator_sound_service_new (); + result = indicator_sound_service_run (service); + g_object_unref(service); + + return result; +} + + diff --git a/src/main.vala b/src/main.vala deleted file mode 100644 index 4da9e58..0000000 --- a/src/main.vala +++ /dev/null @@ -1,14 +0,0 @@ - -[CCode (cheader_filename="libintl.h", type="char *")] -extern unowned string bind_textdomain_codeset (string domainname, string codeset); - -static int main (string[] args) { - bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8"); - Intl.setlocale (LocaleCategory.ALL, ""); - Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.GNOMELOCALEDIR); - - Notify.init ("indicator-sound"); - - var service = new IndicatorSound.Service (); - return service.run (); -} -- cgit v1.2.3