main: Drop broken support G_BUS_TYPE_SYSTEM

Fliping opt_system would still use opt_session so drop that.
While at that remove G_BUS_TYPE_NONE which can't be set by
an option either.
This commit is contained in:
Guido Günther
2021-11-21 20:26:12 +01:00
parent 359376041d
commit 475761ec73

View File

@ -51,8 +51,6 @@ struct squeekboard {
GMainLoop *loop; GMainLoop *loop;
static gboolean opt_system = FALSE;
static gchar *opt_address = NULL;
static void static void
quit (void) quit (void)
@ -316,46 +314,15 @@ main (int argc, char **argv)
// TODO: make dbus errors non-always-fatal // TODO: make dbus errors non-always-fatal
// dbus is not strictly necessary for the useful operation // dbus is not strictly necessary for the useful operation
// if text-input is used, as it can bring the keyboard in and out // if text-input is used, as it can bring the keyboard in and out
GBusType bus_type;
if (opt_system) {
bus_type = G_BUS_TYPE_SYSTEM;
} else if (opt_address) {
bus_type = G_BUS_TYPE_NONE;
} else {
bus_type = G_BUS_TYPE_SESSION;
}
GDBusConnection *connection = NULL; GDBusConnection *connection = NULL;
GError *error = NULL; GError *error = NULL;
switch (bus_type) { error = NULL;
case G_BUS_TYPE_SYSTEM: connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
case G_BUS_TYPE_SESSION: if (connection == NULL) {
error = NULL; g_printerr ("Can't connect to the bus: %s. "
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); "Visibility switching unavailable.", error->message);
if (connection == NULL) { g_error_free (error);
g_printerr ("Can't connect to the bus: %s. "
"Visibility switching unavailable.", error->message);
g_error_free (error);
}
break;
case G_BUS_TYPE_NONE:
error = NULL;
connection = g_dbus_connection_new_for_address_sync (opt_address,
0,
NULL,
NULL,
&error);
if (connection == NULL) {
g_printerr ("Can't connect to the bus at %s: %s\n",
opt_address,
error->message);
g_error_free (error);
exit (1);
}
break;
default:
g_assert_not_reached ();
break;
} }
guint owner_id = 0; guint owner_id = 0;
DBusHandler *service = NULL; DBusHandler *service = NULL;