[gtk/wip/baedert/for-master: 2/5] shortcutmanager: Speed up default_remove_controller a bit
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 2/5] shortcutmanager: Speed up default_remove_controller a bit
- Date: Thu, 30 Apr 2020 09:04:33 +0000 (UTC)
commit e79aa2a38996d209065948382961bcc62eb84c55
Author: Timm Bäder <mail baedert org>
Date: Thu Apr 30 09:08:48 2020 +0200
shortcutmanager: Speed up default_remove_controller a bit
Only call get_n_items on the model once and remove two unnecessary
casts.
gtk/gtkshortcutmanager.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkshortcutmanager.c b/gtk/gtkshortcutmanager.c
index c6530c0efe..9aa3577703 100644
--- a/gtk/gtkshortcutmanager.c
+++ b/gtk/gtkshortcutmanager.c
@@ -113,16 +113,16 @@ gtk_shortcut_manager_default_remove_controller (GtkShortcutManager *self,
if (model)
{
GListModel *store;
- guint position;
+ guint position, len;
- store = gtk_flatten_list_model_get_model (model);
+ store = gtk_flatten_list_model_get_model (model);
#if 0 && GLIB_CHECK_VERSION(2,64,0)
if (_g_list_store_find (G_LIST_STORE (store), controller, &position))
g_list_store_remove (G_LIST_STORE (store), position);
#else
- for (position = 0; position < g_list_model_get_n_items (G_LIST_MODEL (store)); position++)
+ for (position = 0, len = g_list_model_get_n_items (store); position < len; position++)
{
- GtkShortcutController *item = g_list_model_get_item (G_LIST_MODEL (store), position);
+ GtkShortcutController *item = g_list_model_get_item (store, position);
g_object_unref (item);
if (item == controller)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]