Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jayaddison/gnome-control-center
  • mwei/gnome-control-center
  • vanvugt/gnome-control-center
  • binli/gnome-control-center
  • nteodosio/gnome-control-center
  • tadd/gnome-control-center
  • aleasto/gnome-control-center
  • kathenas/gnome-control-center
  • muqtxdir/gnome-control-center
  • ubuntu-desktop-helper/gnome-control-center
  • biebl/gnome-control-center
  • jardon/gnome-control-center
  • bandali/gnome-control-center
  • jbicha/gnome-control-center
  • janitor-team/proposed/gnome-control-center
  • mwleeds/gnome-control-center
  • 3v1n0/gnome-control-center
  • gnome-team/gnome-control-center
  • azzar1-guest/gnome-control-center
  • wjt/gnome-control-center
20 results
Show changes
Commits on Source (27)
Showing
with 255 additions and 134 deletions
================
Version 44.2
================
- Updated translations.
- Various small accessibility fixes.
- Fixes in Gtk template usage that causes crashes on some systems.
Appearance
- Clear dconf when resetting to defaults.
Mouse
- Hide entire "Touchpad" row when touchpad cannot be disabled
Network
- Fix racy radio buttons in connection editor.
Users:
- Remove autologin row tooltip when unlocked.
================
Version 44.1
================
......
project(
'gnome-control-center', 'c',
version : '44.1',
version : '44.2',
license : 'GPL2+',
meson_version : '>= 0.57.0'
)
......
......@@ -268,6 +268,54 @@ create_save_dir (void)
return TRUE;
}
static void
reset_settings_if_defaults (CcBackgroundPanel *panel,
GSettings *settings,
gboolean check_dark)
{
gsize i;
const char *keys[] = {
WP_URI_KEY, /* this key needs to be first */
WP_URI_DARK_KEY,
WP_OPTIONS_KEY,
WP_SHADING_KEY,
WP_PCOLOR_KEY,
WP_SCOLOR_KEY,
NULL
};
for (i = 0; keys[i] != NULL; i++)
{
g_autoptr (GVariant) default_value = NULL;
g_autoptr (GVariant) user_value = NULL;
gboolean setting_is_default;
if (!check_dark && g_str_equal (keys[i], WP_URI_DARK_KEY))
continue;
default_value = g_settings_get_default_value (settings, keys[i]);
user_value = g_settings_get_value (settings, keys[i]);
setting_is_default = g_variant_equal (default_value, user_value);
/* As a courtesy to distros that are a little lackadaisical about making sure
* schema defaults match the settings in the background item with the default
* picture, we only look at the URI to determine if we shouldn't clean out dconf.
*
* In otherwords, we still clean out the picture-uri key from dconf when a user
* selects the default background in control-center, even if after selecting it
* e.g., primary-color still mismatches with schema defaults.
*/
if (g_str_equal (keys[i], WP_URI_KEY) && !setting_is_default)
return;
if (setting_is_default)
g_settings_reset (settings, keys[i]);
}
g_settings_apply (settings);
}
static void
set_background (CcBackgroundPanel *panel,
GSettings *settings,
......@@ -320,6 +368,9 @@ set_background (CcBackgroundPanel *panel,
/* Apply all changes */
g_settings_apply (settings);
/* Clean out dconf if the user went back to distro defaults */
reset_settings_if_defaults (panel, settings, set_dark);
/* Save the source XML if there is one */
filename = get_save_path ();
if (create_save_dir ())
......
......@@ -61,6 +61,14 @@ enum {
static GParamSpec *properties[N_PROPS];
static void
update_checked_state (CcListRow *self)
{
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_STATE_CHECKED, self->switch_active,
-1);
}
static void
cc_list_row_switch_active_cb (CcListRow *self)
{
......@@ -75,6 +83,7 @@ cc_list_row_switch_active_cb (CcListRow *self)
return;
self->switch_active = switch_active;
update_checked_state (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIVE]);
}
......@@ -133,6 +142,7 @@ cc_list_row_set_property (GObject *object,
gtk_switch_set_active (self->enable_switch,
g_value_get_boolean (value));
self->switch_active = g_value_get_boolean (value);
update_checked_state (self);
g_signal_handlers_unblock_by_func (self->enable_switch,
cc_list_row_switch_active_cb, self);
break;
......@@ -228,6 +238,8 @@ cc_list_row_set_show_switch (CcListRow *self,
adw_action_row_set_activatable_widget (ADW_ACTION_ROW (self),
self->show_switch ? GTK_WIDGET (self->enable_switch) : NULL);
update_checked_state (self);
}
gboolean
......
......@@ -20,6 +20,7 @@
<object class="GtkSwitch" id="enable_switch">
<property name="visible">False</property>
<property name="valign">center</property>
<property name="can-focus">false</property>
<signal name="notify::active" handler="cc_list_row_switch_active_cb" swapped="yes"/>
</object>
</child>
......
......@@ -20,6 +20,7 @@
*/
#include "config.h"
#include "cc-list-row.h"
#include "cc-time-editor.h"
#include "cc-datetime-panel.h"
#include "cc-datetime-resources.h"
......@@ -32,6 +33,7 @@
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <gdesktop-enums.h>
#include "gdesktop-enums-types.h"
#include <string.h>
#include <stdlib.h>
#include <libintl.h>
......@@ -830,6 +832,10 @@ cc_date_time_panel_class_init (CcDateTimePanelClass *klass)
panel_class->get_help_uri = cc_date_time_panel_get_help_uri;
g_type_ensure (CC_TYPE_LIST_ROW);
g_type_ensure (CC_TYPE_TZ_DIALOG);
g_type_ensure (G_DESKTOP_TYPE_DESKTOP_CLOCK_FORMAT);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/datetime/cc-datetime-panel.ui");
gtk_widget_class_bind_template_child (widget_class, CcDateTimePanel, auto_datetime_row);
......
......@@ -205,7 +205,7 @@
<signal name="notify::selected-item" handler="change_clock_settings" object="CcDateTimePanel" swapped="no"/>
<property name="model">
<object class="AdwEnumListModel">
<property name="enum_type">GDesktopClockFormat</property>
<property name="enum-type">GDesktopClockFormat</property>
</object>
</property>
<property name="expression">
......
......@@ -43,6 +43,31 @@ sources = files(
'tz.c'
)
enums = 'gdesktop-enums-types'
enums_header = files(
gsettings_desktop_dep.get_pkgconfig_variable('prefix') + '/include/gsettings-desktop-schemas/gdesktop-enums.h',
'cc-datetime-panel.h'
)
sources += gnome.mkenums(
enums + '.h',
sources: enums_header,
fhead: '#pragma once\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n',
fprod: '/* enumerations from "@filename@" */\n',
vhead: 'GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define G_DESKTOP_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n',
ftail: 'G_END_DECLS\n'
)
sources += gnome.mkenums(
enums + '.c',
sources: enums_header,
fhead: '#include <gdesktop-enums.h>\n#include "gdesktop-enums-types.h"\n#include "cc-datetime-panel.h"',
fprod: '\n/* enumerations from "@filename@" */',
vhead: 'GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {',
vprod: ' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
vtail: ' { 0, NULL, NULL }\n };\n etype = g_@type@_register_static ("@EnumName@", values);\n }\n return etype;\n}\n'
)
gdbus = 'timedated'
gdbus_iface_xml = gdbus + '1-interface.xml'
......
......@@ -574,6 +574,7 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
g_type_ensure (CC_TYPE_LIST_ROW);
g_type_ensure (CC_TYPE_NIGHT_LIGHT_PAGE);
panel_class->get_help_uri = cc_display_panel_get_help_uri;
......
......@@ -84,7 +84,7 @@
<property name="receives-default">True</property>
<property name="sensitive">True</property>
<property name="halign">center</property>
<property name="label">Copy Technical Report</property>
<property name="label" translatable="yes">Copy Technical Report</property>
<signal name="clicked" handler="on_hsi_detail_button_clicked_cb" swapped="no" />
<style>
<class name="pill" />
......
......@@ -897,6 +897,8 @@ cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
g_type_ensure (CC_TYPE_HOSTNAME_ENTRY);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/info-overview/cc-info-overview-panel.ui");
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, disk_row);
......
......@@ -182,6 +182,7 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
g_object_class_override_property (object_class, PROP_PARAMETERS, "parameters");
g_type_ensure (CC_TYPE_INPUT_LIST_BOX);
g_type_ensure (CC_TYPE_LIST_ROW);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/keyboard/cc-keyboard-panel.ui");
......
......@@ -56,6 +56,7 @@ struct _CcMousePanel
CcSplitRow *touchpad_scroll_method_row;
GtkListBoxRow *touchpad_speed_row;
GtkScale *touchpad_speed_scale;
AdwActionRow *touchpad_toggle_row;
GtkSwitch *touchpad_toggle_switch;
GSettings *mouse_settings;
......@@ -165,12 +166,12 @@ get_touchpad_enabled (GSettings *settings)
}
static gboolean
show_touchpad_enabling_switch (CcMousePanel *self)
can_disable_touchpad (CcMousePanel *self)
{
if (!self->have_touchpad)
return FALSE;
g_debug ("Should we show the touchpad disable switch: have_mouse: %s have_touchscreen: %s\n",
g_debug ("Should we show the row to enable touchpad: have_mouse: %s have_touchscreen: %s\n",
self->have_mouse ? "true" : "false",
self->have_touchscreen ? "true" : "false");
......@@ -298,7 +299,7 @@ setup_dialog (CcMousePanel *self)
NULL, NULL);
/* Touchpad section */
gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_switch), show_touchpad_enabling_switch (self));
gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_row), can_disable_touchpad (self));
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->touchpad_toggle_switch, "active",
......@@ -371,7 +372,7 @@ device_changed (CcMousePanel *self)
self->have_mouse = mouse_is_present ();
gtk_widget_set_visible (GTK_WIDGET (self->mouse_group), self->have_mouse);
gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_switch), show_touchpad_enabling_switch (self));
gtk_widget_set_visible (GTK_WIDGET (self->touchpad_toggle_row), can_disable_touchpad (self));
}
static void
......@@ -441,6 +442,7 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
object_class->dispose = cc_mouse_panel_dispose;
g_type_ensure (CC_TYPE_ILLUSTRATED_ROW);
g_type_ensure (CC_TYPE_SPLIT_ROW);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/mouse/cc-mouse-panel.ui");
......@@ -462,6 +464,7 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_stack_page);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_scale);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_toggle_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_toggle_switch);
gtk_widget_class_bind_template_callback (widget_class, on_touchpad_scroll_method_changed_cb);
......
......@@ -77,7 +77,7 @@
<object class="GtkListBox" id="box_bluetooth">
<property name="selection_mode">none</property>
<accessibility>
<property name="label" translatable="yes">Other Devices</property>
<relation name="labelled-by">container_bluetooth</relation>
</accessibility>
<style>
<class name="boxed-list" />
......
......@@ -47,13 +47,10 @@ struct _CEPageIP4
GtkSizeGroup *address_sizegroup;
GtkSwitch *auto_dns_switch;
GtkSwitch *auto_routes_switch;
GtkCheckButton *automatic_radio;
GtkBox *content_box;
GtkCheckButton *disabled_radio;
GtkEntry *dns_entry;
GtkCheckButton *local_radio;
GtkGrid *main_box;
GtkCheckButton *manual_radio;
GtkCheckButton *never_default_check;
GtkLabel *routes_address_label;
GtkBox *routes_box;
......@@ -68,6 +65,8 @@ struct _CEPageIP4
GtkWidget *address_list;
GtkWidget *routes_list;
GActionGroup *method_group;
};
static void ce_page_iface_init (CEPageInterface *);
......@@ -80,30 +79,27 @@ enum {
METHOD_COL_METHOD
};
enum {
IP4_METHOD_AUTO,
IP4_METHOD_MANUAL,
IP4_METHOD_LINK_LOCAL,
IP4_METHOD_SHARED,
IP4_METHOD_DISABLED
};
static void
method_changed (CEPageIP4 *self)
{
gboolean addr_enabled;
gboolean dns_enabled;
gboolean routes_enabled;
g_autoptr(GVariant) method_variant = NULL;
const gchar *method;
method_variant = g_action_group_get_action_state (self->method_group, "ip4method");
method = g_variant_get_string (method_variant, NULL);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->disabled_radio)) ||
gtk_check_button_get_active (GTK_CHECK_BUTTON (self->shared_radio))) {
if (g_str_equal (method, "disabled") ||
g_str_equal (method, "shared")) {
addr_enabled = FALSE;
dns_enabled = FALSE;
routes_enabled = FALSE;
} else {
addr_enabled = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->manual_radio));
routes_enabled = !gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio));
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio)))
addr_enabled = g_str_equal (method, "manual");
routes_enabled = !g_str_equal (method, "local");
if (g_str_equal (method, "local"))
dns_enabled = FALSE;
else
dns_enabled = !gtk_switch_get_active (self->auto_dns_switch);
......@@ -483,7 +479,7 @@ static void
connect_ip4_page (CEPageIP4 *self)
{
const gchar *str_method;
guint method;
gchar *method;
add_address_box (self);
add_dns_section (self);
......@@ -500,45 +496,22 @@ connect_ip4_page (CEPageIP4 *self)
self->content_box, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
method = IP4_METHOD_AUTO;
method = "automatic";
if (g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL) == 0) {
method = IP4_METHOD_LINK_LOCAL;
method = "local";
} else if (g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0) {
method = IP4_METHOD_MANUAL;
method = "manual";
} else if (g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) {
method = IP4_METHOD_SHARED;
method = "shared";
} else if (g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) {
method = IP4_METHOD_DISABLED;
method = "disabled";
}
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->never_default_check),
nm_setting_ip_config_get_never_default (self->setting));
g_signal_connect_object (self->never_default_check, "toggled", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->automatic_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->local_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->manual_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->disabled_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
switch (method) {
case IP4_METHOD_AUTO:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->automatic_radio), TRUE);
break;
case IP4_METHOD_LINK_LOCAL:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->local_radio), TRUE);
break;
case IP4_METHOD_MANUAL:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->manual_radio), TRUE);
break;
case IP4_METHOD_SHARED:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->shared_radio), TRUE);
break;
case IP4_METHOD_DISABLED:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->disabled_radio), TRUE);
break;
default:
break;
}
g_action_group_change_action_state (self->method_group, "ip4method", g_variant_new_string (method));
method_changed (self);
}
......@@ -547,6 +520,7 @@ static gboolean
ui_to_setting (CEPageIP4 *self)
{
const gchar *method;
g_autoptr(GVariant) method_variant = NULL;
gboolean ignore_auto_dns;
gboolean ignore_auto_routes;
gboolean never_default;
......@@ -562,16 +536,20 @@ ui_to_setting (CEPageIP4 *self)
gchar *dns_text = NULL;
guint i;
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->disabled_radio)))
method_variant = g_action_group_get_action_state (self->method_group, "ip4method");
method = g_variant_get_string (method_variant, NULL);
if (g_str_equal (method, "disabled"))
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->automatic_radio)))
else if (g_str_equal (method, "automatic"))
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio)))
else if (g_str_equal (method, "local"))
method = NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL;
else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->manual_radio)))
else if (g_str_equal (method, "manual"))
method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->shared_radio)))
else if (g_str_equal (method, "shared"))
method = NM_SETTING_IP4_CONFIG_METHOD_SHARED;
else
g_assert_not_reached ();
addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref);
add_addresses = g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
......@@ -768,6 +746,17 @@ out:
return ret;
}
static void
on_ip4_method_activated_cb (GSimpleAction* action,
GVariant* parameter,
gpointer user_data)
{
CEPageIP4 *self = CE_PAGE_IP4 (user_data);
g_simple_action_set_state (action, parameter);
method_changed (self);
}
static const gchar *
ce_page_ip4_get_title (CEPage *page)
{
......@@ -788,6 +777,14 @@ ce_page_ip4_validate (CEPage *self,
static void
ce_page_ip4_init (CEPageIP4 *self)
{
const GActionEntry ip4_entries[] = {
{ "ip4method", on_ip4_method_activated_cb, "s", "'automatic'", NULL},
};
self->method_group = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (self->method_group), ip4_entries, G_N_ELEMENTS (ip4_entries), self);
gtk_widget_insert_action_group (GTK_WIDGET (self), "ip4page", G_ACTION_GROUP (self->method_group));
gtk_widget_init_template (GTK_WIDGET (self));
}
......@@ -802,13 +799,10 @@ ce_page_ip4_class_init (CEPageIP4Class *klass)
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, auto_dns_switch);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, auto_routes_switch);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, automatic_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, content_box);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, disabled_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, dns_entry);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, local_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, main_box);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, manual_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, never_default_check);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_address_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, address_netmask_label);
......
......@@ -47,14 +47,10 @@ struct _CEPageIP6
GtkSizeGroup *address_sizegroup;
GtkSwitch *auto_dns_switch;
GtkSwitch *auto_routes_switch;
GtkCheckButton *automatic_radio;
GtkBox *content_box;
GtkCheckButton *dhcp_radio;
GtkCheckButton *disabled_radio;
GtkEntry *dns_entry;
GtkCheckButton *local_radio;
GtkGrid *main_box;
GtkCheckButton *manual_radio;
GtkCheckButton *never_default_check;
GtkBox *routes_box;
GtkLabel *routes_address_label;
......@@ -69,6 +65,8 @@ struct _CEPageIP6
GtkWidget *address_list;
GtkWidget *routes_list;
GActionGroup *method_group;
};
static void ce_page_iface_init (CEPageInterface *);
......@@ -81,31 +79,27 @@ enum {
METHOD_COL_METHOD
};
enum {
IP6_METHOD_AUTO,
IP6_METHOD_DHCP,
IP6_METHOD_MANUAL,
IP6_METHOD_LINK_LOCAL,
IP6_METHOD_SHARED,
IP6_METHOD_DISABLED
};
static void
method_changed (CEPageIP6 *self)
{
gboolean addr_enabled;
gboolean dns_enabled;
gboolean routes_enabled;
g_autoptr(GVariant) method_variant = NULL;
const gchar *method;
method_variant = g_action_group_get_action_state (self->method_group, "ip6method");
method = g_variant_get_string (method_variant, NULL);
if (gtk_check_button_get_active (self->disabled_radio) ||
gtk_check_button_get_active (self->shared_radio)) {
if (g_str_equal (method, "disabled") ||
g_str_equal (method, "shared")) {
addr_enabled = FALSE;
dns_enabled = FALSE;
routes_enabled = FALSE;
} else {
addr_enabled = gtk_check_button_get_active (self->manual_radio);
routes_enabled = !gtk_check_button_get_active (self->local_radio);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->local_radio)))
addr_enabled = g_str_equal (method, "manual");
routes_enabled = !g_str_equal (method, "local");
if (g_str_equal (method, "local"))
dns_enabled = FALSE;
else
dns_enabled = !gtk_switch_get_active (self->auto_dns_switch);
......@@ -453,7 +447,7 @@ static void
connect_ip6_page (CEPageIP6 *self)
{
const gchar *str_method;
guint method;
gchar *method;
add_address_box (self);
add_dns_section (self);
......@@ -470,52 +464,25 @@ connect_ip6_page (CEPageIP6 *self)
self->content_box, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
method = IP6_METHOD_AUTO;
method = "automatic";
if (g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0) {
method = IP6_METHOD_DHCP;
method = "dhcp";
} else if (g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0) {
method = IP6_METHOD_LINK_LOCAL;
method = "local";
} else if (g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0) {
method = IP6_METHOD_MANUAL;
method = "manual";
} else if (g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_SHARED) == 0) {
method = IP6_METHOD_SHARED;
method = "shared";
} else if (g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED) == 0 ||
g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) {
method = IP6_METHOD_DISABLED;
method = "disabled";
}
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->never_default_check),
nm_setting_ip_config_get_never_default (self->setting));
g_signal_connect_object (self->never_default_check, "toggled", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->automatic_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->dhcp_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->local_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->manual_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (self->disabled_radio, "toggled", G_CALLBACK (method_changed), self, G_CONNECT_SWAPPED);
switch (method) {
case IP6_METHOD_AUTO:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->automatic_radio), TRUE);
break;
case IP6_METHOD_DHCP:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->dhcp_radio), TRUE);
break;
case IP6_METHOD_LINK_LOCAL:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->local_radio), TRUE);
break;
case IP6_METHOD_MANUAL:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->manual_radio), TRUE);
break;
case IP6_METHOD_SHARED:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->shared_radio), TRUE);
break;
case IP6_METHOD_DISABLED:
gtk_check_button_set_active (GTK_CHECK_BUTTON (self->disabled_radio), TRUE);
break;
default:
break;
}
g_action_group_change_action_state (self->method_group, "ip6method", g_variant_new_string (method));
method_changed (self);
}
......@@ -524,6 +491,7 @@ static gboolean
ui_to_setting (CEPageIP6 *self)
{
GtkWidget *child;
g_autoptr(GVariant) method_variant = NULL;
const gchar *method;
gboolean ignore_auto_dns;
gboolean ignore_auto_routes;
......@@ -535,18 +503,22 @@ ui_to_setting (CEPageIP6 *self)
gchar *dns_text = NULL;
guint i;
if (gtk_check_button_get_active (self->disabled_radio))
method_variant = g_action_group_get_action_state (self->method_group, "ip6method");
method = g_variant_get_string (method_variant, NULL);
if (g_str_equal (method, "disabled"))
method = NM_SETTING_IP6_CONFIG_METHOD_DISABLED;
else if (gtk_check_button_get_active (self->manual_radio))
else if (g_str_equal (method, "manual"))
method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
else if (gtk_check_button_get_active (self->local_radio))
else if (g_str_equal (method, "local"))
method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL;
else if (gtk_check_button_get_active (self->dhcp_radio))
else if (g_str_equal (method, "dhcp"))
method = NM_SETTING_IP6_CONFIG_METHOD_DHCP;
else if (gtk_check_button_get_active (self->automatic_radio))
else if (g_str_equal (method, "automatic"))
method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
else if (gtk_check_button_get_active (self->shared_radio))
else if (g_str_equal (method, "shared"))
method = NM_SETTING_IP6_CONFIG_METHOD_SHARED;
else
g_assert_not_reached ();
nm_setting_ip_config_clear_addresses (self->setting);
if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
......@@ -738,6 +710,17 @@ out:
return ret;
}
static void
on_ip6_method_activated_cb (GSimpleAction* action,
GVariant* parameter,
gpointer user_data)
{
CEPageIP6 *self = CE_PAGE_IP6 (user_data);
g_simple_action_set_state (action, parameter);
method_changed (self);
}
static const gchar *
ce_page_ip6_get_title (CEPage *page)
{
......@@ -758,6 +741,14 @@ ce_page_ip6_validate (CEPage *self,
static void
ce_page_ip6_init (CEPageIP6 *self)
{
const GActionEntry ip6_entries[] = {
{ "ip6method", on_ip6_method_activated_cb, "s", "'automatic'", NULL},
};
self->method_group = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (self->method_group), ip6_entries, G_N_ELEMENTS (ip6_entries), self);
gtk_widget_insert_action_group (GTK_WIDGET (self), "ip6page", G_ACTION_GROUP (self->method_group));
gtk_widget_init_template (GTK_WIDGET (self));
}
......@@ -775,14 +766,10 @@ ce_page_ip6_class_init (CEPageIP6Class *klass)
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, address_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, auto_dns_switch);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, auto_routes_switch);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, automatic_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, content_box);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, dhcp_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, disabled_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, dns_entry);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, local_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, main_box);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, manual_radio);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, never_default_check);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_box);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_address_label);
......
......@@ -34,6 +34,8 @@
<child>
<object class="GtkCheckButton" id="automatic_radio">
<property name="label" translatable="yes">Automatic (DHCP)</property>
<property name="action-name">ip4page.ip4method</property>
<property name="action-target">'automatic'</property>
<layout>
<property name="row">0</property>
<property name="column">1</property>
......@@ -43,7 +45,8 @@
<child>
<object class="GtkCheckButton" id="local_radio">
<property name="label" translatable="yes">Link-Local Only</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip4page.ip4method</property>
<property name="action-target">'local'</property>
<layout>
<property name="row">0</property>
<property name="column">2</property>
......@@ -53,7 +56,8 @@
<child>
<object class="GtkCheckButton" id="manual_radio">
<property name="label" translatable="yes">Manual</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip4page.ip4method</property>
<property name="action-target">'manual'</property>
<layout>
<property name="row">1</property>
<property name="column">1</property>
......@@ -63,7 +67,8 @@
<child>
<object class="GtkCheckButton" id="disabled_radio">
<property name="label" translatable="yes">Disable</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip4page.ip4method</property>
<property name="action-target">'disabled'</property>
<layout>
<property name="row">1</property>
<property name="column">2</property>
......@@ -73,7 +78,8 @@
<child>
<object class="GtkCheckButton" id="shared_radio">
<property name="label" translatable="yes">Shared to other computers</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip4page.ip4method</property>
<property name="action-target">'shared'</property>
<layout>
<property name="row">2</property>
<property name="column">1</property>
......
......@@ -34,6 +34,8 @@
<child>
<object class="GtkCheckButton" id="automatic_radio">
<property name="label" translatable="yes">Automatic</property>
<property name="action-name">ip6page.ip6method</property>
<property name="action-target">'automatic'</property>
<layout>
<property name="row">0</property>
<property name="column">1</property>
......@@ -43,7 +45,8 @@
<child>
<object class="GtkCheckButton" id="dhcp_radio">
<property name="label" translatable="yes">Automatic, DHCP only</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip6page.ip6method</property>
<property name="action-target">'dhcp'</property>
<layout>
<property name="row">0</property>
<property name="column">2</property>
......@@ -53,7 +56,8 @@
<child>
<object class="GtkCheckButton" id="local_radio">
<property name="label" translatable="yes">Link-Local Only</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip6page.ip6method</property>
<property name="action-target">'local'</property>
<layout>
<property name="row">1</property>
<property name="column">1</property>
......@@ -63,7 +67,8 @@
<child>
<object class="GtkCheckButton" id="manual_radio">
<property name="label" translatable="yes">Manual</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip6page.ip6method</property>
<property name="action-target">'manual'</property>
<layout>
<property name="row">1</property>
<property name="column">2</property>
......@@ -73,7 +78,8 @@
<child>
<object class="GtkCheckButton" id="disabled_radio">
<property name="label" translatable="yes">Disable</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip6page.ip6method</property>
<property name="action-target">'disabled'</property>
<layout>
<property name="row">2</property>
<property name="column">1</property>
......@@ -83,7 +89,8 @@
<child>
<object class="GtkCheckButton" id="shared_radio">
<property name="label" translatable="yes">Shared to other computers</property>
<property name="group">automatic_radio</property>
<property name="action-name">ip6page.ip6method</property>
<property name="action-target">'shared'</property>
<layout>
<property name="row">2</property>
<property name="column">2</property>
......
......@@ -835,6 +835,8 @@ cc_region_panel_class_init (CcRegionPanelClass * klass)
object_class->finalize = cc_region_panel_finalize;
g_type_ensure (CC_TYPE_LIST_ROW);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/region/cc-region-panel.ui");
gtk_widget_class_bind_template_child (widget_class, CcRegionPanel, formats_row);
......
......@@ -18,6 +18,7 @@
* Author: Cosimo Cecchi <cosimoc@gnome.org>
*/
#include "cc-list-row.h"
#include "cc-search-panel.h"
#include "cc-search-panel-row.h"
#include "cc-search-locations-dialog.h"
......@@ -664,6 +665,8 @@ cc_search_panel_class_init (CcSearchPanelClass *klass)
oclass->finalize = cc_search_panel_finalize;
g_type_ensure (CC_TYPE_LIST_ROW);
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/search/cc-search-panel.ui");
......