[gnome-control-center] region-panel: do not show Login button if localed is not available
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region-panel: do not show Login button if localed is not available
- Date: Tue, 4 Feb 2014 14:44:57 +0000 (UTC)
commit c5268f8a4b4c9c3ebbaf68321bca7c37a8d66caa
Author: Antoine Jacoutot <ajacoutot gnome org>
Date: Tue Feb 4 15:09:48 2014 +0100
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
panels/region/cc-region-panel.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index 78a90ca..564470c 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -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)),
- priv->login_button);
+ if (priv->permission)
+ cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
+ priv->login_button);
}
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",
+ 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);
g_dbus_proxy_new (bus,
G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]