mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Drop gtk_application_is_inhibited
This function returns global session state that may not be available to applications (e.g. in sandboxed environments), and is not needed by applications, so just drop it, instead of keeping a function around that can't be guaranteed to work.
This commit is contained in:
parent
4371f370bc
commit
65808418e1
@ -611,45 +611,6 @@ gtk_application_impl_dbus_uninhibit (GtkApplicationImpl *impl,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl *impl,
|
||||
GtkApplicationInhibitFlags flags)
|
||||
{
|
||||
GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) impl;
|
||||
GVariant *res;
|
||||
GError *error = NULL;
|
||||
gboolean inhibited;
|
||||
static gboolean warned = FALSE;
|
||||
|
||||
if (dbus->sm_proxy == NULL)
|
||||
return FALSE;
|
||||
|
||||
res = g_dbus_proxy_call_sync (dbus->sm_proxy,
|
||||
"IsInhibited",
|
||||
g_variant_new ("(u)", flags),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
G_MAXINT,
|
||||
NULL,
|
||||
&error);
|
||||
if (error)
|
||||
{
|
||||
if (!warned)
|
||||
{
|
||||
g_warning ("Calling %s.IsInhibited failed: %s",
|
||||
g_dbus_proxy_get_interface_name (dbus->sm_proxy),
|
||||
error->message);
|
||||
warned = TRUE;
|
||||
}
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_variant_get (res, "(b)", &inhibited);
|
||||
g_variant_unref (res);
|
||||
|
||||
return inhibited;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_application_impl_dbus_prefers_app_menu (GtkApplicationImpl *impl)
|
||||
{
|
||||
@ -718,7 +679,6 @@ gtk_application_impl_dbus_class_init (GtkApplicationImplDBusClass *class)
|
||||
impl_class->set_menubar = gtk_application_impl_dbus_set_menubar;
|
||||
impl_class->inhibit = gtk_application_impl_dbus_inhibit;
|
||||
impl_class->uninhibit = gtk_application_impl_dbus_uninhibit;
|
||||
impl_class->is_inhibited = gtk_application_impl_dbus_is_inhibited;
|
||||
impl_class->prefers_app_menu = gtk_application_impl_dbus_prefers_app_menu;
|
||||
|
||||
gobject_class->finalize = gtk_application_impl_dbus_finalize;
|
||||
|
@ -292,18 +292,6 @@ gtk_application_impl_quartz_uninhibit (GtkApplicationImpl *impl,
|
||||
g_warning ("Invalid inhibitor cookie");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_application_impl_quartz_is_inhibited (GtkApplicationImpl *impl,
|
||||
GtkApplicationInhibitFlags flags)
|
||||
{
|
||||
GtkApplicationImplQuartz *quartz = (GtkApplicationImplQuartz *) impl;
|
||||
|
||||
if (flags & GTK_APPLICATION_INHIBIT_LOGOUT)
|
||||
return quartz->quit_inhibit > 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_impl_quartz_init (GtkApplicationImplQuartz *quartz)
|
||||
{
|
||||
@ -332,7 +320,6 @@ gtk_application_impl_quartz_class_init (GtkApplicationImplClass *class)
|
||||
class->set_menubar = gtk_application_impl_quartz_set_menubar;
|
||||
class->inhibit = gtk_application_impl_quartz_inhibit;
|
||||
class->uninhibit = gtk_application_impl_quartz_uninhibit;
|
||||
class->is_inhibited = gtk_application_impl_quartz_is_inhibited;
|
||||
|
||||
gobject_class->finalize = gtk_application_impl_quartz_finalize;
|
||||
}
|
||||
|
@ -1150,31 +1150,6 @@ gtk_application_uninhibit (GtkApplication *application,
|
||||
gtk_application_impl_uninhibit (application->priv->impl, cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_is_inhibited:
|
||||
* @application: the #GtkApplication
|
||||
* @flags: what types of actions should be queried
|
||||
*
|
||||
* Determines if any of the actions specified in @flags are
|
||||
* currently inhibited (possibly by another application).
|
||||
*
|
||||
* Note that this information may not be available (for example
|
||||
* when the application is running in a sandbox).
|
||||
*
|
||||
* Returns: %TRUE if any of the actions specified in @flags are inhibited
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
gboolean
|
||||
gtk_application_is_inhibited (GtkApplication *application,
|
||||
GtkApplicationInhibitFlags flags)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
|
||||
g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), FALSE);
|
||||
|
||||
return gtk_application_impl_is_inhibited (application->priv->impl, flags);
|
||||
}
|
||||
|
||||
GtkActionMuxer *
|
||||
gtk_application_get_parent_muxer_for_window (GtkWindow *window)
|
||||
{
|
||||
|
@ -117,9 +117,6 @@ guint gtk_application_inhibit (GtkApplication
|
||||
GDK_AVAILABLE_IN_3_4
|
||||
void gtk_application_uninhibit (GtkApplication *application,
|
||||
guint cookie);
|
||||
GDK_AVAILABLE_IN_3_4
|
||||
gboolean gtk_application_is_inhibited (GtkApplication *application,
|
||||
GtkApplicationInhibitFlags flags);
|
||||
|
||||
GDK_AVAILABLE_IN_3_6
|
||||
GtkWindow * gtk_application_get_window_by_id (GtkApplication *application,
|
||||
|
@ -59,7 +59,6 @@ gtk_application_impl_class_init (GtkApplicationImplClass *class)
|
||||
class->set_menubar = (gpointer) do_nothing;
|
||||
class->inhibit = (gpointer) do_nothing;
|
||||
class->uninhibit = (gpointer) do_nothing;
|
||||
class->is_inhibited = (gpointer) do_nothing;
|
||||
class->prefers_app_menu = (gpointer) return_false;
|
||||
}
|
||||
|
||||
@ -148,13 +147,6 @@ gtk_application_impl_uninhibit (GtkApplicationImpl *impl,
|
||||
GTK_APPLICATION_IMPL_GET_CLASS (impl)->uninhibit (impl, cookie);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_application_impl_is_inhibited (GtkApplicationImpl *impl,
|
||||
GtkApplicationInhibitFlags flags)
|
||||
{
|
||||
return GTK_APPLICATION_IMPL_GET_CLASS (impl)->is_inhibited (impl, flags);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_application_impl_prefers_app_menu (GtkApplicationImpl *impl)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user