Skip to content

Commit

Permalink
Budgie network applet
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpinto8zz6 committed Apr 10, 2020
1 parent 972c537 commit fb6fe41
Show file tree
Hide file tree
Showing 27 changed files with 401 additions and 320 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/gettext.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/main.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/release.yml

This file was deleted.

21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Wingpanel Network Indicator
[![l10n](https://l10n.elementary.io/widgets/wingpanel/wingpanel-indicator-network/svg-badge.svg)](https://l10n.elementary.io/projects/wingpanel/wingpanel-indicator-network)
# Budgie Network Applet
This is a fork of [Wingpanel Network Indicator](https://github.com/elementary/wingpanel-indicator-network), ported to budgie desktop


![Screenshot](data/screenshot.png?raw=true)

Expand All @@ -8,12 +9,12 @@
You'll need the following dependencies:

* gobject-introspection
* libgranite-dev
* libnm-dev
* libnma-dev
* libwingpanel-2.0-dev
* budgie-1.0
* meson
* valac
* gee-0.8

Run `meson` to configure the build environment and then `ninja` to build

Expand All @@ -24,3 +25,15 @@ Run `meson` to configure the build environment and then `ninja` to build
To install, use `ninja install`

sudo ninja install

### Arch
you can install that applet on archlinux with aur : [budgie-network-applet](https://aur.archlinux.org/packages/budgie-network-applet)

### Solus (dependencies)
```
sudo eopkg it -c system.devel
sudo eopkg it budgie-desktop-devel libgtk-3-devel ninja gobject-introspection meson vala network-manager-applet-devel libgee-devel gcc
```
## Donation

If you like this applet, you can donate via **[PayPal](https://www.paypal.me/danielpinto8zz6)**. It will help me to spend more time improving this!
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Plugin]
Module=networkapplet.so
Name=Network
Description=Network Applet
Authors=Daniel Pinto
Copyright=Copyright © 2018 Daniel Pinto
Website=https://github.com/danielpinto8zz6/budgie-network-applet
Icon=network-wireless-signal-excellent-symbolic
21 changes: 14 additions & 7 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
i18n.merge_file(
input: 'network.appdata.xml.in',
output: 'io.elementary.wingpanel.network.appdata.xml',
po_dir: join_paths(meson.source_root(), 'po', 'extra'),
type: 'xml',
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo'),
plugin_file = i18n.merge_file(
input: 'com.github.danielpinto8zz6.budgie-network-applet.plugin.in',
output: 'com.github.danielpinto8zz6.budgie-network-applet.plugin',
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: lib_install_dir
)

plugin_utils = find_program('desktop-file-validate', required: false)
if plugin_utils.found()
test('Validate plugin file', plugin_utils,
args: [plugin_file]
)
endif
31 changes: 0 additions & 31 deletions data/network.appdata.xml.in

This file was deleted.

Binary file modified data/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 11 additions & 45 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
project(
'network',
'vala', 'c',
version: '2.2.3'
)

gettext_name = meson.project_name() + '-indicator'
i18n = import('i18n')
project('com.github.danielpinto8zz6.budgie-network-applet',
['vala', 'c'],
version: '1.0',
meson_version: '>=0.40.0',
license: 'GPL2')

prefix = get_option('prefix')
libdir = join_paths(prefix, get_option('libdir'))
i18n=import('i18n')

add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(gettext_name), language:'c')
add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language: 'c')

add_project_arguments(
'--vapidir', join_paths(meson.current_source_dir(), 'vapi'),
language: 'vala'
)

wingpanel_dep = dependency('wingpanel-2.0')
wingpanel_indicatorsdir = wingpanel_dep.get_pkgconfig_variable('indicatorsdir', define_variable: ['libdir', libdir])
i18n=import('i18n')

shared_module(
meson.project_name(),
'src/Indicator.vala',
'src/Utils.vala',
'src/common/rfkill.vala',
'src/common/Widgets/AbstractEtherInterface.vala',
'src/common/Widgets/AbstractModemInterface.vala',
'src/common/Widgets/AbstractVpnInterface.vala',
'src/common/Widgets/AbstractWifiInterface.vala',
'src/common/Widgets/NMVisualizer.vala',
'src/common/Widgets/VpnMenuItem.vala',
'src/common/Widgets/WidgetNMInterface.vala',
'src/common/Widgets/WifiMenuItem.vala',
'src/Widgets/DisplayWidget.vala',
'src/Widgets/EtherInterface.vala',
'src/Widgets/ModemInterface.vala',
'src/Widgets/VpnInterface.vala',
'src/Widgets/WifiInterface.vala',
'src/Widgets/PopoverWidget.vala',
dependencies: [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('granite'),
dependency('gtk+-3.0'),
dependency('libnm'),
dependency('libnma'),
meson.get_compiler('vala').find_library('posix'),
wingpanel_dep
],
install: true,
install_dir : wingpanel_indicatorsdir
)
lib_install_dir=join_paths(get_option('prefix'), get_option(
'libdir'), 'budgie-desktop', 'plugins', meson.project_name())

subdir('src')
subdir('data')
subdir('po')
2 changes: 1 addition & 1 deletion po/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ msgstr ""

#: src/Indicator.vala:29
msgid "Network"
msgstr "Newtork"
msgstr "Network"

#: src/Indicator.vala:30
msgid "Network indicator"
Expand Down
5 changes: 1 addition & 4 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
i18n.gettext(gettext_name,
args: '--directory=' + meson.source_root(),
preset: 'glib'
)
i18n.gettext(meson.project_name(), preset: 'glib')

subdir('extra')
100 changes: 100 additions & 0 deletions src/Applet.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright (c) 2018-2020 Daniel Pinto (https://github.com/danielpinto8zz6/budgie-network-applet)
* Copyright (c) 2015-2018 elementary LLC (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or
* (at your option) any later version.
*
* 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace Network {
public class Plugin : Budgie.Plugin, Peas.ExtensionBase {
public Budgie.Applet get_panel_widget (string uuid) {
return new Applet ();
}
}

public class Applet : Budgie.Applet {
protected Gtk.EventBox widget;

Budgie.Popover ? popover = null;

private unowned Budgie.PopoverManager ? manager = null;

Widgets.PopoverWidget? popover_widget = null;
Widgets.DisplayWidget? display_widget = null;

public Applet () {
GLib.Intl.setlocale (GLib.LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALE_DIR);
GLib.Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
GLib.Intl.textdomain (Config.GETTEXT_PACKAGE);

widget = new Gtk.EventBox ();
add(widget);

get_style_context ().add_class ("budgie-network-applet");

popover = new Budgie.Popover (widget);

display_widget = new Widgets.DisplayWidget ();
widget.add (display_widget);

popover_widget = new Widgets.PopoverWidget ();
popover_widget.width_request = 250;
popover_widget.border_width = 6;
popover.add (popover_widget);
popover_widget.notify["state"].connect (on_state_changed);
popover_widget.notify["secure"].connect (on_state_changed);
popover_widget.notify["extra-info"].connect (on_state_changed);
popover_widget.settings_shown.connect (() => { popover.hide(); });

widget.button_press_event.connect ((e)=> {
if (e.button != 1) {
return Gdk.EVENT_PROPAGATE;
}
if (popover.get_visible ()) {
popover.hide ();
} else {
this.manager.show_popover (widget);
}
return Gdk.EVENT_STOP;
});

popover.get_child ().show_all ();

show_all ();

on_state_changed ();
}

public override void update_popovers (Budgie.PopoverManager ? manager) {
this.manager = manager;
manager.register_popover (widget, popover);
}

void on_state_changed () {
assert (popover_widget != null);
assert (display_widget != null);

display_widget.update_state (popover_widget.state, popover_widget.secure, popover_widget.extra_info);
}
}
}

[ModuleInit]
public void peas_register_types (TypeModule module) {
// boilerplate - all modules need this
var objmodule = module as Peas.ObjectModule;
objmodule.register_extension_type (typeof (Budgie.Plugin), typeof (Network.Plugin));
}
Loading

0 comments on commit fb6fe41

Please sign in to comment.