summaryrefslogtreecommitdiff
path: root/capplets/accessibility/at-properties/main.c
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-06-27 22:27:07 +0800
committerraveit65 <[email protected]>2019-07-17 09:38:54 +0200
commitd361f977a857e769392cb210c629405ced6c99ba (patch)
tree016864b3d3a26906488a2b5f9f2af836e92bb074 /capplets/accessibility/at-properties/main.c
parent726e201050edd5bf3b46b12639bc490a9cefc465 (diff)
downloadmate-control-center-d361f977a857e769392cb210c629405ced6c99ba.tar.bz2
mate-control-center-d361f977a857e769392cb210c629405ced6c99ba.tar.xz
use current running DM preferences program
Diffstat (limited to 'capplets/accessibility/at-properties/main.c')
-rw-r--r--capplets/accessibility/at-properties/main.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/capplets/accessibility/at-properties/main.c b/capplets/accessibility/at-properties/main.c
index 11e91bd3..44e07563 100644
--- a/capplets/accessibility/at-properties/main.c
+++ b/capplets/accessibility/at-properties/main.c
@@ -1,6 +1,7 @@
#include <config.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include "dm-util.h"
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -33,7 +34,8 @@ create_builder (void)
if (gtk_builder_add_from_resource (builder, "/org/mate/mcc/accessibility/at/at-enable-dialog.ui", &error)) {
GObject *object;
- gchar *prog;
+ gchar *prog = NULL;
+ DMType dm_type;
object = gtk_builder_get_object (builder, "at_enable_image");
gtk_image_set_from_file (GTK_IMAGE (object),
@@ -44,15 +46,18 @@ create_builder (void)
gtk_image_set_from_file (GTK_IMAGE (object),
PIXMAPDIR "/at-support.png");
- prog = g_find_program_in_path ("lightdm-gtk-greeter-settings-pkexec");
- if (prog == NULL) {
+ dm_type = dm_get_type();
+ if (dm_type == DM_TYPE_MDM) {
prog = g_find_program_in_path ("mdmsetup");
- if (prog == NULL) {
- object = gtk_builder_get_object (builder, "login_button");
- gtk_widget_hide (GTK_WIDGET (object));
- }
+ } else if (dm_type == DM_TYPE_LIGHTDM) {
+ prog = g_find_program_in_path ("lightdm-gtk-greeter-settings-pkexec");
+ }
+ if (prog == NULL) {
+ object = gtk_builder_get_object (builder, "login_button");
+ gtk_widget_hide (GTK_WIDGET (object));
}
g_free (prog);
+
} else {
g_warning ("Could not load UI: %s", error->message);
g_error_free (error);
@@ -84,13 +89,20 @@ cb_mouse_preferences (GtkDialog *dialog, gint response_id)
static void
cb_login_preferences (GtkDialog *dialog, gint response_id)
{
- gchar *prog;
- prog = g_find_program_in_path ("lightdm-gtk-greeter-settings-pkexec");
- if (prog == NULL) {
+ DMType dm_type;
+ gchar *prog = NULL;
+
+ dm_type = dm_get_type();
+ if (dm_type == DM_TYPE_MDM) {
prog = g_find_program_in_path ("mdmsetup");
+ } else if (dm_type == DM_TYPE_LIGHTDM) {
+ prog = g_find_program_in_path ("lightdm-gtk-greeter-settings-pkexec");
+ }
+
+ if (prog != NULL) {
+ g_spawn_command_line_async (prog, NULL);
+ g_free(prog);
}
- g_spawn_command_line_async (prog, NULL);
- g_free(prog);
}
/* get_session_bus(), get_sm_proxy(), and do_logout() are all