diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | data/Makefile.am | 11 | ||||
-rw-r--r-- | data/com.canonical.indicator.bluetooth.gschema.xml.in | 9 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | po/indicator-bluetooth.pot | 34 | ||||
-rw-r--r-- | src/indicator-bluetooth-service.vala | 18 |
7 files changed, 56 insertions, 20 deletions
@@ -2,6 +2,7 @@ Overview of changes in indicator-bluetooth 0.0.6 * Add "Set Up New Device" menu item * Only show indicator if Bluetooth adapter present + * Support existing gsettings key to disable indicator Overview of changes in indicator-bluetooth 0.0.5 diff --git a/configure.ac b/configure.ac index 758c71a..2fe9bbe 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,8 @@ AM_PROG_VALAC([0.16.0]) AM_PROG_CC_C_O LT_INIT +GLIB_GSETTINGS + dnl ########################################################################### dnl Dependencies dnl ########################################################################### diff --git a/data/Makefile.am b/data/Makefile.am index ac63ebc..6f16e85 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -4,7 +4,14 @@ dbus_services_DATA = indicator-bluetooth.service %.service: %.service.in sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ -EXTRA_DIST = indicator-bluetooth.service.in +gsettings_SCHEMAS = com.canonical.indicator.bluetooth.gschema.xml +@INTLTOOL_XML_NOMERGE_RULE@ +@GSETTINGS_RULES@ + +EXTRA_DIST = \ + indicator-bluetooth.service.in \ + com.canonical.indicator.bluetooth.gschema.xml.in CLEANFILES = \ - $(dbus_services_DATA) + $(dbus_services_DATA) \ + $(gsettings_SCHEMAS) diff --git a/data/com.canonical.indicator.bluetooth.gschema.xml.in b/data/com.canonical.indicator.bluetooth.gschema.xml.in new file mode 100644 index 0000000..cb60641 --- /dev/null +++ b/data/com.canonical.indicator.bluetooth.gschema.xml.in @@ -0,0 +1,9 @@ +<schemalist> + <schema id="com.canonical.indicator.bluetooth" path="/com/canonical/indicator/bluetooth/"> + <key name="visible" type="b"> + <default>true</default> + <_summary>Whether or not to show the bluetooth indicator in the menu bar.</_summary> + <_description>Whether or not to show the bluetooth indicator in the menu bar.</_description> + </key> + </schema> +</schemalist> diff --git a/po/POTFILES.in b/po/POTFILES.in index 366eae0..634553a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,6 @@ # List of source files containing translatable strings. # Please keep this file in alphabetical order. [encoding: UTF-8] +data/com.canonical.indicator.bluetooth.gschema.xml.in src/indicator-bluetooth.vala src/indicator-bluetooth-service.vala diff --git a/po/indicator-bluetooth.pot b/po/indicator-bluetooth.pot index bd60d88..9559462 100644 --- a/po/indicator-bluetooth.pot +++ b/po/indicator-bluetooth.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-01-31 12:34-0500\n" +"POT-Creation-Date: 2013-02-08 11:56+1300\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" @@ -17,48 +17,56 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../data/com.canonical.indicator.bluetooth.gschema.xml.in.h:1 +msgid "Whether or not to show the bluetooth indicator in the menu bar." +msgstr "" + #: ../src/indicator-bluetooth.vala:17 -#: ../src/indicator-bluetooth-service.vala:195 +#: ../src/indicator-bluetooth-service.vala:231 msgid "Bluetooth: On" msgstr "" -#: ../src/indicator-bluetooth-service.vala:47 -#: ../src/indicator-bluetooth-service.vala:385 +#: ../src/indicator-bluetooth-service.vala:54 +#: ../src/indicator-bluetooth-service.vala:438 msgid "Bluetooth" msgstr "" -#: ../src/indicator-bluetooth-service.vala:61 +#: ../src/indicator-bluetooth-service.vala:68 msgid "Visible" msgstr "" -#: ../src/indicator-bluetooth-service.vala:110 +#: ../src/indicator-bluetooth-service.vala:117 +msgid "Set Up New Device…" +msgstr "" + +#: ../src/indicator-bluetooth-service.vala:122 msgid "Bluetooth Settings…" msgstr "" -#: ../src/indicator-bluetooth-service.vala:195 +#: ../src/indicator-bluetooth-service.vala:231 msgid "Bluetooth: Off" msgstr "" -#: ../src/indicator-bluetooth-service.vala:254 +#: ../src/indicator-bluetooth-service.vala:290 msgid "Connection" msgstr "" -#: ../src/indicator-bluetooth-service.vala:277 +#: ../src/indicator-bluetooth-service.vala:313 msgid "Send files…" msgstr "" -#: ../src/indicator-bluetooth-service.vala:285 +#: ../src/indicator-bluetooth-service.vala:321 msgid "Browse files…" msgstr "" -#: ../src/indicator-bluetooth-service.vala:294 +#: ../src/indicator-bluetooth-service.vala:330 msgid "Keyboard Settings…" msgstr "" -#: ../src/indicator-bluetooth-service.vala:302 +#: ../src/indicator-bluetooth-service.vala:338 msgid "Mouse and Touchpad Settings…" msgstr "" -#: ../src/indicator-bluetooth-service.vala:311 +#: ../src/indicator-bluetooth-service.vala:347 msgid "Sound Settings…" msgstr "" diff --git a/src/indicator-bluetooth-service.vala b/src/indicator-bluetooth-service.vala index 21ac4e5..ac84f33 100644 --- a/src/indicator-bluetooth-service.vala +++ b/src/indicator-bluetooth-service.vala @@ -10,6 +10,7 @@ public class BluetoothIndicator { + private Settings settings; private DBusConnection bus; private Indicator.Service indicator_service; private Dbusmenu.Server menu_server; @@ -26,6 +27,13 @@ public class BluetoothIndicator public BluetoothIndicator () throws Error { + settings = new Settings ("com.canonical.indicator.bluetooth"); + settings.changed.connect ((key) => + { + if (key == "visible") + update_visible (); + }); + bus = Bus.get_sync (BusType.SESSION); indicator_service = new Indicator.Service ("com.canonical.indicator.bluetooth"); @@ -117,9 +125,9 @@ public class BluetoothIndicator killswitch_state_changed_cb (killswitch.state); - client.adapter_model.row_inserted.connect (adapters_changed_cb); - client.adapter_model.row_deleted.connect (adapters_changed_cb); - adapters_changed_cb (); + client.adapter_model.row_inserted.connect (update_visible); + client.adapter_model.row_deleted.connect (update_visible); + update_visible (); } private BluetoothMenuItem? find_menu_item (string address) @@ -176,9 +184,9 @@ public class BluetoothIndicator item.update (type, proxy, alias, icon, connected, services, uuids); } - private void adapters_changed_cb () + private void update_visible () { - bluetooth_service._visible = client.adapter_model.iter_n_children (null) > 0; + bluetooth_service._visible = client.adapter_model.iter_n_children (null) > 0 && settings.get_boolean ("visible"); var builder = new VariantBuilder (VariantType.ARRAY); builder.add ("{sv}", "Visible", new Variant.boolean (bluetooth_service._visible)); try |