Commit c5268f8a authored by Antoine Jacoutot's avatar Antoine Jacoutot Committed by Rui Matos
Browse files

region-panel: do not show Login button if localed is not available

Missing org.freedesktop.locale1 means priv->permission will not be set
and will trigger a segfault when used by set_login_button_visibility().
Unconditionally not display the Login button if localed is not available
since it will be useless anyway.
parent 45893b62
......@@ -174,8 +174,9 @@ cc_region_panel_constructed (GObject *object)
G_OBJECT_CLASS (cc_region_panel_parent_class)->constructed (object);
cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
if (priv->permission)
cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
static const char *
......@@ -1746,8 +1747,16 @@ setup_login_button (CcRegionPanel *self)
CcRegionPanelPrivate *priv = self->priv;
GDBusConnection *bus;
gboolean loaded;
GError *error = NULL;
priv->permission = polkit_permission_new_sync ("org.freedesktop.locale1.set-locale", NULL, NULL, &error);
if (priv->permission == NULL) {
g_warning ("Could not get 'org.freedesktop.locale1.set-locale' permission: %s",
g_error_free (error);
priv->permission = polkit_permission_new_sync ("org.freedesktop.locale1.set-locale", NULL, NULL, NULL);
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
g_dbus_proxy_new (bus,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment