diff --git a/meson.build b/meson.build index d791fb1..2b68676 100644 --- a/meson.build +++ b/meson.build @@ -32,6 +32,7 @@ dep_posix = meson.get_compiler('vala').find_library('posix') dep_unity = dependency('unity', version: '>=4.0.0') dep_sqlite = dependency('sqlite3') + add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'src/MConnect/vapi')], language: 'vala') dependencies = [ diff --git a/src/EOSConnect/Wingpanel/Indicator.vala b/src/EOSConnect/Wingpanel/Indicator.vala new file mode 100644 index 0000000..5fe30aa --- /dev/null +++ b/src/EOSConnect/Wingpanel/Indicator.vala @@ -0,0 +1,64 @@ +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * AUTHORS + * gyan000 + */ +using EOSConnect; + +public class EOSConnect.Indicator : Wingpanel.Indicator { + + private Gtk.Spinner? display_widget = null; + // private Gtk.StyleContext style_context; + // private Nightlight.Widgets.PopoverWidget? popover_widget = null; + + public Indicator (Wingpanel.IndicatorManager.ServerType server_type) { + Object (code_name: "wingpanel-indicator-eosconnect", + display_name: _("EOSConnect"), + description: _("EOSConnect indicator")); + } + + public override Gtk.Widget get_display_widget () { + debug ("get_display_widget"); + if (display_widget == null) { + display_widget = new Gtk.Spinner (); + } + return display_widget; + } + + public override Gtk.Widget? get_widget () { + debug ("get_widget"); + return null; + } + + public override void opened () { + debug ("opened"); + } + + public override void closed () { + debug ("closed"); + } +} + +public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) { + debug ("Activating EOSConnect Indicator"); + + if (server_type != Wingpanel.IndicatorManager.ServerType.SESSION) { + warning ("Wingpanel is not in session, not loading EOSConnect indicator."); + return null; + } + + var indicator = new EOSConnect.Indicator (server_type); + return indicator; +} diff --git a/src/meson.build b/src/meson.build index 466b4e7..7772b02 100644 --- a/src/meson.build +++ b/src/meson.build @@ -44,6 +44,7 @@ all_files = files( 'EOSConnect/Widgets/DeviceMenuitem.vala', 'EOSConnect/Widgets/PluginListBox.vala', 'EOSConnect/Widgets/PluginListBoxRow.vala', + # 'EOSConnect/Wingpanel/Indicator.vala', # 'MConnect/Config.vala', 'MConnect/BatteryHandler.vala', 'MConnect/Core.vala', @@ -82,3 +83,32 @@ executable( #vala_args: args, install: true ) + +dep_wingpanel = dependency('wingpanel-2.0') + +# as_resources = gnome.compile_resources( +# 'as-resources', 'data/io.elementary.wingpanel.nightlight.gresource.xml', +# source_dir: 'data', +# c_name: 'as' +# ) + +# pkg-config wingpanel-2.0 --variable=indicatorsdir +# ls -lh /usr/lib/x86_64-linux-gnu/wingpanel + +shared_module( + meson.project_name(), + 'EOSConnect/Wingpanel/Indicator.vala', + # 'src/Services/ColorInterface.vala', + # 'src/Widgets/PopoverWidget.vala', + # 'src/Widgets/RevealerSwitch.vala', + # as_resources, + dependencies: [ + dependency('glib-2.0'), + dependency('gobject-2.0'), + dependency('granite'), + dependency('gtk+-3.0'), + dep_wingpanel + ], + install: true, + install_dir : dep_wingpanel.get_pkgconfig_variable('indicatorsdir') +)