summaryrefslogtreecommitdiff
path: root/gio/src/appinfomonitor.hg
blob: 0f6fcf38e62d9df0d212f321a15a274b0e6474ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* Copyright (C) 2022 The giomm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

_CONFIGINCLUDE(giommconfig.h)

#include <glibmm/object.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gio
{

/** Monitor application information for changes.
 *
 * %Gio::AppInfoMonitor is a very simple object used for monitoring the app
 * info database for changes (ie: newly installed or removed
 * applications).
 *
 * Call get() to get a %Gio::AppInfoMonitor and connect to signal_changed().
 *
 * In the usual case, applications should try to make note of the change
 * (doing things like invalidating caches) but not act on it. In
 * particular, applications should avoid making calls to Gio::AppInfo APIs
 * in response to the change signal, deferring these until the time that
 * the data is actually required. The exception to this case is when
 * application information is actually being displayed on the screen
 * (eg: during a search or when the list of all applications is shown).
 * The reason for this is that changes to the list of installed
 * applications often come in groups (like during system updates) and
 * rescanning the list on every change is pointless and expensive.
 *
 * @newin{2,72}
 */
class GIOMM_API AppInfoMonitor : public Glib::Object
{
  _CLASS_GOBJECT(AppInfoMonitor, GAppInfoMonitor, G_APP_INFO_MONITOR, Glib::Object, GObject, , , GIOMM_API)

public:
  /** Gets the %AppInfoMonitor for the current thread-default main context.
   *
   * The %AppInfoMonitor will emit a "changed" signal in the
   * thread-default main context whenever the list of installed
   * applications (as reported by Gio::AppInfo::get_all()) may have changed.
   *
   * You must only drop the last reference on the return value from under
   * the same main context as you created it.
   *
   * @newin{2,72}
   *
   * @return A reference to a %Gio::AppInfoMonitor.
   */
  _WRAP_METHOD(static Glib::RefPtr<AppInfoMonitor> get(), g_app_info_monitor_get, newin "2,72")

  // no_default_handler because the wrapped C signal has no default handler.
  _WRAP_SIGNAL(void changed(), "changed", no_default_handler, newin "2,72")
};

} // namespace Gio