Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Jan 19, 2024
2 parents b645302 + 5697b4d commit b2279b4
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 39 deletions.
2 changes: 1 addition & 1 deletion po/extra/extra.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: extra\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-17 19:02+0000\n"
"POT-Creation-Date: 2024-01-19 15:54+0000\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"
Expand Down
33 changes: 20 additions & 13 deletions po/networking-plug.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: networking-plug\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-17 19:02+0000\n"
"POT-Creation-Date: 2024-01-19 15:54+0000\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"
Expand Down Expand Up @@ -270,47 +270,54 @@ msgstr ""
msgid "Exceptions"
msgstr ""

#: src/Views/VPNPage.vala:36
msgid "VPN removed"
#: src/Views/VPNPage.vala:31
msgid ""
"A Virtual Private Network can hide network traffic on public networks or "
"from your internet service provider. It can't protect passwords from "
"attackers or prevent websites from identifying you."
msgstr ""

#: src/Views/VPNPage.vala:37
msgid "VPN removed"
msgstr ""

#: src/Views/VPNPage.vala:38
msgid "Undo"
msgstr ""

#: src/Views/VPNPage.vala:40
#: src/Views/VPNPage.vala:41
msgid "No VPN Connections"
msgstr ""

#: src/Views/VPNPage.vala:41
#: src/Views/VPNPage.vala:42
msgid "Add a new VPN connection to begin."
msgstr ""

#: src/Views/VPNPage.vala:59
#: src/Views/VPNPage.vala:60
msgid "Add Connection…"
msgstr ""

#: src/Views/VPNPage.vala:72
#: src/Views/VPNPage.vala:73
msgid "Forget selected VPN…"
msgstr ""

#: src/Views/VPNPage.vala:77
#: src/Views/VPNPage.vala:78
msgid "Edit VPN connection…"
msgstr ""

#: src/Views/VPNPage.vala:300 src/Views/VPNPage.vala:358
#: src/Views/VPNPage.vala:301 src/Views/VPNPage.vala:359
msgid "Failed to remove VPN connection"
msgstr ""

#: src/Views/VPNPage.vala:301
#: src/Views/VPNPage.vala:302
msgid "Cannot remove an active VPN connection."
msgstr ""

#: src/Views/VPNPage.vala:334
#: src/Views/VPNPage.vala:335
msgid "Failed to run Connection Editor"
msgstr ""

#: src/Views/VPNPage.vala:335
#: src/Views/VPNPage.vala:336
msgid "The program \"nm-connection-editor\" may not be installed."
msgstr ""

Expand Down Expand Up @@ -419,7 +426,7 @@ msgstr ""
msgid "Enabled (auto mode)"
msgstr ""

#: src/Widgets/WifiMenuItem.vala:79 src/Widgets/VPN/VPNMenuItem.vala:77
#: src/Widgets/WifiMenuItem.vala:79 src/Widgets/VPN/VPNMenuItem.vala:72
#: src/Widgets/VPN/VPNMenuItem.vala:114 src/Widgets/VPN/VPNMenuItem.vala:131
#: src/Widgets/VPN/VPNMenuItem.vala:136
msgid "Connect"
Expand Down
16 changes: 1 addition & 15 deletions src/Views/VPNPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Network.VPNPage : Network.Widgets.Page {
public VPNPage () {
Object (
title: _("VPN"),
description: _("A Virtual Private Network can hide network traffic on public networks or from your internet service provider. It can't protect passwords from attackers or prevent websites from identifying you."),
icon_name: "network-vpn"
);
}
Expand Down Expand Up @@ -68,13 +69,7 @@ public class Network.VPNPage : Network.Widgets.Page {
add_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
add_button_label.mnemonic_widget = add_button;

var edit_connection_button = new Gtk.Button.from_icon_name ("preferences-system-symbolic") {
tooltip_text = _("Edit VPN connection…"),
sensitive = false
};

actionbar.pack_start (add_button);
actionbar.pack_start (edit_connection_button);

var scrolled = new Gtk.ScrolledWindow (null, null) {
child = vpn_list
Expand Down Expand Up @@ -102,11 +97,6 @@ public class Network.VPNPage : Network.Widgets.Page {
try_connection_editor ("--create --type=vpn");
});

edit_connection_button.clicked.connect (() => {
var selected_row = (VPNMenuItem) vpn_list.get_selected_row ();
try_connection_editor ("--edit=" + selected_row.connection.get_uuid ());
});

remove_vpn_toast.default_action.connect (() => {
GLib.Source.remove (timeout_id);
timeout_id = 0;
Expand All @@ -121,10 +111,6 @@ public class Network.VPNPage : Network.Widgets.Page {
}
});

vpn_list.row_selected.connect (row => {
edit_connection_button.sensitive = row != null;
});

active_connections = new Gee.ArrayList<NM.ActiveConnection> ();

update ();
Expand Down
33 changes: 32 additions & 1 deletion src/Widgets/VPN/VPNInfoDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class Network.Widgets.VPNInfoDialog : Granite.MessageDialog {

public VPNInfoDialog (NM.RemoteConnection? connection) {
Object (
buttons: Gtk.ButtonsType.CLOSE,
image_icon: new ThemedIcon ("network-vpn"),
connection: connection
);
Expand All @@ -50,6 +49,9 @@ public class Network.Widgets.VPNInfoDialog : Granite.MessageDialog {
xalign = 0
};

add_button (_("Edit Connection…"), 1);
add_button (_("Close"), Gtk.ResponseType.CLOSE);

var box = new Gtk.Box (VERTICAL, 0);
box.add (new Granite.HeaderLabel (("VPN Type")));
box.add (vpn_type);
Expand All @@ -64,6 +66,35 @@ public class Network.Widgets.VPNInfoDialog : Granite.MessageDialog {

connection.changed.connect (update_status);
update_status ();

response.connect ((response) => {
if (response == 1) {
try {
var appinfo = AppInfo.create_from_commandline (
"nm-connection-editor --edit=%s".printf (connection.get_uuid ()),
null,
GLib.AppInfoCreateFlags.NONE
);
appinfo.launch (null, null);
} catch (Error error) {
var dialog = new Granite.MessageDialog (
_("Failed to run Connection Editor"),
_("The program \"nm-connection-editor\" may not be installed."),
new ThemedIcon ("network-vpn"),
Gtk.ButtonsType.CLOSE
) {
badge_icon = new ThemedIcon ("dialog-error"),
modal = true,
transient_for = (Gtk.Window) get_toplevel ()
};
dialog.show_error_details (error.message);
dialog.present ();
dialog.response.connect (dialog.destroy);
}
}

destroy ();
});
}

private string get_key_group_username () {
Expand Down
17 changes: 8 additions & 9 deletions src/Widgets/VPN/VPNMenuItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class Network.VPNMenuItem : Gtk.ListBoxRow {
private Gtk.Image vpn_state;
private Gtk.Label state_label;
private Gtk.Label vpn_label;
private Widgets.VPNInfoDialog vpn_info_dialog;

public VPNMenuItem (NM.RemoteConnection _connection) {
Object (
Expand Down Expand Up @@ -62,18 +61,15 @@ public class Network.VPNMenuItem : Gtk.ListBoxRow {
xalign = 0
};

vpn_info_dialog = new Widgets.VPNInfoDialog (connection) {
modal = true
};

var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") {
tooltip_text = _("Forget connection…"),
margin_end = 3,
tooltip_text = _("Forget connection"),
valign = CENTER
};

var vpn_info_button = new Gtk.Button.from_icon_name ("view-more-horizontal-symbolic") {
margin_end = 3,
tooltip_text = _("Connection info"),
valign = Gtk.Align.CENTER
};
vpn_info_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
Expand Down Expand Up @@ -107,9 +103,13 @@ public class Network.VPNMenuItem : Gtk.ListBoxRow {
remove_button.clicked.connect (remove_row);

vpn_info_button.clicked.connect (() => {
vpn_info_dialog.transient_for = (Gtk.Window) get_toplevel ();
var vpn_info_dialog = new Widgets.VPNInfoDialog (connection) {
modal = true,
secondary_text = Utils.state_to_string (state),
transient_for = (Gtk.Window) get_toplevel ()
};

vpn_info_dialog.present ();
vpn_info_dialog.response.connect (vpn_info_dialog.destroy);
});
}

Expand Down Expand Up @@ -168,7 +168,6 @@ public class Network.VPNMenuItem : Gtk.ListBoxRow {
}

state_label.label = GLib.Markup.printf_escaped ("<span font_size='small'>%s</span>", Utils.state_to_string (state));
vpn_info_dialog.secondary_text = Utils.state_to_string (state);
}

}

0 comments on commit b2279b4

Please sign in to comment.