network: Move signals handlers into .ui files
This commit is contained in:
parent
012e9cae25
commit
3beaa9d158
6 changed files with 20 additions and 28 deletions
|
@ -35,7 +35,6 @@ struct _CcWifiConnectionRow
|
|||
GtkImage *active_icon;
|
||||
GtkStack *button_stack;
|
||||
GtkCheckButton *checkbutton;
|
||||
GtkButton *configure_button;
|
||||
GtkSpinner *connecting_spinner;
|
||||
GtkImage *encrypted_icon;
|
||||
GtkLabel *name_label;
|
||||
|
@ -68,6 +67,8 @@ G_DEFINE_TYPE (CcWifiConnectionRow, cc_wifi_connection_row, GTK_TYPE_LIST_BOX_RO
|
|||
|
||||
static GParamSpec *props[PROP_LAST];
|
||||
|
||||
static void configure_clicked_cb (CcWifiConnectionRow *self);
|
||||
|
||||
static NMAccessPointSecurity
|
||||
get_access_point_security (NMAccessPoint *ap)
|
||||
{
|
||||
|
@ -460,12 +461,13 @@ cc_wifi_connection_row_class_init (CcWifiConnectionRowClass *klass)
|
|||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, active_icon);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, button_stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, checkbutton);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, configure_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, connecting_spinner);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, encrypted_icon);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, name_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, strength_icon);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, configure_clicked_cb);
|
||||
|
||||
props[PROP_CHECKABLE] = g_param_spec_boolean ("checkable", "checkable",
|
||||
"Whether to show a checkbox to select the row",
|
||||
FALSE,
|
||||
|
@ -514,8 +516,6 @@ cc_wifi_connection_row_init (CcWifiConnectionRow *self)
|
|||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
g_signal_connect_object (self->configure_button, "clicked", G_CALLBACK (configure_clicked_cb), self, G_CONNECT_SWAPPED);
|
||||
|
||||
self->aps = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
g_object_bind_property (self, "checked",
|
||||
|
|
|
@ -82,13 +82,14 @@
|
|||
<property name="halign">end</property>
|
||||
<property name="hexpand">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="configure_button">
|
||||
<object class="GtkButton">
|
||||
<property name="name">options_button</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="configure_clicked_cb" object="CcWifiConnectionRow" swapped="yes"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -40,7 +40,6 @@ struct _NetProxy
|
|||
|
||||
GtkRadioButton *automatic_radio;
|
||||
GtkDialog *dialog;
|
||||
GtkButton *dialog_button;
|
||||
GtkRadioButton *manual_radio;
|
||||
GtkRadioButton *none_radio;
|
||||
GtkEntry *proxy_ftp_entry;
|
||||
|
@ -212,7 +211,6 @@ net_proxy_class_init (NetProxyClass *klass)
|
|||
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, automatic_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, dialog);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, dialog_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, manual_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, none_radio);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, proxy_ftp_entry);
|
||||
|
@ -228,6 +226,9 @@ net_proxy_class_init (NetProxyClass *klass)
|
|||
gtk_widget_class_bind_template_child (widget_class, NetProxy, proxy_warning_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetProxy, status_label);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, panel_proxy_mode_radio_changed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, show_dialog_cb);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -363,17 +364,6 @@ net_proxy_init (NetProxy *self)
|
|||
panel_proxy_mode_setup_widgets (self, value);
|
||||
panel_update_status_label (self, value);
|
||||
|
||||
g_signal_connect_object (self->none_radio, "toggled", G_CALLBACK (panel_proxy_mode_radio_changed_cb), self, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (self->manual_radio, "toggled", G_CALLBACK (panel_proxy_mode_radio_changed_cb), self, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (self->automatic_radio, "toggled", G_CALLBACK (panel_proxy_mode_radio_changed_cb), self, G_CONNECT_SWAPPED);
|
||||
|
||||
/* show dialog button */
|
||||
g_signal_connect_object (self->dialog_button,
|
||||
"clicked",
|
||||
G_CALLBACK (show_dialog_cb),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
/* prevent the dialog from being destroyed */
|
||||
g_signal_connect_object (self->dialog,
|
||||
"delete-event",
|
||||
|
|
|
@ -38,7 +38,6 @@ struct _NetVpn
|
|||
GtkBox *box;
|
||||
GtkLabel *device_label;
|
||||
GtkSwitch *device_off_switch;
|
||||
GtkButton *options_button;
|
||||
GtkSeparator *separator;
|
||||
|
||||
NMClient *client;
|
||||
|
@ -155,7 +154,7 @@ edit_connection (NetVpn *self)
|
|||
NetConnectionEditor *editor;
|
||||
g_autofree gchar *title = NULL;
|
||||
|
||||
window = gtk_widget_get_toplevel (GTK_WIDGET (self->options_button));
|
||||
window = gtk_widget_get_toplevel (GTK_WIDGET (self));
|
||||
|
||||
editor = net_connection_editor_new (GTK_WINDOW (window),
|
||||
self->connection,
|
||||
|
@ -196,20 +195,16 @@ net_vpn_class_init (NetVpnClass *klass)
|
|||
|
||||
gtk_widget_class_bind_template_child (widget_class, NetVpn, device_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetVpn, device_off_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetVpn, options_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, NetVpn, separator);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, device_off_toggled);
|
||||
gtk_widget_class_bind_template_callback (widget_class, edit_connection);
|
||||
}
|
||||
|
||||
static void
|
||||
net_vpn_init (NetVpn *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
g_signal_connect_object (self->device_off_switch, "notify::active",
|
||||
G_CALLBACK (device_off_toggled), self, G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (self->options_button, "clicked",
|
||||
G_CALLBACK (edit_connection), self, G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
NetVpn *
|
||||
|
|
|
@ -64,9 +64,10 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="dialog_button">
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="clicked" handler="show_dialog_cb" object="NetProxy" swapped="yes"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
|
@ -107,6 +108,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">none_radio</property>
|
||||
<signal name="toggled" handler="panel_proxy_mode_radio_changed_cb" object="NetProxy" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -117,6 +119,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">none_radio</property>
|
||||
<signal name="toggled" handler="panel_proxy_mode_radio_changed_cb" object="NetProxy" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -126,6 +129,7 @@
|
|||
<property name="label" translatable="yes">Disabled</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="panel_proxy_mode_radio_changed_cb" object="NetProxy" swapped="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="notify::active" handler="device_off_toggled" object="NetVpn" swapped="yes"/>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject">
|
||||
<property name="accessible-name" translatable="yes">Turn VPN connection off</property>
|
||||
|
@ -63,6 +64,7 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="edit_connection" object="NetVpn" swapped="yes"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
|
|
Loading…
Add table
Reference in a new issue