-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
972c537
commit fb6fe41
Showing
27 changed files
with
401 additions
and
320 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
data/com.github.danielpinto8zz6.budgie-network-applet.plugin.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} |
Oops, something went wrong.