From 39263df5ab76e2f444e5dbb702512f741c56830c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 31 Jul 2013 23:09:41 -0500 Subject: add main() to its own file --- src/Makefile.am | 1 + src/indicator-bluetooth-service.vala | 28 ---------------------------- src/main.vala | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 src/main.vala (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 5fcfc5c..2b92f9b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,7 @@ indicator_LTLIBRARIES = libbluetooth.la indicator_bluetooth_service_SOURCES = \ indicator3-0.4.vapi \ gnome-bluetooth-1.0.vapi \ + main.vala \ indicator-bluetooth-service.vala indicator_bluetooth_service_VALAFLAGS = \ diff --git a/src/indicator-bluetooth-service.vala b/src/indicator-bluetooth-service.vala index e9d8e76..f65c538 100644 --- a/src/indicator-bluetooth-service.vala +++ b/src/indicator-bluetooth-service.vala @@ -394,34 +394,6 @@ private void show_control_center (string panel) } } -public static int main (string[] args) -{ - Intl.setlocale (LocaleCategory.ALL, ""); - Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.GNOMELOCALEDIR); - Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8"); - Intl.textdomain (Config.GETTEXT_PACKAGE); - - var loop = new MainLoop (); - - BluetoothIndicator indicator; - try - { - indicator = new BluetoothIndicator (); - } - catch (Error e) - { - warning ("Failed to start bluetooth indicator service: %s", e.message); - return Posix.EXIT_FAILURE; - } - // FIXMEindicator.shutdown.connect (() => { loop.quit (); }); - - loop.run (); - - indicator = null; - - return Posix.EXIT_SUCCESS; -} - [DBus (name = "com.canonical.indicator.bluetooth.service")] private class BluetoothService : Object { diff --git a/src/main.vala b/src/main.vala new file mode 100644 index 0000000..79683b2 --- /dev/null +++ b/src/main.vala @@ -0,0 +1,27 @@ + +public static int +main (string[] args) +{ + Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8"); + Intl.setlocale (LocaleCategory.ALL, ""); + Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.GNOMELOCALEDIR); + Intl.textdomain (Config.GETTEXT_PACKAGE); + + var loop = new MainLoop (); + + BluetoothIndicator indicator; + try + { + indicator = new BluetoothIndicator (); + } + catch (Error e) + { + warning ("Failed to start bluetooth indicator service: %s", e.message); + return Posix.EXIT_FAILURE; + } + + loop.run (); + return Posix.EXIT_SUCCESS; +} + //var service = new IndicatorSound.Service (); + //return service.run (); -- cgit v1.2.3