Don't crash if accounts service policy is not available
This commit is contained in:
parent
bf5cb44016
commit
2874efc7f1
2 changed files with 25 additions and 18 deletions
|
@ -390,6 +390,7 @@ um_login_options_new (GtkBuilder *builder)
|
|||
G_CALLBACK (update_login_options), um);
|
||||
|
||||
um->permission = polkit_permission_new_sync ("org.freedesktop.accounts.set-login-option", NULL, NULL, NULL);
|
||||
if (um->permission != NULL) {
|
||||
widget = um_lock_button_new (um->permission);
|
||||
gtk_widget_show (widget);
|
||||
box = (GtkWidget *)gtk_builder_get_object (builder, "lockbutton-alignment");
|
||||
|
@ -398,6 +399,7 @@ um_login_options_new (GtkBuilder *builder)
|
|||
G_CALLBACK (lockbutton_changed), um);
|
||||
lockbutton_changed (UM_LOCK_BUTTON (widget), um);
|
||||
um->lock_button = widget;
|
||||
}
|
||||
|
||||
error = NULL;
|
||||
um->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
|
||||
|
|
|
@ -558,7 +558,9 @@ selected_user_changed (GtkTreeSelection *selection, UmUserPanelPrivate *d)
|
|||
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
||||
gtk_tree_model_get (model, &iter, USER_COL, &user, -1);
|
||||
show_user (user, d);
|
||||
if (d->lock_button != NULL) {
|
||||
lockbutton_changed (UM_LOCK_BUTTON (d->lock_button), d);
|
||||
}
|
||||
g_object_unref (user);
|
||||
}
|
||||
}
|
||||
|
@ -1153,6 +1155,8 @@ setup_main_window (UmUserPanelPrivate *d)
|
|||
G_CALLBACK (change_fingerprint), d);
|
||||
|
||||
d->permission = polkit_permission_new_sync ("org.freedesktop.accounts.user-administration", NULL, NULL, NULL);
|
||||
if (d->permission != NULL) {
|
||||
/* accounts service not available? */
|
||||
button = um_lock_button_new (d->permission);
|
||||
gtk_widget_set_margin_top (button, 12);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1162,6 +1166,7 @@ setup_main_window (UmUserPanelPrivate *d)
|
|||
G_CALLBACK (lockbutton_changed), d);
|
||||
lockbutton_changed (UM_LOCK_BUTTON (button), d);
|
||||
d->lock_button = button;
|
||||
}
|
||||
|
||||
button = get_widget (d, "add-user-button");
|
||||
names[0] = "changes-prevent-symbolic";
|
||||
|
|
Loading…
Add table
Reference in a new issue