network: Drop Reset page

Following the latest mockups [1], the "Forget" button
is now available in the Details page, and the Reset page
is gone.

This patch then removes the Reset page, and moves the
functionality to the Details page.

[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/network/aday2/network-wires.png

https://bugzilla.gnome.org/show_bug.cgi?id=779841
This commit is contained in:
Georges Basile Stavracas Neto 2017-05-21 15:00:08 -03:00
parent ce289c3824
commit 8137036675
9 changed files with 46 additions and 248 deletions

View file

@ -20,8 +20,6 @@ libconnection_editor_la_SOURCES = \
ce-page-ip6.c \
ce-page-security.h \
ce-page-security.c \
ce-page-reset.h \
ce-page-reset.c \
ce-page-ethernet.h \
ce-page-ethernet.c \
ce-page-8021x-security.h \

View file

@ -31,6 +31,12 @@
G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
static void
forget_cb (GtkButton *button, CEPageDetails *page)
{
net_connection_editor_forget (page->editor);
}
static gchar *
get_ap_security_string (NMAccessPoint *ap)
{
@ -231,6 +237,10 @@ connect_details_page (CEPageDetails *page)
g_signal_connect (widget, "toggled",
G_CALLBACK (all_user_changed), page);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
/* Forget button */
widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_forget"));
g_signal_connect (widget, "clicked", G_CALLBACK (forget_cb), page);
}
static void
@ -247,7 +257,8 @@ CEPage *
ce_page_details_new (NMConnection *connection,
NMClient *client,
NMDevice *device,
NMAccessPoint *ap)
NMAccessPoint *ap,
NetConnectionEditor *editor)
{
CEPageDetails *page;
@ -257,6 +268,7 @@ ce_page_details_new (NMConnection *connection,
"/org/gnome/control-center/network/details-page.ui",
_("Details")));
page->editor = editor;
page->device = device;
page->ap = ap;
@ -264,4 +276,3 @@ ce_page_details_new (NMConnection *connection,
return CE_PAGE (page);
}

View file

@ -25,6 +25,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
#include "net-connection-editor.h"
#include "ce-page.h"
G_BEGIN_DECLS
@ -45,6 +46,7 @@ struct _CEPageDetails
NMDevice *device;
NMAccessPoint *ap;
NetConnectionEditor *editor;
};
struct _CEPageDetailsClass
@ -57,7 +59,8 @@ GType ce_page_details_get_type (void);
CEPage *ce_page_details_new (NMConnection *connection,
NMClient *client,
NMDevice *device,
NMAccessPoint *ap);
NMAccessPoint *ap,
NetConnectionEditor *editor);
G_END_DECLS

View file

@ -1,84 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2012 Red Hat, Inc
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 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.
*/
#include "config.h"
#include <glib-object.h>
#include <glib/gi18n.h>
#include "net-connection-editor.h"
#include "ce-page-reset.h"
G_DEFINE_TYPE (CEPageReset, ce_page_reset, CE_TYPE_PAGE)
static void
forget_cb (GtkButton *button, CEPageReset *page)
{
net_connection_editor_forget (page->editor);
}
static void
reset_cb (GtkButton *button, CEPageReset *page)
{
net_connection_editor_reset (page->editor);
}
static void
connect_reset_page (CEPageReset *page)
{
GtkWidget *widget;
widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_forget"));
g_signal_connect (widget, "clicked", G_CALLBACK (forget_cb), page);
widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_reset"));
g_signal_connect (widget, "clicked", G_CALLBACK (reset_cb), page);
}
static void
ce_page_reset_init (CEPageReset *page)
{
}
static void
ce_page_reset_class_init (CEPageResetClass *class)
{
}
CEPage *
ce_page_reset_new (NMConnection *connection,
NMClient *client,
NetConnectionEditor *editor)
{
CEPageReset *page;
page = CE_PAGE_RESET (ce_page_new (CE_TYPE_PAGE_RESET,
connection,
client,
"/org/gnome/control-center/network/reset-page.ui",
_("Reset")));
page->editor = editor;
connect_reset_page (page);
return CE_PAGE (page);
}

View file

@ -1,64 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2012 Red Hat, Inc.
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more reset.
*
* 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.
*/
#ifndef __CE_PAGE_RESET_H
#define __CE_PAGE_RESET_H
#include <glib-object.h>
#include <gtk/gtk.h>
#include "net-connection-editor.h"
#include "ce-page.h"
G_BEGIN_DECLS
#define CE_TYPE_PAGE_RESET (ce_page_reset_get_type ())
#define CE_PAGE_RESET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CE_TYPE_PAGE_RESET, CEPageReset))
#define CE_PAGE_RESET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CE_TYPE_PAGE_RESET, CEPageResetClass))
#define CE_IS_PAGE_RESET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CE_TYPE_PAGE_RESET))
#define CE_IS_PAGE_RESET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CE_TYPE_PAGE_RESET))
#define CE_PAGE_RESET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CE_TYPE_PAGE_RESET, CEPageResetClass))
typedef struct _CEPageReset CEPageReset;
typedef struct _CEPageResetClass CEPageResetClass;
struct _CEPageReset
{
CEPage parent;
NetConnectionEditor *editor;
};
struct _CEPageResetClass
{
CEPageClass parent_class;
};
GType ce_page_reset_get_type (void);
CEPage *ce_page_reset_new (NMConnection *connection,
NMClient *client,
NetConnectionEditor *editor);
G_END_DECLS
#endif /* __CE_PAGE_RESET_H */

View file

@ -7,7 +7,6 @@
<file preprocess="xml-stripblanks">ethernet-page.ui</file>
<file preprocess="xml-stripblanks">ip4-page.ui</file>
<file preprocess="xml-stripblanks">ip6-page.ui</file>
<file preprocess="xml-stripblanks">reset-page.ui</file>
<file preprocess="xml-stripblanks">security-page.ui</file>
<file preprocess="xml-stripblanks">vpn-page.ui</file>
<file preprocess="xml-stripblanks">wifi-page.ui</file>

View file

@ -4,7 +4,6 @@
<object class="GtkGrid" id="page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="margin_start">24</property>
<property name="margin_end">24</property>
<property name="margin_top">24</property>
@ -33,6 +32,7 @@
<object class="GtkLabel" id="label_strength">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="label">Weak</property>
<property name="selectable">True</property>
@ -355,5 +355,26 @@
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_forget">
<property name="label" translatable="yes">_Forget</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use_underline">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="halign">end</property>
<property name="valign">end</property>
<style>
<class name="destructive-action" />
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">11</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
</object>
</interface>

View file

@ -34,7 +34,6 @@
#include "ce-page-ip4.h"
#include "ce-page-ip6.h"
#include "ce-page-security.h"
#include "ce-page-reset.h"
#include "ce-page-ethernet.h"
#include "ce-page-8021x-security.h"
#include "ce-page-vpn.h"
@ -529,7 +528,7 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
type = nm_setting_connection_get_connection_type (sc);
if (!editor->is_new_connection)
add_page (editor, ce_page_details_new (editor->connection, editor->client, editor->device, editor->ap));
add_page (editor, ce_page_details_new (editor->connection, editor->client, editor->device, editor->ap, editor));
if (strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME) == 0)
add_page (editor, ce_page_security_new (editor->connection, editor->client));
@ -551,9 +550,6 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
add_page (editor, ce_page_ip4_new (editor->connection, editor->client));
add_page (editor, ce_page_ip6_new (editor->connection, editor->client));
if (!editor->is_new_connection)
add_page (editor, ce_page_reset_new (editor->connection, editor->client, editor));
pages = g_slist_copy (editor->initializing_pages);
for (l = pages; l; l = l->next) {
CEPage *page = l->data;

View file

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkGrid" id="page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">50</property>
<property name="margin_end">50</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="row_spacing">20</property>
<property name="column_spacing">20</property>
<child>
<object class="GtkButton" id="button_reset">
<property name="label" translatable="yes">_Reset</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_forget">
<property name="label" translatable="yes">_Forget</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_reset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Reset the settings for this network, including passwords, but remember it as a preferred network</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
<property name="mnemonic_widget">button_reset</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_forget">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Remove all details relating to this network and do not try to automatically connect</property>
<property name="wrap">True</property>
<property name="max_width_chars">30</property>
<property name="mnemonic_widget">button_forget</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</interface>