mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-23 15:49:16 +02:00
gapplication: add "is-busy"
A property to query the current busy state of an application. https://bugzilla.gnome.org/show_bug.cgi?id=744756
This commit is contained in:
parent
6ef0664017
commit
b4ef6d957f
@ -3150,6 +3150,7 @@ g_application_get_default
|
|||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
g_application_mark_busy
|
g_application_mark_busy
|
||||||
g_application_unmark_busy
|
g_application_unmark_busy
|
||||||
|
g_application_get_is_busy
|
||||||
g_application_bind_busy_property
|
g_application_bind_busy_property
|
||||||
g_application_unbind_busy_property
|
g_application_unbind_busy_property
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
|
@ -263,7 +263,8 @@ enum
|
|||||||
PROP_IS_REGISTERED,
|
PROP_IS_REGISTERED,
|
||||||
PROP_IS_REMOTE,
|
PROP_IS_REMOTE,
|
||||||
PROP_INACTIVITY_TIMEOUT,
|
PROP_INACTIVITY_TIMEOUT,
|
||||||
PROP_ACTION_GROUP
|
PROP_ACTION_GROUP,
|
||||||
|
PROP_IS_BUSY
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -1180,6 +1181,10 @@ g_application_get_property (GObject *object,
|
|||||||
g_application_get_inactivity_timeout (application));
|
g_application_get_inactivity_timeout (application));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_IS_BUSY:
|
||||||
|
g_value_set_boolean (value, g_application_get_is_busy (application));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
@ -1343,6 +1348,20 @@ g_application_class_init (GApplicationClass *class)
|
|||||||
G_TYPE_ACTION_GROUP,
|
G_TYPE_ACTION_GROUP,
|
||||||
G_PARAM_DEPRECATED | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_DEPRECATED | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GApplication:is-busy:
|
||||||
|
*
|
||||||
|
* Whether the application is currently marked as busy through
|
||||||
|
* g_application_mark_busy() or g_application_bind_busy_property().
|
||||||
|
*
|
||||||
|
* Since: 2.44
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class, PROP_IS_BUSY,
|
||||||
|
g_param_spec_boolean ("is-busy",
|
||||||
|
P_("Is busy"),
|
||||||
|
P_("If this application is currently marked busy"),
|
||||||
|
FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GApplication::startup:
|
* GApplication::startup:
|
||||||
* @application: the application
|
* @application: the application
|
||||||
@ -2544,7 +2563,10 @@ g_application_mark_busy (GApplication *application)
|
|||||||
application->priv->busy_count++;
|
application->priv->busy_count++;
|
||||||
|
|
||||||
if (!was_busy)
|
if (!was_busy)
|
||||||
|
{
|
||||||
g_application_impl_set_busy_state (application->priv->impl, TRUE);
|
g_application_impl_set_busy_state (application->priv->impl, TRUE);
|
||||||
|
g_object_notify (G_OBJECT (application), "is-busy");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2570,7 +2592,29 @@ g_application_unmark_busy (GApplication *application)
|
|||||||
application->priv->busy_count--;
|
application->priv->busy_count--;
|
||||||
|
|
||||||
if (application->priv->busy_count == 0)
|
if (application->priv->busy_count == 0)
|
||||||
|
{
|
||||||
g_application_impl_set_busy_state (application->priv->impl, FALSE);
|
g_application_impl_set_busy_state (application->priv->impl, FALSE);
|
||||||
|
g_object_notify (G_OBJECT (application), "is-busy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_application_get_is_busy:
|
||||||
|
* @application: a #GApplication
|
||||||
|
*
|
||||||
|
* Gets the application's current busy state, as set through
|
||||||
|
* g_application_mark_busy() or g_application_bind_busy_property().
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if @application is currenty marked as busy
|
||||||
|
*
|
||||||
|
* Since: 2.44
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
g_application_get_is_busy (GApplication *application)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (G_IS_APPLICATION (application), FALSE);
|
||||||
|
|
||||||
|
return application->priv->busy_count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notifications {{{1 */
|
/* Notifications {{{1 */
|
||||||
|
@ -217,6 +217,8 @@ GLIB_AVAILABLE_IN_2_38
|
|||||||
void g_application_mark_busy (GApplication *application);
|
void g_application_mark_busy (GApplication *application);
|
||||||
GLIB_AVAILABLE_IN_2_38
|
GLIB_AVAILABLE_IN_2_38
|
||||||
void g_application_unmark_busy (GApplication *application);
|
void g_application_unmark_busy (GApplication *application);
|
||||||
|
GLIB_AVAILABLE_IN_2_44
|
||||||
|
gboolean g_application_get_is_busy (GApplication *application);
|
||||||
|
|
||||||
GLIB_AVAILABLE_IN_2_40
|
GLIB_AVAILABLE_IN_2_40
|
||||||
void g_application_send_notification (GApplication *application,
|
void g_application_send_notification (GApplication *application,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user