"Fossies" - the Fresh Open Source Software Archive

Member "glibmm-2.74.0/gio/src/appinfomonitor.hg" (19 Sep 2022, 2806 Bytes) of package /linux/misc/glibmm-2.74.0.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 2022 The giomm Development Team
    2  *
    3  * This library is free software; you can redistribute it and/or
    4  * modify it under the terms of the GNU Lesser General Public
    5  * License as published by the Free Software Foundation; either
    6  * version 2.1 of the License, or (at your option) any later version.
    7  *
    8  * This library is distributed in the hope that it will be useful,
    9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11  * Lesser General Public License for more details.
   12  *
   13  * You should have received a copy of the GNU Lesser General Public
   14  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
   15  */
   16 
   17 _CONFIGINCLUDE(giommconfig.h)
   18 
   19 #include <glibmm/object.h>
   20 
   21 _DEFS(giomm,gio)
   22 _PINCLUDE(glibmm/private/object_p.h)
   23 
   24 namespace Gio
   25 {
   26 
   27 /** Monitor application information for changes.
   28  *
   29  * %Gio::AppInfoMonitor is a very simple object used for monitoring the app
   30  * info database for changes (ie: newly installed or removed
   31  * applications).
   32  *
   33  * Call get() to get a %Gio::AppInfoMonitor and connect to signal_changed().
   34  *
   35  * In the usual case, applications should try to make note of the change
   36  * (doing things like invalidating caches) but not act on it. In
   37  * particular, applications should avoid making calls to Gio::AppInfo APIs
   38  * in response to the change signal, deferring these until the time that
   39  * the data is actually required. The exception to this case is when
   40  * application information is actually being displayed on the screen
   41  * (eg: during a search or when the list of all applications is shown).
   42  * The reason for this is that changes to the list of installed
   43  * applications often come in groups (like during system updates) and
   44  * rescanning the list on every change is pointless and expensive.
   45  *
   46  * @newin{2,72}
   47  */
   48 class GIOMM_API AppInfoMonitor : public Glib::Object
   49 {
   50   _CLASS_GOBJECT(AppInfoMonitor, GAppInfoMonitor, G_APP_INFO_MONITOR, Glib::Object, GObject, , , GIOMM_API)
   51 
   52 public:
   53   /** Gets the %AppInfoMonitor for the current thread-default main context.
   54    *
   55    * The %AppInfoMonitor will emit a "changed" signal in the
   56    * thread-default main context whenever the list of installed
   57    * applications (as reported by Gio::AppInfo::get_all()) may have changed.
   58    *
   59    * You must only drop the last reference on the return value from under
   60    * the same main context as you created it.
   61    *
   62    * @newin{2,72}
   63    *
   64    * @return A reference to a %Gio::AppInfoMonitor.
   65    */
   66   _WRAP_METHOD(static Glib::RefPtr<AppInfoMonitor> get(), g_app_info_monitor_get, newin "2,72")
   67 
   68   // no_default_handler because the wrapped C signal has no default handler.
   69   _WRAP_SIGNAL(void changed(), "changed", no_default_handler, newin "2,72")
   70 };
   71 
   72 } // namespace Gio