Skip to content

Commit

Permalink
manager: Resort extension list only with sort-enabled-first
Browse files Browse the repository at this point in the history
Helps #220
  • Loading branch information
oscfdezdz committed Jan 5, 2025
1 parent c683d49 commit 6c9330b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/local/exm-manager.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* exm-manager.c
/*
* exm-manager.c
*
* Copyright 2022-2024 Matthew Jakeman <[email protected]>
* Copyright 2022-2025 Matthew Jakeman <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -26,6 +27,8 @@
#include "../exm-types.h"
#include "../exm-enums.h"

#include "exm-config.h"

struct _ExmManager
{
GObject parent_instance;
Expand Down Expand Up @@ -764,13 +767,19 @@ on_state_changed (ShellExtensions *object,
return;
}

GSettings *settings;
settings = g_settings_new (APP_ID);

// Emit items-changed signal to re-sort extension list
if (g_settings_get_boolean (settings, "sort-enabled-first"))
{
guint position;
if (g_list_store_find_with_equal_func (list_store, extension, (GEqualFunc)is_extension_equal, &position))
g_list_model_items_changed (G_LIST_MODEL (list_store), position, 1, 1);
}

g_object_unref (settings);

// If the extension that has changed has an update, then
// one or more extensions have updates available. Lazily
// check the exact number and emit the 'updates-available'
Expand Down

0 comments on commit 6c9330b

Please sign in to comment.