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.

https://bugzilla.gnome.org/show_bug.cgi?id=723550
parent 45893b62
...@@ -174,8 +174,9 @@ cc_region_panel_constructed (GObject *object) ...@@ -174,8 +174,9 @@ cc_region_panel_constructed (GObject *object)
G_OBJECT_CLASS (cc_region_panel_parent_class)->constructed (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)
priv->login_button); cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
priv->login_button);
} }
static const char * static const char *
...@@ -1746,8 +1747,16 @@ setup_login_button (CcRegionPanel *self) ...@@ -1746,8 +1747,16 @@ setup_login_button (CcRegionPanel *self)
CcRegionPanelPrivate *priv = self->priv; CcRegionPanelPrivate *priv = self->priv;
GDBusConnection *bus; GDBusConnection *bus;
gboolean loaded; 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",
error->message);
g_error_free (error);
return;
}
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); bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
g_dbus_proxy_new (bus, g_dbus_proxy_new (bus,
G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES, G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES,
......
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