Skip to content

Commit

Permalink
GH-4 - Start work on wingpanel/indicator integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
gyan000 committed Nov 24, 2018
1 parent e364d6f commit fe96f3b
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
64 changes: 64 additions & 0 deletions src/EOSConnect/Wingpanel/Indicator.vala
Original file line number Diff line number Diff line change
@@ -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 <gyan000 (at] ijaz.fr>
*/
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;
}
30 changes: 30 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
)

0 comments on commit fe96f3b

Please sign in to comment.