Binary files /tmp/tmp9iuQWV/I6cnvujMkx/gnome-usage-3.30.0/data/icons/hicolor/16x16/apps/org.gnome.Usage.png and /tmp/tmp9iuQWV/XEcqsdBYvx/gnome-usage-3.32.0/data/icons/hicolor/16x16/apps/org.gnome.Usage.png differ Binary files /tmp/tmp9iuQWV/I6cnvujMkx/gnome-usage-3.30.0/data/icons/hicolor/22x22/apps/org.gnome.Usage.png and /tmp/tmp9iuQWV/XEcqsdBYvx/gnome-usage-3.32.0/data/icons/hicolor/22x22/apps/org.gnome.Usage.png differ Binary files /tmp/tmp9iuQWV/I6cnvujMkx/gnome-usage-3.30.0/data/icons/hicolor/24x24/apps/org.gnome.Usage.png and /tmp/tmp9iuQWV/XEcqsdBYvx/gnome-usage-3.32.0/data/icons/hicolor/24x24/apps/org.gnome.Usage.png differ Binary files /tmp/tmp9iuQWV/I6cnvujMkx/gnome-usage-3.30.0/data/icons/hicolor/32x32/apps/org.gnome.Usage.png and /tmp/tmp9iuQWV/XEcqsdBYvx/gnome-usage-3.32.0/data/icons/hicolor/32x32/apps/org.gnome.Usage.png differ Binary files /tmp/tmp9iuQWV/I6cnvujMkx/gnome-usage-3.30.0/data/icons/hicolor/48x48/apps/org.gnome.Usage.png and /tmp/tmp9iuQWV/XEcqsdBYvx/gnome-usage-3.32.0/data/icons/hicolor/48x48/apps/org.gnome.Usage.png differ Binary files /tmp/tmp9iuQWV/I6cnvujMkx/gnome-usage-3.30.0/data/icons/hicolor/512x512/apps/org.gnome.Usage.png and /tmp/tmp9iuQWV/XEcqsdBYvx/gnome-usage-3.32.0/data/icons/hicolor/512x512/apps/org.gnome.Usage.png differ diff -Nru gnome-usage-3.30.0/data/icons/hicolor/scalable/apps/org.gnome.Usage.svg gnome-usage-3.32.0/data/icons/hicolor/scalable/apps/org.gnome.Usage.svg --- gnome-usage-3.30.0/data/icons/hicolor/scalable/apps/org.gnome.Usage.svg 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/data/icons/hicolor/scalable/apps/org.gnome.Usage.svg 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,153 @@ + + + + Adwaita Icon Template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + GNOME Design Team + + + + + Adwaita Icon Template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru gnome-usage-3.30.0/data/icons/org.gnome.Usage.svg gnome-usage-3.32.0/data/icons/org.gnome.Usage.svg --- gnome-usage-3.30.0/data/icons/org.gnome.Usage.svg 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/icons/org.gnome.Usage.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,5271 +0,0 @@ - - - - - Firewall - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Lapo Calamandrei - - - - - Firewall - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clonesparents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru gnome-usage-3.30.0/data/interface/adwaita.css gnome-usage-3.32.0/data/interface/adwaita.css --- gnome-usage-3.30.0/data/interface/adwaita.css 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/interface/adwaita.css 2019-03-22 14:43:03.000000000 +0000 @@ -17,33 +17,6 @@ background: alpha(@error_color, 0.4); } -list row.opened { - background:alpha(@theme_fg_color, 0.2); -} - -list row.opened:hover { - background: alpha(@theme_fg_color, 0.3); -} - -subprocess-list row { - padding: 0; - background: @theme_bg_color; -} - -subprocess-list row:hover { - background: alpha(@theme_fg_color, 0.3); -} - -subprocess-list row.max { - background: #fabbbb; - border: 1px solid #faa5a2; -} - -subprocess-list row.max:hover { - background: #faa5a2; - border: 1px solid #faa5a2; -} - button.graph-switcher { border-style: none; border-radius: 0; diff -Nru gnome-usage-3.30.0/data/meson.build gnome-usage-3.32.0/data/meson.build --- gnome-usage-3.30.0/data/meson.build 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/meson.build 2019-03-22 14:43:03.000000000 +0000 @@ -1,5 +1,6 @@ resource_data = files( 'interface/adwaita.css', + 'ui/primary-menu.ui', 'ui/header-bar.ui', 'ui/memory-speedometer.ui', 'ui/no-results-found-view.ui', diff -Nru gnome-usage-3.30.0/data/org.gnome.Usage.gresource.xml gnome-usage-3.32.0/data/org.gnome.Usage.gresource.xml --- gnome-usage-3.30.0/data/org.gnome.Usage.gresource.xml 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/org.gnome.Usage.gresource.xml 2019-03-22 14:43:03.000000000 +0000 @@ -2,6 +2,7 @@ interface/adwaita.css + ui/primary-menu.ui ui/header-bar.ui ui/memory-speedometer.ui ui/no-results-found-view.ui diff -Nru gnome-usage-3.30.0/data/org.gnome.Usage.gschema.xml gnome-usage-3.32.0/data/org.gnome.Usage.gschema.xml --- gnome-usage-3.30.0/data/org.gnome.Usage.gschema.xml 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/org.gnome.Usage.gschema.xml 2019-03-22 14:43:03.000000000 +0000 @@ -1,7 +1,7 @@ - ['gnome-shell', 'gdm-x-session', 'gdm-wayland-session', 'gdm', 'systemd', 'gdm-session-worker', 'pulseaudio', 'Xorg'] + ['gnome-shell', 'gdm-x-session', 'gdm-wayland-session', 'gdm', 'systemd', 'gdm-session-worker', 'pulseaudio', 'Xorg', 'system'] A list of processes which we don’t want killed This list is used for filtering which processes the user can’t stop. diff -Nru gnome-usage-3.30.0/data/ui/header-bar.ui gnome-usage-3.32.0/data/ui/header-bar.ui --- gnome-usage-3.30.0/data/ui/header-bar.ui 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/ui/header-bar.ui 2019-03-22 14:43:03.000000000 +0000 @@ -1,6 +1,6 @@ - + + diff -Nru gnome-usage-3.30.0/data/ui/primary-menu.ui gnome-usage-3.32.0/data/ui/primary-menu.ui --- gnome-usage-3.30.0/data/ui/primary-menu.ui 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/data/ui/primary-menu.ui 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,51 @@ + + + + + + diff -Nru gnome-usage-3.30.0/data/ui/sub-process-list-box.ui gnome-usage-3.32.0/data/ui/sub-process-list-box.ui --- gnome-usage-3.30.0/data/ui/sub-process-list-box.ui 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/data/ui/sub-process-list-box.ui 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ - - - - - diff -Nru gnome-usage-3.30.0/debian/changelog gnome-usage-3.32.0/debian/changelog --- gnome-usage-3.30.0/debian/changelog 2018-12-25 22:04:41.000000000 +0000 +++ gnome-usage-3.32.0/debian/changelog 2019-09-22 23:45:47.000000000 +0000 @@ -1,3 +1,13 @@ +gnome-usage (3.32.0-1) unstable; urgency=medium + + * New upstream release + * Update debian/copyright + * Build-Depend on libdazzle-1.0-dev + * Build-Depend on dh-sequence-gnome instead of gnome-pkg-tools + * Bump Standards-Version to 4.4.0 + + -- Jeremy Bicha Sun, 22 Sep 2019 19:45:47 -0400 + gnome-usage (3.30.0-2) unstable; urgency=medium * Build-Depend on debhelper-compat 12 and drop debian/compat diff -Nru gnome-usage-3.30.0/debian/control gnome-usage-3.32.0/debian/control --- gnome-usage-3.30.0/debian/control 2018-12-25 22:04:41.000000000 +0000 +++ gnome-usage-3.32.0/debian/control 2019-09-22 23:45:47.000000000 +0000 @@ -8,13 +8,14 @@ Maintainer: Debian GNOME Maintainers Uploaders: Jeremy Bicha Build-Depends: debhelper-compat (= 12), - gnome-pkg-tools, + dh-sequence-gnome, + libdazzle-1.0-dev (>= 3.30), libglib2.0-dev (>= 2.38.0), libgtk-3-dev (>= 3.20.10), libgtop2-dev (>= 2.34.0), meson (>= 0.37), valac -Standards-Version: 4.3.0 +Standards-Version: 4.4.0 Vcs-Browser: https://salsa.debian.org/gnome-team/gnome-usage Vcs-Git: https://salsa.debian.org/gnome-team/gnome-usage.git Homepage: https://wiki.gnome.org/Apps/Usage diff -Nru gnome-usage-3.30.0/debian/control.in gnome-usage-3.32.0/debian/control.in --- gnome-usage-3.30.0/debian/control.in 2018-12-25 22:04:41.000000000 +0000 +++ gnome-usage-3.32.0/debian/control.in 2019-09-22 23:45:47.000000000 +0000 @@ -4,13 +4,14 @@ Maintainer: Debian GNOME Maintainers Uploaders: @GNOME_TEAM@ Build-Depends: debhelper-compat (= 12), - gnome-pkg-tools, + dh-sequence-gnome, + libdazzle-1.0-dev (>= 3.30), libglib2.0-dev (>= 2.38.0), libgtk-3-dev (>= 3.20.10), libgtop2-dev (>= 2.34.0), meson (>= 0.37), valac -Standards-Version: 4.3.0 +Standards-Version: 4.4.0 Vcs-Browser: https://salsa.debian.org/gnome-team/gnome-usage Vcs-Git: https://salsa.debian.org/gnome-team/gnome-usage.git Homepage: https://wiki.gnome.org/Apps/Usage diff -Nru gnome-usage-3.30.0/debian/copyright gnome-usage-3.32.0/debian/copyright --- gnome-usage-3.30.0/debian/copyright 2018-12-25 22:04:41.000000000 +0000 +++ gnome-usage-3.32.0/debian/copyright 2019-09-22 23:45:47.000000000 +0000 @@ -10,49 +10,6 @@ Copyright: 2017 Red Hat, Inc. License: CC0-1.0 -Files: external/egg/* -Copyright: 2015-2016 Christian Hergert -License: GPL-3+ - -Files: external/egg/egg-animation.* - external/egg/egg-date-time.* - external/egg/egg-counter.* - external/egg/egg-file-chooser-entry.* - external/egg/egg-frame-source.* - external/egg/egg-heap.* - external/egg/egg-task-cache.* - external/egg/egg-widget-action-group.c -Copyright: 2010-2016, Christian Hergert -License: LGPL-2.1+ - -Files: external/egg/egg-binding-group.* - external/egg/egg-signal-group.* -Copyright: 2015 Christian Hergert - 2015 Garrett Regier -License: LGPL-3+ - -Files: external/egg/egg-menu-manager.* - external/egg/egg-widget-action-group.h -Copyright: 2015 Christian Hergert -License: LGPL-2+ - -Files: external/egg/egg-search-bar.* - external/egg/egg-settings-sandwich.* - external/egg/egg-state-machine* - external/rg/* -Copyright: 2015 Christian Hergert -License: LGPL-3+ - -Files: external/egg/egg-state-machine-buildable.c -Copyright: 1998-2002 James Henstridge - 2006-2007 Async Open Source - 2015 Christian Hergert -License: LGPL-3+ - -Files: external/rg/rg-ring.* -Copyright: 2010 Christian Hergert -License: LGPL-2.1+ - Files: src/no-results-found-view.vala Copyright: 2017 Radhika Dua License: GPL-3+ @@ -84,53 +41,3 @@ . On Debian systems, the complete text of the GNU General Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". - -License: LGPL-2.1+ - This file 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 file 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, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - . - On Debian systems, the complete text of the GNU Lesser General Public - License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". - -License: LGPL-2+ - 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 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. - . - On Debian systems, the complete text of the GNU Lesser General Public - License version 2 can be found in "/usr/share/common-licenses/LGPL-2". - -License: LGPL-3+ - This file 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 3 of the - License, or (at your option) any later version. - . - This file 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 program. If not, see . - . - On Debian systems, the complete text of the GNU Lesser General - Public License version 3 can be found in `/usr/share/common-licenses/LGPL-3'. - diff -Nru gnome-usage-3.30.0/debian/rules gnome-usage-3.32.0/debian/rules --- gnome-usage-3.30.0/debian/rules 2018-12-25 22:04:41.000000000 +0000 +++ gnome-usage-3.32.0/debian/rules 2019-09-22 23:45:47.000000000 +0000 @@ -4,4 +4,4 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs -Wl,--as-needed %: - dh $@ --with gnome + dh $@ diff -Nru gnome-usage-3.30.0/external/egg/egg-animation.c gnome-usage-3.32.0/external/egg/egg-animation.c --- gnome-usage-3.30.0/external/egg/egg-animation.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-animation.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1184 +0,0 @@ -/* egg-animation.c - * - * Copyright (C) 2010-2016 Christian Hergert - * - * This file 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 file 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 General Public License along - * with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include - -#include "egg-animation.h" -#include "egg-frame-source.h" - -#define FALLBACK_FRAME_RATE 60 - -typedef gdouble (*AlphaFunc) (gdouble offset); -typedef void (*TweenFunc) (const GValue *begin, - const GValue *end, - GValue *value, - gdouble offset); - -typedef struct -{ - gboolean is_child; /* Does GParamSpec belong to parent widget */ - GParamSpec *pspec; /* GParamSpec of target property */ - GValue begin; /* Begin value in animation */ - GValue end; /* End value in animation */ -} Tween; - - -struct _EggAnimation -{ - GInitiallyUnowned parent_instance; - - gpointer target; /* Target object to animate */ - guint64 begin_msec; /* Time in which animation started */ - guint duration_msec; /* Duration of animation */ - guint mode; /* Tween mode */ - gulong tween_handler; /* GSource or signal handler */ - gulong after_paint_handler; /* signal handler */ - gdouble last_offset; /* Track our last offset */ - GArray *tweens; /* Array of tweens to perform */ - GdkFrameClock *frame_clock; /* An optional frame-clock for sync. */ - GDestroyNotify notify; /* Notify callback */ - gpointer notify_data; /* Data for notify */ -}; - -G_DEFINE_TYPE (EggAnimation, egg_animation, G_TYPE_INITIALLY_UNOWNED) - -enum { - PROP_0, - PROP_DURATION, - PROP_FRAME_CLOCK, - PROP_MODE, - PROP_TARGET, - LAST_PROP -}; - - -enum { - TICK, - LAST_SIGNAL -}; - - -/* - * Helper macros. - */ -#define LAST_FUNDAMENTAL 64 -#define TWEEN(type) \ - static void \ - tween_ ## type (const GValue * begin, \ - const GValue * end, \ - GValue * value, \ - gdouble offset) \ - { \ - g ## type x = g_value_get_ ## type (begin); \ - g ## type y = g_value_get_ ## type (end); \ - g_value_set_ ## type (value, x + ((y - x) * offset)); \ - } - - -/* - * Globals. - */ -static AlphaFunc alpha_funcs[EGG_ANIMATION_LAST]; -static gboolean debug; -static GParamSpec *properties[LAST_PROP]; -static guint signals[LAST_SIGNAL]; -static TweenFunc tween_funcs[LAST_FUNDAMENTAL]; -static guint slow_down_factor = 1; - - -/* - * Tweeners for basic types. - */ -TWEEN (int); -TWEEN (uint); -TWEEN (long); -TWEEN (ulong); -TWEEN (float); -TWEEN (double); - - -/** - * egg_animation_alpha_ease_in_cubic: - * @offset: (in): The position within the animation; 0.0 to 1.0. - * - * An alpha function to transform the offset within the animation. - * @EGG_ANIMATION_CUBIC means the valu ewill be transformed into - * cubic acceleration (x * x * x). - */ -static gdouble -egg_animation_alpha_ease_in_cubic (gdouble offset) -{ - return offset * offset * offset; -} - - -static gdouble -egg_animation_alpha_ease_out_cubic (gdouble offset) -{ - gdouble p = offset - 1.0; - - return p * p * p + 1.0; -} - -static gdouble -egg_animation_alpha_ease_in_out_cubic (gdouble offset) -{ - if (offset < .5) - return egg_animation_alpha_ease_in_cubic (offset * 2.0) / 2.0; - else - return .5 + egg_animation_alpha_ease_out_cubic ((offset - .5) * 2.0) / 2.0; -} - - -/** - * egg_animation_alpha_linear: - * @offset: (in): The position within the animation; 0.0 to 1.0. - * - * An alpha function to transform the offset within the animation. - * @EGG_ANIMATION_LINEAR means no tranformation will be made. - * - * Returns: @offset. - * Side effects: None. - */ -static gdouble -egg_animation_alpha_linear (gdouble offset) -{ - return offset; -} - - -/** - * egg_animation_alpha_ease_in_quad: - * @offset: (in): The position within the animation; 0.0 to 1.0. - * - * An alpha function to transform the offset within the animation. - * @EGG_ANIMATION_EASE_IN_QUAD means that the value will be transformed - * into a quadratic acceleration. - * - * Returns: A tranformation of @offset. - * Side effects: None. - */ -static gdouble -egg_animation_alpha_ease_in_quad (gdouble offset) -{ - return offset * offset; -} - - -/** - * egg_animation_alpha_ease_out_quad: - * @offset: (in): The position within the animation; 0.0 to 1.0. - * - * An alpha function to transform the offset within the animation. - * @EGG_ANIMATION_EASE_OUT_QUAD means that the value will be transformed - * into a quadratic deceleration. - * - * Returns: A tranformation of @offset. - * Side effects: None. - */ -static gdouble -egg_animation_alpha_ease_out_quad (gdouble offset) -{ - return -1.0 * offset * (offset - 2.0); -} - - -/** - * egg_animation_alpha_ease_in_out_quad: - * @offset: (in): The position within the animation; 0.0 to 1.0. - * - * An alpha function to transform the offset within the animation. - * @EGG_ANIMATION_EASE_IN_OUT_QUAD means that the value will be transformed - * into a quadratic acceleration for the first half, and quadratic - * deceleration the second half. - * - * Returns: A tranformation of @offset. - * Side effects: None. - */ -static gdouble -egg_animation_alpha_ease_in_out_quad (gdouble offset) -{ - offset *= 2.0; - if (offset < 1.0) - return 0.5 * offset * offset; - offset -= 1.0; - return -0.5 * (offset * (offset - 2.0) - 1.0); -} - - -/** - * egg_animation_load_begin_values: - * @animation: (in): A #EggAnimation. - * - * Load the begin values for all the properties we are about to - * animate. - * - * Side effects: None. - */ -static void -egg_animation_load_begin_values (EggAnimation *animation) -{ - GtkContainer *container; - Tween *tween; - guint i; - - g_return_if_fail (EGG_IS_ANIMATION (animation)); - - for (i = 0; i < animation->tweens->len; i++) - { - tween = &g_array_index (animation->tweens, Tween, i); - g_value_reset (&tween->begin); - if (tween->is_child) - { - container = GTK_CONTAINER (gtk_widget_get_parent (animation->target)); - gtk_container_child_get_property (container, - animation->target, - tween->pspec->name, - &tween->begin); - } - else - { - g_object_get_property (animation->target, - tween->pspec->name, - &tween->begin); - } - } -} - - -/** - * egg_animation_unload_begin_values: - * @animation: (in): A #EggAnimation. - * - * Unloads the begin values for the animation. This might be particularly - * useful once we support pointer types. - * - * Side effects: None. - */ -static void -egg_animation_unload_begin_values (EggAnimation *animation) -{ - Tween *tween; - guint i; - - g_return_if_fail (EGG_IS_ANIMATION (animation)); - - for (i = 0; i < animation->tweens->len; i++) - { - tween = &g_array_index (animation->tweens, Tween, i); - g_value_reset (&tween->begin); - } -} - - -/** - * egg_animation_get_offset: - * @animation: A #EggAnimation. - * @frame_time: the time to present the frame, or 0 for current timing. - * - * Retrieves the position within the animation from 0.0 to 1.0. This - * value is calculated using the msec of the beginning of the animation - * and the current time. - * - * Returns: The offset of the animation from 0.0 to 1.0. - */ -static gdouble -egg_animation_get_offset (EggAnimation *animation, - gint64 frame_time) -{ - gdouble offset; - gint64 frame_msec; - - g_return_val_if_fail (EGG_IS_ANIMATION (animation), 0.0); - - if (frame_time == 0) - { - if (animation->frame_clock != NULL) - frame_time = gdk_frame_clock_get_frame_time (animation->frame_clock); - else - frame_time = g_get_monotonic_time (); - } - - frame_msec = frame_time / 1000L; - - offset = (gdouble) (frame_msec - animation->begin_msec) / - (gdouble) MAX (animation->duration_msec, 1); - - return CLAMP (offset, 0.0, 1.0); -} - - -/** - * egg_animation_update_property: - * @animation: (in): A #EggAnimation. - * @target: (in): A #GObject. - * @tween: (in): a #Tween containing the property. - * @value: (in): The new value for the property. - * - * Updates the value of a property on an object using @value. - * - * Side effects: The property of @target is updated. - */ -static void -egg_animation_update_property (EggAnimation *animation, - gpointer target, - Tween *tween, - const GValue *value) -{ - g_assert (EGG_IS_ANIMATION (animation)); - g_assert (G_IS_OBJECT (target)); - g_assert (tween); - g_assert (value); - - g_object_set_property (target, tween->pspec->name, value); -} - - -/** - * egg_animation_update_child_property: - * @animation: (in): A #EggAnimation. - * @target: (in): A #GObject. - * @tween: (in): A #Tween containing the property. - * @value: (in): The new value for the property. - * - * Updates the value of the parent widget of the target to @value. - * - * Side effects: The property of @target's parent widget is updated. - */ -static void -egg_animation_update_child_property (EggAnimation *animation, - gpointer target, - Tween *tween, - const GValue *value) -{ - GtkWidget *parent; - - g_assert (EGG_IS_ANIMATION (animation)); - g_assert (G_IS_OBJECT (target)); - g_assert (tween); - g_assert (value); - - parent = gtk_widget_get_parent (GTK_WIDGET (target)); - gtk_container_child_set_property (GTK_CONTAINER (parent), - target, - tween->pspec->name, - value); -} - - -/** - * egg_animation_get_value_at_offset: - * @animation: (in): A #EggAnimation. - * @offset: (in): The offset in the animation from 0.0 to 1.0. - * @tween: (in): A #Tween containing the property. - * @value: (out): A #GValue in which to store the property. - * - * Retrieves a value for a particular position within the animation. - * - * Side effects: None. - */ -static void -egg_animation_get_value_at_offset (EggAnimation *animation, - gdouble offset, - Tween *tween, - GValue *value) -{ - g_return_if_fail (EGG_IS_ANIMATION (animation)); - g_return_if_fail (tween != NULL); - g_return_if_fail (value != NULL); - g_return_if_fail (value->g_type == tween->pspec->value_type); - - if (value->g_type < LAST_FUNDAMENTAL) - { - /* - * If you hit the following assertion, you need to add a function - * to create the new value at the given offset. - */ - g_assert (tween_funcs[value->g_type]); - tween_funcs[value->g_type](&tween->begin, &tween->end, value, offset); - } - else - { - /* - * TODO: Support complex transitions. - */ - if (offset >= 1.0) - g_value_copy (&tween->end, value); - } -} - -static void -egg_animation_set_frame_clock (EggAnimation *animation, - GdkFrameClock *frame_clock) -{ - if (animation->frame_clock != frame_clock) - { - g_clear_object (&animation->frame_clock); - animation->frame_clock = frame_clock ? g_object_ref (frame_clock) : NULL; - } -} - -static void -egg_animation_set_target (EggAnimation *animation, - gpointer target) -{ - g_assert (!animation->target); - - animation->target = g_object_ref (target); - - if (GTK_IS_WIDGET (animation->target)) - egg_animation_set_frame_clock (animation, - gtk_widget_get_frame_clock (animation->target)); -} - - -/** - * egg_animation_tick: - * @animation: (in): A #EggAnimation. - * - * Moves the object properties to the next position in the animation. - * - * Returns: %TRUE if the animation has not completed; otherwise %FALSE. - * Side effects: None. - */ -static gboolean -egg_animation_tick (EggAnimation *animation, - gdouble offset) -{ - gdouble alpha; - GValue value = { 0 }; - Tween *tween; - guint i; - - g_return_val_if_fail (EGG_IS_ANIMATION (animation), FALSE); - - if (offset == animation->last_offset) - return offset < 1.0; - - alpha = alpha_funcs[animation->mode](offset); - - /* - * Update property values. - */ - for (i = 0; i < animation->tweens->len; i++) - { - tween = &g_array_index (animation->tweens, Tween, i); - g_value_init (&value, tween->pspec->value_type); - egg_animation_get_value_at_offset (animation, alpha, tween, &value); - if (!tween->is_child) - { - egg_animation_update_property (animation, - animation->target, - tween, - &value); - } - else - { - egg_animation_update_child_property (animation, - animation->target, - tween, - &value); - } - g_value_unset (&value); - } - - /* - * Notify anyone interested in the tick signal. - */ - g_signal_emit (animation, signals[TICK], 0); - - /* - * Flush any outstanding events to the graphics server (in the case of X). - */ -#if !GTK_CHECK_VERSION (3, 13, 0) - if (GTK_IS_WIDGET (animation->target)) - { - GdkWindow *window; - - if ((window = gtk_widget_get_window (GTK_WIDGET (animation->target)))) - gdk_window_flush (window); - } -#endif - - animation->last_offset = offset; - - return offset < 1.0; -} - - -/** - * egg_animation_timeout_cb: - * @user_data: (in): A #EggAnimation. - * - * Timeout from the main loop to move to the next step of the animation. - * - * Returns: %TRUE until the animation has completed; otherwise %FALSE. - * Side effects: None. - */ -static gboolean -egg_animation_timeout_cb (gpointer user_data) -{ - EggAnimation *animation = user_data; - gboolean ret; - gdouble offset; - - offset = egg_animation_get_offset (animation, 0); - - if (!(ret = egg_animation_tick (animation, offset))) - egg_animation_stop (animation); - - return ret; -} - - -static gboolean -egg_animation_widget_tick_cb (GdkFrameClock *frame_clock, - EggAnimation *animation) -{ - gboolean ret = G_SOURCE_REMOVE; - - g_assert (GDK_IS_FRAME_CLOCK (frame_clock)); - g_assert (EGG_IS_ANIMATION (animation)); - - if (animation->tween_handler) - { - gdouble offset; - - offset = egg_animation_get_offset (animation, 0); - - if (!(ret = egg_animation_tick (animation, offset))) - egg_animation_stop (animation); - } - - return ret; -} - - -static void -egg_animation_widget_after_paint_cb (GdkFrameClock *frame_clock, - EggAnimation *animation) -{ - gint64 base_time; - gint64 interval; - gint64 next_frame_time; - gdouble offset; - - g_assert (GDK_IS_FRAME_CLOCK (frame_clock)); - g_assert (EGG_IS_ANIMATION (animation)); - - base_time = gdk_frame_clock_get_frame_time (frame_clock); - gdk_frame_clock_get_refresh_info (frame_clock, base_time, &interval, &next_frame_time); - - offset = egg_animation_get_offset (animation, next_frame_time); - - egg_animation_tick (animation, offset); -} - - -/** - * egg_animation_start: - * @animation: (in): A #EggAnimation. - * - * Start the animation. When the animation stops, the internal reference will - * be dropped and the animation may be finalized. - * - * Side effects: None. - */ -void -egg_animation_start (EggAnimation *animation) -{ - g_return_if_fail (EGG_IS_ANIMATION (animation)); - g_return_if_fail (!animation->tween_handler); - - g_object_ref_sink (animation); - egg_animation_load_begin_values (animation); - - if (animation->frame_clock) - { - animation->begin_msec = gdk_frame_clock_get_frame_time (animation->frame_clock) / 1000UL; - animation->tween_handler = - g_signal_connect (animation->frame_clock, - "update", - G_CALLBACK (egg_animation_widget_tick_cb), - animation); - animation->after_paint_handler = - g_signal_connect (animation->frame_clock, - "after-paint", - G_CALLBACK (egg_animation_widget_after_paint_cb), - animation); - gdk_frame_clock_begin_updating (animation->frame_clock); - } - else - { - animation->begin_msec = g_get_monotonic_time () / 1000UL; - animation->tween_handler = egg_frame_source_add (FALLBACK_FRAME_RATE, - egg_animation_timeout_cb, - animation); - } -} - - -static void -egg_animation_notify (EggAnimation *self) -{ - g_assert (EGG_IS_ANIMATION (self)); - - if (self->notify != NULL) - { - GDestroyNotify notify = self->notify; - gpointer data = self->notify_data; - - self->notify = NULL; - self->notify_data = NULL; - - notify (data); - } -} - - -/** - * egg_animation_stop: - * @animation: (in): A #EggAnimation. - * - * Stops a running animation. The internal reference to the animation is - * dropped and therefore may cause the object to finalize. - * - * Side effects: None. - */ -void -egg_animation_stop (EggAnimation *animation) -{ - g_return_if_fail (EGG_IS_ANIMATION (animation)); - - if (animation->tween_handler) - { - if (animation->frame_clock) - { - gdk_frame_clock_end_updating (animation->frame_clock); - g_signal_handler_disconnect (animation->frame_clock, animation->tween_handler); - g_signal_handler_disconnect (animation->frame_clock, animation->after_paint_handler); - animation->tween_handler = 0; - } - else - { - g_source_remove (animation->tween_handler); - animation->tween_handler = 0; - } - egg_animation_unload_begin_values (animation); - egg_animation_notify (animation); - g_object_unref (animation); - } -} - - -/** - * egg_animation_add_property: - * @animation: (in): A #EggAnimation. - * @pspec: (in): A #ParamSpec of @target or a #GtkWidget's parent. - * @value: (in): The new value for the property at the end of the animation. - * - * Adds a new property to the set of properties to be animated during the - * lifetime of the animation. - * - * Side effects: None. - */ -void -egg_animation_add_property (EggAnimation *animation, - GParamSpec *pspec, - const GValue *value) -{ - Tween tween = { 0 }; - GType type; - - g_return_if_fail (EGG_IS_ANIMATION (animation)); - g_return_if_fail (pspec != NULL); - g_return_if_fail (value != NULL); - g_return_if_fail (value->g_type); - g_return_if_fail (animation->target); - g_return_if_fail (!animation->tween_handler); - - type = G_TYPE_FROM_INSTANCE (animation->target); - tween.is_child = !g_type_is_a (type, pspec->owner_type); - if (tween.is_child) - { - if (!GTK_IS_WIDGET (animation->target)) - { - g_critical (_("Cannot locate property %s in class %s"), - pspec->name, g_type_name (type)); - return; - } - } - - tween.pspec = g_param_spec_ref (pspec); - g_value_init (&tween.begin, pspec->value_type); - g_value_init (&tween.end, pspec->value_type); - g_value_copy (value, &tween.end); - g_array_append_val (animation->tweens, tween); -} - - -/** - * egg_animation_dispose: - * @object: (in): A #EggAnimation. - * - * Releases any object references the animation contains. - * - * Side effects: None. - */ -static void -egg_animation_dispose (GObject *object) -{ - EggAnimation *self = EGG_ANIMATION (object); - - g_clear_object (&self->target); - g_clear_object (&self->frame_clock); - - G_OBJECT_CLASS (egg_animation_parent_class)->dispose (object); -} - - -/** - * egg_animation_finalize: - * @object: (in): A #EggAnimation. - * - * Finalizes the object and releases any resources allocated. - * - * Side effects: None. - */ -static void -egg_animation_finalize (GObject *object) -{ - EggAnimation *self = EGG_ANIMATION (object); - Tween *tween; - guint i; - - for (i = 0; i < self->tweens->len; i++) - { - tween = &g_array_index (self->tweens, Tween, i); - g_value_unset (&tween->begin); - g_value_unset (&tween->end); - g_param_spec_unref (tween->pspec); - } - - g_array_unref (self->tweens); - - G_OBJECT_CLASS (egg_animation_parent_class)->finalize (object); -} - - -/** - * egg_animation_set_property: - * @object: (in): A #GObject. - * @prop_id: (in): The property identifier. - * @value: (in): The given property. - * @pspec: (in): A #ParamSpec. - * - * Set a given #GObject property. - */ -static void -egg_animation_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggAnimation *animation = EGG_ANIMATION (object); - - switch (prop_id) - { - case PROP_DURATION: - animation->duration_msec = g_value_get_uint (value) * slow_down_factor; - break; - - case PROP_FRAME_CLOCK: - egg_animation_set_frame_clock (animation, g_value_get_object (value)); - break; - - case PROP_MODE: - animation->mode = g_value_get_enum (value); - break; - - case PROP_TARGET: - egg_animation_set_target (animation, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - - -/** - * egg_animation_class_init: - * @klass: (in): A #EggAnimationClass. - * - * Initializes the GObjectClass. - * - * Side effects: Properties, signals, and vtables are initialized. - */ -static void -egg_animation_class_init (EggAnimationClass *klass) -{ - GObjectClass *object_class; - const gchar *slow_down_factor_env; - - debug = !!g_getenv ("EGG_ANIMATION_DEBUG"); - slow_down_factor_env = g_getenv ("EGG_ANIMATION_SLOW_DOWN_FACTOR"); - - if (slow_down_factor_env) - slow_down_factor = MAX (1, atoi (slow_down_factor_env)); - - object_class = G_OBJECT_CLASS (klass); - object_class->dispose = egg_animation_dispose; - object_class->finalize = egg_animation_finalize; - object_class->set_property = egg_animation_set_property; - - /** - * EggAnimation:duration: - * - * The "duration" property is the total number of milliseconds that the - * animation should run before being completed. - */ - properties[PROP_DURATION] = - g_param_spec_uint ("duration", - "Duration", - "The duration of the animation", - 0, - G_MAXUINT, - 250, - (G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - properties[PROP_FRAME_CLOCK] = - g_param_spec_object ("frame-clock", - "Frame Clock", - "An optional frame-clock to synchronize with.", - GDK_TYPE_FRAME_CLOCK, - (G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - /** - * EggAnimation:mode: - * - * The "mode" property is the Alpha function that should be used to - * determine the offset within the animation based on the current - * offset in the animations duration. - */ - properties[PROP_MODE] = - g_param_spec_enum ("mode", - "Mode", - "The animation mode", - EGG_TYPE_ANIMATION_MODE, - EGG_ANIMATION_LINEAR, - (G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - /** - * EggAnimation:target: - * - * The "target" property is the #GObject that should have its properties - * animated. - */ - properties[PROP_TARGET] = - g_param_spec_object ("target", - "Target", - "The target of the animation", - G_TYPE_OBJECT, - (G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - /** - * EggAnimation::tick: - * - * The "tick" signal is emitted on each frame in the animation. - */ - signals[TICK] = g_signal_new ("tick", - EGG_TYPE_ANIMATION, - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, NULL, - G_TYPE_NONE, - 0); - -#define SET_ALPHA(_T, _t) \ - alpha_funcs[EGG_ANIMATION_ ## _T] = egg_animation_alpha_ ## _t - - SET_ALPHA (LINEAR, linear); - SET_ALPHA (EASE_IN_QUAD, ease_in_quad); - SET_ALPHA (EASE_OUT_QUAD, ease_out_quad); - SET_ALPHA (EASE_IN_OUT_QUAD, ease_in_out_quad); - SET_ALPHA (EASE_IN_CUBIC, ease_in_cubic); - SET_ALPHA (EASE_OUT_CUBIC, ease_out_cubic); - SET_ALPHA (EASE_IN_OUT_CUBIC, ease_in_out_cubic); - -#define SET_TWEEN(_T, _t) \ - G_STMT_START { \ - guint idx = G_TYPE_ ## _T; \ - tween_funcs[idx] = tween_ ## _t; \ - } G_STMT_END - - SET_TWEEN (INT, int); - SET_TWEEN (UINT, uint); - SET_TWEEN (LONG, long); - SET_TWEEN (ULONG, ulong); - SET_TWEEN (FLOAT, float); - SET_TWEEN (DOUBLE, double); -} - - -/** - * egg_animation_init: - * @animation: (in): A #EggAnimation. - * - * Initializes the #EggAnimation instance. - * - * Side effects: Everything. - */ -static void -egg_animation_init (EggAnimation *animation) -{ - animation->duration_msec = 250; - animation->mode = EGG_ANIMATION_EASE_IN_OUT_QUAD; - animation->tweens = g_array_new (FALSE, FALSE, sizeof (Tween)); - animation->last_offset = -G_MINDOUBLE; -} - - -/** - * egg_animation_mode_get_type: - * - * Retrieves the GType for #EggAnimationMode. - * - * Returns: A GType. - * Side effects: GType registered on first call. - */ -GType -egg_animation_mode_get_type (void) -{ - static GType type_id = 0; - static const GEnumValue values[] = { - { EGG_ANIMATION_LINEAR, "EGG_ANIMATION_LINEAR", "linear" }, - { EGG_ANIMATION_EASE_IN_QUAD, "EGG_ANIMATION_EASE_IN_QUAD", "ease-in-quad" }, - { EGG_ANIMATION_EASE_IN_OUT_QUAD, "EGG_ANIMATION_EASE_IN_OUT_QUAD", "ease-in-out-quad" }, - { EGG_ANIMATION_EASE_OUT_QUAD, "EGG_ANIMATION_EASE_OUT_QUAD", "ease-out-quad" }, - { EGG_ANIMATION_EASE_IN_CUBIC, "EGG_ANIMATION_EASE_IN_CUBIC", "ease-in-cubic" }, - { EGG_ANIMATION_EASE_OUT_CUBIC, "EGG_ANIMATION_EASE_OUT_CUBIC", "ease-out-cubic" }, - { EGG_ANIMATION_EASE_IN_OUT_CUBIC, "EGG_ANIMATION_EASE_IN_OUT_CUBIC", "ease-in-out-cubic" }, - { 0 } - }; - - if (G_UNLIKELY (!type_id)) - type_id = g_enum_register_static ("EggAnimationMode", values); - return type_id; -} - -/** - * egg_object_animatev: - * @object: A #GObject. - * @mode: The animation mode. - * @duration_msec: The duration in milliseconds. - * @frame_clock: (nullable): The #GdkFrameClock to synchronize to. - * @first_property: The first property to animate. - * @args: A variadac list of arguments - * - * Returns: (transfer none): A #EggAnimation. - */ -EggAnimation * -egg_object_animatev (gpointer object, - EggAnimationMode mode, - guint duration_msec, - GdkFrameClock *frame_clock, - const gchar *first_property, - va_list args) -{ - EggAnimation *animation; - GObjectClass *klass; - GObjectClass *pklass; - const gchar *name; - GParamSpec *pspec; - GtkWidget *parent; - GValue value = { 0 }; - gchar *error = NULL; - GType type; - GType ptype; - gboolean enable_animations; - - g_return_val_if_fail (first_property != NULL, NULL); - g_return_val_if_fail (mode < EGG_ANIMATION_LAST, NULL); - - if ((frame_clock == NULL) && GTK_IS_WIDGET (object)) - frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (object)); - - /* - * If we have a frame clock, then we must be in the gtk thread and we - * should check GtkSettings for disabled animations. If we are disabled, - * we will just make the timeout immediate. - */ - if (frame_clock != NULL) - { - g_object_get (gtk_settings_get_default (), - "gtk-enable-animations", &enable_animations, - NULL); - - if (enable_animations == FALSE) - duration_msec = 0; - } - - name = first_property; - type = G_TYPE_FROM_INSTANCE (object); - klass = G_OBJECT_GET_CLASS (object); - animation = g_object_new (EGG_TYPE_ANIMATION, - "duration", duration_msec, - "frame-clock", frame_clock, - "mode", mode, - "target", object, - NULL); - - do - { - /* - * First check for the property on the object. If that does not exist - * then check if the object has a parent and look at its child - * properties (if it's a GtkWidget). - */ - if (!(pspec = g_object_class_find_property (klass, name))) - { - if (!g_type_is_a (type, GTK_TYPE_WIDGET)) - { - g_critical (_("Failed to find property %s in %s"), - name, g_type_name (type)); - goto failure; - } - if (!(parent = gtk_widget_get_parent (object))) - { - g_critical (_("Failed to find property %s in %s"), - name, g_type_name (type)); - goto failure; - } - pklass = G_OBJECT_GET_CLASS (parent); - ptype = G_TYPE_FROM_INSTANCE (parent); - if (!(pspec = gtk_container_class_find_child_property (pklass, name))) - { - g_critical (_("Failed to find property %s in %s or parent %s"), - name, g_type_name (type), g_type_name (ptype)); - goto failure; - } - } - - g_value_init (&value, pspec->value_type); - G_VALUE_COLLECT (&value, args, 0, &error); - if (error != NULL) - { - g_critical (_("Failed to retrieve va_list value: %s"), error); - g_free (error); - goto failure; - } - - egg_animation_add_property (animation, pspec, &value); - g_value_unset (&value); - } - while ((name = va_arg (args, const gchar *))); - - egg_animation_start (animation); - - return animation; - -failure: - g_object_ref_sink (animation); - g_object_unref (animation); - return NULL; -} - -/** - * egg_object_animate: - * @object: (in): A #GObject. - * @mode: (in): The animation mode. - * @duration_msec: (in): The duration in milliseconds. - * @first_property: (in): The first property to animate. - * - * Animates the properties of @object. The can be set in a similar manner to g_object_set(). They - * will be animated from their current value to the target value over the time period. - * - * Return value: (transfer none): A #EggAnimation. - * Side effects: None. - */ -EggAnimation* -egg_object_animate (gpointer object, - EggAnimationMode mode, - guint duration_msec, - GdkFrameClock *frame_clock, - const gchar *first_property, - ...) -{ - EggAnimation *animation; - va_list args; - - va_start (args, first_property); - animation = egg_object_animatev (object, - mode, - duration_msec, - frame_clock, - first_property, - args); - va_end (args); - - return animation; -} - -/** - * egg_object_animate_full: - * - * Return value: (transfer none): A #EggAnimation. - */ -EggAnimation* -egg_object_animate_full (gpointer object, - EggAnimationMode mode, - guint duration_msec, - GdkFrameClock *frame_clock, - GDestroyNotify notify, - gpointer notify_data, - const gchar *first_property, - ...) -{ - EggAnimation *animation; - va_list args; - - va_start (args, first_property); - animation = egg_object_animatev (object, - mode, - duration_msec, - frame_clock, - first_property, - args); - va_end (args); - - animation->notify = notify; - animation->notify_data = notify_data; - - return animation; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-animation.h gnome-usage-3.32.0/external/egg/egg-animation.h --- gnome-usage-3.30.0/external/egg/egg-animation.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-animation.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* egg-animation.h - * - * Copyright (C) 2010-2016 Christian Hergert - * - * This file 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 file 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 General Public License along - * with this program. If not, see . - */ - -#ifndef EGG_ANIMATION_H -#define EGG_ANIMATION_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_ANIMATION (egg_animation_get_type()) -#define EGG_TYPE_ANIMATION_MODE (egg_animation_mode_get_type()) - -G_DECLARE_FINAL_TYPE (EggAnimation, egg_animation, - EGG, ANIMATION, GInitiallyUnowned) - -typedef enum _EggAnimationMode EggAnimationMode; - -enum _EggAnimationMode -{ - EGG_ANIMATION_LINEAR, - EGG_ANIMATION_EASE_IN_QUAD, - EGG_ANIMATION_EASE_OUT_QUAD, - EGG_ANIMATION_EASE_IN_OUT_QUAD, - EGG_ANIMATION_EASE_IN_CUBIC, - EGG_ANIMATION_EASE_OUT_CUBIC, - EGG_ANIMATION_EASE_IN_OUT_CUBIC, - - EGG_ANIMATION_LAST -}; - -GType egg_animation_mode_get_type (void); -void egg_animation_start (EggAnimation *animation); -void egg_animation_stop (EggAnimation *animation); -void egg_animation_add_property (EggAnimation *animation, - GParamSpec *pspec, - const GValue *value); - -EggAnimation *egg_object_animatev (gpointer object, - EggAnimationMode mode, - guint duration_msec, - GdkFrameClock *frame_clock, - const gchar *first_property, - va_list args); -EggAnimation* egg_object_animate (gpointer object, - EggAnimationMode mode, - guint duration_msec, - GdkFrameClock *frame_clock, - const gchar *first_property, - ...) G_GNUC_NULL_TERMINATED; -EggAnimation* egg_object_animate_full (gpointer object, - EggAnimationMode mode, - guint duration_msec, - GdkFrameClock *frame_clock, - GDestroyNotify notify, - gpointer notify_data, - const gchar *first_property, - ...) G_GNUC_NULL_TERMINATED; - -G_END_DECLS - -#endif /* EGG_ANIMATION_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-binding-group.c gnome-usage-3.32.0/external/egg/egg-binding-group.c --- gnome-usage-3.30.0/external/egg/egg-binding-group.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-binding-group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,638 +0,0 @@ -/* egg-binding-group.c - * - * Copyright (C) 2015 Christian Hergert - * Copyright (C) 2015 Garrett Regier - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-binding-group" - -#include - -#include "egg-binding-group.h" - -/** - * SECTION:egg-binding-group - * @title: EggBindingGroup - * @short_description: Manage a collection of #GBindings on - * a #GObject as a group. - * - * #EggBindingGroup manages to simplify the process of binding - * many properties from a #GObject as a group. As such there is no API - * to unbind a property from the group. - * - * In particular, this allows you to change the source instance for the - * bindings. This automatically causes the unbinding of the properties - * from the old instance and binding to the new instance. - * - * This should not be confused with #GtkBindingGroup. - */ - -struct _EggBindingGroup -{ - GObject parent_instance; - - GObject *source; - GPtrArray *lazy_bindings; -}; - -typedef struct -{ - EggBindingGroup *group; - const gchar *source_property; - const gchar *target_property; - GObject *target; - GBinding *binding; - gpointer user_data; - GDestroyNotify user_data_destroy; - gpointer transform_to; - gpointer transform_from; - GBindingFlags binding_flags; - guint using_closures : 1; -} LazyBinding; - -G_DEFINE_TYPE (EggBindingGroup, egg_binding_group, G_TYPE_OBJECT) - -enum { - PROP_0, - PROP_SOURCE, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -/*#define DEBUG_BINDINGS 1*/ - -#ifdef DEBUG_BINDINGS -static gchar * -_g_flags_to_string (GFlagsClass *flags_class, - guint value) -{ - GString *str; - GFlagsValue *flags_value; - gboolean first = TRUE; - - str = g_string_new (NULL); - - while ((first || value != 0) && - (flags_value = g_flags_get_first_value (flags_class, value)) != NULL) - { - if (!first) - g_string_append (str, " | "); - - g_string_append (str, flags_value->value_name); - - first = FALSE; - value &= ~(flags_value->value); - } - - return g_string_free (str, FALSE); -} -#endif - -static void -egg_binding_group_connect (EggBindingGroup *self, - LazyBinding *lazy_binding) -{ - GBinding *binding; - - g_assert (EGG_IS_BINDING_GROUP (self)); - g_assert (self->source != NULL); - g_assert (lazy_binding != NULL); - g_assert (lazy_binding->binding == NULL); - g_assert (lazy_binding->target != NULL); - g_assert (lazy_binding->target_property != NULL); - g_assert (lazy_binding->source_property != NULL); - -#ifdef DEBUG_BINDINGS - { - GFlagsClass *flags_class; - g_autofree gchar *flags_str; - - flags_class = g_type_class_ref (G_TYPE_BINDING_FLAGS); - flags_str = _g_flags_to_string (flags_class, - lazy_binding->binding_flags); - - g_print ("Binding %s(%p):%s to %s(%p):%s (flags=%s)\n", - G_OBJECT_TYPE_NAME (self->source), - self->source, - lazy_binding->source_property, - G_OBJECT_TYPE_NAME (lazy_binding->target), - lazy_binding->target, - lazy_binding->target_property, - flags_str); - - g_type_class_unref (flags_class); - } -#endif - - if (!lazy_binding->using_closures) - { - binding = g_object_bind_property_full (self->source, - lazy_binding->source_property, - lazy_binding->target, - lazy_binding->target_property, - lazy_binding->binding_flags, - lazy_binding->transform_to, - lazy_binding->transform_from, - lazy_binding->user_data, - NULL); - } - else - { - binding = g_object_bind_property_with_closures (self->source, - lazy_binding->source_property, - lazy_binding->target, - lazy_binding->target_property, - lazy_binding->binding_flags, - lazy_binding->transform_to, - lazy_binding->transform_from); - } - - lazy_binding->binding = binding; -} - -static void -egg_binding_group_disconnect (LazyBinding *lazy_binding) -{ - g_assert (lazy_binding != NULL); - - if (lazy_binding->binding != NULL) - { - g_binding_unbind (lazy_binding->binding); - lazy_binding->binding = NULL; - } -} - -static void -egg_binding_group__source_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggBindingGroup *self = data; - gsize i; - - g_assert (EGG_IS_BINDING_GROUP (self)); - - self->source = NULL; - - for (i = 0; i < self->lazy_bindings->len; i++) - { - LazyBinding *lazy_binding; - - lazy_binding = g_ptr_array_index (self->lazy_bindings, i); - lazy_binding->binding = NULL; - } -} - -static void -egg_binding_group__target_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggBindingGroup *self = data; - gsize i; - - g_assert (EGG_IS_BINDING_GROUP (self)); - - for (i = 0; i < self->lazy_bindings->len; i++) - { - LazyBinding *lazy_binding; - - lazy_binding = g_ptr_array_index (self->lazy_bindings, i); - - if (lazy_binding->target == where_object_was) - { - lazy_binding->target = NULL; - lazy_binding->binding = NULL; - - g_ptr_array_remove_index_fast (self->lazy_bindings, i); - break; - } - } -} - -static void -lazy_binding_free (gpointer data) -{ - LazyBinding *lazy_binding = data; - - if (lazy_binding->target != NULL) - { - g_object_weak_unref (lazy_binding->target, - egg_binding_group__target_weak_notify, - lazy_binding->group); - lazy_binding->target = NULL; - } - - egg_binding_group_disconnect (lazy_binding); - - lazy_binding->group = NULL; - lazy_binding->source_property = NULL; - lazy_binding->target_property = NULL; - - if (lazy_binding->user_data_destroy) - lazy_binding->user_data_destroy (lazy_binding->user_data); - - if (lazy_binding->using_closures) - { - g_clear_pointer (&lazy_binding->transform_to, g_closure_unref); - g_clear_pointer (&lazy_binding->transform_from, g_closure_unref); - } - - g_slice_free (LazyBinding, lazy_binding); -} - -static void -egg_binding_group_dispose (GObject *object) -{ - EggBindingGroup *self = (EggBindingGroup *)object; - - g_assert (EGG_IS_BINDING_GROUP (self)); - - if (self->source != NULL) - { - g_object_weak_unref (self->source, - egg_binding_group__source_weak_notify, - self); - self->source = NULL; - } - - if (self->lazy_bindings->len != 0) - g_ptr_array_remove_range (self->lazy_bindings, 0, self->lazy_bindings->len); - - G_OBJECT_CLASS (egg_binding_group_parent_class)->dispose (object); -} - -static void -egg_binding_group_finalize (GObject *object) -{ - EggBindingGroup *self = (EggBindingGroup *)object; - - g_assert (self->lazy_bindings != NULL); - g_assert (self->lazy_bindings->len == 0); - - g_clear_pointer (&self->lazy_bindings, g_ptr_array_unref); - - G_OBJECT_CLASS (egg_binding_group_parent_class)->finalize (object); -} - -static void -egg_binding_group_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggBindingGroup *self = EGG_BINDING_GROUP (object); - - switch (prop_id) - { - case PROP_SOURCE: - g_value_set_object (value, egg_binding_group_get_source (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_binding_group_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggBindingGroup *self = EGG_BINDING_GROUP (object); - - switch (prop_id) - { - case PROP_SOURCE: - egg_binding_group_set_source (self, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_binding_group_class_init (EggBindingGroupClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = egg_binding_group_dispose; - object_class->finalize = egg_binding_group_finalize; - object_class->get_property = egg_binding_group_get_property; - object_class->set_property = egg_binding_group_set_property; - - /** - * EggBindingGroup:source - * - * The source object used for binding properties. - */ - properties [PROP_SOURCE] = - g_param_spec_object ("source", - "Source", - "The source GObject used for binding properties.", - G_TYPE_OBJECT, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -egg_binding_group_init (EggBindingGroup *self) -{ - self->lazy_bindings = g_ptr_array_new_with_free_func (lazy_binding_free); -} - -/** - * egg_binding_group_new: - * - * Creates a new #EggBindingGroup. - * - * Returns: a new #EggBindingGroup - */ -EggBindingGroup * -egg_binding_group_new (void) -{ - return g_object_new (EGG_TYPE_BINDING_GROUP, NULL); -} - -/** - * egg_binding_group_get_source: - * @self: the #EggBindingGroup - * - * Gets the source object used for binding properties. - * - * Returns: (transfer none) (nullable): the source object. - */ -GObject * -egg_binding_group_get_source (EggBindingGroup *self) -{ - g_return_val_if_fail (EGG_IS_BINDING_GROUP (self), NULL); - - return self->source; -} - -static gboolean -egg_binding_group_check_source (EggBindingGroup *self, - gpointer source) -{ - gsize i; - - for (i = 0; i < self->lazy_bindings->len; i++) - { - LazyBinding *lazy_binding; - - lazy_binding = g_ptr_array_index (self->lazy_bindings, i); - - g_return_val_if_fail (g_object_class_find_property (G_OBJECT_GET_CLASS (source), - lazy_binding->source_property) != NULL, - FALSE); - } - - return TRUE; -} - -/** - * egg_binding_group_set_source: - * @self: the #EggBindingGroup - * @source: (type GObject) (nullable): the source #GObject - * - * Sets @source as the source object used for creating property - * bindings. If there is already a source object all bindings from it - * will be removed. - * - * Note: All properties that have been bound must exist on @source. - */ -void -egg_binding_group_set_source (EggBindingGroup *self, - gpointer source) -{ - g_return_if_fail (EGG_IS_BINDING_GROUP (self)); - g_return_if_fail (!source || G_IS_OBJECT (source)); - g_return_if_fail (source != (gpointer)self); - - if (source == (gpointer)self->source) - return; - - if (self->source != NULL) - { - gsize i; - - g_object_weak_unref (self->source, - egg_binding_group__source_weak_notify, - self); - self->source = NULL; - - for (i = 0; i < self->lazy_bindings->len; i++) - { - LazyBinding *lazy_binding; - - lazy_binding = g_ptr_array_index (self->lazy_bindings, i); - egg_binding_group_disconnect (lazy_binding); - } - } - - if (source != NULL && egg_binding_group_check_source (self, source)) - { - gsize i; - - self->source = source; - g_object_weak_ref (self->source, - egg_binding_group__source_weak_notify, - self); - - for (i = 0; i < self->lazy_bindings->len; i++) - { - LazyBinding *lazy_binding; - - lazy_binding = g_ptr_array_index (self->lazy_bindings, i); - egg_binding_group_connect (self, lazy_binding); - } - } - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SOURCE]); -} - -void -egg_binding_group_bind_helper (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - gpointer transform_to, - gpointer transform_from, - gpointer user_data, - GDestroyNotify user_data_destroy, - gboolean using_closures) -{ - LazyBinding *lazy_binding; - - g_return_if_fail (EGG_IS_BINDING_GROUP (self)); - g_return_if_fail (source_property != NULL); - g_return_if_fail (self->source == NULL || - g_object_class_find_property (G_OBJECT_GET_CLASS (self->source), - source_property) != NULL); - g_return_if_fail (G_IS_OBJECT (target)); - g_return_if_fail (target_property != NULL); - g_return_if_fail (g_object_class_find_property (G_OBJECT_GET_CLASS (target), - target_property) != NULL); - g_return_if_fail (target != (gpointer)self || - strcmp (source_property, target_property) != 0); - - lazy_binding = g_slice_new0 (LazyBinding); - lazy_binding->group = self; - lazy_binding->source_property = g_intern_string (source_property); - lazy_binding->target_property = g_intern_string (target_property); - lazy_binding->target = target; - lazy_binding->binding_flags = flags | G_BINDING_SYNC_CREATE; - lazy_binding->user_data = user_data; - lazy_binding->user_data_destroy = user_data_destroy; - lazy_binding->transform_to = transform_to; - lazy_binding->transform_from = transform_from; - - if (using_closures) - { - lazy_binding->using_closures = TRUE; - - if (transform_to != NULL) - g_closure_sink (g_closure_ref (transform_to)); - - if (transform_from != NULL) - g_closure_sink (g_closure_ref (transform_from)); - } - - g_object_weak_ref (target, - egg_binding_group__target_weak_notify, - self); - - g_ptr_array_add (self->lazy_bindings, lazy_binding); - - if (self->source != NULL) - egg_binding_group_connect (self, lazy_binding); -} - -/** - * egg_binding_group_bind: - * @self: the #EggBindingGroup - * @source_property: the property on the source to bind - * @target: (type GObject): the target #GObject - * @target_property: the property on @target to bind - * @flags: the flags used to create the #GBinding - * - * Creates a binding between @source_property on the source object - * and @target_property on @target. Whenever the @source_property - * is changed the @target_property is updated using the same value. - * The binding flags #G_BINDING_SYNC_CREATE is automatically specified. - * - * See: g_object_bind_property(). - */ -void -egg_binding_group_bind (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags) -{ - egg_binding_group_bind_full (self, source_property, - target, target_property, - flags, - NULL, NULL, - NULL, NULL); -} - -/** - * egg_binding_group_bind_full: - * @self: the #EggBindingGroup - * @source_property: the property on the source to bind - * @target: (type GObject): the target #GObject - * @target_property: the property on @target to bind - * @flags: the flags used to create the #GBinding - * @transform_to: (scope notified) (nullable): the transformation function - * from the source object to the @target, or %NULL to use the default - * @transform_from: (scope notified) (nullable): the transformation function - * from the @target to the source object, or %NULL to use the default - * @user_data: custom data to be passed to the transformation - * functions, or %NULL - * @user_data_destroy: function to be called when disposing the binding, - * to free the resources used by the transformation functions - * - * Creates a binding between @source_property on the source object and - * @target_property on @target, allowing you to set the transformation - * functions to be used by the binding. The binding flags - * #G_BINDING_SYNC_CREATE is automatically specified. - * - * See: g_object_bind_property_full(). - */ -void -egg_binding_group_bind_full (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - GBindingTransformFunc transform_to, - GBindingTransformFunc transform_from, - gpointer user_data, - GDestroyNotify user_data_destroy) -{ - egg_binding_group_bind_helper (self, source_property, - target, target_property, - flags, - transform_to, transform_from, - user_data, user_data_destroy, - FALSE); -} - -/** - * egg_binding_group_bind_with_closures: (rename-to egg_binding_group_bind_full) - * @self: the #EggBindingGroup - * @source_property: the property on the source to bind - * @target: (type GObject): the target #GObject - * @target_property: the property on @target to bind - * @flags: the flags used to create the #GBinding - * @transform_to: (nullable): a #GClosure wrapping the - * transformation function from the source object to the @target, - * or %NULL to use the default - * @transform_from: (nullable): a #GClosure wrapping the - * transformation function from the @target to the source object, - * or %NULL to use the default - * - * Creates a binding between @source_property on the source object and - * @target_property on @target, allowing you to set the transformation - * functions to be used by the binding. The binding flags - * #G_BINDING_SYNC_CREATE is automatically specified. - * - * This function is the language bindings friendly version of - * egg_binding_group_bind_property_full(), using #GClosures - * instead of function pointers. - * - * See: g_object_bind_property_with_closures(). - */ -void -egg_binding_group_bind_with_closures (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - GClosure *transform_to, - GClosure *transform_from) -{ - egg_binding_group_bind_helper (self, source_property, - target, target_property, - flags, - transform_to, transform_from, - NULL, NULL, - TRUE); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-binding-group.h gnome-usage-3.32.0/external/egg/egg-binding-group.h --- gnome-usage-3.30.0/external/egg/egg-binding-group.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-binding-group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* egg-binding-group.h - * - * Copyright (C) 2015 Christian Hergert - * Copyright (C) 2015 Garrett Regier - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_BINDING_GROUP_H -#define EGG_BINDING_GROUP_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_BINDING_GROUP (egg_binding_group_get_type()) - -G_DECLARE_FINAL_TYPE (EggBindingGroup, egg_binding_group, EGG, BINDING_GROUP, GObject) - -EggBindingGroup *egg_binding_group_new (void); -GObject *egg_binding_group_get_source (EggBindingGroup *self); -void egg_binding_group_set_source (EggBindingGroup *self, - gpointer source); -void egg_binding_group_bind (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags); -void egg_binding_group_bind_full (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - GBindingTransformFunc transform_to, - GBindingTransformFunc transform_from, - gpointer user_data, - GDestroyNotify user_data_destroy); -void egg_binding_group_bind_with_closures (EggBindingGroup *self, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - GClosure *transform_to, - GClosure *transform_from); - -G_END_DECLS - -#endif /* EGG_BINDING_GROUP_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-box.c gnome-usage-3.32.0/external/egg/egg-box.c --- gnome-usage-3.30.0/external/egg/egg-box.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-box.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -/* egg-box.c - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#include "egg-box.h" - -typedef struct -{ - gint max_width_request; -} EggBoxPrivate; - -enum { - PROP_0, - PROP_MAX_WIDTH_REQUEST, - LAST_PROP -}; - -G_DEFINE_TYPE_WITH_PRIVATE (EggBox, egg_box, GTK_TYPE_BOX) - -static GParamSpec *properties [LAST_PROP]; - -static void -egg_box_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggBox *self = (EggBox *)widget; - EggBoxPrivate *priv = egg_box_get_instance_private (self); - - g_assert (EGG_IS_BOX (self)); - - GTK_WIDGET_CLASS (egg_box_parent_class)->get_preferred_width (widget, min_width, nat_width); - - if (priv->max_width_request > 0) - { - if (*min_width > priv->max_width_request) - *min_width = priv->max_width_request; - - if (*nat_width > priv->max_width_request) - *nat_width = priv->max_width_request; - } -} - -static void -egg_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggBox *self = EGG_BOX (object); - EggBoxPrivate *priv = egg_box_get_instance_private (self); - - switch (prop_id) - { - case PROP_MAX_WIDTH_REQUEST: - g_value_set_int (value, priv->max_width_request); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggBox *self = EGG_BOX (object); - EggBoxPrivate *priv = egg_box_get_instance_private (self); - - switch (prop_id) - { - case PROP_MAX_WIDTH_REQUEST: - priv->max_width_request = g_value_get_int (value); - gtk_widget_queue_resize (GTK_WIDGET (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_box_class_init (EggBoxClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->get_property = egg_box_get_property; - object_class->set_property = egg_box_set_property; - - widget_class->get_preferred_width = egg_box_get_preferred_width; - - properties [PROP_MAX_WIDTH_REQUEST] = - g_param_spec_int ("max-width-request", - "Max Width Request", - "Max Width Request", - -1, - G_MAXINT, - -1, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -egg_box_init (EggBox *self) -{ - EggBoxPrivate *priv = egg_box_get_instance_private (self); - - priv->max_width_request = -1; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-box.h gnome-usage-3.32.0/external/egg/egg-box.h --- gnome-usage-3.30.0/external/egg/egg-box.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-box.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* egg-box.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_BOX_H -#define EGG_BOX_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_BOX (egg_box_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggBox, egg_box, EGG, BOX, GtkBox) - -struct _EggBoxClass -{ - GtkBoxClass parent_class; -}; - -GtkWidget *egg_box_new (void); -gint egg_box_get_max_width_request (EggBox *self); -void egg_box_set_max_width_request (EggBox *self, - gint max_width_request); - -G_END_DECLS - -#endif /* EGG_BOX_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-centering-bin.c gnome-usage-3.32.0/external/egg/egg-centering-bin.c --- gnome-usage-3.30.0/external/egg/egg-centering-bin.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-centering-bin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,322 +0,0 @@ -/* egg-centering-bin.c - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "egg-centering-bin.h" -#include "egg-signal-group.h" - -/** - * SECTION:egg-centering-bin: - * @title: EggCenteringBin - * @short_description: center a widget with respect to the toplevel - * - * First off, you probably want to use GtkBox with a center widget instead - * of this widget. However, the case where this widget is useful is when - * you cannot control your layout within the width of the toplevel, but - * still want your child centered within the toplevel. - * - * This is done by translating coordinates of the widget with respect to - * the toplevel and anchoring the child at TRUE_CENTER-(alloc.width/2). - */ - -typedef struct -{ - EggSignalGroup *signals; - gint max_width_request; -} EggCenteringBinPrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (EggCenteringBin, egg_centering_bin, GTK_TYPE_BIN) - -enum { - PROP_0, - PROP_MAX_WIDTH_REQUEST, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -GtkWidget * -egg_centering_bin_new (void) -{ - return g_object_new (EGG_TYPE_CENTERING_BIN, NULL); -} - -static void -egg_centering_bin_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EggCenteringBin *self = (EggCenteringBin *)widget; - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - GtkWidget *child; - - g_assert (GTK_IS_WIDGET (widget)); - g_assert (allocation != NULL); - - gtk_widget_set_allocation (widget, allocation); - - child = gtk_bin_get_child (GTK_BIN (widget)); - - if ((child != NULL) && gtk_widget_get_visible (child)) - { - GtkWidget *toplevel = gtk_widget_get_toplevel (child); - GtkAllocation top_allocation; - GtkAllocation child_allocation; - GtkRequisition nat_child_req; - gint translated_x; - gint translated_y; - gint border_width; - - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - - gtk_widget_get_allocation (toplevel, &top_allocation); - gtk_widget_translate_coordinates (toplevel, widget, - top_allocation.x + (top_allocation.width / 2), - 0, - &translated_x, - &translated_y); - - gtk_widget_get_preferred_size (child, NULL, &nat_child_req); - - child_allocation.x = allocation->x; - child_allocation.y = allocation->y; - child_allocation.height = allocation->height; - child_allocation.width = translated_x * 2; - - child_allocation.y += border_width; - child_allocation.height -= border_width * 2; - - if (nat_child_req.width > child_allocation.width) - child_allocation.width = MIN (nat_child_req.width, allocation->width); - - if ((priv->max_width_request > 0) && (child_allocation.width > priv->max_width_request)) - { - child_allocation.x += (child_allocation.width - priv->max_width_request) / 2; - child_allocation.width = priv->max_width_request; - } - - gtk_widget_size_allocate (child, &child_allocation); - } -} - -static gboolean -queue_allocate_in_idle (gpointer data) -{ - g_autoptr(EggCenteringBin) self = data; - - gtk_widget_queue_allocate (GTK_WIDGET (self)); - - return G_SOURCE_REMOVE; -} - -static void -egg_centering_bin_toplevel_size_allocate (EggCenteringBin *self, - GtkAllocation *allocation, - GtkWindow *toplevel) -{ - g_assert (EGG_IS_CENTERING_BIN (self)); - g_assert (GTK_IS_WINDOW (toplevel)); - - /* - * If we ::queue_allocate() immediately, we can get into a state where an - * allocation is needed when ::draw() should be called. That causes a - * warning on the command line, so instead just delay until we leave - * our current main loop iteration. - */ - g_timeout_add (0, queue_allocate_in_idle, g_object_ref (self)); -} - -static void -egg_centering_bin_hierarchy_changed (GtkWidget *widget, - GtkWidget *previous_toplevel) -{ - EggCenteringBin *self = (EggCenteringBin *)widget; - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - GtkWidget *toplevel; - - g_assert (EGG_IS_CENTERING_BIN (self)); - - /* - * The hierarcy has changed, so we need to ensure we get allocation change - * from the toplevel so we can relayout our child to be centered. - */ - - toplevel = gtk_widget_get_toplevel (widget); - - if (GTK_IS_WINDOW (toplevel)) - egg_signal_group_set_target (priv->signals, toplevel); - else - egg_signal_group_set_target (priv->signals, NULL); -} - -static void -egg_centering_bin_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggCenteringBin *self = (EggCenteringBin *)widget; - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - - g_assert (EGG_IS_CENTERING_BIN (self)); - - GTK_WIDGET_CLASS (egg_centering_bin_parent_class)->get_preferred_width (widget, min_width, nat_width); - - if ((priv->max_width_request > 0) && (*min_width > priv->max_width_request)) - *min_width = priv->max_width_request; - - if ((priv->max_width_request > 0) && (*nat_width > priv->max_width_request)) - *nat_width = priv->max_width_request; -} - -static void -egg_centering_bin_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *min_height, - gint *nat_height) -{ - EggCenteringBin *self = (EggCenteringBin *)widget; - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - GtkWidget *child; - gint border_width; - - g_assert (EGG_IS_CENTERING_BIN (self)); - - /* - * TODO: Something is still not right here. I'm seeing a situation where - * we are not getting the proper height for width. See the extensions - * page in preferences. We are not getting the right height from - * our box child, due to GtkLabel line wrapping. - */ - - *min_height = 0; - *nat_height = 0; - - child = gtk_bin_get_child (GTK_BIN (self)); - if (child == NULL) - return; - - if ((priv->max_width_request) > 0 && (width > priv->max_width_request)) - width = priv->max_width_request; - - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - width -= border_width * 2; - - gtk_widget_get_preferred_height_for_width (child, width, min_height, nat_height); - - *min_height += border_width * 2; - *nat_height += border_width * 2; -} - -static GtkSizeRequestMode -egg_centering_bin_get_request_mode (GtkWidget *widget) -{ - return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; -} - -static void -egg_centering_bin_finalize (GObject *object) -{ - EggCenteringBin *self = (EggCenteringBin *)object; - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - - g_clear_object (&priv->signals); - - G_OBJECT_CLASS (egg_centering_bin_parent_class)->finalize (object); -} - -static void -egg_centering_bin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggCenteringBin *self = EGG_CENTERING_BIN(object); - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - - switch (prop_id) - { - case PROP_MAX_WIDTH_REQUEST: - g_value_set_int (value, priv->max_width_request); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - } -} - -static void -egg_centering_bin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggCenteringBin *self = EGG_CENTERING_BIN(object); - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - - switch (prop_id) - { - case PROP_MAX_WIDTH_REQUEST: - priv->max_width_request = g_value_get_int (value); - gtk_widget_queue_resize (GTK_WIDGET (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - } -} - -static void -egg_centering_bin_class_init (EggCenteringBinClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = egg_centering_bin_finalize; - object_class->get_property = egg_centering_bin_get_property; - object_class->set_property = egg_centering_bin_set_property; - - widget_class->get_preferred_height_for_width = egg_centering_bin_get_preferred_height_for_width; - widget_class->get_preferred_width = egg_centering_bin_get_preferred_width; - widget_class->get_request_mode = egg_centering_bin_get_request_mode; - widget_class->hierarchy_changed = egg_centering_bin_hierarchy_changed; - widget_class->size_allocate = egg_centering_bin_size_allocate; - - properties [PROP_MAX_WIDTH_REQUEST] = - g_param_spec_int ("max-width-request", - "Max Width Request", - "Max Width Request", - -1, - G_MAXINT, - -1, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -egg_centering_bin_init (EggCenteringBin *self) -{ - EggCenteringBinPrivate *priv = egg_centering_bin_get_instance_private (self); - - priv->signals = egg_signal_group_new (GTK_TYPE_WINDOW); - priv->max_width_request = -1; - - egg_signal_group_connect_object (priv->signals, - "size-allocate", - G_CALLBACK (egg_centering_bin_toplevel_size_allocate), - self, - G_CONNECT_SWAPPED); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-centering-bin.h gnome-usage-3.32.0/external/egg/egg-centering-bin.h --- gnome-usage-3.30.0/external/egg/egg-centering-bin.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-centering-bin.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* egg-centering-bin.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_CENTERING_BIN_H -#define EGG_CENTERING_BIN_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_CENTERING_BIN (egg_centering_bin_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggCenteringBin, egg_centering_bin, EGG, CENTERING_BIN, GtkBin) - -struct _EggCenteringBinClass -{ - GtkBinClass parent; -}; - -GtkWidget *egg_centering_bin_new (void); - -G_END_DECLS - -#endif /* EGG_CENTERING_BIN_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-column-layout.c gnome-usage-3.32.0/external/egg/egg-column-layout.c --- gnome-usage-3.30.0/external/egg/egg-column-layout.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-column-layout.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,710 +0,0 @@ -/* egg-column-layout.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "egg-column-layout.h" - -typedef struct -{ - GtkWidget *widget; - GtkAllocation alloc; - GtkRequisition req; - GtkRequisition min_req; - gint priority; -} EggColumnLayoutChild; - -typedef struct -{ - GArray *children; - gint column_width; - gint column_spacing; - gint row_spacing; - guint max_columns; -} EggColumnLayoutPrivate; - -#define COLUMN_WIDTH_DEFAULT 500 -#define COLUMN_SPACING_DEFAULT 24 -#define ROW_SPACING_DEFAULT 24 - -G_DEFINE_TYPE_WITH_PRIVATE (EggColumnLayout, egg_column_layout, GTK_TYPE_CONTAINER) - -enum { - PROP_0, - PROP_COLUMN_WIDTH, - PROP_COLUMN_SPACING, - PROP_MAX_COLUMNS, - PROP_ROW_SPACING, - LAST_PROP -}; - -enum { - CHILD_PROP_0, - CHILD_PROP_PRIORITY, - LAST_CHILD_PROP -}; - -static GParamSpec *properties [LAST_PROP]; -static GParamSpec *child_properties [LAST_CHILD_PROP]; - -static void -egg_column_layout_layout (EggColumnLayout *self, - gint width, - gint height, - gint *tallest_column) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - gint real_tallest_column = 0; - gint total_height = 0; - gint n_columns = 0; - gint border_width; - gint column; - guint i; - - g_assert (EGG_IS_COLUMN_LAYOUT (self)); - g_assert (width > 0); - g_assert (tallest_column != NULL); - - /* - * We want to layout the children in a series of columns, but try to - * fill up each column before spilling into the next column. - * - * We can determine the number of columns we can support by the width - * of our allocation, and determine the max-height of each column - * by dividing the total height of all children by the number of - * columns. There is the chance that non-uniform sizing will mess up - * the height a bit here, but in practice it's mostly okay. - * - * The order of children is sorted by the priority, so that we know - * we can allocate them serially as we walk the array. - * - * We keep allocating children until we will go over the height of - * the column. - */ - - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - total_height = border_width * 2; - - for (i = 0; i < priv->children->len; i++) - { - EggColumnLayoutChild *child; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i); - - gtk_widget_get_preferred_height_for_width (child->widget, - priv->column_width, - &child->min_req.height, - &child->req.height); - - if (i != 0) - total_height += priv->row_spacing; - total_height += child->req.height; - } - - if (total_height <= height) - n_columns = 1; - else - n_columns = MAX (1, (width - (border_width * 2)) / (priv->column_width + priv->column_spacing)); - - if (priv->max_columns > 0) - n_columns = MIN (n_columns, priv->max_columns); - - for (column = 0, i = 0; column < n_columns; column++) - { - GtkAllocation alloc; - gint j = 0; - - alloc.x = border_width + (priv->column_width * column) + (column * priv->column_spacing); - alloc.y = border_width; - alloc.width = priv->column_width; - alloc.height = (height != 0) ? (height - (border_width * 2)) : total_height / n_columns; - - for (; i < priv->children->len; i++) - { - EggColumnLayoutChild *child; - gint child_height; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i); - - /* - * Ignore this child if it is not visible. - */ - if (!gtk_widget_get_visible (child->widget) || - !gtk_widget_get_child_visible (child->widget)) - continue; - - /* - * If we are discovering height, and this is the last item in the - * first column, and we only have one column, then we will just - * make this "vexpand". - */ - if (priv->max_columns == 1 && i == priv->children->len - 1) - { - if (height == 0) - child_height = child->min_req.height; - else - child_height = alloc.height; - } - else - child_height = child->req.height; - - /* - * If the child requisition is taller than the space we have left in - * this column, we need to spill over to the next column. - */ - if ((j != 0) && (child_height > alloc.height) && (column < (n_columns - 1))) - break; - - child->alloc.x = alloc.x; - child->alloc.y = alloc.y; - child->alloc.width = priv->column_width; - child->alloc.height = child_height; - -#if 0 - g_print ("Allocating child to: [%d] %d,%d %dx%d\n", - column, - child->alloc.x, - child->alloc.y, - child->alloc.width, - child->alloc.height); -#endif - - alloc.y += child_height + priv->row_spacing; - alloc.height -= child_height + priv->row_spacing; - - if (alloc.y > real_tallest_column) - real_tallest_column = alloc.y; - - j++; - } - } - - real_tallest_column += border_width; - - *tallest_column = real_tallest_column; -} - -static GtkSizeRequestMode -egg_column_layout_get_request_mode (GtkWidget *widget) -{ - return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; -} - -static void -egg_column_layout_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggColumnLayout *self = (EggColumnLayout *)widget; - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - gint border_width; - gint n_columns = 3; - - g_assert (EGG_IS_COLUMN_LAYOUT (self)); - g_assert (min_width != NULL); - g_assert (nat_width != NULL); - - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - - /* - * By default we try to natural size up to 3 columns. Otherwise, we - * use the max_columns. It would be nice if we could deal with this - * in a better way, but that is going to take a bunch more solving. - */ - - if (priv->max_columns > 0) - n_columns = priv->max_columns; - - *nat_width = (priv->column_width * n_columns) + (priv->column_spacing * (n_columns - 1)) + (border_width * 2); - *min_width = priv->column_width + (border_width * 2); -} - -static void -egg_column_layout_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *min_height, - gint *nat_height) -{ - EggColumnLayout *self = (EggColumnLayout *)widget; - gint tallest_column = 0; - - g_assert (EGG_IS_COLUMN_LAYOUT (self)); - g_assert (min_height != NULL); - g_assert (nat_height != NULL); - - egg_column_layout_layout (self, width, 0, &tallest_column); - - *min_height = *nat_height = tallest_column; -} - -static void -egg_column_layout_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EggColumnLayout *self = (EggColumnLayout *)widget; - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - gint tallest_column = 0; - guint i; - - g_assert (EGG_IS_COLUMN_LAYOUT (self)); - g_assert (allocation != NULL); - - gtk_widget_set_allocation (widget, allocation); - - egg_column_layout_layout (self, allocation->width, allocation->height, &tallest_column); - - /* - * If we are on a RTL language, flip all our allocations around so - * we move from right to left. This is easier than adding all the - * complexity to directions during layout time. - */ - if (GTK_TEXT_DIR_RTL == gtk_widget_get_direction (widget)) - { - for (i = 0; i < priv->children->len; i++) - { - EggColumnLayoutChild *child; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i); - child->alloc.x = allocation->x + allocation->width - child->alloc.x - child->alloc.width; - } - } - - for (i = 0; i < priv->children->len; i++) - { - EggColumnLayoutChild *child; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i); - gtk_widget_size_allocate (child->widget, &child->alloc); - } -} - -static gint -egg_column_layout_child_compare (gconstpointer a, - gconstpointer b) -{ - const EggColumnLayoutChild *child_a = a; - const EggColumnLayoutChild *child_b = b; - - return child_a->priority - child_b->priority; -} - -static void -egg_column_layout_add (GtkContainer *container, - GtkWidget *widget) -{ - EggColumnLayout *self = (EggColumnLayout *)container; - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - EggColumnLayoutChild child = { 0 }; - - g_assert (EGG_IS_COLUMN_LAYOUT (self)); - g_assert (GTK_IS_WIDGET (widget)); - - child.widget = g_object_ref_sink (widget); - child.priority = 0; - - g_array_append_val (priv->children, child); - g_array_sort (priv->children, egg_column_layout_child_compare); - - gtk_widget_set_parent (widget, GTK_WIDGET (self)); - gtk_widget_queue_resize (GTK_WIDGET (self)); -} - -static void -egg_column_layout_remove (GtkContainer *container, - GtkWidget *widget) -{ - EggColumnLayout *self = (EggColumnLayout *)container; - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - guint i; - - g_assert (GTK_IS_CONTAINER (container)); - g_assert (GTK_IS_WIDGET (widget)); - - for (i = 0; i < priv->children->len; i++) - { - EggColumnLayoutChild *child; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i); - - if (child->widget == widget) - { - gtk_widget_unparent (child->widget); - g_array_remove_index (priv->children, i); - gtk_widget_queue_resize (GTK_WIDGET (self)); - return; - } - } -} - -static void -egg_column_layout_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer user_data) -{ - EggColumnLayout *self = (EggColumnLayout *)container; - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - gint i; - - g_assert (GTK_IS_CONTAINER (container)); - g_assert (callback != NULL); - - /* - * We walk backwards in the array to be safe against callback destorying - * the widget (and causing it to be removed). - */ - - for (i = priv->children->len; i > 0; i--) - { - EggColumnLayoutChild *child; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i - 1); - callback (child->widget, user_data); - } -} - -static EggColumnLayoutChild * -egg_column_layout_find_child (EggColumnLayout *self, - GtkWidget *widget) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_assert (EGG_IS_COLUMN_LAYOUT (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (guint i = 0; i < priv->children->len; i++) - { - EggColumnLayoutChild *child; - - child = &g_array_index (priv->children, EggColumnLayoutChild, i); - - if (child->widget == widget) - return child; - } - - g_assert_not_reached (); - - return NULL; -} - -gint -egg_column_layout_get_column_width (EggColumnLayout *self) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - g_return_val_if_fail (EGG_IS_COLUMN_LAYOUT (self), 0); - return priv->column_width; -} - -void -egg_column_layout_set_column_width (EggColumnLayout *self, - gint column_width) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_return_if_fail (EGG_IS_COLUMN_LAYOUT (self)); - g_return_if_fail (column_width >= 0); - - if (priv->column_width != column_width) - { - priv->column_width = column_width; - gtk_widget_queue_resize (GTK_WIDGET (self)); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_COLUMN_WIDTH]); - } -} - -gint -egg_column_layout_get_column_spacing (EggColumnLayout *self) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - g_return_val_if_fail (EGG_IS_COLUMN_LAYOUT (self), 0); - return priv->column_spacing; -} - -void -egg_column_layout_set_column_spacing (EggColumnLayout *self, - gint column_spacing) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_return_if_fail (EGG_IS_COLUMN_LAYOUT (self)); - g_return_if_fail (column_spacing >= 0); - - if (priv->column_spacing != column_spacing) - { - priv->column_spacing = column_spacing; - gtk_widget_queue_resize (GTK_WIDGET (self)); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_COLUMN_SPACING]); - } -} - -gint -egg_column_layout_get_row_spacing (EggColumnLayout *self) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - g_return_val_if_fail (EGG_IS_COLUMN_LAYOUT (self), 0); - return priv->row_spacing; -} - -void -egg_column_layout_set_row_spacing (EggColumnLayout *self, - gint row_spacing) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_return_if_fail (EGG_IS_COLUMN_LAYOUT (self)); - g_return_if_fail (row_spacing >= 0); - - if (priv->row_spacing != row_spacing) - { - priv->row_spacing = row_spacing; - gtk_widget_queue_resize (GTK_WIDGET (self)); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ROW_SPACING]); - } -} - -static void -egg_column_layout_get_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggColumnLayout *self = (EggColumnLayout *)container; - EggColumnLayoutChild *child = egg_column_layout_find_child (self, widget); - - switch (prop_id) - { - case CHILD_PROP_PRIORITY: - g_value_set_int (value, child->priority); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_column_layout_set_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggColumnLayout *self = (EggColumnLayout *)container; - EggColumnLayoutChild *child = egg_column_layout_find_child (self, widget); - - switch (prop_id) - { - case CHILD_PROP_PRIORITY: - child->priority = g_value_get_int (value); - gtk_widget_queue_allocate (GTK_WIDGET (self)); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_column_layout_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggColumnLayout *self = EGG_COLUMN_LAYOUT(object); - - switch (prop_id) - { - case PROP_COLUMN_SPACING: - g_value_set_int (value, egg_column_layout_get_column_spacing (self)); - break; - - case PROP_COLUMN_WIDTH: - g_value_set_int (value, egg_column_layout_get_column_width (self)); - break; - - case PROP_MAX_COLUMNS: - g_value_set_uint (value, egg_column_layout_get_max_columns (self)); - break; - - case PROP_ROW_SPACING: - g_value_set_int (value, egg_column_layout_get_row_spacing (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - } -} - -static void -egg_column_layout_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggColumnLayout *self = EGG_COLUMN_LAYOUT(object); - - switch (prop_id) - { - case PROP_COLUMN_SPACING: - egg_column_layout_set_column_spacing (self, g_value_get_int (value)); - break; - - case PROP_COLUMN_WIDTH: - egg_column_layout_set_column_width (self, g_value_get_int (value)); - break; - - case PROP_MAX_COLUMNS: - egg_column_layout_set_max_columns (self, g_value_get_uint (value)); - break; - - case PROP_ROW_SPACING: - egg_column_layout_set_row_spacing (self, g_value_get_int (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - } -} - -static void -egg_column_layout_finalize (GObject *object) -{ - EggColumnLayout *self = (EggColumnLayout *)object; - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_clear_pointer (&priv->children, g_array_unref); - - G_OBJECT_CLASS (egg_column_layout_parent_class)->finalize (object); -} - -static void -egg_column_layout_class_init (EggColumnLayoutClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->finalize = egg_column_layout_finalize; - object_class->get_property = egg_column_layout_get_property; - object_class->set_property = egg_column_layout_set_property; - - properties [PROP_COLUMN_SPACING] = - g_param_spec_int ("column-spacing", - "Column Spacing", - "The spacing between columns", - 0, - G_MAXINT, - COLUMN_SPACING_DEFAULT, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_COLUMN_WIDTH] = - g_param_spec_int ("column-width", - "Column Width", - "The width of the columns", - 0, - G_MAXINT, - COLUMN_WIDTH_DEFAULT, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_MAX_COLUMNS] = - g_param_spec_uint ("max-columns", - "Max Columns", - "Max Columns", - 0, - G_MAXINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_ROW_SPACING] = - g_param_spec_int ("row-spacing", - "Row Spacing", - "The spacing between rows", - 0, - G_MAXINT, - ROW_SPACING_DEFAULT, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - widget_class->get_preferred_height_for_width = egg_column_layout_get_preferred_height_for_width; - widget_class->get_preferred_width = egg_column_layout_get_preferred_width; - widget_class->get_request_mode = egg_column_layout_get_request_mode; - widget_class->size_allocate = egg_column_layout_size_allocate; - - container_class->add = egg_column_layout_add; - container_class->forall = egg_column_layout_forall; - container_class->remove = egg_column_layout_remove; - container_class->get_child_property = egg_column_layout_get_child_property; - container_class->set_child_property = egg_column_layout_set_child_property; - - child_properties [CHILD_PROP_PRIORITY] = - g_param_spec_int ("priority", - "Priority", - "The sort priority of the child", - G_MININT, - G_MAXINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - gtk_container_class_install_child_properties (container_class, LAST_CHILD_PROP, child_properties); -} - -static void -egg_column_layout_init (EggColumnLayout *self) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); - - priv->children = g_array_new (FALSE, TRUE, sizeof (EggColumnLayoutChild)); - - priv->column_width = COLUMN_WIDTH_DEFAULT; - priv->column_spacing = COLUMN_SPACING_DEFAULT; - priv->row_spacing = ROW_SPACING_DEFAULT; -} - -GtkWidget * -egg_column_layout_new (void) -{ - return g_object_new (EGG_TYPE_COLUMN_LAYOUT, NULL); -} - -guint -egg_column_layout_get_max_columns (EggColumnLayout *self) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_COLUMN_LAYOUT (self), 0); - - return priv->max_columns; -} - -void -egg_column_layout_set_max_columns (EggColumnLayout *self, - guint max_columns) -{ - EggColumnLayoutPrivate *priv = egg_column_layout_get_instance_private (self); - - g_return_if_fail (EGG_IS_COLUMN_LAYOUT (self)); - - if (priv->max_columns != max_columns) - { - priv->max_columns = max_columns; - gtk_widget_queue_resize (GTK_WIDGET (self)); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MAX_COLUMNS]); - } -} diff -Nru gnome-usage-3.30.0/external/egg/egg-column-layout.h gnome-usage-3.32.0/external/egg/egg-column-layout.h --- gnome-usage-3.30.0/external/egg/egg-column-layout.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-column-layout.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* egg-column-layout.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_COLUMN_LAYOUT_H -#define EGG_COLUMN_LAYOUT_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_COLUMN_LAYOUT (egg_column_layout_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggColumnLayout, egg_column_layout, EGG, COLUMN_LAYOUT, GtkContainer) - -struct _EggColumnLayoutClass -{ - GtkContainerClass parent; -}; - -GtkWidget *egg_column_layout_new (void); -guint egg_column_layout_get_max_columns (EggColumnLayout *self); -void egg_column_layout_set_max_columns (EggColumnLayout *self, - guint max_columns); -gint egg_column_layout_get_column_width (EggColumnLayout *self); -void egg_column_layout_set_column_width (EggColumnLayout *self, - gint column_width); -gint egg_column_layout_get_column_spacing (EggColumnLayout *self); -void egg_column_layout_set_column_spacing (EggColumnLayout *self, - gint column_spacing); -gint egg_column_layout_get_row_spacing (EggColumnLayout *self); -void egg_column_layout_set_row_spacing (EggColumnLayout *self, - gint row_spacing); - -G_END_DECLS - -#endif /* EGG_COLUMN_LAYOUT_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-counter.c gnome-usage-3.32.0/external/egg/egg-counter.c --- gnome-usage-3.30.0/external/egg/egg-counter.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-counter.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,632 +0,0 @@ -/* egg-counter.c - * - * Copyright (C) 2013-2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "egg-counter.h" - -G_DEFINE_BOXED_TYPE (EggCounterArena, egg_counter_arena, egg_counter_arena_ref, egg_counter_arena_unref) - -#define MAX_COUNTERS 2000 -#define NAME_FORMAT "/EggCounters-%u" -#define MAGIC 0x71167125 -#define COUNTER_MAX_SHM (1024 * 1024 * 4) -#define COUNTERS_PER_GROUP 8 -#define DATA_CELL_SIZE 64 -#define CELLS_PER_INFO (sizeof(CounterInfo) / DATA_CELL_SIZE) -#define CELLS_PER_HEADER 2 -#define CELLS_PER_GROUP(ncpu) \ - (((sizeof (CounterInfo) * COUNTERS_PER_GROUP) + \ - (sizeof(EggCounterValue) * (ncpu))) / DATA_CELL_SIZE) -#define EGG_MEMORY_BARRIER __sync_synchronize() - -typedef struct -{ - guint cell : 29; /* Counter groups starting cell */ - guint position : 3; /* Index within counter group */ - gchar category[20]; /* Counter category name. */ - gchar name[32]; /* Counter name. */ - gchar description[72]; /* Counter description */ -} CounterInfo __attribute__((aligned (DATA_CELL_SIZE))); - -G_STATIC_ASSERT (sizeof (CounterInfo) == 128); -G_STATIC_ASSERT (CELLS_PER_INFO == 2); -G_STATIC_ASSERT (CELLS_PER_GROUP(1) == 17); -G_STATIC_ASSERT (CELLS_PER_GROUP(2) == 18); -G_STATIC_ASSERT (CELLS_PER_GROUP(4) == 20); -G_STATIC_ASSERT (CELLS_PER_GROUP(8) == 24); -G_STATIC_ASSERT (CELLS_PER_GROUP(16) == 32); - -typedef struct -{ - gint64 values[8]; -} DataCell __attribute__((aligned (DATA_CELL_SIZE))); - -G_STATIC_ASSERT (sizeof (DataCell) == 64); - -typedef struct -{ - guint32 magic; /* Expected magic value */ - guint32 size; /* Size of underlying shm file */ - guint32 ncpu; /* Number of CPUs registered with */ - guint32 first_offset; /* Offset to first counter info in cells */ - guint32 n_counters; /* Number of CounterInfos */ - gchar padding [108]; -} ShmHeader __attribute__((aligned (DATA_CELL_SIZE))); - -G_STATIC_ASSERT (sizeof(ShmHeader) == (DATA_CELL_SIZE * CELLS_PER_HEADER)); - -struct _EggCounterArena -{ - gint ref_count; - guint arena_is_malloced : 1; - guint data_is_mmapped : 1; - guint is_local_arena : 1; - gsize n_cells; - DataCell *cells; - gsize data_length; - GPid pid; - guint n_counters; - GList *counters; -}; - -G_LOCK_DEFINE_STATIC (reglock); - -static void _egg_counter_init_getcpu (void) __attribute__ ((constructor)); -static guint (*_egg_counter_getcpu_helper) (void); - -gint64 -egg_counter_get (EggCounter *counter) -{ - gint64 value = 0; - guint ncpu; - guint i; - - g_return_val_if_fail (counter, G_GINT64_CONSTANT (-1)); - - ncpu = g_get_num_processors (); - - EGG_MEMORY_BARRIER; - - for (i = 0; i < ncpu; i++) - value += counter->values [i].value; - - return value; -} - -void -egg_counter_reset (EggCounter *counter) -{ - guint ncpu; - guint i; - - g_return_if_fail (counter); - - ncpu = g_get_num_processors (); - - for (i = 0; i < ncpu; i++) - counter->values [i].value = 0; - - EGG_MEMORY_BARRIER; -} - -static void -_egg_counter_arena_atexit (void) -{ - gchar name [32]; - gint pid; - - pid = getpid (); - g_snprintf (name, sizeof name, NAME_FORMAT, pid); - shm_unlink (name); -} - -static void -_egg_counter_arena_init_local (EggCounterArena *arena) -{ - ShmHeader *header; - gpointer mem; - unsigned pid; - gsize size; - gint page_size; - gint fd; - gchar name [32]; - - page_size = sysconf (_SC_PAGE_SIZE); - - /* Implausible, but squashes warnings. */ - if (page_size < 4096) - { - page_size = 4096; - size = page_size * 4; - goto use_malloc; - } - - /* - * FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=749280 - * - * We have some very tricky work ahead of us to add unlimited numbers - * of counters at runtime. We basically need to avoid placing counters - * that could overlap a page. - */ - size = page_size * 4; - - arena->ref_count = 1; - arena->is_local_arena = TRUE; - - if (getenv ("EGG_COUNTER_DISABLE_SHM")) - goto use_malloc; - - pid = getpid (); - g_snprintf (name, sizeof name, NAME_FORMAT, pid); - - if (-1 == (fd = shm_open (name, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR|S_IRGRP))) - goto use_malloc; - - /* - * ftruncate() will cause reads to be zero. Therefore, we don't need to - * do write() of zeroes to initialize the shared memory area. - */ - if (-1 == ftruncate (fd, size)) - goto failure; - - /* - * Memory map the shared memory segement so that we can store our counters - * within it. We need to layout the counters into the segment so that other - * processes can traverse and read the values by loading the shared page. - */ - mem = mmap (NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); - if (mem == MAP_FAILED) - goto failure; - - close (fd); - atexit (_egg_counter_arena_atexit); - - arena->data_is_mmapped = TRUE; - arena->cells = mem; - arena->n_cells = (size / DATA_CELL_SIZE); - arena->data_length = size; - - header = mem; - header->magic = MAGIC; - header->ncpu = g_get_num_processors (); - header->first_offset = CELLS_PER_HEADER; - - EGG_MEMORY_BARRIER; - - header->size = (guint32)arena->data_length; - - return; - -failure: - shm_unlink (name); - close (fd); - -use_malloc: - g_warning ("Failed to allocate shared memory for counters. " - "Counters will not be available to external processes."); - - arena->data_is_mmapped = FALSE; - arena->cells = g_malloc0 (size << 1); - arena->n_cells = (size / DATA_CELL_SIZE); - arena->data_length = size; - - /* - * Make sure that we have a properly aligned allocation back from - * malloc. Since we are at least a page size, we should pretty much - * be guaranteed this, but better to check with posix_memalign(). - */ - if (posix_memalign ((void *)&arena->cells, page_size, size << 1) != 0) - { - perror ("posix_memalign()"); - abort (); - } - - header = (void *)arena->cells; - header->magic = MAGIC; - header->ncpu = g_get_num_processors (); - header->first_offset = CELLS_PER_HEADER; - - EGG_MEMORY_BARRIER; - - header->size = (guint32)arena->data_length; -} - -static gboolean -_egg_counter_arena_init_remote (EggCounterArena *arena, - GPid pid) -{ - ShmHeader header; - gssize count; - gchar name [32]; - void *mem = NULL; - guint ncpu; - guint n_counters; - guint i; - int fd = -1; - - g_assert (arena != NULL); - - ncpu = g_get_num_processors (); - - arena->ref_count = 1; - arena->pid = pid; - - g_snprintf (name, sizeof name, NAME_FORMAT, (int)pid); - - fd = shm_open (name, O_RDONLY, 0); - if (fd < 0) - return FALSE; - - count = pread (fd, &header, sizeof header, 0); - - if ((count != sizeof header) || - (header.magic != MAGIC) || - (header.size > COUNTER_MAX_SHM) || - (header.ncpu > g_get_num_processors ())) - goto failure; - - n_counters = header.n_counters; - - if (n_counters > MAX_COUNTERS) - goto failure; - - if (header.size < - CELLS_PER_HEADER + (((n_counters / COUNTERS_PER_GROUP) + 1) * CELLS_PER_GROUP(header.ncpu))) - goto failure; - - mem = mmap (NULL, header.size, PROT_READ, MAP_SHARED, fd, 0); - - if (mem == MAP_FAILED) - goto failure; - - arena->is_local_arena = FALSE; - arena->data_is_mmapped = TRUE; - arena->cells = mem; - arena->n_cells = header.size / DATA_CELL_SIZE; - arena->data_length = header.size; - arena->counters = NULL; - - /* Not strictly required, but helpful for now */ - if (header.first_offset != CELLS_PER_HEADER) - goto failure; - - for (i = 0; i < n_counters; i++) - { - CounterInfo *info; - EggCounter *counter; - guint group_start_cell; - guint group; - guint position; - - group = i / COUNTERS_PER_GROUP; - position = i % COUNTERS_PER_GROUP; - group_start_cell = header.first_offset + (CELLS_PER_GROUP (ncpu) * group); - - if (group_start_cell + CELLS_PER_GROUP (ncpu) >= arena->n_cells) - goto failure; - - info = &(((CounterInfo *)&arena->cells[group_start_cell])[position]); - - counter = g_new0 (EggCounter, 1); - counter->category = g_strndup (info->category, sizeof info->category); - counter->name = g_strndup (info->name, sizeof info->name); - counter->description = g_strndup (info->description, sizeof info->description); - counter->values = (EggCounterValue *)&arena->cells [info->cell].values[info->position]; - -#if 0 - g_print ("Counter discovered: cell=%u position=%u category=%s name=%s values=%p offset=%lu\n", - info->cell, info->position, info->category, info->name, counter->values, - (guint8*)counter->values - (guint8*)mem); -#endif - - arena->counters = g_list_prepend (arena->counters, counter); - } - - close (fd); - - return TRUE; - -failure: - close (fd); - - if ((mem != NULL) && (mem != MAP_FAILED)) - munmap (mem, header.size); - - return FALSE; -} - -EggCounterArena * -egg_counter_arena_new_for_pid (GPid pid) -{ - EggCounterArena *arena; - - arena = g_new0 (EggCounterArena, 1); - - if (!_egg_counter_arena_init_remote (arena, pid)) - { - g_free (arena); - return NULL; - } - - return arena; -} - -static void -_egg_counter_arena_destroy (EggCounterArena *arena) -{ - g_assert (arena != NULL); - - if (arena->data_is_mmapped) - munmap (arena->cells, arena->data_length); - else - g_free (arena->cells); - - g_clear_pointer (&arena->counters, g_list_free); - - arena->cells = NULL; - - if (arena->arena_is_malloced) - g_free (arena); -} - -EggCounterArena * -egg_counter_arena_get_default (void) -{ - static EggCounterArena instance; - static gsize initialized; - - if (G_UNLIKELY (g_once_init_enter (&initialized))) - { - _egg_counter_arena_init_local (&instance); - g_once_init_leave (&initialized, 1); - } - - return &instance; -} - -EggCounterArena * -egg_counter_arena_ref (EggCounterArena *arena) -{ - g_return_val_if_fail (arena, NULL); - g_return_val_if_fail (arena->ref_count > 0, NULL); - - g_atomic_int_inc (&arena->ref_count); - - return arena; -} - -void -egg_counter_arena_unref (EggCounterArena *arena) -{ - g_return_if_fail (arena); - g_return_if_fail (arena->ref_count); - - if (g_atomic_int_dec_and_test (&arena->ref_count)) - _egg_counter_arena_destroy (arena); -} - -/** - * egg_counter_arena_foreach: - * @arena: An #EggCounterArena - * @func: (scope call): A callback to execute - * @user_data: user data for @func - * - * Calls @func for every counter found in @area. - */ -void -egg_counter_arena_foreach (EggCounterArena *arena, - EggCounterForeachFunc func, - gpointer user_data) -{ - GList *iter; - - g_return_if_fail (arena != NULL); - g_return_if_fail (func != NULL); - - for (iter = arena->counters; iter; iter = iter->next) - func (iter->data, user_data); -} - -void -egg_counter_arena_register (EggCounterArena *arena, - EggCounter *counter) -{ - CounterInfo *info; - guint group; - guint ncpu; - guint position; - guint group_start_cell; - - g_return_if_fail (arena != NULL); - g_return_if_fail (counter != NULL); - - if (!arena->is_local_arena) - { - g_warning ("Cannot add counters to a remote arena."); - return; - } - - ncpu = g_get_num_processors (); - - G_LOCK (reglock); - - /* - * Get the counter group and position within the group of the counter. - */ - group = arena->n_counters / COUNTERS_PER_GROUP; - position = arena->n_counters % COUNTERS_PER_GROUP; - - /* - * Get the starting cell for this group. Cells roughly map to cachelines. - */ - group_start_cell = CELLS_PER_HEADER + (CELLS_PER_GROUP (ncpu) * group); - info = &((CounterInfo *)&arena->cells [group_start_cell])[position]; - - g_assert (position < COUNTERS_PER_GROUP); - g_assert (group_start_cell < arena->n_cells); - - /* - * Store information about the counter in the SHM area. Also, update - * the counter values pointer to map to the right cell in the SHM zone. - */ - info->cell = group_start_cell + (COUNTERS_PER_GROUP * CELLS_PER_INFO); - info->position = position; - g_snprintf (info->category, sizeof info->category, "%s", counter->category); - g_snprintf (info->description, sizeof info->description, "%s", counter->description); - g_snprintf (info->name, sizeof info->name, "%s", counter->name); - counter->values = (EggCounterValue *)&arena->cells [info->cell].values[info->position]; - -#if 0 - g_print ("Counter registered: cell=%u position=%u category=%s name=%s\n", - info->cell, info->position, info->category, info->name); -#endif - - /* - * Track the counter address, so we can _foreach() them. - */ - arena->counters = g_list_append (arena->counters, counter); - arena->n_counters++; - - /* - * Now notify remote processes of the counter. - */ - EGG_MEMORY_BARRIER; - ((ShmHeader *)&arena->cells[0])->n_counters++; - - G_UNLOCK (reglock); -} - -#ifdef __linux__ -static void * -_egg_counter_find_getcpu_in_vdso (void) -{ - static const gchar *vdso_names[] = { - "linux-vdso.so.1", - "linux-vdso32.so.1", - "linux-vdso64.so.1", - NULL - }; - static const gchar *sym_names[] = { - "__kernel_getcpu", - "__vdso_getcpu", - NULL - }; - gint i; - - for (i = 0; vdso_names [i]; i++) - { - GModule *lib; - gint j; - - lib = g_module_open (vdso_names [i], 0); - if (lib == NULL) - continue; - - for (j = 0; sym_names [j]; j++) - { - void *sym = NULL; - - if (!g_module_symbol (lib, sym_names [j], &sym) || (sym == NULL)) - continue; - - return sym; - } - - g_module_close (lib); - } - - return NULL; -} - -static guint (*_egg_counter_getcpu_vdso_raw) (int *cpu, - int *node, - void *tcache); - -static guint -_egg_counter_getcpu_vdso_helper (void) -{ - int cpu; - _egg_counter_getcpu_vdso_raw (&cpu, NULL, NULL); - return cpu; -} -#endif - -#ifndef HAVE_SCHED_GETCPU -static guint -_egg_counter_getcpu_fallback (void) -{ - return 0; -} -#endif - -#ifdef EGG_HAVE_RDTSCP -static guint -_egg_counter_getcpu_rdtscp (void) -{ - return egg_get_current_cpu_rdtscp (); -} -#endif - -static void -_egg_counter_init_getcpu (void) -{ - -#ifdef EGG_HAVE_RDTSCP - _egg_counter_getcpu_helper = _egg_counter_getcpu_rdtscp; -#endif - -#ifdef __linux__ - _egg_counter_getcpu_vdso_raw = _egg_counter_find_getcpu_in_vdso (); - - if (_egg_counter_getcpu_vdso_raw) - { - _egg_counter_getcpu_helper = _egg_counter_getcpu_vdso_helper; - return; - } -#endif - -#ifdef HAVE_SCHED_GETCPU - _egg_counter_getcpu_helper = (guint (*) (void))sched_getcpu; -#else - _egg_counter_getcpu_helper = _egg_counter_getcpu_fallback; -#endif -} - -guint -egg_get_current_cpu_call (void) -{ - return _egg_counter_getcpu_helper (); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-counter.h gnome-usage-3.32.0/external/egg/egg-counter.h --- gnome-usage-3.30.0/external/egg/egg-counter.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-counter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,289 +0,0 @@ -/* egg-counter.h - * - * Copyright (C) 2013-2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - * - * Additionally, this file does not claim copyright over the expansion - * of macros in your source program. - */ - -#ifndef EGG_COUNTER_H -#define EGG_COUNTER_H - -#include - -/* - * History - * ======= - * - * EggCounter is a performance counter based on ideas from previous work - * on high performance counters. They are not guaranteed to be 100% - * correct, but they approach that with no synchronization given new - * enough hardware. In particular, we use %ecx from rdtscp (the core id) - * to determine which cachline to increment the counter within. - * - * Given a counter, the value will be split up int NCPU cachelines where - * NCPU is the number of cores returned from get_nprocs() (on Linux). - * - * Updating the counter is very cheap, reading back the counter requires - * a volatile read of each cacheline. Again, no correctness is guaranteed. - * - * In practice, very few values are lost even during tight competing loops. - * A loss can happen when the thread is pre-empted between the %rdtscp - * instruction and the addq increment (on x86_64). - * - * - * Using EggCounter - * ================ - * - * To define a counter, you must have support for constructor attributes. - * - * EGG_DEFINE_COUNTER (Symbol, "Category", "Name", "Description") - * - * To increment the counter in a function of your choice (but within the - * same module), use EGG_COUNTER_ADD, EGG_COUNTER_INC, EGG_COUNTER_DEC. - * - * EGG_COUNTER_INC (Symbol); - * - * - * Architecture Support - * ==================== - * - * If you are not on x86_64, or are missing the rdtscp instruction, a 64-bit - * atomic will be performed using __sync_fetch_and_add8(). Clearly, we can - * do some more work here to abstract which implementation is used, but we - * only support GCC and Clang today, which both have that intrinsic. Some - * architectures may not have it (such as 32-bit PPC), but I'm not too - * concerned about that at the moment. - * - * The counters are mapped into a shared memory zone using shm_open() and - * mmap(). An external program can then discover the available counters - * and print them without blocking the target program. It simply must - * perform the reads in a volatile manner just like the target process - * would need to do for readback. - * - * EggCounterArena provides a helper to walk through the counters in the - * shared memory zone. egg_counter_arena_foreach(). - * - * You cannot remove a counter once it has been registered. - * - * - * Accessing Counters Remotely - * =========================== - * - * You can access the counters from out of process. By opening the SHM zone - * and reading the contents from each cachline, you can get the approximate - * state of the target application without blocking it. - * - * EggCounterArena provides a helper for you to do this. - * - * EggCounterArena *arena; - * - * arena = egg_counter_arena_new_for_pid (other_process_pid); - * egg_counter_arena_foreach (arena, my_counter_callback, user_data); - * - * - * Data Layout - * =========== - * - * The layout of the shared memory zone is broken into "cells". Each cell - * is an approximate cacheline (64-bytes) on modern Intel hardware. Indexes - * to data locations are represented in cells to simplify the math and - * allow the compiler to know we are working with properly aligned structures. - * - * The base pointer in EggCounter.values is not 64-byte aligned! It is 8-byte - * aligned and points to the offset within the cacheline for that counter. - * We pack 8 64-bit counters into a single cacheline. This allows us to avoid - * an extra MOV instruction when incrementing since we only need to perform - * the offset from the base pointer. - * - * The first two cells are the header which contain information about the - * underlying shm file and how large the mmap() range should be. - * - * After that, begin the counters. - * - * The counters are layed out in groups of 8 counters. - * - * [8 CounterInfo Structs (128-bytes each)][N_CPU Data Zones (64-byte each)] - * - * See egg-counter.c for more information on the contents of these structures. - * - * - * Build System Requirements - * ========================= - * - * We need to know if rdtscp is available at compile time. In an effort - * to keep the headers as portable as possible (if that matters here?) we - * require that you define EGG_HAVE_RDTSCP if the instruction is supported. - * - * An example for autoconf might be similar to the following: - * - * AC_MSG_CHECKING([for fast counters with rdtscp]) - * AC_RUN_IFELSE( - * [AC_LANG_SOURCE([[ - * #include - * int main (int argc, char *argv[]) { int cpu; __builtin_ia32_rdtscp (&cpu); return 0; }]])], - * [have_rdtscp=yes], - * [have_rdtscp=no]) - * AC_MSG_RESULT([$have_rdtscp]) - * AS_IF([test "$have_rdtscp" = "yes"], - * [CFLAGS="$CFLAGS -DEGG_HAVE_RDTSCP"]) - */ - -G_BEGIN_DECLS - -#ifdef EGG_HAVE_RDTSCP -# include - static inline guint - egg_get_current_cpu_rdtscp (void) - { - /* - * This extracts the IA32_TSC_AUX into the ecx register. On Linux, - * that value contains a value with the bottom 12 bits being the - * cpu identifier, and the next 10 bits being the node group. - */ - guint aux; - __builtin_ia32_rdtscp (&aux); - return aux & 0xFFF; - } -# define egg_get_current_cpu() egg_get_current_cpu_rdtscp() -#elif defined(__linux__) -# define egg_get_current_cpu() egg_get_current_cpu_call() -#else -# define egg_get_current_cpu() 0 -# define EGG_COUNTER_REQUIRES_ATOMIC 1 -#endif - -/** - * EGG_DEFINE_COUNTER: - * @Identifier: The symbol name of the counter - * @Category: A string category for the counter. - * @Name: A string name for the counter. - * @Description: A string description for the counter. - * - * |[ - * EGG_DEFINE_COUNTER (my_counter, "My", "Counter", "My Counter Description"); - * ]| - */ -#define EGG_DEFINE_COUNTER(Identifier, Category, Name, Description) \ - static EggCounter Identifier##_ctr = { NULL, Category, Name, Description }; \ - static void Identifier##_ctr_init (void) __attribute__((constructor)); \ - static void \ - Identifier##_ctr_init (void) \ - { \ - egg_counter_arena_register (egg_counter_arena_get_default(), &Identifier##_ctr); \ - } - -/** - * EGG_COUNTER_INC: - * @Identifier: The identifier of the counter. - * - * Increments the counter @Identifier by 1. - */ -#define EGG_COUNTER_INC(Identifier) EGG_COUNTER_ADD(Identifier, G_GINT64_CONSTANT(1)) - -/** - * EGG_COUNTER_DEC: - * @Identifier: The identifier of the counter. - * - * Decrements the counter @Identifier by 1. - */ -#define EGG_COUNTER_DEC(Identifier) EGG_COUNTER_SUB(Identifier, G_GINT64_CONSTANT(1)) - -/** - * EGG_COUNTER_SUB: - * @Identifier: The identifier of the counter. - * @Count: the amount to subtract. - * - * Subtracts from the counter identified by @Identifier by @Count. - */ -#define EGG_COUNTER_SUB(Identifier, Count) EGG_COUNTER_ADD(Identifier, (-(Count))) - -/** - * EGG_COUNTER_ADD: - * @Identifier: The identifier of the counter. - * @Count: the amount to add to the counter. - * - * Adds @Count to @Identifier. - * - * This operation is not guaranteed to have full correctness. It tries to find - * a happy medium between fast, and accurate. When possible, the %rdtscp - * instruction is used to get a cacheline owned by the executing CPU, to avoid - * collisions. However, this is not guaranteed as the thread could be swapped - * between the calls to %rdtscp and %addq (on 64-bit Intel). - * - * Other platforms have fallbacks which may give different guarantees, such as - * using atomic operations (and therefore, memory barriers). - * - * See #EggCounter for more information. - */ -#ifdef EGG_COUNTER_REQUIRES_ATOMIC -# define EGG_COUNTER_ADD(Identifier, Count) \ - G_STMT_START { \ - __sync_add_and_fetch ((gint64 *)&Identifier##_ctr.values[0], ((gint64)(Count))); \ - } G_STMT_END -#else -# define EGG_COUNTER_ADD(Identifier, Count) \ - G_STMT_START { \ - Identifier##_ctr.values[egg_get_current_cpu()].value += ((gint64)(Count)); \ - } G_STMT_END -#endif - -typedef struct _EggCounter EggCounter; -typedef struct _EggCounterArena EggCounterArena; -typedef struct _EggCounterValue EggCounterValue; - -/** - * EggCounterForeachFunc: - * @counter: the counter. - * @user_data: data supplied to egg_counter_arena_foreach(). - * - * Function prototype for callbacks provided to egg_counter_arena_foreach(). - */ -typedef void (*EggCounterForeachFunc) (EggCounter *counter, - gpointer user_data); - -struct _EggCounter -{ - /*< Private >*/ - EggCounterValue *values; - const gchar *category; - const gchar *name; - const gchar *description; -} __attribute__ ((aligned(8))); - -struct _EggCounterValue -{ - volatile gint64 value; - gint64 padding [7]; -} __attribute__ ((aligned(8))); - -GType egg_counter_arena_get_type (void); -guint egg_get_current_cpu_call (void); -EggCounterArena *egg_counter_arena_get_default (void); -EggCounterArena *egg_counter_arena_new_for_pid (GPid pid); -EggCounterArena *egg_counter_arena_ref (EggCounterArena *arena); -void egg_counter_arena_unref (EggCounterArena *arena); -void egg_counter_arena_register (EggCounterArena *arena, - EggCounter *counter); -void egg_counter_arena_foreach (EggCounterArena *arena, - EggCounterForeachFunc func, - gpointer user_data); -void egg_counter_reset (EggCounter *counter); -gint64 egg_counter_get (EggCounter *counter); - -G_END_DECLS - -#endif /* EGG_COUNTER_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-date-time.c gnome-usage-3.32.0/external/egg/egg-date-time.c --- gnome-usage-3.30.0/external/egg/egg-date-time.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-date-time.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* egg-date-time.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#include - -#include "egg-date-time.h" - -/** - * egg_date_time_format_for_display: - * @self: A #GDateTime - * - * Helper function to "humanize" a #GDateTime into a relative time - * relationship string. - * - * Returns: (transfer full): A newly allocated string describing the - * date and time imprecisely such as "Yesterday". - */ -gchar * -egg_date_time_format_for_display (GDateTime *self) -{ - GDateTime *now; - GTimeSpan diff; - gint years; - - /* - * TODO: - * - * There is probably a lot more we can do here to be friendly for - * various locales, but this will get us started. - */ - - g_return_val_if_fail (self != NULL, NULL); - - now = g_date_time_new_now_utc (); - diff = g_date_time_difference (now, self) / G_USEC_PER_SEC; - - if (diff < 0) - return g_strdup (""); - else if (diff < (60 * 45)) - return g_strdup (_("Just now")); - else if (diff < (60 * 90)) - return g_strdup (_("An hour ago")); - else if (diff < (60 * 60 * 24 * 2)) - return g_strdup (_("Yesterday")); - else if (diff < (60 * 60 * 24 * 7)) - return g_date_time_format (self, "%A"); - else if (diff < (60 * 60 * 24 * 365)) - return g_date_time_format (self, "%B"); - else if (diff < (60 * 60 * 24 * 365 * 1.5)) - return g_strdup (_("About a year ago")); - - years = MAX (2, diff / (60 * 60 * 24 * 365)); - - return g_strdup_printf (ngettext ("About %u year ago", "About %u years ago", years), years); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-date-time.h gnome-usage-3.32.0/external/egg/egg-date-time.h --- gnome-usage-3.30.0/external/egg/egg-date-time.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-date-time.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* egg-date-time.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_DATE_TIME_H -#define EGG_DATE_TIME_H - -#include - -G_BEGIN_DECLS - -gchar *egg_date_time_format_for_display (GDateTime *self); - -G_END_DECLS - -#endif /* EGG_DATE_TIME_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-empty-state.c gnome-usage-3.32.0/external/egg/egg-empty-state.c --- gnome-usage-3.30.0/external/egg/egg-empty-state.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-empty-state.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,407 +0,0 @@ -/* egg-empty-state.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include -#include - -#include "egg-empty-state.h" - -typedef struct -{ - GtkBox *box; - GtkImage *image; - GtkLabel *subtitle; - GtkLabel *title; -} EggEmptyStatePrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (EggEmptyState, egg_empty_state, GTK_TYPE_BIN) - -enum { - PROP_0, - PROP_ICON_NAME, - PROP_PIXEL_SIZE, - PROP_RESOURCE, - PROP_SUBTITLE, - PROP_TITLE, - N_PROPS -}; - -static GParamSpec *properties [N_PROPS]; - -static gboolean -egg_empty_state_action (GtkWidget *widget, - const gchar *prefix, - const gchar *action_name, - GVariant *parameter) -{ - GtkWidget *toplevel; - GApplication *app; - GActionGroup *group = NULL; - - g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - g_return_val_if_fail (prefix, FALSE); - g_return_val_if_fail (action_name, FALSE); - - app = g_application_get_default (); - toplevel = gtk_widget_get_toplevel (widget); - - while ((group == NULL) && (widget != NULL)) - { - group = gtk_widget_get_action_group (widget, prefix); - widget = gtk_widget_get_parent (widget); - } - - if (!group && g_str_equal (prefix, "win") && G_IS_ACTION_GROUP (toplevel)) - group = G_ACTION_GROUP (toplevel); - - if (!group && g_str_equal (prefix, "app") && G_IS_ACTION_GROUP (app)) - group = G_ACTION_GROUP (app); - - if (group && g_action_group_has_action (group, action_name)) - { - g_action_group_activate_action (group, action_name, parameter); - return TRUE; - } - - if (parameter && g_variant_is_floating (parameter)) - { - parameter = g_variant_ref_sink (parameter); - g_variant_unref (parameter); - } - - g_warning ("Failed to locate action %s.%s", prefix, action_name); - - return FALSE; -} - -static gboolean -egg_empty_state_activate_link (EggEmptyState *self, - const gchar *uri, - GtkLabel *label) -{ - g_assert (EGG_IS_EMPTY_STATE (self)); - g_assert (uri != NULL); - g_assert (GTK_IS_LABEL (label)); - - if (g_str_has_prefix (uri, "action://")) - { - g_autofree gchar *full_name = NULL; - g_autofree gchar *action_name = NULL; - g_autofree gchar *group_name = NULL; - g_autoptr(GVariant) param = NULL; - g_autoptr(GError) error = NULL; - - uri += strlen ("action://"); - - if (g_action_parse_detailed_name (uri, &full_name, ¶m, &error)) - { - const gchar *dot = strchr (full_name, '.'); - - if (param != NULL && g_variant_is_floating (param)) - param = g_variant_ref_sink (param); - - if (dot == NULL) - return FALSE; - - group_name = g_strndup (full_name, dot - full_name); - action_name = g_strdup (++dot); - - egg_empty_state_action (GTK_WIDGET (self), - group_name, - action_name, - param); - - return TRUE; - } - else - g_warning ("%s", error->message); - } - - return FALSE; -} - -static void -egg_empty_state_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggEmptyState *self = EGG_EMPTY_STATE (object); - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - switch (prop_id) - { - case PROP_ICON_NAME: - g_value_set_string (value, egg_empty_state_get_icon_name (self)); - break; - - case PROP_PIXEL_SIZE: - g_value_set_int (value, gtk_image_get_pixel_size (priv->image)); - break; - - case PROP_SUBTITLE: - g_value_set_string (value, egg_empty_state_get_subtitle (self)); - break; - - case PROP_TITLE: - g_value_set_string (value, egg_empty_state_get_title (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_empty_state_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggEmptyState *self = EGG_EMPTY_STATE (object); - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - switch (prop_id) - { - case PROP_ICON_NAME: - egg_empty_state_set_icon_name (self, g_value_get_string (value)); - break; - - case PROP_PIXEL_SIZE: - gtk_image_set_pixel_size (priv->image, g_value_get_int (value)); - break; - - case PROP_RESOURCE: - egg_empty_state_set_resource (self, g_value_get_string (value)); - break; - - case PROP_SUBTITLE: - egg_empty_state_set_subtitle (self, g_value_get_string (value)); - break; - - case PROP_TITLE: - egg_empty_state_set_title (self, g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_empty_state_class_init (EggEmptyStateClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->get_property = egg_empty_state_get_property; - object_class->set_property = egg_empty_state_set_property; - - properties [PROP_ICON_NAME] = - g_param_spec_string ("icon-name", - "Icon Name", - "The name of the icon to display", - NULL, - (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_PIXEL_SIZE] = - g_param_spec_int ("pixel-size", - "Pixel Size", - "Pixel Size", - 0, - G_MAXINT, - 128, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_RESOURCE] = - g_param_spec_string ("resource", - "Resource", - "A resource path to use for the icon", - NULL, - (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_SUBTITLE] = - g_param_spec_string ("subtitle", - "Subtitle", - "The subtitle of the empty state", - NULL, - (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_TITLE] = - g_param_spec_string ("title", - "Title", - "The title of the empty state", - NULL, - (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); - - gtk_widget_class_set_template_from_resource (widget_class, - "/org/gnome/libegg-private/egg-empty-state.ui"); - gtk_widget_class_bind_template_child_private (widget_class, EggEmptyState, box); - gtk_widget_class_bind_template_child_private (widget_class, EggEmptyState, image); - gtk_widget_class_bind_template_child_private (widget_class, EggEmptyState, title); - gtk_widget_class_bind_template_child_private (widget_class, EggEmptyState, subtitle); -} - -static void -egg_empty_state_init (EggEmptyState *self) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - gtk_widget_init_template (GTK_WIDGET (self)); - - g_signal_connect_object (priv->subtitle, - "activate-link", - G_CALLBACK (egg_empty_state_activate_link), - self, - G_CONNECT_SWAPPED); -} - -const gchar * -egg_empty_state_get_icon_name (EggEmptyState *self) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - const gchar *icon_name = NULL; - - g_return_val_if_fail (EGG_IS_EMPTY_STATE (self), NULL); - - gtk_image_get_icon_name (priv->image, &icon_name, NULL); - - return icon_name; -} - -void -egg_empty_state_set_icon_name (EggEmptyState *self, - const gchar *icon_name) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - g_return_if_fail (EGG_IS_EMPTY_STATE (self)); - - if (g_strcmp0 (icon_name, egg_empty_state_get_icon_name (self)) != 0) - { - GtkStyleContext *context; - - g_object_set (priv->image, - "icon-name", icon_name, - NULL); - - context = gtk_widget_get_style_context (GTK_WIDGET (priv->image)); - - if (icon_name != NULL && g_str_has_suffix (icon_name, "-symbolic")) - gtk_style_context_add_class (context, "dim-label"); - else - gtk_style_context_remove_class (context, "dim-label"); - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ICON_NAME]); - } -} - -const gchar * -egg_empty_state_get_subtitle (EggEmptyState *self) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_EMPTY_STATE (self), NULL); - - return gtk_label_get_label (priv->subtitle); -} - -void -egg_empty_state_set_subtitle (EggEmptyState *self, - const gchar *subtitle) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - g_return_if_fail (EGG_IS_EMPTY_STATE (self)); - - if (g_strcmp0 (subtitle, egg_empty_state_get_subtitle (self)) != 0) - { - gtk_label_set_label (priv->subtitle, subtitle); - gtk_widget_set_visible (GTK_WIDGET (priv->subtitle), subtitle && *subtitle); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SUBTITLE]); - } -} - -const gchar * -egg_empty_state_get_title (EggEmptyState *self) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_EMPTY_STATE (self), NULL); - - return gtk_label_get_label (priv->title); -} - -void -egg_empty_state_set_title (EggEmptyState *self, - const gchar *title) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - g_return_if_fail (EGG_IS_EMPTY_STATE (self)); - - if (g_strcmp0 (title, egg_empty_state_get_title (self)) != 0) - { - gtk_label_set_label (priv->title, title); - gtk_widget_set_visible (GTK_WIDGET (priv->title), title && *title); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]); - } -} - -void -egg_empty_state_set_resource (EggEmptyState *self, - const gchar *resource) -{ - EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self); - - g_return_if_fail (EGG_IS_EMPTY_STATE (self)); - - if (resource != NULL) - { - GdkPixbuf *pixbuf; - GError *error = NULL; - gint scale_factor; - - scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (self)); - - pixbuf = gdk_pixbuf_new_from_resource_at_scale (resource, - 128 * scale_factor, - 128 * scale_factor, - TRUE, - &error); - - if (pixbuf == NULL) - { - g_warning ("%s", error->message); - g_clear_error (&error); - return; - } - - g_object_set (priv->image, - "pixbuf", pixbuf, - NULL); - - g_clear_object (&pixbuf); - } -} diff -Nru gnome-usage-3.30.0/external/egg/egg-empty-state.h gnome-usage-3.32.0/external/egg/egg-empty-state.h --- gnome-usage-3.30.0/external/egg/egg-empty-state.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-empty-state.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* egg-empty-state.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_EMPTY_STATE_H -#define EGG_EMPTY_STATE_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_EMPTY_STATE (egg_empty_state_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggEmptyState, egg_empty_state, EGG, EMPTY_STATE, GtkBin) - -struct _EggEmptyStateClass -{ - GtkBinClass parent_class; -}; - -GtkWidget *egg_empty_state_new (void); -const gchar *egg_empty_state_get_icon_name (EggEmptyState *self); -void egg_empty_state_set_icon_name (EggEmptyState *self, - const gchar *icon_name); -void egg_empty_state_set_resource (EggEmptyState *self, - const gchar *resource); -const gchar *egg_empty_state_get_title (EggEmptyState *self); -void egg_empty_state_set_title (EggEmptyState *self, - const gchar *title); -const gchar *egg_empty_state_get_subtitle (EggEmptyState *self); -void egg_empty_state_set_subtitle (EggEmptyState *self, - const gchar *title); - -G_END_DECLS - -#endif /* EGG_EMPTY_STATE_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-empty-state.ui gnome-usage-3.32.0/external/egg/egg-empty-state.ui --- gnome-usage-3.30.0/external/egg/egg-empty-state.ui 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-empty-state.ui 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ - - - - diff -Nru gnome-usage-3.30.0/external/egg/egg-entry-box.c gnome-usage-3.32.0/external/egg/egg-entry-box.c --- gnome-usage-3.30.0/external/egg/egg-entry-box.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-entry-box.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,143 +0,0 @@ -/* egg-entry-box.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "egg-entry-box.h" - -struct _EggEntryBox -{ - GtkBox parent_instance; - - gint max_width_chars; -}; - -G_DEFINE_TYPE (EggEntryBox, egg_entry_box, GTK_TYPE_BOX) - -enum { - PROP_0, - PROP_MAX_WIDTH_CHARS, - N_PROPS -}; - -static GParamSpec *properties [N_PROPS]; - -static void -egg_entry_box_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggEntryBox *self = (EggEntryBox *)widget; - - g_assert (EGG_IS_ENTRY_BOX (self)); - g_assert (min_width != NULL); - g_assert (nat_width != NULL); - - GTK_WIDGET_CLASS (egg_entry_box_parent_class)->get_preferred_width (widget, min_width, nat_width); - - if (self->max_width_chars > 0) - { - PangoContext *context; - PangoFontMetrics *metrics; - gint char_width; - gint digit_width; - gint width; - - context = gtk_widget_get_pango_context (widget); - metrics = pango_context_get_metrics (context, - pango_context_get_font_description (context), - pango_context_get_language (context)); - - char_width = pango_font_metrics_get_approximate_char_width (metrics); - digit_width = pango_font_metrics_get_approximate_digit_width (metrics); - width = MAX (char_width, digit_width) * self->max_width_chars / PANGO_SCALE; - - if (width > *nat_width) - *nat_width = width; - - pango_font_metrics_unref (metrics); - } -} - -static void -egg_entry_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggEntryBox *self = EGG_ENTRY_BOX (object); - - switch (prop_id) - { - case PROP_MAX_WIDTH_CHARS: - g_value_set_int (value, self->max_width_chars); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_entry_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggEntryBox *self = EGG_ENTRY_BOX (object); - - switch (prop_id) - { - case PROP_MAX_WIDTH_CHARS: - self->max_width_chars = g_value_get_int (value); - gtk_widget_queue_resize (GTK_WIDGET (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_entry_box_class_init (EggEntryBoxClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = egg_entry_box_get_property; - object_class->set_property = egg_entry_box_set_property; - - widget_class->get_preferred_width = egg_entry_box_get_preferred_width; - - properties [PROP_MAX_WIDTH_CHARS] = - g_param_spec_int ("max-width-chars", - "Max Width Chars", - "Max Width Chars", - -1, - G_MAXINT, - -1, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); - - gtk_widget_class_set_css_name (widget_class, "entry"); -} - -static void -egg_entry_box_init (EggEntryBox *self) -{ - self->max_width_chars = -1; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-entry-box.h gnome-usage-3.32.0/external/egg/egg-entry-box.h --- gnome-usage-3.30.0/external/egg/egg-entry-box.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-entry-box.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* egg-entry-box.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_ENTRY_BOX_H -#define EGG_ENTRY_BOX_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_ENTRY_BOX (egg_entry_box_get_type()) - -G_DECLARE_FINAL_TYPE (EggEntryBox, egg_entry_box, EGG, ENTRY_BOX, GtkBox) - -GtkWidget *egg_entry_box_new (void); - -G_END_DECLS - -#endif /* EGG_ENTRY_BOX_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-file-chooser-entry.c gnome-usage-3.32.0/external/egg/egg-file-chooser-entry.c --- gnome-usage-3.30.0/external/egg/egg-file-chooser-entry.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-file-chooser-entry.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,568 +0,0 @@ -/* egg-file-chooser-entry.c - * - * Copyright (C) 2016 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-file-chooser-entry" - -#include - -#include "egg-file-chooser-entry.h" - -typedef struct -{ - GtkEntry *entry; - GtkButton *button; - - GtkFileChooserDialog *dialog; - GtkFileFilter *filter; - GFile *file; - - GtkFileChooserAction action; - - guint local_only : 1; - guint create_folders : 1; - guint do_overwrite_confirmation : 1; - guint select_multiple : 1; - guint show_hidden : 1; -} EggFileChooserEntryPrivate; - -enum { - PROP_0, - PROP_ACTION, - PROP_CREATE_FOLDERS, - PROP_DO_OVERWRITE_CONFIRMATION, - PROP_FILE, - PROP_FILTER, - PROP_LOCAL_ONLY, - PROP_SHOW_HIDDEN, - PROP_MAX_WIDTH_CHARS, - PROP_TITLE, - N_PROPS -}; - -static GParamSpec *properties [N_PROPS]; - -G_DEFINE_TYPE_EXTENDED (EggFileChooserEntry, - egg_file_chooser_entry, - GTK_TYPE_BIN, - 0, - G_ADD_PRIVATE (EggFileChooserEntry)) - -static void -egg_file_chooser_entry_sync_to_dialog (EggFileChooserEntry *self) -{ - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - GtkWidget *toplevel; - GtkWidget *default_widget; - - g_assert (EGG_IS_FILE_CHOOSER_ENTRY (self)); - - if (priv->dialog == NULL) - return; - - g_object_set (priv->dialog, - "action", priv->action, - "create-folders", priv->create_folders, - "do-overwrite-confirmation", priv->do_overwrite_confirmation, - "local-only", priv->local_only, - "show-hidden", priv->show_hidden, - "filter", priv->filter, - NULL); - - if (priv->file != NULL) - gtk_file_chooser_set_file (GTK_FILE_CHOOSER (priv->dialog), priv->file, NULL); - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self)); - - if (GTK_IS_WINDOW (toplevel)) - gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), GTK_WINDOW (toplevel)); - - default_widget = gtk_dialog_get_widget_for_response (GTK_DIALOG (priv->dialog), - GTK_RESPONSE_OK); - - switch (priv->action) - { - case GTK_FILE_CHOOSER_ACTION_OPEN: - gtk_button_set_label (GTK_BUTTON (default_widget), _("Open")); - break; - - case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: - gtk_button_set_label (GTK_BUTTON (default_widget), _("Select")); - break; - - case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: - gtk_button_set_label (GTK_BUTTON (default_widget), _("Create")); - break; - - case GTK_FILE_CHOOSER_ACTION_SAVE: - gtk_button_set_label (GTK_BUTTON (default_widget), _("Save")); - break; - - default: - break; - } -} - -static gboolean -egg_file_chooser_entry_dialog_delete_event (EggFileChooserEntry *self, - GdkEvent *event, - GtkFileChooserDialog *dialog) -{ - g_assert (EGG_IS_FILE_CHOOSER_ENTRY (self)); - g_assert (event != NULL); - g_assert (GTK_IS_FILE_CHOOSER_DIALOG (dialog)); - - if (gtk_widget_in_destruction (GTK_WIDGET (self))) - return GDK_EVENT_PROPAGATE; - - gtk_widget_hide (GTK_WIDGET (dialog)); - - return GDK_EVENT_STOP; -} - -static void -egg_file_chooser_entry_dialog_response (EggFileChooserEntry *self, - gint response_id, - GtkFileChooserDialog *dialog) -{ - g_autoptr(GFile) file = NULL; - - g_assert (EGG_IS_FILE_CHOOSER_ENTRY (self)); - g_assert (GTK_IS_FILE_CHOOSER_DIALOG (dialog)); - - if (response_id == GTK_RESPONSE_CANCEL) - { - gtk_widget_hide (GTK_WIDGET (dialog)); - return; - } - - file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); - - if (file != NULL) - egg_file_chooser_entry_set_file (self, file); - - gtk_widget_hide (GTK_WIDGET (dialog)); -} - -static void -egg_file_chooser_entry_button_clicked (EggFileChooserEntry *self, - GtkButton *button) -{ - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - - g_assert (EGG_IS_FILE_CHOOSER_ENTRY (self)); - g_assert (GTK_IS_BUTTON (button)); - - egg_file_chooser_entry_sync_to_dialog (self); - - if (priv->dialog != NULL) - gtk_window_present (GTK_WINDOW (priv->dialog)); -} - -static GFile * -file_expand (const gchar *path) -{ - g_autofree gchar *relative = NULL; - g_autofree gchar *scheme = NULL; - - if (path == NULL) - return g_file_new_for_path (g_get_home_dir ()); - - scheme = g_uri_parse_scheme (path); - if (scheme != NULL) - return g_file_new_for_uri (path); - - if (g_path_is_absolute (path)) - return g_file_new_for_path (path); - - relative = g_build_filename (g_get_home_dir (), - path[0] == '~' ? &path[1] : path, - NULL); - - return g_file_new_for_path (relative); -} - -static void -egg_file_chooser_entry_changed (EggFileChooserEntry *self, - GtkEntry *entry) -{ - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - g_autoptr(GFile) file = NULL; - - g_assert (EGG_IS_FILE_CHOOSER_ENTRY (self)); - g_assert (GTK_IS_ENTRY (entry)); - - file = file_expand (gtk_entry_get_text (entry)); - g_set_object (&priv->file, file); -} - -static void -egg_file_chooser_entry_destroy (GtkWidget *widget) -{ - EggFileChooserEntry *self = (EggFileChooserEntry *)widget; - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - - if (priv->dialog != NULL) - gtk_widget_destroy (GTK_WIDGET (priv->dialog)); - - GTK_WIDGET_CLASS (egg_file_chooser_entry_parent_class)->destroy (widget); -} - -static void -egg_file_chooser_entry_finalize (GObject *object) -{ - EggFileChooserEntry *self = (EggFileChooserEntry *)object; - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - - g_clear_object (&priv->file); - g_clear_object (&priv->filter); - - G_OBJECT_CLASS (egg_file_chooser_entry_parent_class)->finalize (object); -} - -static void -egg_file_chooser_entry_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggFileChooserEntry *self = EGG_FILE_CHOOSER_ENTRY (object); - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - - switch (prop_id) - { - case PROP_ACTION: - g_value_set_enum (value, priv->action); - break; - - case PROP_LOCAL_ONLY: - g_value_set_boolean (value, priv->local_only); - break; - - case PROP_CREATE_FOLDERS: - g_value_set_boolean (value, priv->create_folders); - break; - - case PROP_DO_OVERWRITE_CONFIRMATION: - g_value_set_boolean (value, priv->do_overwrite_confirmation); - break; - - case PROP_SHOW_HIDDEN: - g_value_set_boolean (value, priv->show_hidden); - break; - - case PROP_FILTER: - g_value_set_object (value, priv->filter); - break; - - case PROP_FILE: - g_value_take_object (value, egg_file_chooser_entry_get_file (self)); - break; - - case PROP_MAX_WIDTH_CHARS: - g_value_set_int (value, gtk_entry_get_max_width_chars (priv->entry)); - break; - - case PROP_TITLE: - g_value_set_string (value, gtk_window_get_title (GTK_WINDOW (priv->dialog))); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_file_chooser_entry_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggFileChooserEntry *self = EGG_FILE_CHOOSER_ENTRY (object); - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - - switch (prop_id) - { - case PROP_ACTION: - priv->action = g_value_get_enum (value); - break; - - case PROP_LOCAL_ONLY: - priv->local_only = g_value_get_boolean (value); - break; - - case PROP_CREATE_FOLDERS: - priv->create_folders= g_value_get_boolean (value); - break; - - case PROP_DO_OVERWRITE_CONFIRMATION: - priv->do_overwrite_confirmation = g_value_get_boolean (value); - break; - - case PROP_SHOW_HIDDEN: - priv->show_hidden = g_value_get_boolean (value); - break; - - case PROP_FILTER: - g_clear_object (&priv->filter); - priv->filter = g_value_dup_object (value); - break; - - case PROP_FILE: - egg_file_chooser_entry_set_file (self, g_value_get_object (value)); - break; - - case PROP_MAX_WIDTH_CHARS: - gtk_entry_set_max_width_chars (priv->entry, g_value_get_int (value)); - break; - - case PROP_TITLE: - gtk_window_set_title (GTK_WINDOW (priv->dialog), g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } - - egg_file_chooser_entry_sync_to_dialog (self); -} - -static void -egg_file_chooser_entry_class_init (EggFileChooserEntryClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->finalize = egg_file_chooser_entry_finalize; - object_class->get_property = egg_file_chooser_entry_get_property; - object_class->set_property = egg_file_chooser_entry_set_property; - - widget_class->destroy = egg_file_chooser_entry_destroy; - - properties [PROP_ACTION] = - g_param_spec_enum ("action", - NULL, - NULL, - GTK_TYPE_FILE_CHOOSER_ACTION, - GTK_FILE_CHOOSER_ACTION_OPEN, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_CREATE_FOLDERS] = - g_param_spec_boolean ("create-folders", - NULL, - NULL, - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_DO_OVERWRITE_CONFIRMATION] = - g_param_spec_boolean ("do-overwrite-confirmation", - NULL, - NULL, - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_LOCAL_ONLY] = - g_param_spec_boolean ("local-only", - NULL, - NULL, - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_SHOW_HIDDEN] = - g_param_spec_boolean ("show-hidden", - NULL, - NULL, - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_FILTER] = - g_param_spec_object ("filter", - NULL, - NULL, - GTK_TYPE_FILE_FILTER, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_FILE] = - g_param_spec_object ("file", - NULL, - NULL, - G_TYPE_FILE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_MAX_WIDTH_CHARS] = - g_param_spec_int ("max-width-chars", - NULL, - NULL, - -1, - G_MAXINT, - -1, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_TITLE] = - g_param_spec_string ("title", - NULL, - NULL, - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); -} - -static void -egg_file_chooser_entry_init (EggFileChooserEntry *self) -{ - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - GtkWidget *hbox; - - hbox = g_object_new (GTK_TYPE_BOX, - "orientation", GTK_ORIENTATION_HORIZONTAL, - "visible", TRUE, - NULL); - gtk_style_context_add_class (gtk_widget_get_style_context (hbox), "linked"); - gtk_container_add (GTK_CONTAINER (self), hbox); - - priv->entry = g_object_new (GTK_TYPE_ENTRY, - "visible", TRUE, - NULL); - g_signal_connect (priv->entry, - "destroy", - G_CALLBACK (gtk_widget_destroyed), - &priv->entry); - g_signal_connect_object (priv->entry, - "changed", - G_CALLBACK (egg_file_chooser_entry_changed), - self, - G_CONNECT_SWAPPED); - gtk_container_add_with_properties (GTK_CONTAINER (hbox), GTK_WIDGET (priv->entry), - "expand", TRUE, - NULL); - - priv->button = g_object_new (GTK_TYPE_BUTTON, - "label", _("Browse…"), - "visible", TRUE, - NULL); - g_signal_connect_object (priv->button, - "clicked", - G_CALLBACK (egg_file_chooser_entry_button_clicked), - self, - G_CONNECT_SWAPPED); - g_signal_connect (priv->button, - "destroy", - G_CALLBACK (gtk_widget_destroyed), - &priv->button); - gtk_container_add (GTK_CONTAINER (hbox), GTK_WIDGET (priv->button)); - - priv->dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG, - "local-only", TRUE, - "modal", TRUE, - NULL); - g_signal_connect_object (priv->dialog, - "delete-event", - G_CALLBACK (egg_file_chooser_entry_dialog_delete_event), - self, - G_CONNECT_SWAPPED); - g_signal_connect_object (priv->dialog, - "response", - G_CALLBACK (egg_file_chooser_entry_dialog_response), - self, - G_CONNECT_SWAPPED); - g_signal_connect (priv->dialog, - "destroy", - G_CALLBACK (gtk_widget_destroyed), - &priv->dialog); - gtk_dialog_add_buttons (GTK_DIALOG (priv->dialog), - _("Cancel"), GTK_RESPONSE_CANCEL, - _("Open"), GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK); -} - -static gchar * -file_collapse (GFile *file) -{ - gchar *path = NULL; - - g_assert (!file || G_IS_FILE (file)); - - if (file == NULL) - return g_strdup (""); - - if (!g_file_is_native (file)) - return g_file_get_uri (file); - - path = g_file_get_path (file); - - if (path == NULL) - return g_strdup (""); - - if (!g_path_is_absolute (path)) - { - g_autofree gchar *freeme = path; - - path = g_build_filename (g_get_home_dir (), freeme, NULL); - } - - if (g_str_has_prefix (path, g_get_home_dir ())) - { - g_autofree gchar *freeme = path; - - path = g_build_filename ("~", - freeme + strlen (g_get_home_dir ()), - NULL); - } - - return path; -} - -/** - * egg_file_chooser_entry_get_file: - * - * Returns the currently selected file or %NULL if there is no selection. - * - * Returns: (nullable) (transfer full): A #GFile or %NULL. - */ -GFile * -egg_file_chooser_entry_get_file (EggFileChooserEntry *self) -{ - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_FILE_CHOOSER_ENTRY (self), NULL); - - return priv->file ? g_object_ref (priv->file) : NULL; -} - -void -egg_file_chooser_entry_set_file (EggFileChooserEntry *self, - GFile *file) -{ - EggFileChooserEntryPrivate *priv = egg_file_chooser_entry_get_instance_private (self); - g_autofree gchar *collapsed = NULL; - - g_return_if_fail (EGG_IS_FILE_CHOOSER_ENTRY (self)); - - if (priv->file == file || (priv->file && file && g_file_equal (priv->file, file))) - return; - - if (file != NULL) - g_object_ref (file); - - g_clear_object (&priv->file); - priv->file = file; - - collapsed = file_collapse (file); - gtk_entry_set_text (priv->entry, collapsed); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-file-chooser-entry.h gnome-usage-3.32.0/external/egg/egg-file-chooser-entry.h --- gnome-usage-3.30.0/external/egg/egg-file-chooser-entry.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-file-chooser-entry.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* egg-file-chooser-entry.h - * - * Copyright (C) 2016 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_FILE_CHOOSER_ENTRY_H -#define EGG_FILE_CHOOSER_ENTRY_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_FILE_CHOOSER_ENTRY (egg_file_chooser_entry_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggFileChooserEntry, egg_file_chooser_entry, EGG, FILE_CHOOSER_ENTRY, GtkBin) - -struct _EggFileChooserEntryClass -{ - GtkBinClass parent_class; - - gpointer _reserved1; - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - -GtkWidget *egg_file_chooser_entry_new (const gchar *title, - GtkFileChooserAction action); -GFile *egg_file_chooser_entry_get_file (EggFileChooserEntry *self); -void egg_file_chooser_entry_set_file (EggFileChooserEntry *self, - GFile *file); - -G_END_DECLS - -#endif /* EGG_FILE_CHOOSER_ENTRY_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-frame-source.c gnome-usage-3.32.0/external/egg/egg-frame-source.c --- gnome-usage-3.30.0/external/egg/egg-frame-source.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-frame-source.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -/* egg-frame-source.c - * - * Copyright (C) 2010-2016 Christian Hergert - * - * This file 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 file 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 General Public License along - * with this program. If not, see . - */ - -#include "egg-frame-source.h" - -typedef struct -{ - GSource parent; - guint fps; - guint frame_count; - gint64 start_time; -} EggFrameSource; - -static gboolean -egg_frame_source_prepare (GSource *source, - gint *timeout_) -{ - EggFrameSource *fsource = (EggFrameSource *)(gpointer)source; - gint64 current_time; - guint elapsed_time; - guint new_frame_num; - guint frame_time; - - current_time = g_source_get_time(source) / 1000; - elapsed_time = current_time - fsource->start_time; - new_frame_num = elapsed_time * fsource->fps / 1000; - - /* If time has gone backwards or the time since the last frame is - * greater than the two frames worth then reset the time and do a - * frame now */ - if (new_frame_num < fsource->frame_count || - new_frame_num - fsource->frame_count > 2) { - /* Get the frame time rounded up to the nearest ms */ - frame_time = (1000 + fsource->fps - 1) / fsource->fps; - - /* Reset the start time */ - fsource->start_time = current_time; - - /* Move the start time as if one whole frame has elapsed */ - fsource->start_time -= frame_time; - fsource->frame_count = 0; - *timeout_ = 0; - return TRUE; - } else if (new_frame_num > fsource->frame_count) { - *timeout_ = 0; - return TRUE; - } else { - *timeout_ = (fsource->frame_count + 1) * 1000 / fsource->fps - elapsed_time; - return FALSE; - } -} - -static gboolean -egg_frame_source_check (GSource *source) -{ - gint timeout_; - return egg_frame_source_prepare(source, &timeout_); -} - -static gboolean -egg_frame_source_dispatch (GSource *source, - GSourceFunc source_func, - gpointer user_data) -{ - EggFrameSource *fsource = (EggFrameSource *)(gpointer)source; - gboolean ret; - - if ((ret = source_func(user_data))) - fsource->frame_count++; - return ret; -} - -static GSourceFuncs source_funcs = { - egg_frame_source_prepare, - egg_frame_source_check, - egg_frame_source_dispatch, -}; - -/** - * egg_frame_source_add: - * @frames_per_sec: (in): Target frames per second. - * @callback: (in) (scope notified): A #GSourceFunc to execute. - * @user_data: (in): User data for @callback. - * - * Creates a new frame source that will execute when the timeout interval - * for the source has elapsed. The timing will try to synchronize based - * on the end time of the animation. - * - * Returns: A source id that can be removed with g_source_remove(). - */ -guint -egg_frame_source_add (guint frames_per_sec, - GSourceFunc callback, - gpointer user_data) -{ - EggFrameSource *fsource; - GSource *source; - guint ret; - - g_return_val_if_fail (frames_per_sec > 0, 0); - g_return_val_if_fail (frames_per_sec <= 120, 0); - - source = g_source_new(&source_funcs, sizeof(EggFrameSource)); - fsource = (EggFrameSource *)(gpointer)source; - fsource->fps = frames_per_sec; - fsource->frame_count = 0; - fsource->start_time = g_get_monotonic_time() / 1000; - g_source_set_callback(source, callback, user_data, NULL); - g_source_set_name(source, "EggFrameSource"); - - ret = g_source_attach(source, NULL); - g_source_unref(source); - - return ret; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-frame-source.h gnome-usage-3.32.0/external/egg/egg-frame-source.h --- gnome-usage-3.30.0/external/egg/egg-frame-source.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-frame-source.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* egg-frame-source.h - * - * Copyright (C) 2010-2016 Christian Hergert - * - * This file 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 file 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 General Public License along - * with this program. If not, see . - */ - -#ifndef EGG_FRAME_SOURCE_H -#define EGG_FRAME_SOURCE_H - -#include - -G_BEGIN_DECLS - -guint egg_frame_source_add (guint frames_per_sec, - GSourceFunc callback, - gpointer user_data); - -G_END_DECLS - -#endif /* EGG_FRAME_SOURCE_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg.gresource.xml gnome-usage-3.32.0/external/egg/egg.gresource.xml --- gnome-usage-3.30.0/external/egg/egg.gresource.xml 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg.gresource.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - - - - egg-empty-state.ui - egg-pill-box.ui - egg-simple-popover.ui - - diff -Nru gnome-usage-3.30.0/external/egg/egg-heap.c gnome-usage-3.32.0/external/egg/egg-heap.c --- gnome-usage-3.30.0/external/egg/egg-heap.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-heap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,384 +0,0 @@ -/* egg-heap.c - * - * Copyright (C) 2014 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-heap" - -#include - -#include "egg-heap.h" - -/** - * SECTION:egg-heap - * @title: Heaps - * @short_description: efficient priority queues using min/max heaps - * - * Heaps are similar to a partially sorted tree but implemented as an - * array. They allow for efficient O(1) lookup of the highest priority - * item as it will always be the first item of the array. - * - * To create a new heap use egg_heap_new(). - * - * To add items to the heap, use egg_heap_insert_val() or - * egg_heap_insert_vals() to insert in bulk. - * - * To access an item in the heap, use egg_heap_index(). - * - * To remove an arbitrary item from the heap, use egg_heap_extract_index(). - * - * To remove the highest priority item in the heap, use egg_heap_extract(). - * - * To free a heap, use egg_heap_unref(). - * - * Here is an example that stores integers in a #EggHeap: - * |[ - * static int - * cmpint (gconstpointer a, - * gconstpointer b) - * { - * return *(const gint *)a - *(const gint *)b; - * } - * - * int - * main (gint argc, - * gchar *argv[]) - * { - * EggHeap *heap; - * gint i; - * gint v; - * - * heap = egg_heap_new (sizeof (gint), cmpint); - * - * for (i = 0; i < 10000; i++) - * egg_heap_insert_val (heap, i); - * for (i = 0; i < 10000; i++) - * egg_heap_extract (heap, &v); - * - * egg_heap_unref (heap); - * } - * ]| - */ - -#define MIN_HEAP_SIZE 16 - -/* - * Based upon Mastering Algorithms in C by Kyle Loudon. - * Section 10 - Heaps and Priority Queues. - */ - -G_DEFINE_BOXED_TYPE (EggHeap, egg_heap, egg_heap_ref, egg_heap_unref) - -typedef struct _EggHeapReal EggHeapReal; - -struct _EggHeapReal -{ - gchar *data; - gsize len; - volatile gint ref_count; - guint element_size; - gsize allocated_len; - GCompareFunc compare; - gchar tmp[0]; -}; - -#define heap_parent(npos) (((npos)-1)/2) -#define heap_left(npos) (((npos)*2)+1) -#define heap_right(npos) (((npos)*2)+2) -#define heap_index(h,i) ((h)->data + (i * (h)->element_size)) -#define heap_compare(h,a,b) ((h)->compare(heap_index(h,a), heap_index(h,b))) -#define heap_swap(h,a,b) \ - G_STMT_START { \ - memcpy ((h)->tmp, heap_index (h, a), (h)->element_size); \ - memcpy (heap_index (h, a), heap_index (h, b), (h)->element_size); \ - memcpy (heap_index (h, b), (h)->tmp, (h)->element_size); \ - } G_STMT_END - -/** - * egg_heap_new: - * @element_size: the size of each element in the heap - * @compare_func: (scope async): a function to compare to elements - * - * Creates a new #EggHeap. A heap is a tree-like structure stored in - * an array that is not fully sorted, but head is guaranteed to be either - * the max, or min value based on @compare_func. This is also known as - * a priority queue. - * - * Returns: (transfer full): A newly allocated #EggHeap - */ -EggHeap * -egg_heap_new (guint element_size, - GCompareFunc compare_func) -{ - EggHeapReal *real; - - g_return_val_if_fail (element_size, NULL); - g_return_val_if_fail (compare_func, NULL); - - real = g_malloc_n (1, sizeof (EggHeapReal) + element_size); - real->data = NULL; - real->len = 0; - real->ref_count = 1; - real->element_size = element_size; - real->allocated_len = 0; - real->compare = compare_func; - - return (EggHeap *)real; -} - -/** - * egg_heap_ref: - * @heap: An #EggHeap - * - * Increments the reference count of @heap by one. - * - * Returns: (transfer full): @heap - */ -EggHeap * -egg_heap_ref (EggHeap *heap) -{ - EggHeapReal *real = (EggHeapReal *)heap; - - g_return_val_if_fail (heap, NULL); - g_return_val_if_fail (real->ref_count, NULL); - - g_atomic_int_inc (&real->ref_count); - - return heap; -} - -static void -egg_heap_real_free (EggHeapReal *real) -{ - g_assert (real); - g_assert_cmpint (real->ref_count, ==, 0); - - g_free (real->data); - g_free (real); -} - -/** - * egg_heap_unref: - * @heap: (transfer full): An #EggHeap - * - * Decrements the reference count of @heap by one, freeing the structure - * when the reference count reaches zero. - */ -void -egg_heap_unref (EggHeap *heap) -{ - EggHeapReal *real = (EggHeapReal *)heap; - - g_return_if_fail (heap); - g_return_if_fail (real->ref_count); - - if (g_atomic_int_dec_and_test (&real->ref_count)) - egg_heap_real_free (real); -} - -static void -egg_heap_real_grow (EggHeapReal *real) -{ - g_assert (real); - g_assert_cmpint (real->allocated_len, <, G_MAXSIZE / 2); - - real->allocated_len = MAX (MIN_HEAP_SIZE, (real->allocated_len * 2)); - real->data = g_realloc_n (real->data, - real->allocated_len, - real->element_size); -} - -static void -egg_heap_real_shrink (EggHeapReal *real) -{ - g_assert (real); - g_assert ((real->allocated_len / 2) >= real->len); - - real->allocated_len = MAX (MIN_HEAP_SIZE, real->allocated_len / 2); - real->data = g_realloc_n (real->data, - real->allocated_len, - real->element_size); -} - -static void -egg_heap_real_insert_val (EggHeapReal *real, - gconstpointer data) -{ - gint ipos; - gint ppos; - - g_assert (real); - g_assert (data); - - if (G_UNLIKELY (real->len == real->allocated_len)) - egg_heap_real_grow (real); - - memcpy (real->data + (real->element_size * real->len), - data, - real->element_size); - - ipos = real->len; - ppos = heap_parent (ipos); - - while ((ipos > 0) && (heap_compare (real, ppos, ipos) < 0)) - { - heap_swap (real, ppos, ipos); - ipos = ppos; - ppos = heap_parent (ipos); - } - - real->len++; -} - -void -egg_heap_insert_vals (EggHeap *heap, - gconstpointer data, - guint len) -{ - EggHeapReal *real = (EggHeapReal *)heap; - const gchar *ptr = data; - guint i; - - g_return_if_fail (heap); - g_return_if_fail (data); - g_return_if_fail (len); - - for (i = 0; i < len; i++, ptr += real->element_size) - egg_heap_real_insert_val (real, ptr); -} - -gboolean -egg_heap_extract (EggHeap *heap, - gpointer result) -{ - EggHeapReal *real = (EggHeapReal *)heap; - gint ipos; - gint lpos; - gint rpos; - gint mpos; - - g_return_val_if_fail (heap, FALSE); - - if (real->len == 0) - return FALSE; - - if (result) - memcpy (result, heap_index (real, 0), real->element_size); - - if (--real->len > 0) - { - memmove (real->data, - heap_index (real, real->len), - real->element_size); - - ipos = 0; - - while (TRUE) - { - lpos = heap_left (ipos); - rpos = heap_right (ipos); - - if ((lpos < real->len) && (heap_compare (real, lpos, ipos) > 0)) - mpos = lpos; - else - mpos = ipos; - - if ((rpos < real->len) && (heap_compare (real, rpos, mpos) > 0)) - mpos = rpos; - - if (mpos == ipos) - break; - - heap_swap (real, mpos, ipos); - - ipos = mpos; - } - } - - if ((real->len > MIN_HEAP_SIZE) && (real->allocated_len / 2) >= real->len) - egg_heap_real_shrink (real); - - return TRUE; -} - -gboolean -egg_heap_extract_index (EggHeap *heap, - guint index_, - gpointer result) -{ - EggHeapReal *real = (EggHeapReal *)heap; - gint ipos; - gint lpos; - gint mpos; - gint ppos; - gint rpos; - - g_return_val_if_fail (heap, FALSE); - - if (real->len == 0) - return FALSE; - - if (result) - memcpy (result, heap_index (real, index_), real->element_size); - - real->len--; - - if (real->len && index_ != real->len) - { - memcpy (heap_index (real, index_), - heap_index (real, real->len), - real->element_size); - - ipos = index_; - ppos = heap_parent (ipos); - - while (heap_compare (real, ipos, ppos) > 0) - { - heap_swap (real, ipos, ppos); - ipos = ppos; - ppos = heap_parent (ppos); - } - - if (ipos == index_) - { - while (TRUE) - { - lpos = heap_left (ipos); - rpos = heap_right (ipos); - - if ((lpos < real->len) && (heap_compare (real, lpos, ipos) > 0)) - mpos = lpos; - else - mpos = ipos; - - if ((rpos < real->len) && (heap_compare (real, rpos, mpos) > 0)) - mpos = rpos; - - if (mpos == ipos) - break; - - heap_swap (real, mpos, ipos); - - ipos = mpos; - } - } - } - - if ((real->len > MIN_HEAP_SIZE) && (real->allocated_len / 2) >= real->len) - egg_heap_real_shrink (real); - - return TRUE; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-heap.h gnome-usage-3.32.0/external/egg/egg-heap.h --- gnome-usage-3.30.0/external/egg/egg-heap.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-heap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* egg-heap.h - * - * Copyright (C) 2014-2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_HEAP_H -#define EGG_HEAP_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_HEAP (egg_heap_get_type()) -#define egg_heap_insert_val(h,v) egg_heap_insert_vals(h,&(v),1) -#define egg_heap_index(h,t,i) (((t*)(void*)(h)->data)[i]) -#define egg_heap_peek(h,t) egg_heap_index(h,t,0) - -typedef struct _EggHeap EggHeap; - -struct _EggHeap -{ - gchar *data; - guint len; -}; - -GType egg_heap_get_type (void); -EggHeap *egg_heap_new (guint element_size, - GCompareFunc compare_func); -EggHeap *egg_heap_ref (EggHeap *heap); -void egg_heap_unref (EggHeap *heap); -void egg_heap_insert_vals (EggHeap *heap, - gconstpointer data, - guint len); -gboolean egg_heap_extract (EggHeap *heap, - gpointer result); -gboolean egg_heap_extract_index (EggHeap *heap, - guint index_, - gpointer result); - -G_END_DECLS - -#endif /* EGG_HEAP_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-list-box.c gnome-usage-3.32.0/external/egg/egg-list-box.c --- gnome-usage-3.30.0/external/egg/egg-list-box.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-list-box.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,342 +0,0 @@ -/* egg-list-box.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-list-box" - -/* - * This widget is just like GtkListBox, except that it allows you to - * very simply re-use existing widgets instead of creating new widgets - * all the time. - * - * It does not, however, try to keep the number of inflated widgets - * low (that would require more work in GtkListBox directly). - * - * This mostly just avoids the overhead of reparsing the template XML - * on every widget (re)creation. - */ - -#include "egg-list-box.h" - -typedef struct -{ - GListModel *model; - gchar *property_name; - GType row_type; - guint recycle_max; - GQueue trashed_rows; -} EggListBoxPrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (EggListBox, egg_list_box, GTK_TYPE_LIST_BOX) - -enum { - PROP_0, - PROP_PROPERTY_NAME, - PROP_ROW_TYPE, - PROP_ROW_TYPE_NAME, - N_PROPS -}; - -static GParamSpec *properties [N_PROPS]; - -static GtkWidget * -egg_list_box_create_row (gpointer item, - gpointer user_data) -{ - EggListBox *self = user_data; - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_assert (G_IS_OBJECT (item)); - g_assert (EGG_IS_LIST_BOX (self)); - - if (priv->trashed_rows.length > 0) - { - GtkListBoxRow *row = g_queue_pop_tail (&priv->trashed_rows); - - g_object_set (row, priv->property_name, item, NULL); - g_object_force_floating (G_OBJECT (row)); - g_object_unref (row); - - return GTK_WIDGET (row); - } - - return g_object_new (priv->row_type, - "visible", TRUE, - priv->property_name, item, - NULL); -} - -static void -egg_list_box_remove (GtkContainer *container, - GtkWidget *widget) -{ - EggListBox *self = (EggListBox *)container; - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_assert (EGG_IS_LIST_BOX (self)); - g_assert (GTK_IS_LIST_BOX_ROW (widget)); - - g_object_ref (widget); - - GTK_CONTAINER_CLASS (egg_list_box_parent_class)->remove (container, widget); - - if (priv->trashed_rows.length < priv->recycle_max) - { - g_object_set (widget, priv->property_name, NULL, NULL); - g_queue_push_head (&priv->trashed_rows, g_steal_pointer (&widget)); - } - - g_clear_object (&widget); -} - -static void -egg_list_box_constructed (GObject *object) -{ - EggListBox *self = (EggListBox *)object; - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - GObjectClass *row_class; - GParamSpec *pspec; - gboolean valid; - - G_OBJECT_CLASS (egg_list_box_parent_class)->constructed (object); - - if (!g_type_is_a (priv->row_type, GTK_TYPE_LIST_BOX_ROW) || !priv->property_name) - goto failure; - - row_class = g_type_class_ref (priv->row_type); - pspec = g_object_class_find_property (row_class, priv->property_name); - valid = (pspec != NULL) && g_type_is_a (pspec->value_type, G_TYPE_OBJECT); - g_type_class_unref (row_class); - - if (valid) - return; - -failure: - g_warning ("Invalid EggListBox instantiated, will not work as expected"); - priv->row_type = G_TYPE_INVALID; - g_clear_pointer (&priv->property_name, g_free); -} - -static void -egg_list_box_destroy (GtkWidget *widget) -{ - EggListBox *self = (EggListBox *)widget; - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_assert (EGG_IS_LIST_BOX (self)); - - g_queue_foreach (&priv->trashed_rows, (GFunc)g_object_unref, NULL); - g_queue_clear (&priv->trashed_rows); - - GTK_WIDGET_CLASS (egg_list_box_parent_class)->destroy (widget); -} - -static void -egg_list_box_finalize (GObject *object) -{ - EggListBox *self = (EggListBox *)object; - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_clear_pointer (&priv->property_name, g_free); - priv->row_type = G_TYPE_INVALID; - - G_OBJECT_CLASS (egg_list_box_parent_class)->finalize (object); -} - -static void -egg_list_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggListBox *self = EGG_LIST_BOX (object); - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - switch (prop_id) - { - case PROP_ROW_TYPE: - g_value_set_gtype (value, priv->row_type); - break; - - case PROP_PROPERTY_NAME: - g_value_set_string (value, priv->property_name); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_list_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggListBox *self = EGG_LIST_BOX (object); - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - switch (prop_id) - { - case PROP_ROW_TYPE: - { - GType gtype = g_value_get_gtype (value); - - if (gtype != G_TYPE_INVALID) - priv->row_type = gtype; - } - break; - - case PROP_ROW_TYPE_NAME: - { - const gchar *name = g_value_get_string (value); - - if (name != NULL) - priv->row_type = g_type_from_name (name); - } - break; - - case PROP_PROPERTY_NAME: - priv->property_name = g_value_dup_string (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_list_box_class_init (EggListBoxClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->constructed = egg_list_box_constructed; - object_class->finalize = egg_list_box_finalize; - object_class->get_property = egg_list_box_get_property; - object_class->set_property = egg_list_box_set_property; - - widget_class->destroy = egg_list_box_destroy; - - container_class->remove = egg_list_box_remove; - - properties [PROP_ROW_TYPE] = - g_param_spec_gtype ("row-type", - "Row Type", - "The GtkListBoxRow or subclass type to instantiate", - GTK_TYPE_LIST_BOX_ROW, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_ROW_TYPE_NAME] = - g_param_spec_string ("row-type-name", - "Row Type Name", - "The name of the GType as a string", - NULL, - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_PROPERTY_NAME] = - g_param_spec_string ("property-name", - "Property Name", - "The property in which to assign the model item", - NULL, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); -} - -static void -egg_list_box_init (EggListBox *self) -{ - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - priv->row_type = G_TYPE_INVALID; - priv->recycle_max = 25; - - g_queue_init (&priv->trashed_rows); -} - -EggListBox * -egg_list_box_new (GType row_type, - const gchar *property_name) -{ - g_return_val_if_fail (g_type_is_a (row_type, GTK_TYPE_LIST_BOX_ROW), NULL); - g_return_val_if_fail (property_name != NULL, NULL); - - return g_object_new (EGG_TYPE_LIST_BOX, - "property-name", property_name, - "row-type", row_type, - NULL); -} - -/** - * egg_list_box_get_model: - * - * Returns: (nullable) (transfer none): A #GListModel or %NULL. - */ -GListModel * -egg_list_box_get_model (EggListBox *self) -{ - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_LIST_BOX (self), NULL); - - return priv->model; -} - -GType -egg_list_box_get_row_type (EggListBox *self) -{ - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_LIST_BOX (self), G_TYPE_INVALID); - - return priv->row_type; -} - -const gchar * -egg_list_box_get_property_name (EggListBox *self) -{ - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_LIST_BOX (self), NULL); - - return priv->property_name; -} - -void -egg_list_box_set_model (EggListBox *self, - GListModel *model) -{ - EggListBoxPrivate *priv = egg_list_box_get_instance_private (self); - - g_return_if_fail (EGG_IS_LIST_BOX (self)); - g_return_if_fail (priv->property_name != NULL); - g_return_if_fail (priv->row_type != G_TYPE_INVALID); - - if (model == NULL) - { - gtk_list_box_bind_model (GTK_LIST_BOX (self), NULL, NULL, NULL, NULL); - return; - } - - gtk_list_box_bind_model (GTK_LIST_BOX (self), - model, - egg_list_box_create_row, - self, - NULL); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-list-box.h gnome-usage-3.32.0/external/egg/egg-list-box.h --- gnome-usage-3.30.0/external/egg/egg-list-box.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-list-box.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* egg-list-box.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_LIST_BOX_H -#define EGG_LIST_BOX_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_LIST_BOX (egg_list_box_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggListBox, egg_list_box, EGG, LIST_BOX, GtkListBox) - -struct _EggListBoxClass -{ - GtkListBoxClass parent_class; - - gpointer _reserved1; - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - -EggListBox *egg_list_box_new (GType row_type, - const gchar *property_name); -GType egg_list_box_get_row_type (EggListBox *self); -const gchar *egg_list_box_get_property_name (EggListBox *self); -GListModel *egg_list_box_get_model (EggListBox *self); -void egg_list_box_set_model (EggListBox *self, - GListModel *model); - -G_END_DECLS - -#endif /* EGG_LIST_BOX_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-menu-manager.c gnome-usage-3.32.0/external/egg/egg-menu-manager.c --- gnome-usage-3.30.0/external/egg/egg-menu-manager.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-menu-manager.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,524 +0,0 @@ -/* egg-menu-manager.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 of the License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include "egg-menu-manager.h" - -struct _EggMenuManager -{ - GObject parent_instance; - - guint last_merge_id; - GHashTable *models; -}; - -G_DEFINE_TYPE (EggMenuManager, egg_menu_manager, G_TYPE_OBJECT) - -#define EGG_MENU_ATTRIBUTE_BEFORE "before" -#define EGG_MENU_ATTRIBUTE_AFTER "after" -#define EGG_MENU_ATTRIBUTE_MERGE_ID "egg-merge-id" - -/** - * SECTION:egg-menu-manager - * @short_description: UI merging for menus - * - * The goal of #EggMenuManager is to simplify the process of merging multiple - * GtkBuilder .ui files containing menus into a single representation of the - * application menus. Additionally, it provides the ability to "unmerge" - * previously merged menus. - * - * This allows for an application to have plugins which seemlessly extends - * the core application menus. - * - * Implementation notes: - * - * To make this work, we don't use the GMenu instances created by a GtkBuilder - * instance. Instead, we create the menus ourself and recreate section and - * submenu links. This allows the #EggMenuManager to be in full control of - * the generated menus. - * - * egg_menu_manager_get_menu_by_id() will always return a #GMenu, however - * that menu may contain no children until something has extended it later - * on during the application process. - */ - -static const gchar * -get_object_id (GObject *object) -{ - g_assert (G_IS_OBJECT (object)); - - if (GTK_IS_BUILDABLE (object)) - return gtk_buildable_get_name (GTK_BUILDABLE (object)); - else - return g_object_get_data (object, "gtk-builder-name"); -} - -static void -egg_menu_manager_finalize (GObject *object) -{ - EggMenuManager *self = (EggMenuManager *)object; - - g_clear_pointer (&self->models, g_hash_table_unref); - - G_OBJECT_CLASS (egg_menu_manager_parent_class)->finalize (object); -} - -static void -egg_menu_manager_class_init (EggMenuManagerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = egg_menu_manager_finalize; -} - -static void -egg_menu_manager_init (EggMenuManager *self) -{ - self->models = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); -} - -static gint -find_with_attribute_string (GMenuModel *model, - const gchar *attribute, - const gchar *value) -{ - guint n_items; - gint i; - - g_assert (G_IS_MENU_MODEL (model)); - g_assert (attribute != NULL); - g_assert (value != NULL); - - n_items = g_menu_model_get_n_items (model); - - for (i = 0; i < n_items; i++) - { - g_autofree gchar *item_value = NULL; - - if (g_menu_model_get_item_attribute (model, i, attribute, "s", &item_value) && - (g_strcmp0 (value, item_value) == 0)) - return i; - } - - return -1; -} - -static gboolean -egg_menu_manager_menu_contains (EggMenuManager *self, - GMenu *menu, - GMenuItem *item) -{ - const gchar *link_id; - const gchar *label; - - g_assert (EGG_IS_MENU_MANAGER (self)); - g_assert (G_IS_MENU (menu)); - g_assert (G_IS_MENU_ITEM (item)); - - /* try to find match by item label */ - if (g_menu_item_get_attribute (item, G_MENU_ATTRIBUTE_LABEL, "&s", &label) && - (find_with_attribute_string (G_MENU_MODEL (menu), G_MENU_ATTRIBUTE_LABEL, label) >= 0)) - return TRUE; - - /* try to find match by item link */ - if (g_menu_item_get_attribute (item, "egg-link-id", "&s", &link_id) && - (find_with_attribute_string (G_MENU_MODEL (menu), "egg-link-id", link_id) >= 0)) - return TRUE; - - return FALSE; -} - -static void -model_copy_attributes_to_item (GMenuModel *model, - gint item_index, - GMenuItem *item) -{ - GMenuAttributeIter *iter; - const gchar *attr_name; - GVariant *attr_value; - - g_assert (G_IS_MENU_MODEL (model)); - g_assert (item_index >= 0); - g_assert (G_IS_MENU_ITEM (item)); - - iter = g_menu_model_iterate_item_attributes (model, item_index); - while (g_menu_attribute_iter_get_next (iter, &attr_name, &attr_value)) - g_menu_item_set_attribute_value (item, attr_name, attr_value); - g_object_unref (iter); -} - -static gint -find_position_for_item (GMenuModel *model, - GMenuItem *item) -{ - const gchar *after; - const gchar *before; - gint before_pos = -1; - gint after_pos = -1; - - g_assert (G_IS_MENU_MODEL (model)); - g_assert (G_IS_MENU_ITEM (item)); - - if (!g_menu_item_get_attribute (item, EGG_MENU_ATTRIBUTE_AFTER, "&s", &after)) - after = NULL; - - if (!g_menu_item_get_attribute (item, EGG_MENU_ATTRIBUTE_BEFORE, "&s", &before)) - before = NULL; - - if (after != NULL) - after_pos = find_with_attribute_string (model, G_MENU_ATTRIBUTE_LABEL, after); - - if (before != NULL) - before_pos = find_with_attribute_string (model, G_MENU_ATTRIBUTE_LABEL, before); - - /* - * TODO: Perform resort after all items have been inserted. - * - * We cannot resolve all positions incrementally as we add them since - * plugin ordering cannot be guaranteed (and some relative positions - * may not yet be available). If relations were symmetrical, that - * wouldn't be a problem. - */ - - if (before_pos >= 0) - return MAX (0, before_pos - 1); - - if (after_pos >= 0) - return after_pos + 1; - - return -1; -} - -static void -egg_menu_manager_add_to_menu (EggMenuManager *self, - GMenu *menu, - GMenuItem *item) -{ - gint position; - - g_assert (EGG_IS_MENU_MANAGER (self)); - g_assert (G_IS_MENU (menu)); - g_assert (G_IS_MENU_ITEM (item)); - - position = find_position_for_item (G_MENU_MODEL (menu), item); - g_menu_insert_item (menu, position, item); -} - -static void -egg_menu_manager_merge_model (EggMenuManager *self, - GMenu *menu, - GMenuModel *model, - guint merge_id) -{ - guint n_items; - gint i; - - g_assert (EGG_IS_MENU_MANAGER (self)); - g_assert (G_IS_MENU (menu)); - g_assert (G_IS_MENU_MODEL (model)); - g_assert (merge_id > 0); - - /* - * NOTES: - * - * Instead of using g_menu_item_new_from_model(), we create our own item - * and resolve section/submenu links. This allows us to be in full control - * of all of the menu items created. - * - * We move through each item in @model. If that item does not exist within - * @menu, we add it taking into account %EGG_MENU_ATTRIBUTE_BEFORE and - * %EGG_MENU_ATTRIBUTE_AFTER. - */ - - n_items = g_menu_model_get_n_items (model); - - for (i = 0; i < n_items; i++) - { - g_autoptr(GMenuItem) item = NULL; - g_autoptr(GMenuLinkIter) link_iter = NULL; - - item = g_menu_item_new (NULL, NULL); - - /* - * Copy attributes from the model. This includes, label, action, - * target, before, after, etc. Also set our merge-id so that we - * can remove the item when we are unmerged. - */ - model_copy_attributes_to_item (model, i, item); - g_menu_item_set_attribute (item, EGG_MENU_ATTRIBUTE_MERGE_ID, "u", merge_id); - - /* - * If this is a link, resolve it from our already created GMenu. - * The menu might be empty now, but it will get filled in on a - * followup pass for that model. - */ - link_iter = g_menu_model_iterate_item_links (model, i); - while (g_menu_link_iter_next (link_iter)) - { - g_autoptr(GMenuModel) link_model = NULL; - const gchar *link_name; - const gchar *link_id; - GMenuModel *internal_menu; - - link_name = g_menu_link_iter_get_name (link_iter); - link_model = g_menu_link_iter_get_value (link_iter); - - g_assert (link_name != NULL); - g_assert (G_IS_MENU_MODEL (link_model)); - - link_id = get_object_id (G_OBJECT (link_model)); - - if (link_id == NULL) - { - g_warning ("Link of type \"%s\" missing \"id=\". " - "Merging will not be possible.", - link_name); - continue; - } - - internal_menu = g_hash_table_lookup (self->models, link_id); - - if (internal_menu == NULL) - { - g_warning ("linked menu %s has not been created", link_id); - continue; - } - - /* - * Save the internal link reference-id to do merging of items - * later on. We need to know if an item matches when we might - * not have a "label" to work from. - */ - g_menu_item_set_attribute (item, "egg-link-id", "s", link_id); - - g_menu_item_set_link (item, link_name, internal_menu); - } - - /* - * If the menu already has this item, that's fine. We will populate - * the submenu/section links in followup merges of their GMenuModel. - */ - if (egg_menu_manager_menu_contains (self, menu, item)) - continue; - - egg_menu_manager_add_to_menu (self, menu, item); - } -} - -static void -egg_menu_manager_merge (EggMenuManager *self, - GtkBuilder *builder, - guint merge_id) -{ - const GSList *iter; - GSList *list; - - g_assert (EGG_IS_MENU_MANAGER (self)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (merge_id > 0); - - /* - * NOTES: - * - * We cannot re-use any of the created GMenu from the builder as we need - * control over all the created GMenu. Primarily because manipulating - * existing GMenu is such a PITA. So instead, we create our own GMenu and - * resolve links manually. - * - * Since GtkBuilder requires that all menus have an "id" element, we can - * resolve the menu->id fairly easily. First we create our own GMenu - * instances so that we can always resolve them during the creation process. - * Then we can go through and manually resolve links as we create items. - * - * We don't need to recursively create the menus since we will come across - * additional GMenu instances while iterating the available objects from the - * GtkBuilder. This does require 2 iterations of the objects, but that is - * not an issue. - */ - - list = gtk_builder_get_objects (builder); - - /* - * For every menu with an id, check to see if we already created our - * instance of that menu. If not, create it now so we can resolve them - * while building the menu links. - */ - for (iter = list; iter != NULL; iter = iter->next) - { - GObject *object = iter->data; - const gchar *id; - GMenu *menu; - - if (!G_IS_MENU (object)) - continue; - - if (!(id = get_object_id (object))) - { - g_warning ("menu without identifier, implausible"); - continue; - } - - if (!(menu = g_hash_table_lookup (self->models, id))) - g_hash_table_insert (self->models, g_strdup (id), g_menu_new ()); - } - - /* - * Now build each menu we discovered in the GtkBuilder. We do not need to - * build them recursively since we will pass the linked menus as we make - * forward progress on the GtkBuilder created objects. - */ - - for (iter = list; iter != NULL; iter = iter->next) - { - GObject *object = iter->data; - const gchar *id; - GMenu *menu; - - if (!G_IS_MENU_MODEL (object)) - continue; - - if (!(id = get_object_id (object))) - continue; - - menu = g_hash_table_lookup (self->models, id); - - g_assert (G_IS_MENU (menu)); - - egg_menu_manager_merge_model (self, menu, G_MENU_MODEL (object), merge_id); - } - - g_slist_free (list); -} - -EggMenuManager * -egg_menu_manager_new (void) -{ - return g_object_new (EGG_TYPE_MENU_MANAGER, NULL); -} - -guint -egg_menu_manager_add_filename (EggMenuManager *self, - const gchar *filename, - GError **error) -{ - GtkBuilder *builder; - guint merge_id; - - g_return_val_if_fail (EGG_IS_MENU_MANAGER (self), 0); - g_return_val_if_fail (filename != NULL, 0); - - builder = gtk_builder_new (); - - if (!gtk_builder_add_from_file (builder, filename, error)) - { - g_object_unref (builder); - return 0; - } - - merge_id = ++self->last_merge_id; - egg_menu_manager_merge (self, builder, merge_id); - g_object_unref (builder); - - return merge_id; -} - -void -egg_menu_manager_remove (EggMenuManager *self, - guint merge_id) -{ - GHashTableIter iter; - GMenu *menu; - - g_return_if_fail (EGG_IS_MENU_MANAGER (self)); - g_return_if_fail (merge_id != 0); - - g_hash_table_iter_init (&iter, self->models); - - while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&menu)) - { - gint n_items; - gint i; - - g_assert (G_IS_MENU (menu)); - - n_items = g_menu_model_get_n_items (G_MENU_MODEL (menu)); - - /* Iterate backward so we have a stable loop variable. */ - for (i = n_items - 1; i >= 0; i--) - { - guint item_merge_id; - - if (g_menu_model_get_item_attribute (G_MENU_MODEL (menu), - i, - EGG_MENU_ATTRIBUTE_MERGE_ID, - "u", &item_merge_id)) - if (item_merge_id == merge_id) - g_menu_remove (menu, i); - } - } -} - -/** - * egg_menu_manager_get_menu_by_id: - * - * Returns: (transfer none): A #GMenu. - */ -GMenu * -egg_menu_manager_get_menu_by_id (EggMenuManager *self, - const gchar *menu_id) -{ - GMenu *menu; - - g_return_val_if_fail (EGG_IS_MENU_MANAGER (self), NULL); - g_return_val_if_fail (menu_id != NULL, NULL); - - menu = g_hash_table_lookup (self->models, menu_id); - - if (menu == NULL) - { - menu = g_menu_new (); - g_hash_table_insert (self->models, g_strdup (menu_id), menu); - } - - return menu; -} - -guint -egg_menu_manager_add_resource (EggMenuManager *self, - const gchar *resource, - GError **error) -{ - GtkBuilder *builder; - guint merge_id; - - g_return_val_if_fail (EGG_IS_MENU_MANAGER (self), 0); - g_return_val_if_fail (resource != NULL, 0); - - builder = gtk_builder_new (); - - if (!gtk_builder_add_from_resource (builder, resource, error)) - { - g_object_unref (builder); - return 0; - } - - merge_id = ++self->last_merge_id; - egg_menu_manager_merge (self, builder, merge_id); - g_object_unref (builder); - - return merge_id; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-menu-manager.h gnome-usage-3.32.0/external/egg/egg-menu-manager.h --- gnome-usage-3.30.0/external/egg/egg-menu-manager.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-menu-manager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* egg-menu-manager.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 of the License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_MENU_MANAGER_H -#define EGG_MENU_MANAGER_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_MENU_MANAGER (egg_menu_manager_get_type()) - -G_DECLARE_FINAL_TYPE (EggMenuManager, egg_menu_manager, EGG, MENU_MANAGER, GObject) - -EggMenuManager *egg_menu_manager_new (void); -guint egg_menu_manager_add_filename (EggMenuManager *self, - const gchar *filename, - GError **error); -guint egg_menu_manager_add_resource (EggMenuManager *self, - const gchar *resource, - GError **error); -void egg_menu_manager_remove (EggMenuManager *self, - guint merge_id); -GMenu *egg_menu_manager_get_menu_by_id (EggMenuManager *self, - const gchar *menu_id); - -G_END_DECLS - -#endif /* EGG_MENU_MANAGER_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-pill-box.c gnome-usage-3.32.0/external/egg/egg-pill-box.c --- gnome-usage-3.30.0/external/egg/egg-pill-box.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-pill-box.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/* egg-pill-box.c - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-pill-box" - -#include - -#include "egg-pill-box.h" - -struct _EggPillBox -{ - GtkEventBox parent_instance; - - GtkLabel *label; -}; - -G_DEFINE_TYPE (EggPillBox, egg_pill_box, GTK_TYPE_EVENT_BOX) - -enum { - PROP_0, - PROP_LABEL, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -const gchar * -egg_pill_box_get_label (EggPillBox *self) -{ - g_return_val_if_fail (EGG_IS_PILL_BOX (self), NULL); - - return gtk_label_get_label (self->label); -} - -void -egg_pill_box_set_label (EggPillBox *self, - const gchar *label) -{ - g_return_if_fail (EGG_IS_PILL_BOX (self)); - - gtk_label_set_label (self->label, label); -} - -GtkWidget * -egg_pill_box_new (const gchar *label) -{ - return g_object_new (EGG_TYPE_PILL_BOX, - "label", label, - NULL); -} - -static void -egg_pill_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggPillBox *self = EGG_PILL_BOX (object); - - switch (prop_id) - { - case PROP_LABEL: - g_value_set_string (value, egg_pill_box_get_label (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_pill_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggPillBox *self = EGG_PILL_BOX (object); - - switch (prop_id) - { - case PROP_LABEL: - egg_pill_box_set_label (self, g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_pill_box_class_init (EggPillBoxClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->get_property = egg_pill_box_get_property; - object_class->set_property = egg_pill_box_set_property; - - properties [PROP_LABEL] = - g_param_spec_string ("label", - "Label", - "The label for the pill box.", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_LABEL, properties [PROP_LABEL]); - - gtk_widget_class_set_css_name (widget_class, "pillbox"); - gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/libegg-private/egg-pill-box.ui"); - gtk_widget_class_bind_template_child (widget_class, EggPillBox, label); -} - -static void -egg_pill_box_init (EggPillBox *self) -{ - gtk_widget_init_template (GTK_WIDGET (self)); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-pill-box.h gnome-usage-3.32.0/external/egg/egg-pill-box.h --- gnome-usage-3.30.0/external/egg/egg-pill-box.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-pill-box.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* egg-pill-box.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_PILL_BOX_H -#define EGG_PILL_BOX_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_PILL_BOX (egg_pill_box_get_type()) - -G_DECLARE_FINAL_TYPE (EggPillBox, egg_pill_box, EGG, PILL_BOX, GtkEventBox) - -GtkWidget *egg_pill_box_new (const gchar *label); -const gchar *egg_pill_box_get_label (EggPillBox *self); -void egg_pill_box_set_label (EggPillBox *self, - const gchar *label); - -G_END_DECLS - -#endif /* EGG_PILL_BOX_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-pill-box.ui gnome-usage-3.32.0/external/egg/egg-pill-box.ui --- gnome-usage-3.30.0/external/egg/egg-pill-box.ui 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-pill-box.ui 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ - - - - - diff -Nru gnome-usage-3.30.0/external/egg/egg-priority-box.c gnome-usage-3.32.0/external/egg/egg-priority-box.c --- gnome-usage-3.30.0/external/egg/egg-priority-box.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-priority-box.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/* egg-priority-box.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * SECTION:egg-priority-box: - * @title: EggPriorityBox - * - * This is like a #GtkBox but uses stable priorities to sort. - */ - -#define G_LOG_DOMAIN "egg-priority-box" - -#include "egg-priority-box.h" - -typedef struct -{ - GtkWidget *widget; - gint priority; -} EggPriorityBoxChild; - -typedef struct -{ - GArray *children; -} EggPriorityBoxPrivate; - -enum { - CHILD_PROP_0, - CHILD_PROP_PRIORITY, - N_CHILD_PROPS -}; - -G_DEFINE_TYPE_WITH_PRIVATE (EggPriorityBox, egg_priority_box, GTK_TYPE_BOX) - -static GParamSpec *child_properties [N_CHILD_PROPS]; - -static gint -sort_by_priority (gconstpointer a, - gconstpointer b) -{ - const EggPriorityBoxChild *child_a = a; - const EggPriorityBoxChild *child_b = b; - - return child_a->priority - child_b->priority; -} - -static void -egg_priority_box_resort (EggPriorityBox *self) -{ - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - guint i; - - g_assert (EGG_IS_PRIORITY_BOX (self)); - - g_array_sort (priv->children, sort_by_priority); - - for (i = 0; i < priv->children->len; i++) - { - EggPriorityBoxChild *child = &g_array_index (priv->children, EggPriorityBoxChild, i); - - gtk_container_child_set (GTK_CONTAINER (self), child->widget, - "position", i, - NULL); - } -} - -static gint -egg_priority_box_get_child_priority (EggPriorityBox *self, - GtkWidget *widget) -{ - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - guint i; - - g_assert (EGG_IS_PRIORITY_BOX (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (i = 0; i < priv->children->len; i++) - { - EggPriorityBoxChild *child = &g_array_index (priv->children, EggPriorityBoxChild, i); - - if (child->widget == widget) - return child->priority; - } - - g_warning ("No such child \"%s\" of \"%s\"", - G_OBJECT_TYPE_NAME (widget), - G_OBJECT_TYPE_NAME (self)); - - return 0; -} - -static void -egg_priority_box_set_child_priority (EggPriorityBox *self, - GtkWidget *widget, - gint priority) -{ - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - guint i; - - g_assert (EGG_IS_PRIORITY_BOX (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (i = 0; i < priv->children->len; i++) - { - EggPriorityBoxChild *child = &g_array_index (priv->children, EggPriorityBoxChild, i); - - if (child->widget == widget) - { - child->priority = priority; - egg_priority_box_resort (self); - return; - } - } - - g_warning ("No such child \"%s\" of \"%s\"", - G_OBJECT_TYPE_NAME (widget), - G_OBJECT_TYPE_NAME (self)); -} - -static void -egg_priority_box_add (GtkContainer *container, - GtkWidget *widget) -{ - EggPriorityBox *self = (EggPriorityBox *)container; - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - EggPriorityBoxChild child; - - g_assert (EGG_IS_PRIORITY_BOX (self)); - g_assert (GTK_IS_WIDGET (widget)); - - child.widget = widget; - child.priority = 0; - - g_array_append_val (priv->children, child); - - GTK_CONTAINER_CLASS (egg_priority_box_parent_class)->add (container, widget); - - egg_priority_box_resort (self); -} - -static void -egg_priority_box_remove (GtkContainer *container, - GtkWidget *widget) -{ - EggPriorityBox *self = (EggPriorityBox *)container; - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - guint i; - - g_assert (EGG_IS_PRIORITY_BOX (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (i = 0; i < priv->children->len; i++) - { - EggPriorityBoxChild *child; - - child = &g_array_index (priv->children, EggPriorityBoxChild, i); - - if (child->widget == widget) - { - g_array_remove_index_fast (priv->children, i); - break; - } - } - - GTK_CONTAINER_CLASS (egg_priority_box_parent_class)->remove (container, widget); - - egg_priority_box_resort (self); -} - -static void -egg_priority_box_finalize (GObject *object) -{ - EggPriorityBox *self = (EggPriorityBox *)object; - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - - g_clear_pointer (&priv->children, g_array_unref); - - G_OBJECT_CLASS (egg_priority_box_parent_class)->finalize (object); -} - -static void -egg_priority_box_get_child_property (GtkContainer *container, - GtkWidget *child, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggPriorityBox *self = EGG_PRIORITY_BOX (container); - - switch (prop_id) - { - case CHILD_PROP_PRIORITY: - g_value_set_int (value, egg_priority_box_get_child_priority (self, child)); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_priority_box_set_child_property (GtkContainer *container, - GtkWidget *child, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggPriorityBox *self = EGG_PRIORITY_BOX (container); - - switch (prop_id) - { - case CHILD_PROP_PRIORITY: - egg_priority_box_set_child_priority (self, child, g_value_get_int (value)); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_priority_box_class_init (EggPriorityBoxClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->finalize = egg_priority_box_finalize; - - container_class->add = egg_priority_box_add; - container_class->remove = egg_priority_box_remove; - container_class->get_child_property = egg_priority_box_get_child_property; - container_class->set_child_property = egg_priority_box_set_child_property; - - child_properties [CHILD_PROP_PRIORITY] = - g_param_spec_int ("priority", - "Priority", - "Priority", - G_MININT, - G_MAXINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - gtk_container_class_install_child_properties (container_class, N_CHILD_PROPS, child_properties); -} - -static void -egg_priority_box_init (EggPriorityBox *self) -{ - EggPriorityBoxPrivate *priv = egg_priority_box_get_instance_private (self); - - priv->children = g_array_new (FALSE, FALSE, sizeof (EggPriorityBoxChild)); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-priority-box.h gnome-usage-3.32.0/external/egg/egg-priority-box.h --- gnome-usage-3.30.0/external/egg/egg-priority-box.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-priority-box.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* egg-priority-box.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_PRIORITY_BOX_H -#define EGG_PRIORITY_BOX_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_PRIORITY_BOX (egg_priority_box_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggPriorityBox, egg_priority_box, EGG, PRIORITY_BOX, GtkBox) - -struct _EggPriorityBoxClass -{ - GtkBoxClass parent_class; - - gpointer _reserved1; - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - -GtkWidget *egg_priority_box_new (void); - -G_END_DECLS - -#endif /* EGG_PRIORITY_BOX_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-private.h gnome-usage-3.32.0/external/egg/egg-private.h --- gnome-usage-3.30.0/external/egg/egg-private.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-private.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* egg-private.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_PRIVATE_H -#define EGG_PRIVATE_H - -G_BEGIN_DECLS - -#include "egg-animation.h" -#include "egg-binding-group.h" -#include "egg-counter.h" -#include "egg-frame-source.h" -#include "egg-heap.h" -#include "egg-search-bar.h" -#include "egg-settings-sandwich.h" -#include "egg-signal-group.h" -#include "egg-state-machine-buildable.h" -#include "egg-state-machine.h" -#include "egg-task-cache.h" - -G_END_DECLS - -#endif /* EGG_PRIVATE_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-radio-box.c gnome-usage-3.32.0/external/egg/egg-radio-box.c --- gnome-usage-3.30.0/external/egg/egg-radio-box.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-radio-box.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,510 +0,0 @@ -/* egg-radio-box.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-radio-box" - -#include "egg-radio-box.h" - -/* - * XXX: Ideally we would manage all the size requests ourselves. However, - * that takes some more work to do correctly (and support stuff like - * linked, etc). - */ -#define N_PER_ROW 4 - -typedef struct -{ - gchar *id; - gchar *text; - GtkToggleButton *button; -} EggRadioBoxItem; - -typedef struct -{ - GArray *items; - gchar *active_id; - - GtkBox *vbox; - GtkBox *hbox; - GtkRevealer *revealer; - - guint has_more : 1; -} EggRadioBoxPrivate; - -static void buildable_iface_init (GtkBuildableIface *iface); - -G_DEFINE_TYPE_EXTENDED (EggRadioBox, egg_radio_box, GTK_TYPE_BIN, 0, - G_ADD_PRIVATE (EggRadioBox) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init)) - -enum { - PROP_0, - PROP_ACTIVE_ID, - PROP_HAS_MORE, - PROP_SHOW_MORE, - N_PROPS -}; - -enum { - CHANGED, - N_SIGNALS -}; - -static GParamSpec *properties [N_PROPS]; -static guint signals [N_SIGNALS]; - -static gboolean -egg_radio_box_get_has_more (EggRadioBox *self) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_RADIO_BOX (self), FALSE); - - return priv->has_more; -} - -static gboolean -egg_radio_box_get_show_more (EggRadioBox *self) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_RADIO_BOX (self), FALSE); - - return gtk_revealer_get_reveal_child (priv->revealer); -} - -static void -egg_radio_box_set_show_more (EggRadioBox *self, - gboolean show_more) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - - g_return_if_fail (EGG_IS_RADIO_BOX (self)); - - gtk_revealer_set_reveal_child (priv->revealer, show_more); -} - -static void -egg_radio_box_item_clear (EggRadioBoxItem *item) -{ - g_free (item->id); - g_free (item->text); -} - -static void -egg_radio_box_finalize (GObject *object) -{ - EggRadioBox *self = (EggRadioBox *)object; - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - - g_clear_pointer (&priv->items, g_array_unref); - g_clear_pointer (&priv->active_id, g_free); - - G_OBJECT_CLASS (egg_radio_box_parent_class)->finalize (object); -} - -static void -egg_radio_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggRadioBox *self = EGG_RADIO_BOX (object); - - switch (prop_id) - { - case PROP_ACTIVE_ID: - g_value_set_string (value, egg_radio_box_get_active_id (self)); - break; - - case PROP_HAS_MORE: - g_value_set_boolean (value, egg_radio_box_get_has_more (self)); - break; - - case PROP_SHOW_MORE: - g_value_set_boolean (value, egg_radio_box_get_show_more (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_radio_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggRadioBox *self = EGG_RADIO_BOX (object); - - switch (prop_id) - { - case PROP_ACTIVE_ID: - egg_radio_box_set_active_id (self, g_value_get_string (value)); - break; - - case PROP_SHOW_MORE: - egg_radio_box_set_show_more (self, g_value_get_boolean (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_radio_box_class_init (EggRadioBoxClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->finalize = egg_radio_box_finalize; - object_class->get_property = egg_radio_box_get_property; - object_class->set_property = egg_radio_box_set_property; - - properties [PROP_ACTIVE_ID] = - g_param_spec_string ("active-id", - "Active Id", - "Active Id", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_HAS_MORE] = - g_param_spec_boolean ("has-more", - "Has More", - "Has more items to view", - FALSE, - (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_SHOW_MORE] = - g_param_spec_boolean ("show-more", - "Show More", - "Show additional items", - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); - - signals [CHANGED] = - g_signal_new ("changed", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - - gtk_widget_class_set_css_name (widget_class, "radiobox"); -} - -static void -egg_radio_box_init (EggRadioBox *self) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - g_autoptr(GSimpleActionGroup) group = g_simple_action_group_new (); - g_autoptr(GPropertyAction) action = NULL; - GtkWidget *vbox; - - /* GPropertyAction doesn't like NULL strings */ - priv->active_id = g_strdup (""); - - priv->items = g_array_new (FALSE, FALSE, sizeof (EggRadioBoxItem)); - g_array_set_clear_func (priv->items, (GDestroyNotify)egg_radio_box_item_clear); - - vbox = g_object_new (GTK_TYPE_BOX, - "orientation", GTK_ORIENTATION_VERTICAL, - "visible", TRUE, - NULL); - gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (vbox)); - - priv->hbox = g_object_new (GTK_TYPE_BOX, - "orientation", GTK_ORIENTATION_HORIZONTAL, - "visible", TRUE, - NULL); - gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (priv->hbox)), "linked"); - gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (priv->hbox)); - - priv->revealer = g_object_new (GTK_TYPE_REVEALER, - "reveal-child", FALSE, - "visible", TRUE, - NULL); - gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (priv->revealer)); - - priv->vbox = g_object_new (GTK_TYPE_BOX, - "orientation", GTK_ORIENTATION_VERTICAL, - "margin-top", 12, - "spacing", 12, - "visible", TRUE, - NULL); - gtk_container_add (GTK_CONTAINER (priv->revealer), GTK_WIDGET (priv->vbox)); - - action = g_property_action_new ("active", self, "active-id"); - g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); - gtk_widget_insert_action_group (GTK_WIDGET (self), "radiobox", G_ACTION_GROUP (group)); -} - -void -egg_radio_box_add_item (EggRadioBox *self, - const gchar *id, - const gchar *text) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - EggRadioBoxItem item = { 0 }; - guint precount; - - g_return_if_fail (EGG_IS_RADIO_BOX (self)); - g_return_if_fail (id != NULL); - g_return_if_fail (text != NULL); - - precount = priv->items->len; - - for (guint i = 0; i < precount; ++i) - { - /* Avoid duplicate items */ - if (!g_strcmp0 (g_array_index (priv->items, EggRadioBoxItem, i).id, id)) - return; - } - - item.id = g_strdup (id); - item.text = g_strdup (text); - item.button = g_object_new (GTK_TYPE_TOGGLE_BUTTON, - "active", (g_strcmp0 (id, priv->active_id) == 0), - "action-name", "radiobox.active", - "action-target", g_variant_new_string (id), - "label", text, - "visible", TRUE, - NULL); - - g_array_append_val (priv->items, item); - - if (precount > 0 && (precount % N_PER_ROW) == 0) - { - gboolean show_more = egg_radio_box_get_show_more (self); - gboolean visible = !priv->has_more || show_more; - - priv->has_more = priv->items->len > N_PER_ROW; - priv->hbox = g_object_new (GTK_TYPE_BOX, - "orientation", GTK_ORIENTATION_HORIZONTAL, - "visible", visible, - NULL); - gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (priv->hbox)), "linked"); - gtk_container_add (GTK_CONTAINER (priv->vbox), GTK_WIDGET (priv->hbox)); - } - - gtk_container_add_with_properties (GTK_CONTAINER (priv->hbox), GTK_WIDGET (item.button), - "expand", TRUE, - NULL); - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HAS_MORE]); - - /* If this is the first item and no active id has been set, - * then go ahead and set the active item to this one. - */ - if (priv->items->len == 1 && (!priv->active_id || !*priv->active_id)) - egg_radio_box_set_active_id (self, id); -} - -void -egg_radio_box_set_active_id (EggRadioBox *self, - const gchar *id) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - - g_return_if_fail (EGG_IS_RADIO_BOX (self)); - - if (id == NULL) - id = ""; - - if (g_strcmp0 (id, priv->active_id) != 0) - { - g_free (priv->active_id); - priv->active_id = g_strdup (id); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ACTIVE_ID]); - g_signal_emit (self, signals [CHANGED], 0); - } -} - -const gchar * -egg_radio_box_get_active_id (EggRadioBox *self) -{ - EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_RADIO_BOX (self), NULL); - - return priv->active_id; -} - -GtkWidget * -egg_radio_box_new (void) -{ - return g_object_new (EGG_TYPE_RADIO_BOX, NULL); -} - -typedef struct -{ - EggRadioBox *self; - GtkBuilder *builder; - gchar *id; - GString *text; - guint translatable : 1; -} ItemParserData; - -static void -item_parser_start_element (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) -{ - ItemParserData *parser_data = user_data; - - g_assert (context != NULL); - g_assert (element_name != NULL); - g_assert (parser_data != NULL); - - if (g_strcmp0 (element_name, "item") == 0) - { - const gchar *translatable = NULL; - - g_clear_pointer (&parser_data->id, g_free); - g_string_truncate (parser_data->text, 0); - - if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, error, - G_MARKUP_COLLECT_STRDUP, "id", &parser_data->id, - G_MARKUP_COLLECT_STRING, "translatable", &translatable, - G_MARKUP_COLLECT_INVALID)) - return; - - parser_data->translatable = translatable != NULL && g_str_equal ("yes", translatable); - } -} - -static void -item_parser_end_element (GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) -{ - ItemParserData *parser_data = user_data; - - g_assert (context != NULL); - g_assert (element_name != NULL); - g_assert (parser_data != NULL); - - if (g_strcmp0 (element_name, "item") == 0) - { - if (parser_data->id && parser_data->text != NULL) - { - const gchar *str = parser_data->text->str; - - if (parser_data->translatable && str != NULL) - { - const gchar *domain; - - domain = gtk_builder_get_translation_domain (parser_data->builder); - str = g_dgettext (domain, str); - } - - egg_radio_box_add_item (parser_data->self, parser_data->id, str); - } - } -} - -static void -item_parser_text (GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) -{ - ItemParserData *parser_data = user_data; - - g_assert (parser_data != NULL); - - if (parser_data->text == NULL) - parser_data->text = g_string_new (NULL); - - g_string_append_len (parser_data->text, text, text_len); -} - -static GMarkupParser ItemParser = { - item_parser_start_element, - item_parser_end_element, - item_parser_text, -}; - -static gboolean -egg_radio_box_custom_tag_start (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - GMarkupParser *parser, - gpointer *data) -{ - EggRadioBox *self = (EggRadioBox *)buildable; - - g_assert (EGG_IS_RADIO_BOX (self)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (tagname != NULL); - g_assert (parser != NULL); - g_assert (data != NULL); - - if (g_strcmp0 (tagname, "items") == 0) - { - ItemParserData *parser_data; - - parser_data = g_slice_new0 (ItemParserData); - parser_data->self = self; - parser_data->builder = builder; - - *parser = ItemParser; - *data = parser_data; - - return TRUE; - } - - return FALSE; -} - -static void -egg_radio_box_custom_finished (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - gpointer user_data) -{ - EggRadioBox *self = (EggRadioBox *)buildable; - - g_assert (EGG_IS_RADIO_BOX (self)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (tagname != NULL); - - if (g_strcmp0 (tagname, "items") == 0) - { - ItemParserData *parser_data = user_data; - - g_free (parser_data->id); - g_string_free (parser_data->text, TRUE); - g_slice_free (ItemParserData, parser_data); - } -} - -static void -buildable_iface_init (GtkBuildableIface *iface) -{ - iface->custom_tag_start = egg_radio_box_custom_tag_start; - iface->custom_finished = egg_radio_box_custom_finished; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-radio-box.h gnome-usage-3.32.0/external/egg/egg-radio-box.h --- gnome-usage-3.30.0/external/egg/egg-radio-box.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-radio-box.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* egg-radio-box.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_RADIO_BOX_H -#define EGG_RADIO_BOX_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_RADIO_BOX (egg_radio_box_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggRadioBox, egg_radio_box, EGG, RADIO_BOX, GtkBin) - -struct _EggRadioBoxClass -{ - GtkBinClass parent_class; - - gpointer _padding1; - gpointer _padding2; - gpointer _padding3; - gpointer _padding4; -}; - -GtkWidget *egg_radio_box_new (void); -void egg_radio_box_add_item (EggRadioBox *self, - const gchar *id, - const gchar *text); -const gchar *egg_radio_box_get_active_id (EggRadioBox *self); -void egg_radio_box_set_active_id (EggRadioBox *self, - const gchar *id); - -G_END_DECLS - -#endif /* EGG_RADIO_BOX_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-scrolled-window.c gnome-usage-3.32.0/external/egg/egg-scrolled-window.c --- gnome-usage-3.30.0/external/egg/egg-scrolled-window.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-scrolled-window.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -/* egg-scrolled-window.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-scrolled-window" - -#include "egg-scrolled-window.h" - -struct _EggScrolledWindow -{ - GtkScrolledWindow parent_instance; -}; - -G_DEFINE_TYPE (EggScrolledWindow, egg_scrolled_window, GTK_TYPE_SCROLLED_WINDOW) - -static void -egg_scrolled_window_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *min_height, - gint *nat_height) -{ - EggScrolledWindow *self = (EggScrolledWindow *)widget; - gint border_width; - gint min_content_height; - gint max_content_height; - GtkWidget *child; - - g_assert (EGG_IS_SCROLLED_WINDOW (self)); - g_assert (min_height != NULL); - g_assert (nat_height != NULL); - - min_content_height = gtk_scrolled_window_get_min_content_height (GTK_SCROLLED_WINDOW (self)); - max_content_height = gtk_scrolled_window_get_max_content_height (GTK_SCROLLED_WINDOW (self)); - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - child = gtk_bin_get_child (GTK_BIN (self)); - - if (child == NULL) - { - *min_height = 0; - *nat_height = 0; - return; - } - - gtk_widget_get_preferred_height_for_width (child, width, min_height, nat_height); - - if (min_content_height > 0) - *min_height = MAX (*min_height, min_content_height); - else - *min_height = 1; - - if (max_content_height > 0) - *nat_height = MIN (*nat_height, max_content_height); - - *nat_height = MAX (*min_height, *nat_height); - - /* - * Special case for our use. What we should probably do is have a "grow with child - * range" but still fill into larger space with vexpand. - * - * This tries to enfoce at least a 5x3 ratio for the content, for asthetic reasons. - */ - if (*nat_height > width && *min_height < (width / 5 * 3)) - *min_height = (width / 5 * 3); - - *min_height += border_width * 2; - *nat_height += border_width * 2; -} - -static GtkSizeRequestMode -egg_scrolled_window_get_request_mode (GtkWidget *widget) -{ - return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; -} - -static void -egg_scrolled_window_class_init (EggScrolledWindowClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - widget_class->get_preferred_height_for_width = egg_scrolled_window_get_preferred_height_for_width; - widget_class->get_request_mode = egg_scrolled_window_get_request_mode; -} - -static void -egg_scrolled_window_init (EggScrolledWindow *self) -{ -} diff -Nru gnome-usage-3.30.0/external/egg/egg-scrolled-window.h gnome-usage-3.32.0/external/egg/egg-scrolled-window.h --- gnome-usage-3.30.0/external/egg/egg-scrolled-window.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-scrolled-window.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* egg-scrolled-window.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SCROLLED_WINDOW_H -#define EGG_SCROLLED_WINDOW_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SCROLLED_WINDOW (egg_scrolled_window_get_type()) - -G_DECLARE_FINAL_TYPE (EggScrolledWindow, egg_scrolled_window, EGG, SCROLLED_WINDOW, GtkScrolledWindow) - -G_END_DECLS - -#endif /* EGG_SCROLLED_WINDOW_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-search-bar.c gnome-usage-3.32.0/external/egg/egg-search-bar.c --- gnome-usage-3.30.0/external/egg/egg-search-bar.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-search-bar.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,479 +0,0 @@ -/* egg-search-bar.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-search-bar" - -#include - -#include "egg-signal-group.h" -#include "egg-search-bar.h" - -typedef struct -{ - GtkRevealer *revealer; - GtkBox *box; - GtkSearchEntry *entry; - GtkButton *close_button; - - EggSignalGroup *window_signals; - - guint search_mode_enabled : 1; -} EggSearchBarPrivate; - -static void egg_search_bar_init_buildable (GtkBuildableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (EggSearchBar, egg_search_bar, GTK_TYPE_BIN, - G_ADD_PRIVATE (EggSearchBar) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - egg_search_bar_init_buildable)) - -enum { - PROP_0, - PROP_SHOW_CLOSE_BUTTON, - PROP_SEARCH_MODE_ENABLED, - LAST_PROP -}; - -enum { - ACTIVATE, - REVEAL, - LAST_SIGNAL -}; - -static GParamSpec *properties [LAST_PROP]; -static guint signals [LAST_SIGNAL]; - -static void -egg_search_bar__entry_activate (EggSearchBar *self, - GtkSearchEntry *entry) -{ - g_assert (EGG_IS_SEARCH_BAR (self)); - g_assert (GTK_IS_SEARCH_ENTRY (entry)); - - g_signal_emit (self, signals [ACTIVATE], 0); -} - -static gboolean -is_modifier_key (const GdkEventKey *event) -{ - static const guint modifier_keyvals[] = { - GDK_KEY_Shift_L, GDK_KEY_Shift_R, GDK_KEY_Shift_Lock, - GDK_KEY_Caps_Lock, GDK_KEY_ISO_Lock, GDK_KEY_Control_L, - GDK_KEY_Control_R, GDK_KEY_Meta_L, GDK_KEY_Meta_R, - GDK_KEY_Alt_L, GDK_KEY_Alt_R, GDK_KEY_Super_L, GDK_KEY_Super_R, - GDK_KEY_Hyper_L, GDK_KEY_Hyper_R, GDK_KEY_ISO_Level3_Shift, - GDK_KEY_ISO_Next_Group, GDK_KEY_ISO_Prev_Group, - GDK_KEY_ISO_First_Group, GDK_KEY_ISO_Last_Group, - GDK_KEY_Mode_switch, GDK_KEY_Num_Lock, GDK_KEY_Multi_key, - GDK_KEY_Scroll_Lock, - 0 - }; - const guint *ac_val; - - g_return_val_if_fail (event != NULL, FALSE); - - ac_val = modifier_keyvals; - - while (*ac_val) - { - if (event->keyval == *ac_val++) - return TRUE; - } - - return FALSE; -} - -static gboolean -toplevel_key_press_event_before (EggSearchBar *self, - GdkEventKey *event, - GtkWindow *toplevel) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_assert (EGG_IS_SEARCH_BAR (self)); - g_assert (event != NULL); - g_assert (GTK_IS_WINDOW (toplevel)); - - switch (event->keyval) - { - case GDK_KEY_Escape: - if (priv->search_mode_enabled && gtk_widget_has_focus (GTK_WIDGET (priv->entry))) - { - egg_search_bar_set_search_mode_enabled (self, FALSE); - return GDK_EVENT_STOP; - } - break; - - default: - break; - } - - return GDK_EVENT_PROPAGATE; -} - -static gboolean -toplevel_key_press_event_after (EggSearchBar *self, - GdkEventKey *event, - GtkWindow *toplevel) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - GtkWidget *entry; - - g_assert (EGG_IS_SEARCH_BAR (self)); - g_assert (event != NULL); - g_assert (GTK_IS_WINDOW (toplevel)); - - entry = GTK_WIDGET (priv->entry); - - switch (event->keyval) - { - case GDK_KEY_Escape: - case GDK_KEY_Up: - case GDK_KEY_KP_Up: - case GDK_KEY_Down: - case GDK_KEY_KP_Down: - case GDK_KEY_Left: - case GDK_KEY_KP_Left: - case GDK_KEY_Right: - case GDK_KEY_KP_Right: - case GDK_KEY_Home: - case GDK_KEY_KP_Home: - case GDK_KEY_End: - case GDK_KEY_KP_End: - case GDK_KEY_Page_Up: - case GDK_KEY_KP_Page_Up: - case GDK_KEY_Page_Down: - case GDK_KEY_KP_Page_Down: - case GDK_KEY_KP_Tab: - case GDK_KEY_Tab: - /* ignore keynav */ - break; - - default: - if (((event->state & GDK_MOD1_MASK) != 0) || - ((event->state & GDK_CONTROL_MASK) != 0) || - priv->search_mode_enabled || - is_modifier_key (event)) - break; - - egg_search_bar_set_search_mode_enabled (self, TRUE); - - return GTK_WIDGET_GET_CLASS (entry)->key_press_event (entry, event); - } - - return GDK_EVENT_PROPAGATE; -} - -static void -egg_search_bar_hierarchy_changed (GtkWidget *widget, - GtkWidget *old_toplevel) -{ - EggSearchBar *self = (EggSearchBar *)widget; - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - GtkWidget *toplevel; - - g_assert (EGG_IS_SEARCH_BAR (self)); - - toplevel = gtk_widget_get_toplevel (widget); - - if (GTK_IS_WINDOW (toplevel)) - egg_signal_group_set_target (priv->window_signals, toplevel); - else - egg_signal_group_set_target (priv->window_signals, NULL); -} - -static void -egg_search_bar_reveal (EggSearchBar *self) -{ - g_assert (EGG_IS_SEARCH_BAR (self)); - - egg_search_bar_set_search_mode_enabled (self, TRUE); -} - -static GObject * -egg_search_bar_get_internal_child (GtkBuildable *buildable, - GtkBuilder *builder, - const gchar *childname) -{ - EggSearchBar *self = (EggSearchBar *)buildable; - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_assert (GTK_IS_BUILDABLE (buildable)); - g_assert (EGG_IS_SEARCH_BAR (self)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (childname != NULL); - - if (g_strcmp0 (childname, "entry") == 0) - return G_OBJECT (priv->entry); - else if (g_strcmp0 (childname, "revealer") == 0) - return G_OBJECT (priv->revealer); - - return NULL; -} - -static void -egg_search_bar_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSearchBar *self = EGG_SEARCH_BAR (object); - - switch (prop_id) - { - case PROP_SEARCH_MODE_ENABLED: - g_value_set_boolean (value, egg_search_bar_get_search_mode_enabled (self)); - break; - - case PROP_SHOW_CLOSE_BUTTON: - g_value_set_boolean (value, egg_search_bar_get_show_close_button (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_search_bar_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSearchBar *self = EGG_SEARCH_BAR (object); - - switch (prop_id) - { - case PROP_SEARCH_MODE_ENABLED: - egg_search_bar_set_search_mode_enabled (self, g_value_get_boolean (value)); - break; - - case PROP_SHOW_CLOSE_BUTTON: - egg_search_bar_set_show_close_button (self, g_value_get_boolean (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_search_bar_finalize (GObject *object) -{ - EggSearchBar *self = (EggSearchBar *)object; - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_clear_object (&priv->window_signals); - - G_OBJECT_CLASS (egg_search_bar_parent_class)->finalize (object); -} - -static void -egg_search_bar_class_init (EggSearchBarClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->finalize = egg_search_bar_finalize; - object_class->get_property = egg_search_bar_get_property; - object_class->set_property = egg_search_bar_set_property; - - widget_class->hierarchy_changed = egg_search_bar_hierarchy_changed; - - properties [PROP_SEARCH_MODE_ENABLED] = - g_param_spec_boolean ("search-mode-enabled", - "Search Mode Enabled", - "Search Mode Enabled", - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_SHOW_CLOSE_BUTTON] = - g_param_spec_boolean ("show-close-button", - "Show Close Button", - "Show Close Button", - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - signals [ACTIVATE] = - g_signal_new ("activate", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - - signals [REVEAL] = - g_signal_new_class_handler ("reveal", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_CALLBACK (egg_search_bar_reveal), - NULL, NULL, NULL, G_TYPE_NONE, 0); - - gtk_widget_class_set_css_name (widget_class, "eggsearchbar"); -} - -static void -egg_search_bar_init_buildable (GtkBuildableIface *iface) -{ - iface->get_internal_child = egg_search_bar_get_internal_child; -} - -static void -egg_search_bar_init (EggSearchBar *self) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - GtkStyleContext *style_context; - GtkBox *box; - - priv->window_signals = egg_signal_group_new (GTK_TYPE_WINDOW); - egg_signal_group_connect_object (priv->window_signals, - "key-press-event", - G_CALLBACK (toplevel_key_press_event_before), - self, - G_CONNECT_SWAPPED); - egg_signal_group_connect_object (priv->window_signals, - "key-press-event", - G_CALLBACK (toplevel_key_press_event_after), - self, - G_CONNECT_SWAPPED | G_CONNECT_AFTER); - - priv->revealer = - g_object_new (GTK_TYPE_REVEALER, - "transition-type", GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, - "visible", TRUE, - NULL); - /* outer box used for styling */ - box = - g_object_new (GTK_TYPE_BOX, - "orientation", GTK_ORIENTATION_HORIZONTAL, - "visible", TRUE, - NULL); - priv->box = - g_object_new (GTK_TYPE_BOX, - "hexpand", TRUE, - "margin-bottom", 3, - "margin-end", 6, - "margin-start", 6, - "margin-top", 3, - "orientation", GTK_ORIENTATION_HORIZONTAL, - "visible", TRUE, - NULL); - priv->entry = - g_object_connect (g_object_new (GTK_TYPE_SEARCH_ENTRY, - "placeholder-text", _("Search"), - "visible", TRUE, - NULL), - "swapped_object_signal::activate", egg_search_bar__entry_activate, self, - NULL); - priv->close_button = - g_object_new (GTK_TYPE_BUTTON, - "child", g_object_new (GTK_TYPE_IMAGE, - "icon-name", "window-close-symbolic", - "visible", TRUE, - NULL), - "visible", FALSE, - NULL); - - style_context = gtk_widget_get_style_context (GTK_WIDGET (box)); - gtk_style_context_add_class (style_context, "search-bar"); - - gtk_container_add (GTK_CONTAINER (priv->revealer), GTK_WIDGET (box)); - gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->box)); - gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (priv->revealer)); - gtk_container_add_with_properties (GTK_CONTAINER (priv->box), - GTK_WIDGET (priv->close_button), - "fill", FALSE, - "pack-type", GTK_PACK_END, - NULL); - gtk_box_set_center_widget (priv->box, GTK_WIDGET (priv->entry)); -} - -GtkWidget * -egg_search_bar_new (void) -{ - return g_object_new (EGG_TYPE_SEARCH_BAR, NULL); -} - -gboolean -egg_search_bar_get_search_mode_enabled (EggSearchBar *self) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SEARCH_BAR (self), FALSE); - - return priv->search_mode_enabled; -} - -void -egg_search_bar_set_search_mode_enabled (EggSearchBar *self, - gboolean search_mode_enabled) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_return_if_fail (EGG_IS_SEARCH_BAR (self)); - - search_mode_enabled = !!search_mode_enabled; - - if (search_mode_enabled != priv->search_mode_enabled) - { - priv->search_mode_enabled = search_mode_enabled; - gtk_revealer_set_reveal_child (priv->revealer, search_mode_enabled); - gtk_entry_set_text (GTK_ENTRY (priv->entry), ""); - if (search_mode_enabled) - gtk_widget_grab_focus (GTK_WIDGET (priv->entry)); - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SEARCH_MODE_ENABLED]); - } -} - -gboolean -egg_search_bar_get_show_close_button (EggSearchBar *self) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SEARCH_BAR (self), FALSE); - - return gtk_widget_get_visible (GTK_WIDGET (priv->close_button)); -} - -void -egg_search_bar_set_show_close_button (EggSearchBar *self, - gboolean show_close_button) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_return_if_fail (EGG_IS_SEARCH_BAR (self)); - - gtk_widget_set_visible (GTK_WIDGET (priv->close_button), show_close_button); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SHOW_CLOSE_BUTTON]); -} - -/** - * egg_search_bar_get_entry: - * - * Returns: (transfer none) (type Gtk.SearchEntry): A #GtkSearchEntry. - */ -GtkWidget * -egg_search_bar_get_entry (EggSearchBar *self) -{ - EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SEARCH_BAR (self), NULL); - - return GTK_WIDGET (priv->entry); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-search-bar.h gnome-usage-3.32.0/external/egg/egg-search-bar.h --- gnome-usage-3.30.0/external/egg/egg-search-bar.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-search-bar.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* egg-search-bar.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SEARCH_BAR_H -#define EGG_SEARCH_BAR_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SEARCH_BAR (egg_search_bar_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggSearchBar, egg_search_bar, EGG, SEARCH_BAR, GtkBin) - -struct _EggSearchBarClass -{ - GtkBinClass parent_class; -}; - -GtkWidget *egg_search_bar_new (void); -gboolean egg_search_bar_get_search_mode_enabled (EggSearchBar *self); -void egg_search_bar_set_search_mode_enabled (EggSearchBar *self, - gboolean search_mode_enabled); -gboolean egg_search_bar_get_show_close_button (EggSearchBar *self); -void egg_search_bar_set_show_close_button (EggSearchBar *self, - gboolean show_close_button); -GtkWidget *egg_search_bar_get_entry (EggSearchBar *self); - -G_END_DECLS - -#endif /* EGG_SEARCH_BAR_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-settings-flag-action.c gnome-usage-3.32.0/external/egg/egg-settings-flag-action.c --- gnome-usage-3.30.0/external/egg/egg-settings-flag-action.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-settings-flag-action.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,311 +0,0 @@ -/* egg-settings-flag-action.c - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "egg-settings-flag-action.h" - -struct _EggSettingsFlagAction -{ - GObject parent_instance; - - GSettings *settings; - - gchar *schema_id; - gchar *schema_key; - gchar *flag_nick; - gchar *name; -}; - -static void action_iface_init (GActionInterface *iface); - -G_DEFINE_TYPE_EXTENDED (EggSettingsFlagAction, egg_settings_flag_action, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (G_TYPE_ACTION, action_iface_init)) - -enum { - PROP_0, - PROP_SCHEMA_ID, - PROP_SCHEMA_KEY, - PROP_FLAG_NICK, - LAST_PROP, - - PROP_ENABLED, - PROP_NAME, - PROP_STATE, - PROP_STATE_TYPE, - PROP_PARAMETER_TYPE, -}; - -static GParamSpec *properties [LAST_PROP]; - -/** - * egg_settings_flag_action_new: - * - * This creates a new action that can be used to toggle an individual flag in - * a #GSettings key which is of a flags type. - * - * Returns: (transfer full): A new #GAction. - */ -GAction * -egg_settings_flag_action_new (const gchar *schema_id, - const gchar *schema_key, - const gchar *flag_nick) -{ - return g_object_new (EGG_TYPE_SETTINGS_FLAG_ACTION, - "schema-id", schema_id, - "schema-key", schema_key, - "flag-nick", flag_nick, - NULL); -} - -static void -egg_settings_flag_action_finalize (GObject *object) -{ - EggSettingsFlagAction *self = (EggSettingsFlagAction *)object; - - g_clear_pointer (&self->schema_id, g_free); - g_clear_pointer (&self->schema_key, g_free); - g_clear_pointer (&self->flag_nick, g_free); - - G_OBJECT_CLASS (egg_settings_flag_action_parent_class)->finalize (object); -} - -static void -egg_settings_flag_action_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSettingsFlagAction *self = EGG_SETTINGS_FLAG_ACTION (object); - - switch (prop_id) - { - case PROP_ENABLED: - g_value_set_boolean (value, self->schema_id != NULL); - break; - - case PROP_SCHEMA_ID: - g_value_set_string (value, self->schema_id); - break; - - case PROP_NAME: - g_value_set_string (value, g_action_get_name (G_ACTION (self))); - break; - - case PROP_SCHEMA_KEY: - g_value_set_string (value, self->schema_key); - break; - - case PROP_FLAG_NICK: - g_value_set_string (value, self->flag_nick); - break; - - case PROP_STATE: - case PROP_STATE_TYPE: - case PROP_PARAMETER_TYPE: - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_settings_flag_action_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSettingsFlagAction *self = EGG_SETTINGS_FLAG_ACTION (object); - - switch (prop_id) - { - case PROP_SCHEMA_ID: - g_free (self->schema_id); - self->schema_id = g_value_dup_string (value); - break; - - case PROP_SCHEMA_KEY: - g_free (self->schema_key); - self->schema_key = g_value_dup_string (value); - break; - - case PROP_FLAG_NICK: - g_free (self->flag_nick); - self->flag_nick = g_value_dup_string (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_settings_flag_action_class_init (EggSettingsFlagActionClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = egg_settings_flag_action_finalize; - object_class->get_property = egg_settings_flag_action_get_property; - object_class->set_property = egg_settings_flag_action_set_property; - - g_object_class_override_property (object_class, PROP_NAME, "name"); - g_object_class_override_property (object_class, PROP_STATE, "state"); - g_object_class_override_property (object_class, PROP_STATE_TYPE, "state-type"); - g_object_class_override_property (object_class, PROP_PARAMETER_TYPE, "parameter-type"); - g_object_class_override_property (object_class, PROP_ENABLED, "enabled"); - - properties [PROP_SCHEMA_ID] = - g_param_spec_string ("schema-id", - "Schema Id", - "Schema Id", - NULL, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_SCHEMA_KEY] = - g_param_spec_string ("schema-key", - "Schema Key", - "Schema Key", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_FLAG_NICK] = - g_param_spec_string ("flag-nick", - "Flag Nick", - "Flag Nick", - NULL, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -egg_settings_flag_action_init (EggSettingsFlagAction *self) -{ -} - -static GSettings * -egg_settings_flag_action_get_settings (EggSettingsFlagAction *self) -{ - g_assert (EGG_IS_SETTINGS_FLAG_ACTION (self)); - - if (self->settings == NULL) - self->settings = g_settings_new (self->schema_id); - - return self->settings; -} - -static const gchar * -egg_settings_flag_action_get_name (GAction *action) -{ - EggSettingsFlagAction *self = (EggSettingsFlagAction *)action; - - if (self->name == NULL) - self->name = g_strdup_printf ("%s-%s", self->schema_key, self->flag_nick); - - return self->name; -} - -static const GVariantType * -egg_settings_flag_action_get_parameter_type (GAction *action) -{ - return NULL; -} - -static const GVariantType * -egg_settings_flag_action_get_state_type (GAction *action) -{ - return G_VARIANT_TYPE_BOOLEAN; -} - -static GVariant * -egg_settings_flag_action_get_state_hint (GAction *action) -{ - return NULL; -} - -static void -egg_settings_flag_action_change_state (GAction *action, - GVariant *value) -{ -} - -static GVariant * -egg_settings_flag_action_get_state (GAction *action) -{ - EggSettingsFlagAction *self = (EggSettingsFlagAction *)action; - GSettings *settings = egg_settings_flag_action_get_settings (self); - g_auto(GStrv) flags = g_settings_get_strv (settings, self->schema_key); - gboolean state = g_strv_contains ((const gchar * const *)flags, self->flag_nick); - return g_variant_new_boolean (state); -} - -static gboolean -egg_settings_flag_action_get_enabled (GAction *action) -{ - EggSettingsFlagAction *self = (EggSettingsFlagAction *)action; - - return self->schema_id && self->schema_key && self->flag_nick; -} - -static void -egg_settings_flag_action_activate (GAction *action, - GVariant *parameter) -{ - EggSettingsFlagAction *self = (EggSettingsFlagAction *)action; - GSettings *settings; - GPtrArray *ar; - gboolean found = FALSE; - gchar **strv; - guint i; - - g_assert (EGG_IS_SETTINGS_FLAG_ACTION (action)); - g_assert (parameter == NULL); - - settings = egg_settings_flag_action_get_settings (self); - strv = g_settings_get_strv (settings, self->schema_key); - ar = g_ptr_array_new (); - - for (i = 0; strv [i]; i++) - { - if (g_strcmp0 (strv [i], self->flag_nick) == 0) - found = TRUE; - else - g_ptr_array_add (ar, strv [i]); - } - - if (!found) - g_ptr_array_add (ar, self->flag_nick); - - g_ptr_array_add (ar, NULL); - - g_settings_set_strv (settings, self->schema_key, (const gchar * const *)ar->pdata); - - g_strfreev (strv); -} - -static void -action_iface_init (GActionInterface *iface) -{ - iface->activate = egg_settings_flag_action_activate; - iface->change_state = egg_settings_flag_action_change_state; - iface->get_enabled = egg_settings_flag_action_get_enabled; - iface->get_name = egg_settings_flag_action_get_name; - iface->get_parameter_type = egg_settings_flag_action_get_parameter_type; - iface->get_state = egg_settings_flag_action_get_state; - iface->get_state_hint = egg_settings_flag_action_get_state_hint; - iface->get_state_type = egg_settings_flag_action_get_state_type; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-settings-flag-action.h gnome-usage-3.32.0/external/egg/egg-settings-flag-action.h --- gnome-usage-3.30.0/external/egg/egg-settings-flag-action.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-settings-flag-action.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* egg-settings-flag-action.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SETTINGS_FLAG_ACTION_H -#define EGG_SETTINGS_FLAG_ACTION_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SETTINGS_FLAG_ACTION (egg_settings_flag_action_get_type()) - -G_DECLARE_FINAL_TYPE (EggSettingsFlagAction, egg_settings_flag_action, EGG, SETTINGS_FLAG_ACTION, GObject) - -GAction *egg_settings_flag_action_new (const gchar *schema_id, - const gchar *schema_key, - const gchar *flag_nick); - -G_END_DECLS - -#endif /* EGG_SETTINGS_FLAG_ACTION_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-settings-sandwich.c gnome-usage-3.32.0/external/egg/egg-settings-sandwich.c --- gnome-usage-3.30.0/external/egg/egg-settings-sandwich.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-settings-sandwich.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,489 +0,0 @@ -/* egg-settings-sandwich.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-settings-sandwich" -#define G_SETTINGS_ENABLE_BACKEND - -#include -#include - -#include "egg-settings-sandwich.h" - -struct _EggSettingsSandwich -{ - GObject parent_instance; - GPtrArray *settings; - GSettingsBackend *memory_backend; - GSettings *memory_settings; - gchar *schema_id; - gchar *path; -}; - -G_DEFINE_TYPE (EggSettingsSandwich, egg_settings_sandwich, G_TYPE_OBJECT) - -enum { - PROP_0, - PROP_PATH, - PROP_SCHEMA_ID, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -static GSettings * -egg_settings_sandwich_get_primary_settings (EggSettingsSandwich *self) -{ - g_assert (EGG_IS_SETTINGS_SANDWICH (self)); - - if (self->settings->len == 0) - { - g_error ("No settings have been loaded. Aborting."); - g_assert_not_reached (); - return NULL; - } - - return g_ptr_array_index (self->settings, 0); -} - -static void -egg_settings_sandwich_cache_key (EggSettingsSandwich *self, - const gchar *key) -{ - GSettings *settings; - GVariant *value; - gsize i; - - g_assert (EGG_IS_SETTINGS_SANDWICH (self)); - g_assert (key != NULL); - g_assert (self->settings->len > 0); - - for (i = 0; i < self->settings->len; i++) - { - settings = g_ptr_array_index (self->settings, i); - value = g_settings_get_user_value (settings, key); - - if (value != NULL) - { - g_settings_set_value (self->memory_settings, key, value); - return; - } - } - - settings = g_ptr_array_index (self->settings, 0); - value = g_settings_get_value (settings, key); - g_settings_set_value (self->memory_settings, key, value); -} - -static void -egg_settings_sandwich_update_cache (EggSettingsSandwich *self) -{ - GSettingsSchemaSource *source; - GSettingsSchema *schema; - gchar **keys; - gsize i; - - g_assert (EGG_IS_SETTINGS_SANDWICH (self)); - - source = g_settings_schema_source_get_default (); - schema = g_settings_schema_source_lookup (source, self->schema_id, TRUE); - - if (schema == NULL) - { - g_error ("Failed to locate schema: %s", self->schema_id); - return; - } - - keys = g_settings_schema_list_keys (schema); - - for (i = 0; keys [i]; i++) - egg_settings_sandwich_cache_key (self, keys [i]); - - g_settings_schema_unref (schema); - g_strfreev (keys); -} - -static void -egg_settings_sandwich__settings_changed (EggSettingsSandwich *self, - const gchar *key, - GSettings *settings) -{ - g_assert (EGG_IS_SETTINGS_SANDWICH (self)); - g_assert (key != NULL); - g_assert (G_IS_SETTINGS (settings)); - - egg_settings_sandwich_cache_key (self, key); -} - -static void -egg_settings_sandwich_constructed (GObject *object) -{ - EggSettingsSandwich *self = (EggSettingsSandwich *)object; - - g_assert (EGG_IS_SETTINGS_SANDWICH (self)); - g_assert (self->schema_id != NULL); - g_assert (self->path != NULL); - - self->memory_settings = g_settings_new_with_backend_and_path (self->schema_id, - self->memory_backend, - self->path); - - G_OBJECT_CLASS (egg_settings_sandwich_parent_class)->constructed (object); -} - -static void -egg_settings_sandwich_finalize (GObject *object) -{ - EggSettingsSandwich *self = (EggSettingsSandwich *)object; - - g_clear_pointer (&self->settings, g_ptr_array_unref); - g_clear_pointer (&self->schema_id, g_free); - g_clear_pointer (&self->path, g_free); - g_clear_object (&self->memory_backend); - - G_OBJECT_CLASS (egg_settings_sandwich_parent_class)->finalize (object); -} - -static void -egg_settings_sandwich_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSettingsSandwich *self = EGG_SETTINGS_SANDWICH (object); - - switch (prop_id) - { - case PROP_SCHEMA_ID: - g_value_set_string (value, self->schema_id); - break; - - case PROP_PATH: - g_value_set_string (value, self->path); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_settings_sandwich_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSettingsSandwich *self = EGG_SETTINGS_SANDWICH (object); - - switch (prop_id) - { - case PROP_SCHEMA_ID: - self->schema_id = g_value_dup_string (value); - break; - - case PROP_PATH: - self->path = g_value_dup_string (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_settings_sandwich_class_init (EggSettingsSandwichClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructed = egg_settings_sandwich_constructed; - object_class->finalize = egg_settings_sandwich_finalize; - object_class->get_property = egg_settings_sandwich_get_property; - object_class->set_property = egg_settings_sandwich_set_property; - - properties [PROP_SCHEMA_ID] = - g_param_spec_string ("schema-id", - "Schema Id", - "Schema Id", - NULL, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_PATH] = - g_param_spec_string ("path", - "Settings Path", - "Settings Path", - NULL, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -egg_settings_sandwich_init (EggSettingsSandwich *self) -{ - self->settings = g_ptr_array_new_with_free_func (g_object_unref); - self->memory_backend = g_memory_settings_backend_new (); -} - -EggSettingsSandwich * -egg_settings_sandwich_new (const gchar *schema_id, - const gchar *path) -{ - g_return_val_if_fail (schema_id != NULL, NULL); - g_return_val_if_fail (path != NULL, NULL); - - return g_object_new (EGG_TYPE_SETTINGS_SANDWICH, - "schema-id", schema_id, - "path", path, - NULL); -} - -GVariant * -egg_settings_sandwich_get_default_value (EggSettingsSandwich *self, - const gchar *key) -{ - GSettings *settings; - GVariant *ret; - - g_return_val_if_fail (EGG_IS_SETTINGS_SANDWICH (self), NULL); - g_return_val_if_fail (key != NULL, NULL); - - settings = egg_settings_sandwich_get_primary_settings (self); - ret = g_settings_get_default_value (settings, key); - - return ret; -} - -GVariant * -egg_settings_sandwich_get_user_value (EggSettingsSandwich *self, - const gchar *key) -{ - gsize i; - - g_return_val_if_fail (EGG_IS_SETTINGS_SANDWICH (self), NULL); - g_return_val_if_fail (key != NULL, NULL); - - for (i = 0; i < self->settings->len; i++) - { - GSettings *settings; - GVariant *value; - - settings = g_ptr_array_index (self->settings, i); - value = g_settings_get_user_value (settings, key); - if (value != NULL) - return value; - } - - return NULL; -} - -GVariant * -egg_settings_sandwich_get_value (EggSettingsSandwich *self, - const gchar *key) -{ - GSettings *settings; - GVariant *ret; - gsize i; - - g_return_val_if_fail (EGG_IS_SETTINGS_SANDWICH (self), NULL); - g_return_val_if_fail (key != NULL, NULL); - - - for (i = 0; i < self->settings->len; i++) - { - settings = g_ptr_array_index (self->settings, i); - ret = g_settings_get_user_value (settings, key); - if (ret != NULL) - return ret; - } - - settings = egg_settings_sandwich_get_primary_settings (self); - ret = g_settings_get_value (settings, key); - - return ret; -} - -void -egg_settings_sandwich_set_value (EggSettingsSandwich *self, - const gchar *key, - GVariant *value) -{ - GSettings *settings; - - g_return_if_fail (EGG_IS_SETTINGS_SANDWICH (self)); - g_return_if_fail (key != NULL); - - settings = egg_settings_sandwich_get_primary_settings (self); - g_settings_set_value (settings, key, value); -} - -#define DEFINE_GETTER(name, ret_type, func, ...) \ -ret_type \ -egg_settings_sandwich_get_##name (EggSettingsSandwich *self, \ - const gchar *key) \ -{ \ - GVariant *value; \ - ret_type ret; \ - \ - g_return_val_if_fail (EGG_IS_SETTINGS_SANDWICH (self), (ret_type)0); \ - g_return_val_if_fail (key != NULL, (ret_type)0); \ - \ - value = egg_settings_sandwich_get_value (self, key); \ - ret = g_variant_##func (value, ##__VA_ARGS__); \ - g_variant_unref (value); \ - \ - return ret; \ -} - -DEFINE_GETTER (boolean, gboolean, get_boolean) -DEFINE_GETTER (double, gdouble, get_double) -DEFINE_GETTER (int, gint, get_int32) -DEFINE_GETTER (string, gchar *, dup_string, NULL) -DEFINE_GETTER (uint, guint, get_uint32) - -#define DEFINE_SETTER(name, param_type, func) \ -void \ -egg_settings_sandwich_set_##name (EggSettingsSandwich *self, \ - const gchar *key, \ - param_type val) \ -{ \ - GVariant *value; \ - \ - g_return_if_fail (EGG_IS_SETTINGS_SANDWICH (self)); \ - g_return_if_fail (key != NULL); \ - \ - value = g_variant_##func (val); \ - egg_settings_sandwich_set_value (self, key, value); \ -} - -DEFINE_SETTER (boolean, gboolean, new_boolean) -DEFINE_SETTER (double, gdouble, new_double) -DEFINE_SETTER (int, gint, new_int32) -DEFINE_SETTER (string, const gchar *, new_string) -DEFINE_SETTER (uint, guint, new_uint32) - -void -egg_settings_sandwich_append (EggSettingsSandwich *self, - GSettings *settings) -{ - g_return_if_fail (EGG_IS_SETTINGS_SANDWICH (self)); - g_return_if_fail (G_IS_SETTINGS (settings)); - - g_ptr_array_add (self->settings, g_object_ref (settings)); - -#if 0 - { - g_autofree gchar *schema_id = NULL; - g_autofree gchar *path = NULL; - - g_object_get (settings, - "schema-id", &schema_id, - "path", &path, - NULL); - } -#endif - - g_signal_connect_object (settings, - "changed", - G_CALLBACK (egg_settings_sandwich__settings_changed), - self, - G_CONNECT_SWAPPED); - - egg_settings_sandwich_update_cache (self); -} - -void -egg_settings_sandwich_bind (EggSettingsSandwich *self, - const gchar *key, - gpointer object, - const gchar *property, - GSettingsBindFlags flags) -{ - g_return_if_fail (EGG_IS_SETTINGS_SANDWICH (self)); - g_return_if_fail (key != NULL); - g_return_if_fail (G_IS_OBJECT (object)); - g_return_if_fail (property != NULL); - - egg_settings_sandwich_bind_with_mapping (self, key, object, property, flags, - NULL, NULL, NULL, NULL); -} - -/** - * egg_settings_sandwich_bind_with_mapping: - * @self: An #EggSettingsSandwich. - * @key: the settings key to bind. - * @object (type GObject.Object): the target object. - * @property: the property on @object to apply. - * @flags: flags for the binding. - * @get_mapping: (scope notified) (closure user_data) (destroy destroy): the get mapping function - * @set_mapping: (scope notified) (closure user_data) (destroy destroy): the set mapping function - * @user_data: user data for @get_mapping and @set_mapping. - * @destroy: destroy notify for @user_data. - * - * Creates a new binding similar to g_settings_bind_with_mapping() but applying - * from the resolved value via the settings sandwich. - */ -void -egg_settings_sandwich_bind_with_mapping (EggSettingsSandwich *self, - const gchar *key, - gpointer object, - const gchar *property, - GSettingsBindFlags flags, - GSettingsBindGetMapping get_mapping, - GSettingsBindSetMapping set_mapping, - gpointer user_data, - GDestroyNotify destroy) -{ - GSettings *settings; - - g_return_if_fail (EGG_IS_SETTINGS_SANDWICH (self)); - g_return_if_fail (key != NULL); - g_return_if_fail (G_IS_OBJECT (object)); - g_return_if_fail (property != NULL); - - /* - * Our memory backend/settings are compiling the values from all of the layers of our - * sandwich. Therefore, we only want to map reads from the memory backend. We want to direct - * all writes to the topmost layer of the sandwich (found at index 0). - */ - if ((flags & G_SETTINGS_BIND_GET) != 0) - g_settings_bind_with_mapping (self->memory_settings, key, object, property, - (flags & ~G_SETTINGS_BIND_SET), - get_mapping, set_mapping, user_data, destroy); - - /* - * We bind writability directly to our toplevel layer of the sandwich. - */ - settings = egg_settings_sandwich_get_primary_settings (self); - if ((flags & G_SETTINGS_BIND_SET) != 0) - g_settings_bind_with_mapping (settings, key, object, property, (flags & ~G_SETTINGS_BIND_GET), - get_mapping, set_mapping, user_data, destroy); -} - -void -egg_settings_sandwich_unbind (EggSettingsSandwich *self, - const gchar *property) -{ - GSettings *settings; - - g_return_if_fail (EGG_IS_SETTINGS_SANDWICH (self)); - g_return_if_fail (property != NULL); - - settings = egg_settings_sandwich_get_primary_settings (self); - - g_settings_unbind (settings, property); - g_settings_unbind (self->memory_backend, property); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-settings-sandwich.h gnome-usage-3.32.0/external/egg/egg-settings-sandwich.h --- gnome-usage-3.30.0/external/egg/egg-settings-sandwich.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-settings-sandwich.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* egg-settings-sandwich.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SETTINGS_SANDWICH_H -#define EGG_SETTINGS_SANDWICH_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SETTINGS_SANDWICH (egg_settings_sandwich_get_type()) - -G_DECLARE_FINAL_TYPE (EggSettingsSandwich, egg_settings_sandwich, EGG, SETTINGS_SANDWICH, GObject) - -EggSettingsSandwich *egg_settings_sandwich_new (const gchar *schema_id, - const gchar *path); -GVariant *egg_settings_sandwich_get_default_value (EggSettingsSandwich *self, - const gchar *key); -GVariant *egg_settings_sandwich_get_user_value (EggSettingsSandwich *self, - const gchar *key); -GVariant *egg_settings_sandwich_get_value (EggSettingsSandwich *self, - const gchar *key); -void egg_settings_sandwich_set_value (EggSettingsSandwich *self, - const gchar *key, - GVariant *value); -gboolean egg_settings_sandwich_get_boolean (EggSettingsSandwich *self, - const gchar *key); -gdouble egg_settings_sandwich_get_double (EggSettingsSandwich *self, - const gchar *key); -gint egg_settings_sandwich_get_int (EggSettingsSandwich *self, - const gchar *key); -gchar *egg_settings_sandwich_get_string (EggSettingsSandwich *self, - const gchar *key); -guint egg_settings_sandwich_get_uint (EggSettingsSandwich *self, - const gchar *key); -void egg_settings_sandwich_set_boolean (EggSettingsSandwich *self, - const gchar *key, - gboolean val); -void egg_settings_sandwich_set_double (EggSettingsSandwich *self, - const gchar *key, - gdouble val); -void egg_settings_sandwich_set_int (EggSettingsSandwich *self, - const gchar *key, - gint val); -void egg_settings_sandwich_set_string (EggSettingsSandwich *self, - const gchar *key, - const gchar *val); -void egg_settings_sandwich_set_uint (EggSettingsSandwich *self, - const gchar *key, - guint val); -void egg_settings_sandwich_append (EggSettingsSandwich *self, - GSettings *settings); -void egg_settings_sandwich_bind (EggSettingsSandwich *self, - const gchar *key, - gpointer object, - const gchar *property, - GSettingsBindFlags flags); -void egg_settings_sandwich_bind_with_mapping (EggSettingsSandwich *self, - const gchar *key, - gpointer object, - const gchar *property, - GSettingsBindFlags flags, - GSettingsBindGetMapping get_mapping, - GSettingsBindSetMapping set_mapping, - gpointer user_data, - GDestroyNotify destroy); -void egg_settings_sandwich_unbind (EggSettingsSandwich *self, - const gchar *property); - -G_END_DECLS - -#endif /* EGG_SETTINGS_SANDWICH_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-signal-group.c gnome-usage-3.32.0/external/egg/egg-signal-group.c --- gnome-usage-3.30.0/external/egg/egg-signal-group.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-signal-group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,770 +0,0 @@ -/* egg-signal-group.c - * - * Copyright (C) 2015 Christian Hergert - * Copyright (C) 2015 Garrett Regier - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-signal-group" - -#include - -#include "egg-signal-group.h" - -/** - * SECTION:egg-signal-group - * @title: EggSignalGroup - * @short_description: Manage a collection of signals on a #GObject - * - * #EggSignalGroup manages to simplify the process of connecting - * many signals to a #GObject as a group. As such there is no API - * to disconnect a signal from the group. - * - * In particular, this allows you to: - * - * - Change the target instance, which automatically causes disconnection - * of the signals from the old instance and connecting to the new instance. - * - Block and unblock signals as a group - * - Ensuring that blocked state transfers across target instances. - * - * One place you might want to use such a structure is with #GtkTextView and - * #GtkTextBuffer. Often times, you'll need to connect to many signals on - * #GtkTextBuffer from a #GtkTextView subclass. This allows you to create a - * signal group during instance construction, simply bind the - * #GtkTextView:buffer property to #EggSignalGroup:target and connect - * all the signals you need. When the #GtkTextView:buffer property changes - * all of the signals will be transitioned correctly. - */ - -struct _EggSignalGroup -{ - GObject parent_instance; - - GObject *target; - GPtrArray *handlers; - GType target_type; - gsize block_count; -}; - -struct _EggSignalGroupClass -{ - GObjectClass parent_class; - - void (*bind) (EggSignalGroup *self, - GObject *target); - void (*unbind) (EggSignalGroup *self, - GObject *target); -}; - -typedef struct -{ - EggSignalGroup *group; - gulong handler_id; - GClosure *closure; - GObject *object; - guint signal_id; - GQuark signal_detail; - guint connect_after : 1; -} SignalHandler; - -G_DEFINE_TYPE (EggSignalGroup, egg_signal_group, G_TYPE_OBJECT) - -enum { - PROP_0, - PROP_TARGET, - PROP_TARGET_TYPE, - LAST_PROP -}; - -enum { - BIND, - UNBIND, - LAST_SIGNAL -}; - -static GParamSpec *properties [LAST_PROP]; -static guint signals [LAST_SIGNAL]; - -static void -egg_signal_group_set_target_type (EggSignalGroup *self, - GType target_type) -{ - g_assert (EGG_IS_SIGNAL_GROUP (self)); - g_assert (g_type_is_a (target_type, G_TYPE_OBJECT)); - - self->target_type = target_type; - - /* The class must be created at least once for the signals - * to be registered, otherwise g_signal_parse_name() will fail - */ - if (g_type_class_peek (target_type) == NULL) - g_type_class_unref (g_type_class_ref (target_type)); -} - -static void -egg_signal_group__target_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggSignalGroup *self = data; - gsize i; - - g_assert (EGG_IS_SIGNAL_GROUP (self)); - g_assert (where_object_was != NULL); - g_assert (self->target == where_object_was); - - for (i = 0; i < self->handlers->len; i++) - { - SignalHandler *handler; - - handler = g_ptr_array_index (self->handlers, i); - handler->handler_id = 0; - } - - self->target = NULL; - - g_signal_emit (self, signals [UNBIND], 0); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TARGET]); -} - -static void -egg_signal_group__connect_object_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggSignalGroup *self = data; - gsize i; - - g_assert (EGG_IS_SIGNAL_GROUP (self)); - g_assert (where_object_was != NULL); - - for (i = 0; i < self->handlers->len; ++i) - { - SignalHandler *handler; - - handler = g_ptr_array_index (self->handlers, i); - - if (handler->object == where_object_was) - { - handler->object = NULL; - g_ptr_array_remove_index_fast (self->handlers, i); - return; - } - } - - g_critical ("Failed to find handler for %p", (void *)where_object_was); -} - -static void -egg_signal_group_bind_handler (EggSignalGroup *self, - SignalHandler *handler) -{ - gsize i; - - g_assert (self != NULL); - g_assert (self->target != NULL); - g_assert (handler != NULL); - g_assert (handler->signal_id != 0); - g_assert (handler->closure != NULL); - g_assert (handler->handler_id == 0); - - handler->handler_id = g_signal_connect_closure_by_id (self->target, - handler->signal_id, - handler->signal_detail, - handler->closure, - handler->connect_after); - - g_assert (handler->handler_id != 0); - - for (i = 0; i < self->block_count; i++) - g_signal_handler_block (self->target, handler->handler_id); -} - -static void -egg_signal_group_bind (EggSignalGroup *self, - GObject *target) -{ - gsize i; - - g_assert (EGG_IS_SIGNAL_GROUP (self)); - g_assert (self->target == NULL); - g_assert (!target || G_IS_OBJECT (target)); - - if (target == NULL) - return; - - self->target = target; - g_object_weak_ref (self->target, - egg_signal_group__target_weak_notify, - self); - - g_object_ref (target); - - for (i = 0; i < self->handlers->len; i++) - { - SignalHandler *handler; - - handler = g_ptr_array_index (self->handlers, i); - egg_signal_group_bind_handler (self, handler); - } - - g_signal_emit (self, signals [BIND], 0, target); - g_object_unref (target); -} - -static void -egg_signal_group_unbind (EggSignalGroup *self) -{ - GObject *target; - gsize i; - - g_return_if_fail (EGG_IS_SIGNAL_GROUP (self)); - - if (self->target == NULL) - return; - - target = self->target; - self->target = NULL; - - g_object_weak_unref (target, - egg_signal_group__target_weak_notify, - self); - - for (i = 0; i < self->handlers->len; i++) - { - SignalHandler *handler; - gulong handler_id; - - handler = g_ptr_array_index (self->handlers, i); - - g_assert (handler != NULL); - g_assert (handler->signal_id != 0); - g_assert (handler->closure != NULL); - g_assert (handler->handler_id != 0); - - handler_id = handler->handler_id; - handler->handler_id = 0; - - g_signal_handler_disconnect (target, handler_id); - } - - g_signal_emit (self, signals [UNBIND], 0); -} - -static gboolean -egg_signal_group_check_target_type (EggSignalGroup *self, - gpointer target) -{ - if ((target != NULL) && - !g_type_is_a (G_OBJECT_TYPE (target), self->target_type)) - { - g_critical ("Failed to set EggSignalGroup of target type %s " - "using target %p of type %s", - g_type_name (self->target_type), - target, G_OBJECT_TYPE_NAME (target)); - return FALSE; - } - - return TRUE; -} - -/** - * egg_signal_group_block: - * @self: the #EggSignalGroup - * - * Blocks all signal handlers managed by @self so they will not - * be called during any signal emissions. Must be unblocked exactly - * the same number of times it has been blocked to become active again. - * - * This blocked state will be kept across changes of the target instance. - * - * See: g_signal_handler_block(). - */ -void -egg_signal_group_block (EggSignalGroup *self) -{ - gsize i; - - g_return_if_fail (EGG_IS_SIGNAL_GROUP (self)); - g_return_if_fail (self->block_count != G_MAXSIZE); - - self->block_count++; - - if (self->target == NULL) - return; - - for (i = 0; i < self->handlers->len; i++) - { - SignalHandler *handler; - - handler = g_ptr_array_index (self->handlers, i); - - g_assert (handler != NULL); - g_assert (handler->signal_id != 0); - g_assert (handler->closure != NULL); - g_assert (handler->handler_id != 0); - - g_signal_handler_block (self->target, handler->handler_id); - } -} - -/** - * egg_signal_group_unblock: - * @self: the #EggSignalGroup - * - * Unblocks all signal handlers managed by @self so they will be - * called again during any signal emissions unless it is blocked - * again. Must be unblocked exactly the same number of times it - * has been blocked to become active again. - * - * See: g_signal_handler_unblock(). - */ -void -egg_signal_group_unblock (EggSignalGroup *self) -{ - gsize i; - - g_return_if_fail (EGG_IS_SIGNAL_GROUP (self)); - g_return_if_fail (self->block_count != 0); - - self->block_count--; - - if (self->target == NULL) - return; - - for (i = 0; i < self->handlers->len; i++) - { - SignalHandler *handler; - - handler = g_ptr_array_index (self->handlers, i); - - g_assert (handler != NULL); - g_assert (handler->signal_id != 0); - g_assert (handler->closure != NULL); - g_assert (handler->handler_id != 0); - - g_signal_handler_unblock (self->target, handler->handler_id); - } -} - -/** - * egg_signal_group_get_target: - * @self: the #EggSignalGroup - * - * Gets the target instance used when connecting signals. - * - * Returns: (nullable) (transfer none) (type GObject): The target instance. - */ -gpointer -egg_signal_group_get_target (EggSignalGroup *self) -{ - g_return_val_if_fail (EGG_IS_SIGNAL_GROUP (self), NULL); - - return (gpointer)self->target; -} - -/** - * egg_signal_group_set_target: - * @self: the #EggSignalGroup. - * @target: (nullable) (type GObject): The target instance used - * when connecting signals. - * - * Sets the target instance used when connecting signals. Any signal - * that has been registered with egg_signal_group_connect_object() or - * similar functions will be connected to this object. - * - * If the target instance was previously set, signals will be - * disconnected from that object prior to connecting to @target. - */ -void -egg_signal_group_set_target (EggSignalGroup *self, - gpointer target) -{ - g_return_if_fail (EGG_IS_SIGNAL_GROUP (self)); - - if (target == (gpointer)self->target) - return; - - if (!egg_signal_group_check_target_type (self, target)) - return; - - egg_signal_group_unbind (self); - egg_signal_group_bind (self, target); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TARGET]); -} - -static void -signal_handler_free (gpointer data) -{ - SignalHandler *handler = data; - - if (handler->object != NULL) - { - g_object_weak_unref (handler->object, - egg_signal_group__connect_object_weak_notify, - handler->group); - handler->object = NULL; - } - - g_clear_pointer (&handler->closure, g_closure_unref); - handler->handler_id = 0; - handler->signal_id = 0; - handler->signal_detail = 0; - g_slice_free (SignalHandler, handler); -} - -static void -egg_signal_group_constructed (GObject *object) -{ - EggSignalGroup *self = (EggSignalGroup *)object; - - if (!egg_signal_group_check_target_type (self, self->target)) - egg_signal_group_set_target (self, NULL); - - G_OBJECT_CLASS (egg_signal_group_parent_class)->constructed (object); -} - -static void -egg_signal_group_dispose (GObject *object) -{ - EggSignalGroup *self = (EggSignalGroup *)object; - - egg_signal_group_unbind (self); - g_clear_pointer (&self->handlers, g_ptr_array_unref); - - G_OBJECT_CLASS (egg_signal_group_parent_class)->dispose (object); -} - -static void -egg_signal_group_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSignalGroup *self = EGG_SIGNAL_GROUP (object); - - switch (prop_id) - { - case PROP_TARGET: - g_value_set_object (value, egg_signal_group_get_target (self)); - break; - - case PROP_TARGET_TYPE: - g_value_set_gtype (value, self->target_type); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_signal_group_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSignalGroup *self = EGG_SIGNAL_GROUP (object); - - switch (prop_id) - { - case PROP_TARGET: - egg_signal_group_set_target (self, g_value_get_object (value)); - break; - - case PROP_TARGET_TYPE: - egg_signal_group_set_target_type (self, g_value_get_gtype (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_signal_group_class_init (EggSignalGroupClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructed = egg_signal_group_constructed; - object_class->dispose = egg_signal_group_dispose; - object_class->get_property = egg_signal_group_get_property; - object_class->set_property = egg_signal_group_set_property; - - /** - * EggSignalGroup:target - * - * The target instance used when connecting signals. - */ - properties [PROP_TARGET] = - g_param_spec_object ("target", - "Target", - "The target instance used when connecting signals.", - G_TYPE_OBJECT, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * EggSignalGroup:target-type - * - * The GType of the target property. - */ - properties [PROP_TARGET_TYPE] = - g_param_spec_gtype ("target-type", - "Target Type", - "The GType of the target property.", - G_TYPE_OBJECT, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - /** - * EggSignalGroup::bind: - * @self: the #EggSignalGroup - * @instance: a #GObject - * - * This signal is emitted when the target instance of @self - * is set to a new #GObject. - * - * This signal will only be emitted if the target of @self is non-%NULL. - */ - signals [BIND] = - g_signal_new ("bind", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, NULL, - G_TYPE_NONE, - 1, - G_TYPE_OBJECT); - - /** - * EggSignalGroup::unbind: - * @self: a #EggSignalGroup - * - * This signal is emitted when the target instance of @self - * is set to a new #GObject. - * - * This signal will only be emitted if the previous target - * of @self is non-%NULL. - */ - signals [UNBIND] = - g_signal_new ("unbind", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, NULL, - G_TYPE_NONE, - 0); -} - -static void -egg_signal_group_init (EggSignalGroup *self) -{ - self->handlers = g_ptr_array_new_with_free_func (signal_handler_free); - self->target_type = G_TYPE_OBJECT; -} - -/** - * egg_signal_group_new: - * @target_type: the #GType of the target instance. - * - * Creates a new #EggSignalGroup for target instances of @target_type. - * - * Returns: a new #EggSignalGroup - */ -EggSignalGroup * -egg_signal_group_new (GType target_type) -{ - g_return_val_if_fail (g_type_is_a (target_type, G_TYPE_OBJECT), NULL); - - return g_object_new (EGG_TYPE_SIGNAL_GROUP, - "target-type", target_type, - NULL); -} - -static void -egg_signal_group_connect_full (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback callback, - gpointer data, - GClosureNotify notify, - GConnectFlags flags, - gboolean is_object) -{ - SignalHandler *handler; - GClosure *closure; - guint signal_id; - GQuark signal_detail; - - g_return_if_fail (EGG_IS_SIGNAL_GROUP (self)); - g_return_if_fail (detailed_signal != NULL); - g_return_if_fail (g_signal_parse_name (detailed_signal, self->target_type, - &signal_id, &signal_detail, TRUE) != 0); - g_return_if_fail (callback != NULL); - - if ((flags & G_CONNECT_SWAPPED) != 0) - closure = g_cclosure_new_swap (callback, data, notify); - else - closure = g_cclosure_new (callback, data, notify); - - handler = g_slice_new0 (SignalHandler); - handler->group = self; - handler->signal_id = signal_id; - handler->signal_detail = signal_detail; - handler->closure = g_closure_ref (closure); - handler->connect_after = ((flags & G_CONNECT_AFTER) != 0); - - g_closure_sink (closure); - - if (is_object) - { - /* This is what g_cclosure_new_object() does */ - g_object_watch_closure (data, closure); - - handler->object = data; - g_object_weak_ref (data, - egg_signal_group__connect_object_weak_notify, - self); - } - - g_ptr_array_add (self->handlers, handler); - - if (self->target != NULL) - egg_signal_group_bind_handler (self, handler); -} - -/** - * egg_signal_group_connect_object: (skip) - * @self: a #EggSignalGroup - * @detailed_signal: a string of the form "signal-name::detail" - * @c_handler: (scope notified): the #GCallback to connect - * @object: the #GObject to pass as data to @callback calls - * - * Connects @callback to the signal @detailed_signal - * on the target object of @self. - * - * Ensures that the @object stays alive during the call to @callback - * by temporarily adding a reference count. When the @object is destroyed - * the signal handler will automatically be removed. - * - * See: g_signal_connect_object(). - */ -void -egg_signal_group_connect_object (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer object, - GConnectFlags flags) -{ - g_return_if_fail (G_IS_OBJECT (object)); - - egg_signal_group_connect_full (self, detailed_signal, c_handler, object, NULL, - flags, TRUE); -} - -/** - * egg_signal_group_connect_data: - * @self: a #EggSignalGroup - * @detailed_signal: a string of the form "signal-name::detail" - * @c_handler: (scope notified) (closure data) (destroy notify): the #GCallback to connect - * @data: the data to pass to @callback calls - * @notify: function to be called when disposing of @self - * @flags: the flags used to create the signal connection - * - * Connects @callback to the signal @detailed_signal - * on the target instance of @self. - * - * See: g_signal_connect_data(). - */ -void -egg_signal_group_connect_data (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data, - GClosureNotify notify, - GConnectFlags flags) -{ - egg_signal_group_connect_full (self, detailed_signal, c_handler, data, notify, - flags, FALSE); -} - -/** - * egg_signal_group_connect: (skip) - * @self: a #EggSignalGroup - * @detailed_signal: a string of the form "signal-name::detail" - * @c_handler: (scope notified): the #GCallback to connect - * @data: the data to pass to @callback calls - * - * Connects @callback to the signal @detailed_signal - * on the target instance of @self. - * - * See: g_signal_connect(). - */ -void -egg_signal_group_connect (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data) -{ - egg_signal_group_connect_full (self, detailed_signal, c_handler, data, NULL, - 0, FALSE); -} - -/** - * egg_signal_group_connect_after: (skip) - * @self: a #EggSignalGroup - * @detailed_signal: a string of the form "signal-name::detail" - * @c_handler: (scope notified): the #GCallback to connect - * @data: the data to pass to @callback calls - * - * Connects @callback to the signal @detailed_signal - * on the target instance of @self. - * - * The @callback will be called after the default handler of the signal. - * - * See: g_signal_connect_after(). - */ -void -egg_signal_group_connect_after (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data) -{ - egg_signal_group_connect_full (self, detailed_signal, c_handler, - data, NULL, G_CONNECT_AFTER, FALSE); -} - -/** - * egg_signal_group_connect_swapped: - * @self: a #EggSignalGroup - * @detailed_signal: a string of the form "signal-name::detail" - * @c_handler: (scope async): the #GCallback to connect - * @data: the data to pass to @callback calls - * - * Connects @callback to the signal @detailed_signal - * on the target instance of @self. - * - * The instance on which the signal is emitted and @data - * will be swapped when calling @callback. - * - * See: g_signal_connect_swapped(). - */ -void -egg_signal_group_connect_swapped (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data) -{ - egg_signal_group_connect_full (self, detailed_signal, c_handler, data, NULL, - G_CONNECT_SWAPPED, FALSE); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-signal-group.h gnome-usage-3.32.0/external/egg/egg-signal-group.h --- gnome-usage-3.30.0/external/egg/egg-signal-group.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-signal-group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* egg-signal-group.h - * - * Copyright (C) 2015 Christian Hergert - * Copyright (C) 2015 Garrett Regier - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SIGNAL_GROUP_H -#define EGG_SIGNAL_GROUP_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SIGNAL_GROUP (egg_signal_group_get_type()) - -G_DECLARE_FINAL_TYPE (EggSignalGroup, egg_signal_group, EGG, SIGNAL_GROUP, GObject) - -EggSignalGroup *egg_signal_group_new (GType target_type); - -void egg_signal_group_set_target (EggSignalGroup *self, - gpointer target); -gpointer egg_signal_group_get_target (EggSignalGroup *self); - -void egg_signal_group_block (EggSignalGroup *self); -void egg_signal_group_unblock (EggSignalGroup *self); - -void egg_signal_group_connect_object (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer object, - GConnectFlags flags); -void egg_signal_group_connect_data (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data, - GClosureNotify notify, - GConnectFlags flags); -void egg_signal_group_connect (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data); -void egg_signal_group_connect_after (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data); -void egg_signal_group_connect_swapped (EggSignalGroup *self, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data); - -G_END_DECLS - -#endif /* EGG_SIGNAL_GROUP_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-simple-label.c gnome-usage-3.32.0/external/egg/egg-simple-label.c --- gnome-usage-3.30.0/external/egg/egg-simple-label.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-simple-label.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,390 +0,0 @@ -/* egg-simple-label.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#include "egg-simple-label.h" - -struct _EggSimpleLabel -{ - GtkWidget parent_instance; - - gchar *label; - guint label_len; - - gint width_chars; - - PangoLayout *cached_layout; - - gfloat xalign; - - gint cached_width_request; - gint cached_height_request; - gint real_width; - gint real_height; -}; - -G_DEFINE_TYPE (EggSimpleLabel, egg_simple_label, GTK_TYPE_WIDGET) - -enum { - PROP_0, - PROP_LABEL, - PROP_WIDTH_CHARS, - PROP_XALIGN, - N_PROPS -}; - -static GParamSpec *properties [N_PROPS]; - -static void -egg_simple_label_calculate_size (EggSimpleLabel *self) -{ - PangoContext *context; - PangoLayout *layout; - - g_assert (EGG_IS_SIMPLE_LABEL (self)); - - self->cached_height_request = -1; - self->cached_width_request = -1; - - if (self->label == NULL && self->width_chars <= 0) - { - self->cached_height_request = 0; - self->cached_width_request = 0; - self->real_width = 0; - self->real_height = 0; - return; - } - - if (NULL == (context = gtk_widget_get_pango_context (GTK_WIDGET (self)))) - return; - - g_clear_object (&self->cached_layout); - - layout = pango_layout_new (context); - - if (self->width_chars >= 0) - { - gchar str[self->width_chars]; - memset (str, '9', self->width_chars); - pango_layout_set_text (layout, str, self->width_chars); - } - else - { - pango_layout_set_text (layout, self->label, self->label_len); - } - - pango_layout_get_pixel_size (layout, - &self->cached_width_request, - &self->cached_height_request); - - if (self->label != NULL) - pango_layout_set_text (layout, self->label, self->label_len); - else - pango_layout_set_text (layout, "", 0); - - pango_layout_get_pixel_size (layout, &self->real_width, &self->real_height); - - if (self->real_width > self->cached_width_request) - self->cached_width_request = self->real_width; - - if (self->real_height > self->cached_height_request) - self->cached_height_request = self->real_height; - - self->cached_layout = layout; -} - -static void -egg_simple_label_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggSimpleLabel *self = (EggSimpleLabel *)widget; - - g_assert (EGG_IS_SIMPLE_LABEL (self)); - - if (self->cached_width_request == -1) - egg_simple_label_calculate_size (self); - - *min_width = *nat_width = self->cached_width_request; -} - -static void -egg_simple_label_get_preferred_height (GtkWidget *widget, - gint *min_height, - gint *nat_height) -{ - EggSimpleLabel *self = (EggSimpleLabel *)widget; - - g_assert (EGG_IS_SIMPLE_LABEL (self)); - - if (self->cached_height_request == -1) - egg_simple_label_calculate_size (self); - - *min_height = *nat_height = self->cached_height_request; -} - -static gboolean -egg_simple_label_draw (GtkWidget *widget, - cairo_t *cr) -{ - EggSimpleLabel *self = (EggSimpleLabel *)widget; - GtkAllocation alloc; - gdouble x; - gdouble y; - - if (self->label == NULL) - return GDK_EVENT_PROPAGATE; - - gtk_widget_get_allocation (widget, &alloc); - - if (self->cached_width_request == -1 || - self->cached_height_request == -1 || - self->cached_layout == NULL) - egg_simple_label_calculate_size (self); - - x = (alloc.width - self->real_width) * self->xalign; - y = (alloc.height - self->real_height) / 2; - - /* - * We should support baseline here, but we don't actually - * get a real baseline yet where this is used in Builder, - * so I'm going to punt on it. - */ - - gtk_render_layout (gtk_widget_get_style_context (widget), - cr, x, y, self->cached_layout); - - return GDK_EVENT_PROPAGATE; -} - -static void -egg_simple_label_destroy (GtkWidget *widget) -{ - EggSimpleLabel *self = (EggSimpleLabel *)widget; - - g_clear_pointer (&self->label, g_free); - g_clear_object (&self->cached_layout); - - GTK_WIDGET_CLASS (egg_simple_label_parent_class)->destroy (widget); -} - -static void -egg_simple_label_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSimpleLabel *self = EGG_SIMPLE_LABEL (object); - - switch (prop_id) - { - case PROP_LABEL: - g_value_set_string (value, self->label); - break; - - case PROP_WIDTH_CHARS: - g_value_set_int (value, self->width_chars); - break; - - case PROP_XALIGN: - g_value_set_float (value, self->xalign); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_simple_label_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSimpleLabel *self = EGG_SIMPLE_LABEL (object); - - switch (prop_id) - { - case PROP_LABEL: - egg_simple_label_set_label (self, g_value_get_string (value)); - break; - - case PROP_WIDTH_CHARS: - egg_simple_label_set_width_chars (self, g_value_get_int (value)); - break; - - case PROP_XALIGN: - egg_simple_label_set_xalign (self, g_value_get_float (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_simple_label_class_init (EggSimpleLabelClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = egg_simple_label_get_property; - object_class->set_property = egg_simple_label_set_property; - - widget_class->destroy = egg_simple_label_destroy; - widget_class->draw = egg_simple_label_draw; - widget_class->get_preferred_width = egg_simple_label_get_preferred_width; - widget_class->get_preferred_height = egg_simple_label_get_preferred_height; - - gtk_widget_class_set_css_name (widget_class, "label"); - - properties [PROP_LABEL] = - g_param_spec_string ("label", - NULL, - NULL, - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_WIDTH_CHARS] = - g_param_spec_int ("width-chars", - NULL, - NULL, - -1, - 1000, - -1, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_XALIGN] = - g_param_spec_float ("xalign", - NULL, - NULL, - 0.0, - 1.0, - 0.5, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); -} - -static void -egg_simple_label_init (EggSimpleLabel *self) -{ - gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); - - self->width_chars = -1; - self->xalign = 0.5; -} - -GtkWidget * -egg_simple_label_new (const gchar *label) -{ - return g_object_new (EGG_TYPE_SIMPLE_LABEL, NULL); -} - -const gchar * -egg_simple_label_get_label (EggSimpleLabel *self) -{ - g_return_val_if_fail (EGG_IS_SIMPLE_LABEL (self), NULL); - - return self->label; -} - -void -egg_simple_label_set_label (EggSimpleLabel *self, - const gchar *label) -{ - g_return_if_fail (EGG_IS_SIMPLE_LABEL (self)); - - if (g_strcmp0 (label, self->label) != 0) - { - guint last_len = self->label_len; - - g_free (self->label); - - self->label = g_strdup (label); - self->label_len = label ? strlen (label) : 0; - - self->cached_width_request = -1; - self->cached_height_request = -1; - - /* - * If width chars is not set, then we always have to calculate the size - * change. If we are growing larger, we also might have to relcalculate - * if the new length is larger than our precalculated length. If we are - * shrinking from an overgrow position, we also have to resize. - * - * But in *most* cases, we can avoid the resize altogether. This is - * a necessity in the situations where this widget is valuable (such - * as the cursor coordinate label in Builder). - */ - if ((self->width_chars < 0) || - ((self->label_len > self->width_chars) && (last_len != self->label_len)) || - ((last_len > self->width_chars) && (self->label_len <= self->width_chars))) - gtk_widget_queue_resize (GTK_WIDGET (self)); - - gtk_widget_queue_draw (GTK_WIDGET (self)); - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_LABEL]); - } -} - -gint -egg_simple_label_get_width_chars (EggSimpleLabel *self) -{ - g_return_val_if_fail (EGG_IS_SIMPLE_LABEL (self), -1); - - return self->width_chars; -} - -void -egg_simple_label_set_width_chars (EggSimpleLabel *self, - gint width_chars) -{ - g_return_if_fail (EGG_IS_SIMPLE_LABEL (self)); - g_return_if_fail (width_chars >= -1); - g_return_if_fail (width_chars <= 100); - - if (self->width_chars != width_chars) - { - self->width_chars = width_chars; - self->cached_width_request = -1; - self->cached_height_request = -1; - gtk_widget_queue_resize (GTK_WIDGET (self)); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_WIDTH_CHARS]); - } -} - -gfloat -egg_simple_label_get_xalign (EggSimpleLabel *self) -{ - g_return_val_if_fail (EGG_IS_SIMPLE_LABEL (self), 0.0); - - return self->xalign; -} - -void -egg_simple_label_set_xalign (EggSimpleLabel *self, - gfloat xalign) -{ - if (self->xalign != xalign) - { - self->xalign = xalign; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_XALIGN]); - } -} diff -Nru gnome-usage-3.30.0/external/egg/egg-simple-label.h gnome-usage-3.32.0/external/egg/egg-simple-label.h --- gnome-usage-3.30.0/external/egg/egg-simple-label.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-simple-label.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* egg-simple-label.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SIMPLE_LABEL_H -#define EGG_SIMPLE_LABEL_H - -#include - -G_BEGIN_DECLS - -/* - * This widget has one very simple purpose. Allow updating a simple - * amount of text without causing resizes to propagate up the widget - * hierarchy. Therefore, it only supports a very minimal amount of - * features. The label text, and the width-chars to use for sizing. - */ - -#define EGG_TYPE_SIMPLE_LABEL (egg_simple_label_get_type()) - -G_DECLARE_FINAL_TYPE (EggSimpleLabel, egg_simple_label, EGG, SIMPLE_LABEL, GtkWidget) - -GtkWidget *egg_simple_label_new (const gchar *label); -const gchar *egg_simple_label_get_label (EggSimpleLabel *self); -void egg_simple_label_set_label (EggSimpleLabel *self, - const gchar *label); -gint egg_simple_label_get_width_chars (EggSimpleLabel *self); -void egg_simple_label_set_width_chars (EggSimpleLabel *self, - gint width_chars); -gfloat egg_simple_label_get_xalign (EggSimpleLabel *self); -void egg_simple_label_set_xalign (EggSimpleLabel *self, - gfloat xalign); - -G_END_DECLS - -#endif /* EGG_SIMPLE_LABEL_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-simple-popover.c gnome-usage-3.32.0/external/egg/egg-simple-popover.c --- gnome-usage-3.30.0/external/egg/egg-simple-popover.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-simple-popover.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,415 +0,0 @@ -/* egg-simple-popover.c - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "egg-simple-popover.h" - -typedef struct -{ - GtkPopover parent_instance; - - GtkLabel *title; - GtkLabel *message; - GtkEntry *entry; - GtkButton *button; -} EggSimplePopoverPrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (EggSimplePopover, egg_simple_popover, GTK_TYPE_POPOVER) - -enum { - PROP_0, - PROP_BUTTON_TEXT, - PROP_MESSAGE, - PROP_READY, - PROP_TEXT, - PROP_TITLE, - LAST_PROP -}; - -enum { - ACTIVATE, - CHANGED, - INSERT_TEXT, - LAST_SIGNAL -}; - -static GParamSpec *properties [LAST_PROP]; -static guint signals [LAST_SIGNAL]; - -const gchar * -egg_simple_popover_get_button_text (EggSimplePopover *self) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SIMPLE_POPOVER (self), NULL); - - return gtk_button_get_label (priv->button); -} - -void -egg_simple_popover_set_button_text (EggSimplePopover *self, - const gchar *button_text) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_if_fail (EGG_IS_SIMPLE_POPOVER (self)); - - gtk_button_set_label (priv->button, button_text); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BUTTON_TEXT]); -} - -const gchar * -egg_simple_popover_get_message (EggSimplePopover *self) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SIMPLE_POPOVER (self), NULL); - - return gtk_label_get_text (priv->message); -} - -void -egg_simple_popover_set_message (EggSimplePopover *self, - const gchar *message) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_if_fail (EGG_IS_SIMPLE_POPOVER (self)); - - gtk_label_set_label (priv->message, message); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MESSAGE]); -} - -gboolean -egg_simple_popover_get_ready (EggSimplePopover *self) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SIMPLE_POPOVER (self), FALSE); - - return gtk_widget_get_sensitive (GTK_WIDGET (priv->button)); -} - -void -egg_simple_popover_set_ready (EggSimplePopover *self, - gboolean ready) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_if_fail (EGG_IS_SIMPLE_POPOVER (self)); - - gtk_widget_set_sensitive (GTK_WIDGET (priv->button), ready); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_READY]); -} - -const gchar * -egg_simple_popover_get_text (EggSimplePopover *self) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SIMPLE_POPOVER (self), NULL); - - return gtk_entry_get_text (priv->entry); -} - -void -egg_simple_popover_set_text (EggSimplePopover *self, - const gchar *text) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_if_fail (EGG_IS_SIMPLE_POPOVER (self)); - - gtk_entry_set_text (priv->entry, text); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TEXT]); -} - -const gchar * -egg_simple_popover_get_title (EggSimplePopover *self) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SIMPLE_POPOVER (self), NULL); - - return gtk_label_get_label (priv->title); -} - -void -egg_simple_popover_set_title (EggSimplePopover *self, - const gchar *title) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_return_if_fail (EGG_IS_SIMPLE_POPOVER (self)); - - gtk_label_set_label (priv->title, title); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]); -} - -static void -egg_simple_popover_button_clicked (EggSimplePopover *self, - GtkButton *button) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - const gchar *text; - - g_assert (EGG_IS_SIMPLE_POPOVER (self)); - g_assert (GTK_IS_BUTTON (button)); - - text = gtk_entry_get_text (GTK_ENTRY (priv->entry)); - g_signal_emit (self, signals [ACTIVATE], 0, text); - gtk_popover_popdown (GTK_POPOVER (self)); -} - -static void -egg_simple_popover_entry_activate (EggSimplePopover *self, - GtkEntry *entry) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - g_assert (EGG_IS_SIMPLE_POPOVER (self)); - g_assert (GTK_IS_ENTRY (entry)); - - if (egg_simple_popover_get_ready (self)) - gtk_widget_activate (GTK_WIDGET (priv->button)); -} - -static void -egg_simple_popover_entry_changed (EggSimplePopover *self, - GtkEntry *entry) -{ - g_assert (EGG_IS_SIMPLE_POPOVER (self)); - g_assert (GTK_IS_ENTRY (entry)); - - g_signal_emit (self, signals [CHANGED], 0); -} - -static void -egg_simple_popover_entry_insert_text (EggSimplePopover *self, - gchar *new_text, - gint new_text_length, - gint *position, - GtkEntry *entry) -{ - gboolean ret = GDK_EVENT_PROPAGATE; - guint pos; - guint n_chars; - - g_assert (EGG_IS_SIMPLE_POPOVER (self)); - g_assert (new_text != NULL); - g_assert (position != NULL); - - pos = *position; - n_chars = (new_text_length >= 0) ? new_text_length : g_utf8_strlen (new_text, -1); - - g_signal_emit (self, signals [INSERT_TEXT], 0, pos, new_text, n_chars, &ret); - - if (ret == GDK_EVENT_STOP) - g_signal_stop_emission_by_name (entry, "insert-text"); -} - -static void -egg_simple_popover_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSimplePopover *self = EGG_SIMPLE_POPOVER (object); - - switch (prop_id) - { - case PROP_BUTTON_TEXT: - g_value_set_string (value, egg_simple_popover_get_button_text (self)); - break; - - case PROP_MESSAGE: - g_value_set_string (value, egg_simple_popover_get_message (self)); - break; - - case PROP_READY: - g_value_set_boolean (value, egg_simple_popover_get_ready (self)); - break; - - case PROP_TEXT: - g_value_set_string (value, egg_simple_popover_get_text (self)); - break; - - case PROP_TITLE: - g_value_set_string (value, egg_simple_popover_get_title (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_simple_popover_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSimplePopover *self = EGG_SIMPLE_POPOVER (object); - - switch (prop_id) - { - case PROP_BUTTON_TEXT: - egg_simple_popover_set_button_text (self, g_value_get_string (value)); - break; - - case PROP_MESSAGE: - egg_simple_popover_set_message (self, g_value_get_string (value)); - break; - - case PROP_READY: - egg_simple_popover_set_ready (self, g_value_get_boolean (value)); - break; - - case PROP_TEXT: - egg_simple_popover_set_text (self, g_value_get_string (value)); - break; - - case PROP_TITLE: - egg_simple_popover_set_title (self, g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_simple_popover_class_init (EggSimplePopoverClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->get_property = egg_simple_popover_get_property; - object_class->set_property = egg_simple_popover_set_property; - - properties [PROP_BUTTON_TEXT] = - g_param_spec_string ("button-text", - "Button Text", - "Button Text", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_MESSAGE] = - g_param_spec_string ("message", - "Message", - "Message", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_READY] = - g_param_spec_boolean ("ready", - "Ready", - "Ready", - FALSE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_TEXT] = - g_param_spec_string ("text", - "Text", - "Text", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_TITLE] = - g_param_spec_string ("title", - "Title", - "Title", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - signals [ACTIVATE] = - g_signal_new ("activate", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EggSimplePopoverClass, activate), - NULL, NULL, NULL, - G_TYPE_NONE, - 1, - G_TYPE_STRING); - - signals [CHANGED] = - g_signal_new ("changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EggSimplePopoverClass, insert_text), - NULL, NULL, NULL, - G_TYPE_NONE, - 0); - - signals [INSERT_TEXT] = - g_signal_new ("insert-text", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EggSimplePopoverClass, insert_text), - NULL, NULL, NULL, - G_TYPE_BOOLEAN, - 3, - G_TYPE_UINT, - G_TYPE_STRING, - G_TYPE_UINT); - - gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/libegg-private/egg-simple-popover.ui"); - gtk_widget_class_bind_template_child_private (widget_class, EggSimplePopover, title); - gtk_widget_class_bind_template_child_private (widget_class, EggSimplePopover, message); - gtk_widget_class_bind_template_child_private (widget_class, EggSimplePopover, entry); - gtk_widget_class_bind_template_child_private (widget_class, EggSimplePopover, button); -} - -static void -egg_simple_popover_init (EggSimplePopover *self) -{ - EggSimplePopoverPrivate *priv = egg_simple_popover_get_instance_private (self); - - gtk_widget_init_template (GTK_WIDGET (self)); - - g_signal_connect_object (priv->button, - "clicked", - G_CALLBACK (egg_simple_popover_button_clicked), - self, - G_CONNECT_SWAPPED); - - g_signal_connect_object (priv->entry, - "changed", - G_CALLBACK (egg_simple_popover_entry_changed), - self, - G_CONNECT_SWAPPED); - - g_signal_connect_object (priv->entry, - "activate", - G_CALLBACK (egg_simple_popover_entry_activate), - self, - G_CONNECT_SWAPPED); - - g_signal_connect_object (priv->entry, - "insert-text", - G_CALLBACK (egg_simple_popover_entry_insert_text), - self, - G_CONNECT_SWAPPED); -} - -GtkWidget * -egg_simple_popover_new (void) -{ - return g_object_new (EGG_TYPE_SIMPLE_POPOVER, NULL); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-simple-popover.h gnome-usage-3.32.0/external/egg/egg-simple-popover.h --- gnome-usage-3.30.0/external/egg/egg-simple-popover.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-simple-popover.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* egg-simple-popover.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SIMPLE_POPOVER_H -#define EGG_SIMPLE_POPOVER_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SIMPLE_POPOVER (egg_simple_popover_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggSimplePopover, egg_simple_popover, EGG, SIMPLE_POPOVER, GtkPopover) - -struct _EggSimplePopoverClass -{ - GtkPopoverClass parent; - - /** - * EggSimplePopover::activate: - * @self: The #EggSimplePopover instance. - * @text: The text at the time of activation. - * - * This signal is emitted when the popover's forward button is activated. - * Connect to this signal to perform your forward progress. - */ - void (*activate) (EggSimplePopover *self, - const gchar *text); - - /** - * EggSimplePopover::insert-text: - * @self: A #EggSimplePopover. - * @position: the position in UTF-8 characters. - * @chars: the NULL terminated UTF-8 text to insert. - * @n_chars: the number of UTF-8 characters in chars. - * - * Use this signal to determine if text should be allowed to be inserted - * into the text buffer. Return GDK_EVENT_STOP to prevent the text from - * being inserted. - */ - gboolean (*insert_text) (EggSimplePopover *self, - guint position, - const gchar *chars, - guint n_chars); - - - /** - * EggSimplePopover::changed: - * @self: A #EggSimplePopover. - * - * This signal is emitted when the entry text changes. - */ - void (*changed) (EggSimplePopover *self); -}; - -GtkWidget *egg_simple_popover_new (void); -const gchar *egg_simple_popover_get_text (EggSimplePopover *self); -void egg_simple_popover_set_text (EggSimplePopover *self, - const gchar *text); -const gchar *egg_simple_popover_get_message (EggSimplePopover *self); -void egg_simple_popover_set_message (EggSimplePopover *self, - const gchar *message); -const gchar *egg_simple_popover_get_title (EggSimplePopover *self); -void egg_simple_popover_set_title (EggSimplePopover *self, - const gchar *title); -const gchar *egg_simple_popover_get_button_text (EggSimplePopover *self); -void egg_simple_popover_set_button_text (EggSimplePopover *self, - const gchar *button_text); -gboolean egg_simple_popover_get_ready (EggSimplePopover *self); -void egg_simple_popover_set_ready (EggSimplePopover *self, - gboolean ready); - -G_END_DECLS - -#endif /* EGG_SIMPLE_POPOVER_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-simple-popover.ui gnome-usage-3.32.0/external/egg/egg-simple-popover.ui --- gnome-usage-3.30.0/external/egg/egg-simple-popover.ui 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-simple-popover.ui 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ - - - - - diff -Nru gnome-usage-3.30.0/external/egg/egg-slider.c gnome-usage-3.32.0/external/egg/egg-slider.c --- gnome-usage-3.30.0/external/egg/egg-slider.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-slider.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,976 +0,0 @@ -/* egg-slider.c - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#include "egg-animation.h" -#include "egg-slider.h" - -#define clear_weak_pointer(ptr) \ - (*(ptr) ? (g_object_remove_weak_pointer((GObject*)*(ptr), (gpointer*)ptr),*(ptr)=NULL,1) : 0) - -#define set_weak_pointer(ptr,obj) \ - ((obj!=*(ptr))?(clear_weak_pointer(ptr),*(ptr)=obj,((obj)?g_object_add_weak_pointer((GObject*)obj,(gpointer*)ptr),NULL:NULL),1):0) - -typedef struct -{ - GtkWidget *widget; - GdkWindow *window; - GtkAllocation allocation; - EggSliderPosition position : 3; -} EggSliderChild; - -typedef struct -{ - GtkAdjustment *h_adj; - GtkAdjustment *v_adj; - - EggAnimation *h_anim; - EggAnimation *v_anim; - - GPtrArray *children; - - EggSliderPosition position : 3; -} EggSliderPrivate; - -static void buildable_iface_init (GtkBuildableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (EggSlider, egg_slider, GTK_TYPE_CONTAINER, - G_ADD_PRIVATE (EggSlider) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init)) - -enum { - PROP_0, - PROP_POSITION, - LAST_PROP -}; - -enum { - CHILD_PROP_0, - CHILD_PROP_POSITION, -}; - -#define ANIMATION_MODE EGG_ANIMATION_EASE_IN_QUAD -#define ANIMATION_DURATION 150 - -static GParamSpec *properties [LAST_PROP]; - -static void -egg_slider_child_free (EggSliderChild *child) -{ - g_slice_free (EggSliderChild, child); -} - -static void -egg_slider_compute_margin (EggSlider *self, - gint *x_margin, - gint *y_margin) -{ - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gdouble x_ratio; - gdouble y_ratio; - gsize i; - gint real_top_margin = 0; - gint real_bottom_margin = 0; - gint real_left_margin = 0; - gint real_right_margin = 0; - - g_assert (EGG_IS_SLIDER (self)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - gint margin; - - child = g_ptr_array_index (priv->children, i); - - switch (child->position) - { - case EGG_SLIDER_NONE: - break; - - case EGG_SLIDER_BOTTOM: - gtk_widget_get_preferred_height (child->widget, NULL, &margin); - real_bottom_margin = MAX (real_bottom_margin, margin); - break; - - case EGG_SLIDER_TOP: - gtk_widget_get_preferred_height (child->widget, NULL, &margin); - real_top_margin = MAX (real_top_margin, margin); - break; - - case EGG_SLIDER_LEFT: - gtk_widget_get_preferred_width (child->widget, NULL, &margin); - real_left_margin = MAX (real_left_margin, margin); - break; - - case EGG_SLIDER_RIGHT: - gtk_widget_get_preferred_width (child->widget, NULL, &margin); - real_right_margin = MAX (real_right_margin, margin); - break; - - default: - g_assert_not_reached (); - break; - } - } - - x_ratio = gtk_adjustment_get_value (priv->h_adj); - y_ratio = gtk_adjustment_get_value (priv->v_adj); - - if (x_ratio < 0.0) - *x_margin = x_ratio * real_left_margin; - else if (x_ratio > 0.0) - *x_margin = x_ratio * real_right_margin; - else - *x_margin = 0; - - if (y_ratio < 0.0) - *y_margin = y_ratio * real_bottom_margin; - else if (y_ratio > 0.0) - *y_margin = y_ratio * real_top_margin; - else - *y_margin = 0; -} - -static void -egg_slider_compute_child_allocation (EggSlider *self, - EggSliderChild *child, - GtkAllocation *window_allocation, - GtkAllocation *child_allocation) -{ - GtkAllocation real_window_allocation; - GtkAllocation real_child_allocation; - gint nat_height; - gint nat_width; - gint x_margin; - gint y_margin; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (child != NULL); - g_assert (GTK_IS_WIDGET (child->widget)); - - gtk_widget_get_allocation (GTK_WIDGET (self), &real_window_allocation); - - egg_slider_compute_margin (self, &x_margin, &y_margin); - - if (child->position == EGG_SLIDER_NONE) - { - real_child_allocation.y = y_margin; - real_child_allocation.x = x_margin; - real_child_allocation.width = real_window_allocation.width; - real_child_allocation.height = real_window_allocation.height; - } - else if (child->position == EGG_SLIDER_TOP) - { - gtk_widget_get_preferred_height (child->widget, NULL, &nat_height); - - real_window_allocation.y = real_window_allocation.y - nat_height + y_margin; - real_window_allocation.height = nat_height; - - real_child_allocation.y = 0; - real_child_allocation.x = 0; - real_child_allocation.height = nat_height; - real_child_allocation.width = real_window_allocation.width; - } - else if (child->position == EGG_SLIDER_BOTTOM) - { - gtk_widget_get_preferred_height (child->widget, NULL, &nat_height); - - real_window_allocation.y = real_window_allocation.y + real_window_allocation.height + y_margin; - real_window_allocation.height = nat_height; - - real_child_allocation.y = 0; - real_child_allocation.x = 0; - real_child_allocation.height = nat_height; - real_child_allocation.width = real_window_allocation.width; - } - else if (child->position == EGG_SLIDER_RIGHT) - { - gtk_widget_get_preferred_width (child->widget, NULL, &nat_width); - - real_window_allocation.x = real_window_allocation.x + real_window_allocation.width + x_margin; - real_window_allocation.width = nat_width; - - real_child_allocation.y = 0; - real_child_allocation.x = 0; - real_child_allocation.height = real_window_allocation.height; - real_child_allocation.width = nat_width; - } - else if (child->position == EGG_SLIDER_LEFT) - { - gtk_widget_get_preferred_width (child->widget, NULL, &nat_width); - - real_window_allocation.x = real_window_allocation.x - nat_width + x_margin; - real_window_allocation.width = nat_width; - - real_child_allocation.y = 0; - real_child_allocation.x = 0; - real_child_allocation.height = real_window_allocation.height; - real_child_allocation.width = nat_width; - } - else - { - g_assert_not_reached (); - } - - if (window_allocation) - *window_allocation = real_window_allocation; - - if (child_allocation) - *child_allocation = real_child_allocation; -} - -static GdkWindow * -egg_slider_create_child_window (EggSlider *self, - EggSliderChild *child) -{ - GtkWidget *widget = (GtkWidget *)self; - GdkWindow *window; - GtkAllocation allocation; - GdkWindowAttr attributes; - gint attributes_mask; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (child != NULL); - - egg_slider_compute_child_allocation (self, child, &allocation, NULL); - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.width = allocation.width; - attributes.height = allocation.height; - attributes.x = allocation.x; - attributes.y = allocation.y; - attributes.visual = gtk_widget_get_visual (widget); - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; - attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; - - window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask); - gtk_widget_register_window (widget, window); - - gtk_widget_set_parent_window (child->widget, window); - - return window; -} - -static void -egg_slider_add (GtkContainer *container, - GtkWidget *widget) -{ - EggSlider *self = (EggSlider *)container; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - EggSliderChild *child; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (GTK_IS_WIDGET (widget)); - - child = g_slice_new0 (EggSliderChild); - child->position = EGG_SLIDER_NONE; - child->widget = g_object_ref (widget); - - g_ptr_array_add (priv->children, child); - - gtk_widget_set_parent (widget, GTK_WIDGET (self)); - - if (gtk_widget_get_realized (GTK_WIDGET (self))) - child->window = egg_slider_create_child_window (self, child); -} - -static void -egg_slider_remove (GtkContainer *container, - GtkWidget *widget) -{ - EggSlider *self = (EggSlider *)container; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - EggSliderChild *child; - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (i = 0; i < priv->children->len; i++) - { - child = g_ptr_array_index (priv->children, i); - - if (child->widget == widget) - { - gtk_widget_unparent (widget); - g_ptr_array_remove_index (priv->children, i); - gtk_widget_queue_allocate (GTK_WIDGET (self)); - break; - } - } -} - -static void -egg_slider_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - guint i; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (allocation != NULL); - - gtk_widget_set_allocation (widget, allocation); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child = g_ptr_array_index (priv->children, i); - - if (gtk_widget_get_mapped (child->widget)) - { - GtkAllocation window_allocation; - GtkAllocation child_allocation; - - egg_slider_compute_child_allocation (self, child, &window_allocation, &child_allocation); - - gdk_window_move_resize (child->window, - window_allocation.x, - window_allocation.y, - window_allocation.width, - window_allocation.height); - - /* raise the window edges */ - if (child->position != EGG_SLIDER_NONE) - gdk_window_show (child->window); - - gtk_widget_size_allocate (child->widget, &child_allocation); - } - } -} - -static void -egg_slider_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) -{ - EggSlider *self = (EggSlider *)container; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - GtkWidget **children; - guint len; - guint i; - - g_assert (EGG_IS_SLIDER (self)); - - /* - * We need to be widget re-entrant safe, meaning that the callback could - * remove a child during callback(), using gtk_widget_destroy or similar. So - * we create a local array containing a ref'd copy of all of the widgets in - * case the callback removes widgets. - */ - - len = priv->children->len; - children = g_new0 (GtkWidget *, len); - - for (i = 0; i < len; i++) - { - EggSliderChild *child = g_ptr_array_index (priv->children, i); - - children [i] = g_object_ref (child->widget); - } - - for (i = 0; i < len; i++) - { - callback (children [i], callback_data); - g_object_unref (children [i]); - } - - g_free (children); -} - -static EggSliderChild * -egg_slider_get_child (EggSlider *self, - GtkWidget *widget) -{ - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (GTK_IS_WIDGET (widget)); - g_assert (gtk_widget_get_parent (widget) == GTK_WIDGET (self)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - - child = g_ptr_array_index (priv->children, i); - - if (child->widget == widget) - return child; - } - - g_assert_not_reached (); - - return NULL; -} - -static EggSliderPosition -egg_slider_child_get_position (EggSlider *self, - GtkWidget *widget) -{ - EggSliderChild *child; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (GTK_IS_WIDGET (widget)); - - child = egg_slider_get_child (self, widget); - - return child->position; -} - -static void -egg_slider_child_set_position (EggSlider *self, - GtkWidget *widget, - EggSliderPosition position) -{ - EggSliderChild *child; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (GTK_IS_WIDGET (widget)); - g_assert (position >= EGG_SLIDER_NONE); - g_assert (position <= EGG_SLIDER_LEFT); - - child = egg_slider_get_child (self, widget); - - if (position != child->position) - { - child->position = position; - gtk_container_child_notify (GTK_CONTAINER (self), widget, "position"); - gtk_widget_queue_allocate (GTK_WIDGET (self)); - } -} - -static void -egg_slider_get_child_property (GtkContainer *container, - GtkWidget *child, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSlider *self = (EggSlider *)container; - - switch (prop_id) - { - case CHILD_PROP_POSITION: - g_value_set_enum (value, egg_slider_child_get_position (self, child)); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_slider_set_child_property (GtkContainer *container, - GtkWidget *child, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSlider *self = (EggSlider *)container; - - switch (prop_id) - { - case CHILD_PROP_POSITION: - egg_slider_child_set_position (self, child, g_value_get_enum (value)); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_slider_get_preferred_height (GtkWidget *widget, - gint *min_height, - gint *nat_height) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gint real_min_height = 0; - gint real_nat_height = 0; - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - gint child_min_height = 0; - gint child_nat_height = 0; - - child = g_ptr_array_index (priv->children, i); - - if ((child->position == EGG_SLIDER_NONE) && gtk_widget_get_visible (child->widget)) - { - gtk_widget_get_preferred_height (child->widget, &child_min_height, &child_nat_height); - real_min_height = MAX (real_min_height, child_min_height); - real_nat_height = MAX (real_nat_height, child_nat_height); - } - } - - *min_height = real_min_height; - *nat_height = real_nat_height; -} - -static void -egg_slider_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gint real_min_width = 0; - gint real_nat_width = 0; - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - gint child_min_width = 0; - gint child_nat_width = 0; - - child = g_ptr_array_index (priv->children, i); - - if ((child->position == EGG_SLIDER_NONE) && gtk_widget_get_visible (child->widget)) - { - gtk_widget_get_preferred_width (child->widget, &child_min_width, &child_nat_width); - real_min_width = MAX (real_min_width, child_min_width); - real_nat_width = MAX (real_nat_width, child_nat_width); - } - } - - *min_width = real_min_width; - *nat_width = real_nat_width; -} - -static void -egg_slider_realize (GtkWidget *widget) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - GdkWindow *window; - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - - gtk_widget_set_realized (widget, TRUE); - - window = gtk_widget_get_parent_window (widget); - gtk_widget_set_window (widget, g_object_ref (window)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - - child = g_ptr_array_index (priv->children, i); - - if (child->window == NULL) - child->window = egg_slider_create_child_window (self, child); - } -} - -static void -egg_slider_unrealize (GtkWidget *widget) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - - child = g_ptr_array_index (priv->children, i); - - if (child->window != NULL) - { - gtk_widget_set_parent_window (child->widget, NULL); - gtk_widget_unregister_window (widget, child->window); - gdk_window_destroy (child->window); - child->window = NULL; - } - } - - GTK_WIDGET_CLASS (egg_slider_parent_class)->unrealize (widget); -} - -static void -egg_slider_map (GtkWidget *widget) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - - GTK_WIDGET_CLASS (egg_slider_parent_class)->map (widget); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - - child = g_ptr_array_index (priv->children, i); - - if ((child->window != NULL) && - gtk_widget_get_visible (child->widget) && - gtk_widget_get_child_visible (child->widget)) - gdk_window_show (child->window); - } -} - -static void -egg_slider_unmap (GtkWidget *widget) -{ - EggSlider *self = (EggSlider *)widget; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - gsize i; - - g_assert (EGG_IS_SLIDER (self)); - - for (i = 0; i < priv->children->len; i++) - { - EggSliderChild *child; - - child = g_ptr_array_index (priv->children, i); - - if ((child->window != NULL) && gdk_window_is_visible (child->window)) - gdk_window_hide (child->window); - } - - GTK_WIDGET_CLASS (egg_slider_parent_class)->unmap (widget); -} - -static void -egg_slider_add_child (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *type) -{ - EggSliderPosition position = EGG_SLIDER_NONE; - EggSlider *self = (EggSlider *)buildable; - - g_assert (EGG_IS_SLIDER (self)); - g_assert (GTK_IS_BUILDABLE (buildable)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (G_IS_OBJECT (child)); - - if (!GTK_IS_WIDGET (child)) - { - g_warning ("Child \"%s\" must be of type GtkWidget.", - G_OBJECT_TYPE_NAME (child)); - return; - } - - if (type == NULL) - position = EGG_SLIDER_NONE; - else if (g_str_equal (type, "bottom")) - position = EGG_SLIDER_BOTTOM; - else if (g_str_equal (type, "top")) - position = EGG_SLIDER_TOP; - else if (g_str_equal (type, "left")) - position = EGG_SLIDER_LEFT; - else if (g_str_equal (type, "right")) - position = EGG_SLIDER_RIGHT; - else - g_warning ("Unknown child type \"%s\"", type); - - egg_slider_add_slider (self, GTK_WIDGET (child), position); -} - -static void -egg_slider_finalize (GObject *object) -{ - EggSlider *self = (EggSlider *)object; - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - - g_clear_object (&priv->h_adj); - g_clear_object (&priv->v_adj); - g_clear_pointer (&priv->children, g_ptr_array_unref); - - clear_weak_pointer (&priv->h_anim); - clear_weak_pointer (&priv->v_anim); - - G_OBJECT_CLASS (egg_slider_parent_class)->finalize (object); -} - -static void -egg_slider_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggSlider *self = EGG_SLIDER (object); - - switch (prop_id) - { - case PROP_POSITION: - g_value_set_enum (value, egg_slider_get_position (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_slider_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggSlider *self = EGG_SLIDER (object); - - switch (prop_id) - { - case PROP_POSITION: - egg_slider_set_position (self, g_value_get_enum (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -buildable_iface_init (GtkBuildableIface *iface) -{ - iface->add_child = egg_slider_add_child; -} - -static void -egg_slider_class_init (EggSliderClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->finalize = egg_slider_finalize; - object_class->get_property = egg_slider_get_property; - object_class->set_property = egg_slider_set_property; - - widget_class->get_preferred_height = egg_slider_get_preferred_height; - widget_class->get_preferred_width = egg_slider_get_preferred_width; - widget_class->map = egg_slider_map; - widget_class->realize = egg_slider_realize; - widget_class->size_allocate = egg_slider_size_allocate; - widget_class->unmap = egg_slider_unmap; - widget_class->unrealize = egg_slider_unrealize; - - container_class->add = egg_slider_add; - container_class->forall = egg_slider_forall; - container_class->get_child_property = egg_slider_get_child_property; - container_class->remove = egg_slider_remove; - container_class->set_child_property = egg_slider_set_child_property; - - properties [PROP_POSITION] = - g_param_spec_enum ("position", - "Position", - "Which slider child is visible.", - EGG_TYPE_SLIDER_POSITION, - EGG_SLIDER_NONE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - gtk_container_class_install_child_property (container_class, - CHILD_PROP_POSITION, - g_param_spec_enum ("position", - "Position", - "Position", - EGG_TYPE_SLIDER_POSITION, - EGG_SLIDER_NONE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -egg_slider_init (EggSlider *self) -{ - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - - priv->position = EGG_SLIDER_NONE; - priv->children = g_ptr_array_new_with_free_func ((GDestroyNotify)egg_slider_child_free); - - priv->v_adj = g_object_new (GTK_TYPE_ADJUSTMENT, - "lower", -1.0, - "upper", 1.0, - "value", 0.0, - NULL); - g_signal_connect_object (priv->v_adj, - "value-changed", - G_CALLBACK (gtk_widget_queue_allocate), - self, - G_CONNECT_SWAPPED); - - priv->h_adj = g_object_new (GTK_TYPE_ADJUSTMENT, - "lower", -1.0, - "upper", 1.0, - "value", 0.0, - NULL); - g_signal_connect_object (priv->h_adj, - "value-changed", - G_CALLBACK (gtk_widget_queue_allocate), - self, - G_CONNECT_SWAPPED); - - gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); -} - -GType -egg_slider_position_get_type (void) -{ - static GType type_id; - static const GEnumValue values[] = { - { EGG_SLIDER_NONE, "EGG_SLIDER_NONE", "none" }, - { EGG_SLIDER_TOP, "EGG_SLIDER_TOP", "top" }, - { EGG_SLIDER_RIGHT, "EGG_SLIDER_RIGHT", "right" }, - { EGG_SLIDER_BOTTOM, "EGG_SLIDER_BOTTOM", "bottom" }, - { EGG_SLIDER_LEFT, "EGG_SLIDER_LEFT", "left" }, - { 0 } - }; - - if (g_once_init_enter (&type_id)) - { - GType _type_id; - - _type_id = g_enum_register_static ("EggSliderPosition", values); - g_once_init_leave (&type_id, _type_id); - } - - return type_id; -} - -GtkWidget * -egg_slider_new (void) -{ - return g_object_new (EGG_TYPE_SLIDER, NULL); -} - -EggSliderPosition -egg_slider_get_position (EggSlider *self) -{ - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_SLIDER (self), EGG_SLIDER_NONE); - - return priv->position; -} - -void -egg_slider_set_position (EggSlider *self, - EggSliderPosition position) -{ - EggSliderPrivate *priv = egg_slider_get_instance_private (self); - - g_return_if_fail (EGG_IS_SLIDER (self)); - g_return_if_fail (position >= EGG_SLIDER_NONE); - g_return_if_fail (position <= EGG_SLIDER_LEFT); - - if (priv->position != position) - { - GdkFrameClock *frame_clock; - EggAnimation *anim; - gdouble v_value; - gdouble h_value; - - priv->position = position; - - if (priv->h_anim) - egg_animation_stop (priv->h_anim); - clear_weak_pointer (&priv->h_anim); - - if (priv->v_anim) - egg_animation_stop (priv->v_anim); - clear_weak_pointer (&priv->v_anim); - - switch (position) - { - case EGG_SLIDER_NONE: - h_value = 0.0; - v_value = 0.0; - break; - - case EGG_SLIDER_TOP: - h_value = 0.0; - v_value = 1.0; - break; - - case EGG_SLIDER_RIGHT: - h_value = -1.0; - v_value = 0.0; - break; - - case EGG_SLIDER_BOTTOM: - h_value = 0.0; - v_value = -1.0; - break; - - case EGG_SLIDER_LEFT: - h_value = 1.0; - v_value = 0.0; - break; - - default: - g_return_if_reached (); - } - - frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (self)); - - anim = egg_object_animate (priv->h_adj, - ANIMATION_MODE, - ANIMATION_DURATION, - frame_clock, - "value", h_value, - NULL); - set_weak_pointer (&priv->h_anim, anim); - - anim = egg_object_animate (priv->v_adj, - ANIMATION_MODE, - ANIMATION_DURATION, - frame_clock, - "value", v_value, - NULL); - set_weak_pointer (&priv->v_anim, anim); - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_POSITION]); - gtk_widget_queue_allocate (GTK_WIDGET (self)); - } -} - -void -egg_slider_add_slider (EggSlider *self, - GtkWidget *widget, - EggSliderPosition position) -{ - g_return_if_fail (EGG_IS_SLIDER (self)); - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (position >= EGG_SLIDER_NONE); - g_return_if_fail (position <= EGG_SLIDER_LEFT); - - gtk_container_add_with_properties (GTK_CONTAINER (self), widget, - "position", position, - NULL); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-slider.h gnome-usage-3.32.0/external/egg/egg-slider.h --- gnome-usage-3.30.0/external/egg/egg-slider.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-slider.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* egg-slider.h - * - * Copyright (C) 2015 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_SLIDER_H -#define EGG_SLIDER_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_SLIDER (egg_slider_get_type()) -#define EGG_TYPE_SLIDER_POSITION (egg_slider_position_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggSlider, egg_slider, EGG, SLIDER, GtkContainer) - -typedef enum -{ - EGG_SLIDER_NONE, - EGG_SLIDER_TOP, - EGG_SLIDER_RIGHT, - EGG_SLIDER_BOTTOM, - EGG_SLIDER_LEFT, -} EggSliderPosition; - -struct _EggSliderClass -{ - GtkContainerClass parent_instance; -}; - -GType egg_slider_position_get_type (void); -GtkWidget *egg_slider_new (void); -void egg_slider_add_slider (EggSlider *self, - GtkWidget *widget, - EggSliderPosition position); -EggSliderPosition egg_slider_get_position (EggSlider *self); -void egg_slider_set_position (EggSlider *self, - EggSliderPosition position); - -G_END_DECLS - -#endif /* EGG_SLIDER_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-state-machine-buildable.c gnome-usage-3.32.0/external/egg/egg-state-machine-buildable.c --- gnome-usage-3.30.0/external/egg/egg-state-machine-buildable.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-state-machine-buildable.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,686 +0,0 @@ -/* egg-state-machine-buildable.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-state-machine" - -#include -#include - -#include "egg-state-machine.h" -#include "egg-state-machine-buildable.h" - -typedef struct -{ - EggStateMachine *self; - GtkBuilder *builder; - GQueue *stack; -} StatesParserData; - -typedef enum -{ - STACK_ITEM_OBJECT, - STACK_ITEM_STATE, - STACK_ITEM_PROPERTY, -} StackItemType; - -typedef struct -{ - StackItemType type; - union { - struct { - gchar *id; - GSList *classes; - GSList *properties; - } object; - struct { - gchar *name; - GSList *objects; - } state; - struct { - gchar *name; - gchar *bind_source; - gchar *bind_property; - gchar *text; - GBindingFlags bind_flags; - } property; - } u; -} StackItem; - -static GtkBuildableIface *egg_state_machine_parent_buildable; - -static void -stack_item_free (StackItem *item) -{ - switch (item->type) - { - case STACK_ITEM_OBJECT: - g_free (item->u.object.id); - g_slist_free_full (item->u.object.classes, g_free); - break; - - case STACK_ITEM_STATE: - g_free (item->u.state.name); - g_slist_free_full (item->u.state.objects, (GDestroyNotify)stack_item_free); - break; - - case STACK_ITEM_PROPERTY: - g_free (item->u.property.name); - g_free (item->u.property.bind_source); - g_free (item->u.property.bind_property); - g_free (item->u.property.text); - break; - - default: - g_assert_not_reached (); - break; - } - - g_slice_free (StackItem, item); -} - -static StackItem * -stack_item_new (StackItemType type) -{ - StackItem *item; - - item = g_slice_new0 (StackItem); - item->type = type; - - return item; -} - -static void -add_state (StatesParserData *parser_data, - StackItem *item, - GError **error) -{ - GSList *iter; - - g_assert (parser_data != NULL); - g_assert (item != NULL); - g_assert (item->type == STACK_ITEM_STATE); - - for (iter = item->u.state.objects; iter; iter = iter->next) - { - StackItem *stack_obj = iter->data; - GObject *object; - GSList *prop_iter; - GSList *style_iter; - - g_assert (stack_obj->type == STACK_ITEM_OBJECT); - g_assert (stack_obj->u.object.id != NULL); - - object = gtk_builder_get_object (parser_data->builder, stack_obj->u.object.id); - - if (object == NULL) - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "Unknown object for state '%s': %s", - item->u.state.name, - stack_obj->u.object.id); - return; - } - - if (GTK_IS_WIDGET (object)) - for (style_iter = stack_obj->u.object.classes; style_iter; style_iter = style_iter->next) - egg_state_machine_add_style (parser_data->self, - item->u.state.name, - GTK_WIDGET (object), - style_iter->data); - - for (prop_iter = stack_obj->u.object.properties; prop_iter; prop_iter = prop_iter->next) - { - StackItem *stack_prop = prop_iter->data; - GObject *bind_source; - - g_assert (stack_prop->type == STACK_ITEM_PROPERTY); - - if ((stack_prop->u.property.bind_source != NULL) && - (stack_prop->u.property.bind_property != NULL) && - (bind_source = gtk_builder_get_object (parser_data->builder, stack_prop->u.property.bind_source))) - { - egg_state_machine_add_binding (parser_data->self, - item->u.state.name, - bind_source, - stack_prop->u.property.bind_property, - object, - stack_prop->u.property.name, - stack_prop->u.property.bind_flags); - } - else if (stack_prop->u.property.text != NULL) - { - GParamSpec *pspec; - GValue value = G_VALUE_INIT; - - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), stack_prop->u.property.name); - - if (pspec == NULL) - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_PROPERTY, - "No such property: %s", - stack_prop->u.property.name); - return; - } - - if (g_type_is_a (pspec->value_type, G_TYPE_OBJECT)) - { - GObject *relative; - - relative = gtk_builder_get_object (parser_data->builder, stack_prop->u.property.text); - - if (relative == NULL) - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "Unknown object for property '%s': %s", - stack_prop->u.property.name, - stack_prop->u.property.text); - return; - } - - g_value_init (&value, pspec->value_type); - g_value_set_object (&value, relative); - } - else if (!gtk_builder_value_from_string (parser_data->builder, - pspec, - stack_prop->u.property.text, - &value, - error)) - { - return; - } - - egg_state_machine_add_propertyv (parser_data->self, - item->u.state.name, - object, - stack_prop->u.property.name, - &value); - - g_value_unset (&value); - } - } - } -} - -static void -add_object (StatesParserData *parser_data, - StackItem *parent, - StackItem *item) -{ - g_assert (parser_data != NULL); - g_assert (parent != NULL); - g_assert (parent->type == STACK_ITEM_STATE); - g_assert (item != NULL); - g_assert (item->type == STACK_ITEM_OBJECT); - - parent->u.state.objects = g_slist_prepend (parent->u.state.objects, item); -} - -static void -add_property (StatesParserData *parser_data, - StackItem *parent, - StackItem *item) -{ - g_assert (parser_data != NULL); - g_assert (parent != NULL); - g_assert (parent->type == STACK_ITEM_OBJECT); - g_assert (item != NULL); - g_assert (item->type == STACK_ITEM_PROPERTY); - - parent->u.object.properties = g_slist_prepend (parent->u.object.properties, item); -} - -static gboolean -check_parent (GMarkupParseContext *context, - const gchar *element_name, - GError **error) -{ - const GSList *stack; - const gchar *parent_name; - const gchar *our_name; - - stack = g_markup_parse_context_get_element_stack (context); - our_name = stack->data; - parent_name = stack->next ? stack->next->data : ""; - - if (g_strcmp0 (parent_name, element_name) != 0) - { - gint line; - gint col; - - g_markup_parse_context_get_position (context, &line, &col); - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_TAG, - "%d:%d: Element <%s> found in <%s>, expected <%s>.", - line, col, our_name, parent_name, element_name); - return FALSE; - } - - return TRUE; -} - -/* - * flags_from_string: - * - * gtkbuilder.c - * - * Copyright (C) 1998-2002 James Henstridge - * Copyright (C) 2006-2007 Async Open Source, - * Johan Dahlin , - * Henrique Romano - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see . - */ -gboolean -flags_from_string (GType type, - const gchar *string, - guint *flags_value, - GError **error) -{ - GFlagsClass *fclass; - gchar *endptr, *prevptr; - guint i, j, value; - gchar *flagstr; - GFlagsValue *fv; - const gchar *flag; - gunichar ch; - gboolean eos, ret; - - g_return_val_if_fail (G_TYPE_IS_FLAGS (type), FALSE); - g_return_val_if_fail (string != 0, FALSE); - - ret = TRUE; - - endptr = NULL; - errno = 0; - value = g_ascii_strtoull (string, &endptr, 0); - if (errno == 0 && endptr != string) /* parsed a number */ - *flags_value = value; - else - { - fclass = g_type_class_ref (type); - - flagstr = g_strdup (string); - for (value = i = j = 0; ; i++) - { - - eos = flagstr[i] == '\0'; - - if (!eos && flagstr[i] != '|') - continue; - - flag = &flagstr[j]; - endptr = &flagstr[i]; - - if (!eos) - { - flagstr[i++] = '\0'; - j = i; - } - - /* trim spaces */ - for (;;) - { - ch = g_utf8_get_char (flag); - if (!g_unichar_isspace (ch)) - break; - flag = g_utf8_next_char (flag); - } - - while (endptr > flag) - { - prevptr = g_utf8_prev_char (endptr); - ch = g_utf8_get_char (prevptr); - if (!g_unichar_isspace (ch)) - break; - endptr = prevptr; - } - - if (endptr > flag) - { - *endptr = '\0'; - fv = g_flags_get_value_by_name (fclass, flag); - - if (!fv) - fv = g_flags_get_value_by_nick (fclass, flag); - - if (fv) - value |= fv->value; - else - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "Unknown flag: `%s'", - flag); - ret = FALSE; - break; - } - } - - if (eos) - { - *flags_value = value; - break; - } - } - - g_free (flagstr); - - g_type_class_unref (fclass); - } - - return ret; -} - -static void -states_parser_start_element (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) -{ - StatesParserData *parser_data = user_data; - StackItem *item; - - g_assert (context != NULL); - g_assert (element_name != NULL); - g_assert (parser_data != NULL); - - if (g_strcmp0 (element_name, "state") == 0) - { - const gchar *name; - - if (!check_parent (context, "states", error)) - return; - - if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_INVALID)) - return; - - item = stack_item_new (STACK_ITEM_STATE); - item->u.state.name = g_strdup (name); - g_queue_push_head (parser_data->stack, item); - } - else if (g_strcmp0 (element_name, "states") == 0) - { - if (!check_parent (context, "object", error)) - return; - } - else if (g_strcmp0 (element_name, "object") == 0) - { - const gchar *id; - - if (!check_parent (context, "state", error)) - return; - - if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, error, - G_MARKUP_COLLECT_STRING, "id", &id, - G_MARKUP_COLLECT_INVALID)) - return; - - item = stack_item_new (STACK_ITEM_OBJECT); - item->u.object.id = g_strdup (id); - g_queue_push_head (parser_data->stack, item); - } - else if (g_strcmp0 (element_name, "property") == 0) - { - const gchar *name = NULL; - const gchar *translatable = NULL; - const gchar *bind_source = NULL; - const gchar *bind_property = NULL; - const gchar *bind_flags_str = NULL; - GBindingFlags bind_flags = 0; - - if (!check_parent (context, "object", error)) - return; - - if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "translatable", &translatable, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "bind-source", &bind_source, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "bind-property", &bind_property, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "bind-flags", &bind_flags_str, - G_MARKUP_COLLECT_INVALID)) - return; - - if (name != NULL) - { - if (g_strcmp0 (translatable, "yes") == 0) - { - const gchar *domain; - - domain = gtk_builder_get_translation_domain (parser_data->builder); - name = dgettext (domain, name); - } - } - - if ((bind_flags_str != NULL) && !flags_from_string (G_TYPE_BINDING_FLAGS, bind_flags_str, &bind_flags, error)) - return; - - item = stack_item_new (STACK_ITEM_PROPERTY); - item->u.property.name = g_strdup (name); - item->u.property.bind_source = g_strdup (bind_source); - item->u.property.bind_property = g_strdup (bind_property); - item->u.property.bind_flags = bind_flags; - g_queue_push_head (parser_data->stack, item); - } - else if (g_strcmp0 (element_name, "style") == 0) - { - if (!check_parent (context, "object", error)) - return; - } - else if (g_strcmp0 (element_name, "class") == 0) - { - const gchar *name = NULL; - - if (!check_parent (context, "style", error)) - return; - - if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_INVALID)) - return; - - item = g_queue_peek_head (parser_data->stack); - g_assert (item->type == STACK_ITEM_OBJECT); - - item->u.object.classes = g_slist_prepend (item->u.object.classes, g_strdup (name)); - } - else - { - const GSList *stack; - const gchar *parent_name; - const gchar *our_name; - gint line; - gint col; - - stack = g_markup_parse_context_get_element_stack (context); - our_name = stack->data; - parent_name = stack->next ? stack->next->data : ""; - - g_markup_parse_context_get_position (context, &line, &col); - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_TAG, - "%d:%d: Unknown element <%s> found in <%s>.", - line, col, our_name, parent_name); - } - - return; -} - -static void -states_parser_end_element (GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) -{ - StatesParserData *parser_data = user_data; - StackItem *item; - - g_assert (context != NULL); - g_assert (element_name != NULL); - g_assert (parser_data != NULL); - - if (g_strcmp0 (element_name, "state") == 0) - { - item = g_queue_pop_head (parser_data->stack); - g_assert (item->type == STACK_ITEM_STATE); - add_state (parser_data, item, error); - stack_item_free (item); - } - else if (g_strcmp0 (element_name, "object") == 0) - { - StackItem *parent; - - item = g_queue_pop_head (parser_data->stack); - g_assert (item->type == STACK_ITEM_OBJECT); - - parent = g_queue_peek_head (parser_data->stack); - g_assert (parent->type == STACK_ITEM_STATE); - - add_object (parser_data, parent, item); - } - else if (g_strcmp0 (element_name, "property") == 0) - { - StackItem *parent; - - item = g_queue_pop_head (parser_data->stack); - g_assert (item->type == STACK_ITEM_PROPERTY); - - parent = g_queue_peek_head (parser_data->stack); - g_assert (parent->type == STACK_ITEM_OBJECT); - - add_property (parser_data, parent, item); - } -} - -static void -states_parser_text (GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) -{ - StatesParserData *parser_data = user_data; - StackItem *item; - - g_assert (parser_data != NULL); - - item = g_queue_peek_head (parser_data->stack); - if ((item != NULL) && (item->type == STACK_ITEM_PROPERTY)) - item->u.property.text = g_strndup (text, text_len); -} - -static GMarkupParser StatesParser = { - states_parser_start_element, - states_parser_end_element, - states_parser_text, -}; - -static gboolean -egg_state_machine_buildable_custom_tag_start (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - GMarkupParser *parser, - gpointer *data) -{ - EggStateMachine *self = (EggStateMachine *)buildable; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (tagname != NULL); - g_assert (parser != NULL); - g_assert (data != NULL); - - if (g_strcmp0 (tagname, "states") == 0) - { - StatesParserData *parser_data; - - parser_data = g_slice_new0 (StatesParserData); - parser_data->self = g_object_ref (buildable); - parser_data->builder = g_object_ref (builder); - parser_data->stack = g_queue_new (); - - *parser = StatesParser; - *data = parser_data; - - return TRUE; - } - - return FALSE; -} - -static void -egg_state_machine_buildable_custom_finished (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - gpointer user_data) -{ - EggStateMachine *self = (EggStateMachine *)buildable; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (GTK_IS_BUILDER (builder)); - g_assert (tagname != NULL); - - if (g_strcmp0 (tagname, "states") == 0) - { - StatesParserData *parser_data = user_data; - - g_object_unref (parser_data->self); - g_object_unref (parser_data->builder); - g_queue_free_full (parser_data->stack, (GDestroyNotify)stack_item_free); - g_slice_free (StatesParserData, parser_data); - } -} - -/** - * egg_state_machine_buildable_iface_init: (skip) - */ -void -egg_state_machine_buildable_iface_init (GtkBuildableIface *iface) -{ - g_assert (iface != NULL); - - egg_state_machine_parent_buildable = g_type_interface_peek_parent (iface); - - iface->custom_tag_start = egg_state_machine_buildable_custom_tag_start; - iface->custom_finished = egg_state_machine_buildable_custom_finished; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-state-machine-buildable.h gnome-usage-3.32.0/external/egg/egg-state-machine-buildable.h --- gnome-usage-3.30.0/external/egg/egg-state-machine-buildable.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-state-machine-buildable.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* egg-state-machine-buildable.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_STATE_MACHINE_BUILDABLE_H -#define EGG_STATE_MACHINE_BUILDABLE_H - -#include - -G_BEGIN_DECLS - -void egg_state_machine_buildable_iface_init (GtkBuildableIface *iface); - -G_END_DECLS - -#endif /* EGG_STATE_MACHINE_BUILDABLE_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-state-machine.c gnome-usage-3.32.0/external/egg/egg-state-machine.c --- gnome-usage-3.30.0/external/egg/egg-state-machine.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-state-machine.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,746 +0,0 @@ -/* egg-state-machine.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-state-machine" - -#include -#include - -#include "egg-binding-group.h" -#include "egg-signal-group.h" - -#include "egg-state-machine.h" -#include "egg-state-machine-buildable.h" - -G_DEFINE_QUARK (egg_state_machine_error, egg_state_machine_error) - -typedef struct -{ - gchar *state; - GHashTable *states; -} EggStateMachinePrivate; - -typedef struct -{ - gchar *name; - GHashTable *signals; - GHashTable *bindings; - GPtrArray *properties; - GPtrArray *styles; -} EggState; - -typedef struct -{ - EggStateMachine *state_machine; - gpointer object; - gchar *property; - GValue value; -} EggStateProperty; - -typedef struct -{ - EggStateMachine *state_machine; - GtkWidget *widget; - gchar *name; -} EggStateStyle; - -G_DEFINE_TYPE_WITH_CODE (EggStateMachine, egg_state_machine, G_TYPE_OBJECT, - G_ADD_PRIVATE (EggStateMachine) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - egg_state_machine_buildable_iface_init)) - -enum { - PROP_0, - PROP_STATE, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -static void -egg_state_machine__property_object_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggStateProperty *state_prop = data; - EggStateMachine *self = state_prop->state_machine; - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - GHashTableIter iter; - EggState *state; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (where_object_was != NULL); - - state_prop->object = NULL; - - g_hash_table_iter_init (&iter, priv->states); - while (g_hash_table_iter_next (&iter, NULL, (gpointer)&state)) - { - if (g_ptr_array_remove_fast (state->properties, state_prop)) - return; - } - - g_critical ("Failed to find property for %p", where_object_was); -} - -static void -egg_state_machine__style_object_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggStateStyle *style_prop = data; - EggStateMachine *self = style_prop->state_machine; - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - GHashTableIter iter; - EggState *state; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (where_object_was != NULL); - - style_prop->widget = NULL; - - g_hash_table_iter_init (&iter, priv->states); - while (g_hash_table_iter_next (&iter, NULL, (gpointer)&state)) - { - if (g_ptr_array_remove_fast (state->styles, style_prop)) - return; - } - - g_critical ("Failed to find style for %p", where_object_was); -} - -static void -egg_state_machine__binding_source_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggStateMachine *self = data; - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - GHashTableIter iter; - EggState *state; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (where_object_was != NULL); - - g_hash_table_iter_init (&iter, priv->states); - while (g_hash_table_iter_next (&iter, NULL, (gpointer)&state)) - { - EggBindingGroup *bindings; - - bindings = g_hash_table_lookup (state->bindings, where_object_was); - - if (bindings != NULL) - { - g_hash_table_remove (state->bindings, where_object_was); - return; - } - } - - g_critical ("Failed to find bindings for %p", where_object_was); -} - -static void -egg_state_machine__signal_source_weak_notify (gpointer data, - GObject *where_object_was) -{ - EggStateMachine *self = data; - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - GHashTableIter iter; - EggState *state; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (where_object_was != NULL); - - g_hash_table_iter_init (&iter, priv->states); - while (g_hash_table_iter_next (&iter, NULL, (gpointer)&state)) - { - EggSignalGroup *signals; - - signals = g_hash_table_lookup (state->signals, where_object_was); - - if (signals != NULL) - { - g_hash_table_remove (state->signals, where_object_was); - return; - } - } - - g_critical ("Failed to find signals for %p", where_object_was); -} - -static void -egg_state_free (gpointer data) -{ - EggState *state = data; - - g_free (state->name); - g_hash_table_unref (state->signals); - g_hash_table_unref (state->bindings); - g_ptr_array_unref (state->properties); - g_ptr_array_unref (state->styles); - g_slice_free (EggState, state); -} - -static void -egg_state_property_free (gpointer data) -{ - EggStateProperty *prop = data; - - if (prop->object != NULL) - { - g_object_weak_unref (prop->object, - egg_state_machine__property_object_weak_notify, - prop); - prop->object = NULL; - } - - g_free (prop->property); - g_value_unset (&prop->value); - g_slice_free (EggStateProperty, prop); -} - -static void -egg_state_style_free (gpointer data) -{ - EggStateStyle *style = data; - - if (style->widget != NULL) - { - g_object_weak_unref (G_OBJECT (style->widget), - egg_state_machine__style_object_weak_notify, - style); - style->widget = NULL; - } - - g_free (style->name); - g_slice_free (EggStateStyle, style); -} - -static void -egg_state_apply (EggStateMachine *self, - EggState *state) -{ - GHashTableIter iter; - gpointer key; - gpointer value; - gsize i; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (state != NULL); - - g_hash_table_iter_init (&iter, state->bindings); - while (g_hash_table_iter_next (&iter, &key, &value)) - egg_binding_group_set_source (value, key); - - g_hash_table_iter_init (&iter, state->signals); - while (g_hash_table_iter_next (&iter, &key, &value)) - egg_signal_group_set_target (value, key); - - for (i = 0; i < state->properties->len; i++) - { - EggStateProperty *prop; - - prop = g_ptr_array_index (state->properties, i); - g_object_set_property (prop->object, prop->property, &prop->value); - } - - for (i = 0; i < state->styles->len; i++) - { - EggStateStyle *style; - GtkStyleContext *style_context; - - style = g_ptr_array_index (state->styles, i); - style_context = gtk_widget_get_style_context (GTK_WIDGET (style->widget)); - gtk_style_context_add_class (style_context, style->name); - } -} - -static void -egg_state_unapply (EggStateMachine *self, - EggState *state) -{ - GHashTableIter iter; - gpointer key; - gpointer value; - gsize i; - - g_assert (EGG_IS_STATE_MACHINE (self)); - g_assert (state != NULL); - - g_hash_table_iter_init (&iter, state->bindings); - while (g_hash_table_iter_next (&iter, &key, &value)) - egg_binding_group_set_source (value, NULL); - - g_hash_table_iter_init (&iter, state->signals); - while (g_hash_table_iter_next (&iter, &key, &value)) - egg_signal_group_set_target (value, NULL); - - for (i = 0; i < state->styles->len; i++) - { - EggStateStyle *style; - GtkStyleContext *style_context; - - style = g_ptr_array_index (state->styles, i); - style_context = gtk_widget_get_style_context (GTK_WIDGET (style->widget)); - gtk_style_context_remove_class (style_context, style->name); - } -} - -static EggState * -egg_state_machine_get_state_obj (EggStateMachine *self, - const gchar *state) -{ - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - EggState *state_obj; - - g_assert (EGG_IS_STATE_MACHINE (self)); - - state_obj = g_hash_table_lookup (priv->states, state); - - if (state_obj == NULL) - { - state_obj = g_slice_new0 (EggState); - state_obj->name = g_strdup (state); - state_obj->signals = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); - state_obj->bindings = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); - state_obj->properties = g_ptr_array_new_with_free_func (egg_state_property_free); - state_obj->styles = g_ptr_array_new_with_free_func (egg_state_style_free); - g_hash_table_insert (priv->states, g_strdup (state), state_obj); - } - - return state_obj; -} - -static void -egg_state_machine_transition (EggStateMachine *self, - const gchar *old_state, - const gchar *new_state) -{ - EggState *state_obj; - - g_assert (EGG_IS_STATE_MACHINE (self)); - - g_object_freeze_notify (G_OBJECT (self)); - - if (old_state && (state_obj = egg_state_machine_get_state_obj (self, old_state))) - egg_state_unapply (self, state_obj); - - if (new_state && (state_obj = egg_state_machine_get_state_obj (self, new_state))) - egg_state_apply (self, state_obj); - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_STATE]); - - g_object_thaw_notify (G_OBJECT (self)); -} - -static void -egg_state_machine_finalize (GObject *object) -{ - EggStateMachine *self = (EggStateMachine *)object; - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - GHashTableIter state_iter; - EggState *state; - - g_hash_table_iter_init (&state_iter, priv->states); - while (g_hash_table_iter_next (&state_iter, NULL, (gpointer)&state)) - { - GHashTableIter iter; - gpointer key; - - g_hash_table_iter_init (&iter, state->bindings); - while (g_hash_table_iter_next (&iter, &key, NULL)) - { - g_object_weak_unref (key, - egg_state_machine__binding_source_weak_notify, - self); - } - - g_hash_table_iter_init (&iter, state->signals); - while (g_hash_table_iter_next (&iter, &key, NULL)) - { - g_object_weak_unref (key, - egg_state_machine__signal_source_weak_notify, - self); - } - } - - g_clear_pointer (&priv->states, g_hash_table_unref); - g_clear_pointer (&priv->state, g_free); - - G_OBJECT_CLASS (egg_state_machine_parent_class)->finalize (object); -} - -static void -egg_state_machine_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggStateMachine *self = EGG_STATE_MACHINE (object); - - switch (prop_id) - { - case PROP_STATE: - g_value_set_string (value, egg_state_machine_get_state (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_state_machine_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggStateMachine *self = EGG_STATE_MACHINE (object); - - switch (prop_id) - { - case PROP_STATE: - egg_state_machine_set_state (self, g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_state_machine_class_init (EggStateMachineClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = egg_state_machine_finalize; - object_class->get_property = egg_state_machine_get_property; - object_class->set_property = egg_state_machine_set_property; - - properties [PROP_STATE] = - g_param_spec_string ("state", - "State", - "The current state of the machine.", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -egg_state_machine_init (EggStateMachine *self) -{ - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - - priv->states = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, egg_state_free); -} - -EggStateMachine * -egg_state_machine_new (void) -{ - return g_object_new (EGG_TYPE_STATE_MACHINE, NULL); -} - -/** - * egg_state_machine_get_state: - * @self: the #EggStateMachine. - * - * Gets the #EggStateMachine:state property. This is the name of the - * current state of the machine. - * - * Returns: The current state of the machine. - */ -const gchar * -egg_state_machine_get_state (EggStateMachine *self) -{ - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - - g_return_val_if_fail (EGG_IS_STATE_MACHINE (self), NULL); - - return priv->state; -} - -/** - * egg_state_machine_set_state: - * @self: the #EggStateMachine @self: the # - * - * Sets the #EggStateMachine:state property. - * - * Registered state transformations will be applied during the state - * transformation. - * - * If the transition results in a cyclic operation, the state will stop at - * the last state before the cycle was detected. - */ -void -egg_state_machine_set_state (EggStateMachine *self, - const gchar *state) -{ - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - - if (g_strcmp0 (priv->state, state) != 0) - { - gchar *old_state = priv->state; - gchar *new_state = g_strdup (state); - - /* - * Steal ownership of old state and create a copy for new state - * to ensure that we own the references. State machines tend to - * get used in re-entrant fashion. - */ - - priv->state = g_strdup (state); - - egg_state_machine_transition (self, old_state, state); - - g_free (new_state); - g_free (old_state); - } -} - -/** - * egg_state_machine_create_action: - * @self: An #EggStateMachine - * @name: the name of the action. - * - * Creates a new #GAction with the name of @name. - * - * Setting the state of this action will toggle the state of the state machine. - * You should use g_variant_new_string() or similar to create the state. - * - * Returns: (transfer full): A newly created #GAction. - */ -GAction * -egg_state_machine_create_action (EggStateMachine *self, - const gchar *name) -{ - g_return_val_if_fail (EGG_IS_STATE_MACHINE (self), NULL); - g_return_val_if_fail (name != NULL, NULL); - - return G_ACTION (g_property_action_new (name, self, "state")); -} - -void -egg_state_machine_add_property (EggStateMachine *self, - const gchar *state, - gpointer object, - const gchar *property, - ...) -{ - va_list var_args; - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - g_return_if_fail (state != NULL); - g_return_if_fail (object != NULL); - g_return_if_fail (property != NULL); - - va_start (var_args, property); - egg_state_machine_add_property_valist (self, state, object, - property, var_args); - va_end (var_args); -} - -void -egg_state_machine_add_property_valist (EggStateMachine *self, - const gchar *state, - gpointer object, - const gchar *property, - va_list var_args) -{ - GParamSpec *pspec; - gchar *error = NULL; - GValue value = G_VALUE_INIT; - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - g_return_if_fail (state != NULL); - g_return_if_fail (object != NULL); - g_return_if_fail (property != NULL); - - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), - property); - g_return_if_fail (pspec != NULL); - - G_VALUE_COLLECT_INIT (&value, pspec->value_type, var_args, 0, &error); - - if (error != NULL) - { - g_critical ("%s: %s", G_STRFUNC, error); - g_free (error); - } - else - { - egg_state_machine_add_propertyv (self, state, object, - property, &value); - } - - g_value_unset (&value); -} - -void -egg_state_machine_add_propertyv (EggStateMachine *self, - const gchar *state, - gpointer object, - const gchar *property, - const GValue *value) -{ - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - EggState *state_obj; - EggStateProperty *state_prop; - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - g_return_if_fail (state != NULL); - g_return_if_fail (G_IS_OBJECT (object)); - g_return_if_fail (property != NULL); - g_return_if_fail (G_IS_VALUE (value)); - - state_obj = egg_state_machine_get_state_obj (self, state); - - state_prop = g_slice_new0 (EggStateProperty); - state_prop->state_machine = self; - state_prop->object = object; - state_prop->property = g_strdup (property); - g_value_init (&state_prop->value, G_VALUE_TYPE (value)); - g_value_copy (value, &state_prop->value); - - g_object_weak_ref (object, - egg_state_machine__property_object_weak_notify, - state_prop); - - g_ptr_array_add (state_obj->properties, state_prop); - - if (g_strcmp0 (state, priv->state) == 0) - g_object_set_property (object, property, value); -} - -void -egg_state_machine_add_binding (EggStateMachine *self, - const gchar *state, - gpointer source_object, - const gchar *source_property, - gpointer target_object, - const gchar *target_property, - GBindingFlags flags) -{ - EggBindingGroup *bindings; - EggState *state_obj; - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - g_return_if_fail (state != NULL); - g_return_if_fail (G_IS_OBJECT (source_object)); - g_return_if_fail (source_property != NULL); - g_return_if_fail (G_IS_OBJECT (target_object)); - g_return_if_fail (target_property != NULL); - - state_obj = egg_state_machine_get_state_obj (self, state); - - bindings = g_hash_table_lookup (state_obj->bindings, source_object); - - if (bindings == NULL) - { - bindings = egg_binding_group_new (); - g_hash_table_insert (state_obj->bindings, source_object, bindings); - - g_object_weak_ref (source_object, - egg_state_machine__binding_source_weak_notify, - self); - } - - egg_binding_group_bind (bindings, source_property, target_object, target_property, flags); -} - -void -egg_state_machine_add_style (EggStateMachine *self, - const gchar *state, - GtkWidget *widget, - const gchar *style) -{ - EggStateMachinePrivate *priv = egg_state_machine_get_instance_private (self); - EggState *state_obj; - EggStateStyle *style_obj; - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - g_return_if_fail (state != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (style != NULL); - - state_obj = egg_state_machine_get_state_obj (self, state); - - style_obj = g_slice_new0 (EggStateStyle); - style_obj->state_machine = self; - style_obj->name = g_strdup (style); - style_obj->widget = widget; - - g_object_weak_ref (G_OBJECT (widget), - egg_state_machine__style_object_weak_notify, - style_obj); - - g_ptr_array_add (state_obj->styles, style_obj); - - if (g_strcmp0 (state, priv->state) == 0) - { - GtkStyleContext *style_context; - - style_context = gtk_widget_get_style_context (widget); - gtk_style_context_add_class (style_context, style); - } -} - -/** - * egg_state_machine_connect_object: (skip) - * @self: A #EggStateMachine. - * @state: The state the signal connection should exist within - * @source: the source object to connect to - * @detailed_signal: The detailed signal of @source to connect. - * @callback: (scope notified) (closure user_data): The callback to execute upon signal emission. - * @user_data: The user data for @callback. - * @flags: signal connection flags. - * - * Connects to the @detailed_signal of @source only when the current - * state of the state machine is @state. - */ -void -egg_state_machine_connect_object (EggStateMachine *self, - const gchar *state, - gpointer source, - const gchar *detailed_signal, - GCallback callback, - gpointer user_data, - GConnectFlags flags) -{ - EggState *state_obj; - EggSignalGroup *signals; - - g_return_if_fail (EGG_IS_STATE_MACHINE (self)); - g_return_if_fail (state != NULL); - g_return_if_fail (G_IS_OBJECT (source)); - g_return_if_fail (detailed_signal != NULL); - g_return_if_fail (callback != NULL); - - state_obj = egg_state_machine_get_state_obj (self, state); - - if (!(signals = g_hash_table_lookup (state_obj->signals, source))) - { - signals = egg_signal_group_new (G_OBJECT_TYPE (source)); - g_hash_table_insert (state_obj->signals, source, signals); - - g_object_weak_ref (source, - egg_state_machine__signal_source_weak_notify, - self); - } - - egg_signal_group_connect_object (signals, detailed_signal, callback, user_data, flags); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-state-machine.h gnome-usage-3.32.0/external/egg/egg-state-machine.h --- gnome-usage-3.30.0/external/egg/egg-state-machine.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-state-machine.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/* egg-state-machine.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_STATE_MACHINE_H -#define EGG_STATE_MACHINE_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_STATE_MACHINE (egg_state_machine_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggStateMachine, egg_state_machine, EGG, STATE_MACHINE, GObject) - -struct _EggStateMachineClass -{ - GObjectClass parent; -}; - -EggStateMachine *egg_state_machine_new (void); -const gchar *egg_state_machine_get_state (EggStateMachine *self); -void egg_state_machine_set_state (EggStateMachine *self, - const gchar *state); -GAction *egg_state_machine_create_action (EggStateMachine *self, - const gchar *name); -void egg_state_machine_add_property (EggStateMachine *self, - const gchar *state, - gpointer object, - const gchar *property, - ...); -void egg_state_machine_add_property_valist - (EggStateMachine *self, - const gchar *state, - gpointer object, - const gchar *property, - va_list var_args); -void egg_state_machine_add_propertyv (EggStateMachine *self, - const gchar *state, - gpointer object, - const gchar *property, - const GValue *value); -void egg_state_machine_add_binding (EggStateMachine *self, - const gchar *state, - gpointer source_object, - const gchar *source_property, - gpointer target_object, - const gchar *target_property, - GBindingFlags flags); -void egg_state_machine_add_style (EggStateMachine *self, - const gchar *state, - GtkWidget *widget, - const gchar *style); -void egg_state_machine_connect_object (EggStateMachine *self, - const gchar *state, - gpointer source, - const gchar *detailed_signal, - GCallback callback, - gpointer user_data, - GConnectFlags flags); - -G_END_DECLS - -#endif /* EGG_STATE_MACHINE_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-task-cache.c gnome-usage-3.32.0/external/egg/egg-task-cache.c --- gnome-usage-3.30.0/external/egg/egg-task-cache.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-task-cache.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,949 +0,0 @@ -/* egg-task-cache.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-task-cache" - -#include - -#include "egg-counter.h" -#include "egg-heap.h" -#include "egg-task-cache.h" - -typedef struct -{ - EggTaskCache *self; - gpointer key; - gpointer value; - gint64 evict_at; -} CacheItem; - -typedef struct -{ - GSource source; - EggHeap *heap; -} EvictSource; - -struct _EggTaskCache -{ - GObject parent_instance; - - GHashFunc key_hash_func; - GEqualFunc key_equal_func; - GBoxedCopyFunc key_copy_func; - GBoxedFreeFunc key_destroy_func; - GBoxedCopyFunc value_copy_func; - GBoxedFreeFunc value_destroy_func; - - EggTaskCacheCallback populate_callback; - gpointer populate_callback_data; - GDestroyNotify populate_callback_data_destroy; - - GHashTable *cache; - GHashTable *in_flight; - GHashTable *queued; - - gchar *name; - - EggHeap *evict_heap; - GSource *evict_source; - guint evict_source_id; - - gint64 time_to_live_usec; -}; - -G_DEFINE_TYPE (EggTaskCache, egg_task_cache, G_TYPE_OBJECT) - -EGG_DEFINE_COUNTER (instances, "EggTaskCache", "Instances", "Number of EggTaskCache instances") -EGG_DEFINE_COUNTER (in_flight, "EggTaskCache", "In Flight", "Number of in flight operations") -EGG_DEFINE_COUNTER (queued, "EggTaskCache", "Queued", "Number of queued operations") -EGG_DEFINE_COUNTER (cached, "EggTaskCache", "Cache Size", "Number of cached items") -EGG_DEFINE_COUNTER (hits, "EggTaskCache", "Cache Hits", "Number of cache hits") -EGG_DEFINE_COUNTER (misses, "EggTaskCache", "Cache Miss", "Number of cache misses") - -enum { - PROP_0, - PROP_KEY_COPY_FUNC, - PROP_KEY_DESTROY_FUNC, - PROP_KEY_EQUAL_FUNC, - PROP_KEY_HASH_FUNC, - PROP_POPULATE_CALLBACK, - PROP_POPULATE_CALLBACK_DATA, - PROP_POPULATE_CALLBACK_DATA_DESTROY, - PROP_TIME_TO_LIVE, - PROP_VALUE_COPY_FUNC, - PROP_VALUE_DESTROY_FUNC, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -static gboolean -evict_source_check (GSource *source) -{ - EvictSource *ev = (EvictSource *)source; - - g_assert (ev != NULL); - g_assert (ev->heap != NULL); - - if (ev->heap->len > 0) - { - CacheItem *item; - gint64 now; - - now = g_source_get_time (source); - item = egg_heap_peek (ev->heap, gpointer); - - return (item->evict_at <= now); - } - - return FALSE; -} - -static void -evict_source_rearm (GSource *source) -{ - EvictSource *evict_source = (EvictSource *)source; - gint64 ready_time = -1; - - g_assert (source != NULL); - g_assert (evict_source != NULL); - - if (evict_source->heap->len > 0) - { - CacheItem *item; - - item = egg_heap_peek (evict_source->heap, gpointer); - ready_time = item->evict_at; - } - - g_source_set_ready_time (source, ready_time); -} - -static gboolean -evict_source_dispatch (GSource *source, - GSourceFunc callback, - gpointer user_data) -{ - gboolean ret = G_SOURCE_CONTINUE; - - if (callback != NULL) - ret = callback (user_data); - - evict_source_rearm (source); - - return ret; -} - -static void -evict_source_finalize (GSource *source) -{ - EvictSource *ev = (EvictSource *)source; - - g_clear_pointer (&ev->heap, egg_heap_unref); -} - -static GSourceFuncs evict_source_funcs = { - NULL, - evict_source_check, - evict_source_dispatch, - evict_source_finalize, -}; - -static void -cache_item_free (gpointer data) -{ - CacheItem *item = data; - - item->self->key_destroy_func (item->key); - item->self->value_destroy_func (item->value); - item->self = NULL; - item->evict_at = 0; - - g_slice_free (CacheItem, item); -} - -static gint -cache_item_compare_evict_at (gconstpointer a, - gconstpointer b) -{ - const CacheItem **ci1 = (const CacheItem **)a; - const CacheItem **ci2 = (const CacheItem **)b; - gint64 ret; - - /* - * While unlikely, but since we are working with 64-bit monotonic clock and - * 32-bit return values, we can't do the normal (a - b) trick. We need to - * ensure we are within the 32-bit boundary. - */ - - ret = (*ci2)->evict_at - (*ci1)->evict_at; - - if (ret < 0) - return -1; - else if (ret > 0) - return 1; - else - return 0; -} - -static CacheItem * -cache_item_new (EggTaskCache *self, - gconstpointer key, - gconstpointer value) -{ - CacheItem *ret; - - g_assert (EGG_IS_TASK_CACHE (self)); - - ret = g_slice_new0 (CacheItem); - ret->self = self; - ret->key = self->key_copy_func ((gpointer)key); - ret->value = self->value_copy_func ((gpointer)value); - if (self->time_to_live_usec > 0) - ret->evict_at = g_get_monotonic_time () + self->time_to_live_usec; - - return ret; -} - -static gboolean -egg_task_cache_evict_full (EggTaskCache *self, - gconstpointer key, - gboolean check_heap) -{ - CacheItem *item; - - g_return_val_if_fail (EGG_IS_TASK_CACHE (self), FALSE); - - if ((item = g_hash_table_lookup (self->cache, key))) - { - if (check_heap) - { - gsize i; - - for (i = 0; i < self->evict_heap->len; i++) - { - if (item == egg_heap_index (self->evict_heap, gpointer, i)) - { - egg_heap_extract_index (self->evict_heap, i, NULL); - break; - } - } - } - - g_hash_table_remove (self->cache, key); - - EGG_COUNTER_DEC (cached); - - g_debug ("Evicted 1 item from %s", self->name ?: "unnamed cache"); - - if (self->evict_source != NULL) - evict_source_rearm (self->evict_source); - - return TRUE; - } - - return FALSE; -} - -gboolean -egg_task_cache_evict (EggTaskCache *self, - gconstpointer key) -{ - return egg_task_cache_evict_full (self, key, TRUE); -} - -void -egg_task_cache_evict_all (EggTaskCache *self) -{ - guint size; - - g_return_if_fail (EGG_IS_TASK_CACHE (self)); - - size = g_hash_table_size (self->cache); - - while (self->evict_heap->len > 0) - { - CacheItem *item; - - /* The cache item is owned by the hashtable, so safe to "leak" here */ - egg_heap_extract_index (self->evict_heap, self->evict_heap->len - 1, &item); - } - - g_hash_table_remove_all (self->cache); - - EGG_COUNTER_SUB (cached, size); - - if (self->evict_source != NULL) - evict_source_rearm (self->evict_source); -} - -/** - * egg_task_cache_peek: - * @self: An #EggTaskCache - * @key: The key for the cache - * - * Peeks to see @key is contained in the cache and returns the - * matching #GObject if it does. - * - * The reference count of the resulting #GObject is not incremented. - * For that reason, it is important to remember that this function - * may only be called from the main thread. - * - * Returns: (type GObject.Object) (nullable) (transfer none): A #GObject or - * %NULL if the key was not found in the cache. - */ -gpointer -egg_task_cache_peek (EggTaskCache *self, - gconstpointer key) -{ - CacheItem *item; - - g_return_val_if_fail (EGG_IS_TASK_CACHE (self), NULL); - - if ((item = g_hash_table_lookup (self->cache, key))) - { - EGG_COUNTER_INC (hits); - return item->value; - } - - return NULL; -} - -static void -egg_task_cache_propagate_error (EggTaskCache *self, - gconstpointer key, - const GError *error) -{ - GPtrArray *queued; - - g_assert (EGG_IS_TASK_CACHE (self)); - g_assert (error != NULL); - - if ((queued = g_hash_table_lookup (self->queued, key))) - { - gint64 count = queued->len; - gsize i; - - /* we can't use steal because we want the key freed */ - g_ptr_array_ref (queued); - g_hash_table_remove (self->queued, key); - - for (i = 0; i < queued->len; i++) - { - GTask *task; - - task = g_ptr_array_index (queued, i); - g_task_return_error (task, g_error_copy (error)); - } - - g_ptr_array_unref (queued); - - EGG_COUNTER_SUB (queued, count); - } -} - -static void -egg_task_cache_populate (EggTaskCache *self, - gconstpointer key, - gpointer value) -{ - CacheItem *item; - - g_assert (EGG_IS_TASK_CACHE (self)); - - item = cache_item_new (self, key, value); - - if (g_hash_table_contains (self->cache, key)) - egg_task_cache_evict (self, key); - g_hash_table_insert (self->cache, item->key, item); - egg_heap_insert_val (self->evict_heap, item); - - EGG_COUNTER_INC (cached); - - if (self->evict_source != NULL) - evict_source_rearm (self->evict_source); -} - -static void -egg_task_cache_propagate_pointer (EggTaskCache *self, - gconstpointer key, - gpointer value) -{ - GPtrArray *queued = NULL; - - g_assert (EGG_IS_TASK_CACHE (self)); - - if ((queued = g_hash_table_lookup (self->queued, key))) - { - gint64 count = queued->len; - gsize i; - - g_ptr_array_ref (queued); - g_hash_table_remove (self->queued, key); - - for (i = 0; i < queued->len; i++) - { - GTask *task; - - task = g_ptr_array_index (queued, i); - g_task_return_pointer (task, - self->value_copy_func (value), - self->value_destroy_func); - } - - g_ptr_array_unref (queued); - - EGG_COUNTER_SUB (queued, count); - } -} - -static void -egg_task_cache_fetch_cb (GObject *object, - GAsyncResult *result, - gpointer user_data) -{ - EggTaskCache *self = (EggTaskCache *)object; - GTask *task = (GTask *)result; - GError *error = NULL; - gpointer key = user_data; - gpointer ret; - - g_assert (EGG_IS_TASK_CACHE (self)); - g_assert (G_IS_TASK (task)); - - g_hash_table_remove (self->in_flight, key); - - ret = g_task_propagate_pointer (task, &error); - - if (ret != NULL) - { - egg_task_cache_populate (self, key, ret); - egg_task_cache_propagate_pointer (self, key, ret); - self->value_destroy_func (ret); - } - else - { - egg_task_cache_propagate_error (self, key, error); - g_clear_error (&error); - } - - self->key_destroy_func (key); - - EGG_COUNTER_DEC (in_flight); -} - -void -egg_task_cache_get_async (EggTaskCache *self, - gconstpointer key, - gboolean force_update, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_autoptr(GTask) task = NULL; - GPtrArray *queued; - gpointer ret; - - g_return_if_fail (EGG_IS_TASK_CACHE (self)); - g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable)); - - task = g_task_new (self, cancellable, callback, user_data); - g_task_set_return_on_cancel (task, FALSE); - - /* - * If we have the answer, return it now. - */ - if (!force_update && (ret = egg_task_cache_peek (self, key))) - { - g_task_return_pointer (task, - self->value_copy_func (ret), - self->value_destroy_func); - return; - } - - EGG_COUNTER_INC (misses); - - /* - * Always queue the request. If we need to dispatch the worker to - * fetch the result, that will happen with another task. - */ - if (!(queued = g_hash_table_lookup (self->queued, key))) - { - queued = g_ptr_array_new_with_free_func (g_object_unref); - g_hash_table_insert (self->queued, - self->key_copy_func ((gpointer)key), - queued); - } - - g_ptr_array_add (queued, g_object_ref (task)); - EGG_COUNTER_INC (queued); - - /* - * The in_flight hashtable will have a bit set if we have queued - * an operation for this key. - */ - if (!g_hash_table_contains (self->in_flight, key)) - { - g_autoptr(GTask) fetch_task = NULL; - - fetch_task = g_task_new (self, - cancellable, - egg_task_cache_fetch_cb, - self->key_copy_func ((gpointer)key)); - g_hash_table_insert (self->in_flight, - self->key_copy_func ((gpointer)key), - GINT_TO_POINTER (TRUE)); - self->populate_callback (self, - key, - g_object_ref (fetch_task), - self->populate_callback_data); - - EGG_COUNTER_INC (in_flight); - } -} - -/** - * egg_task_cache_get_finish: - * - * Finish a call to egg_task_cache_get_async(). - * - * Returns: (transfer full): The result from the cache. - */ -gpointer -egg_task_cache_get_finish (EggTaskCache *self, - GAsyncResult *result, - GError **error) -{ - GTask *task = (GTask *)result; - - g_return_val_if_fail (EGG_IS_TASK_CACHE (self), NULL); - g_return_val_if_fail (G_IS_TASK (result), NULL); - g_return_val_if_fail (G_IS_TASK (task), NULL); - - return g_task_propagate_pointer (task, error); -} - -static gboolean -egg_task_cache_do_eviction (gpointer user_data) -{ - EggTaskCache *self = user_data; - gint64 now = g_get_monotonic_time (); - - while (self->evict_heap->len > 0) - { - CacheItem *item; - - item = egg_heap_peek (self->evict_heap, gpointer); - - if (item->evict_at <= now) - { - egg_heap_extract (self->evict_heap, NULL); - egg_task_cache_evict_full (self, item->key, FALSE); - continue; - } - - break; - } - - return G_SOURCE_CONTINUE; -} - -static void -egg_task_cache_install_evict_source (EggTaskCache *self) -{ - GMainContext *main_context; - EvictSource *evict_source; - GSource *source; - - main_context = g_main_context_get_thread_default (); - - source = g_source_new (&evict_source_funcs, sizeof (EvictSource)); - g_source_set_callback (source, egg_task_cache_do_eviction, self, NULL); - g_source_set_name (source, "EggTaskCache Eviction"); - g_source_set_priority (source, G_PRIORITY_LOW); - g_source_set_ready_time (source, -1); - - evict_source = (EvictSource *)source; - evict_source->heap = egg_heap_ref (self->evict_heap); - - self->evict_source = source; - self->evict_source_id = g_source_attach (source, main_context); -} - -static void -egg_task_cache_constructed (GObject *object) -{ - EggTaskCache *self = (EggTaskCache *)object; - - G_OBJECT_CLASS (egg_task_cache_parent_class)->constructed (object); - - if ((self->key_copy_func == NULL) || - (self->key_destroy_func == NULL) || - (self->key_equal_func == NULL) || - (self->key_hash_func == NULL) || - (self->value_copy_func == NULL) || - (self->value_destroy_func == NULL) || - (self->populate_callback == NULL)) - { - g_error ("EggTaskCache was configured improperly."); - return; - } - - /* - * This is where the cached result objects live. - */ - self->cache = g_hash_table_new_full (self->key_hash_func, - self->key_equal_func, - NULL, - cache_item_free); - - /* - * This is where we store a bit to know if we have an inflight - * request for this cache key. - */ - self->in_flight = g_hash_table_new_full (self->key_hash_func, - self->key_equal_func, - self->key_destroy_func, - NULL); - - /* - * This is where tasks queue waiting for an in_flight callback. - */ - self->queued = g_hash_table_new_full (self->key_hash_func, - self->key_equal_func, - self->key_destroy_func, - (GDestroyNotify)g_ptr_array_unref); - - /* - * Register our eviction source if we have a time_to_live. - */ - if (self->time_to_live_usec > 0) - egg_task_cache_install_evict_source (self); -} - -static void -count_queued_cb (gpointer key, - gpointer value, - gpointer user_data) -{ - GPtrArray *ar = value; - gint64 *count = user_data; - - (*count) += ar->len; -} - -static void -egg_task_cache_dispose (GObject *object) -{ - EggTaskCache *self = (EggTaskCache *)object; - - if (self->evict_source_id != 0) - { - g_source_remove (self->evict_source_id); - self->evict_source_id = 0; - self->evict_source = NULL; - } - - g_clear_pointer (&self->evict_heap, egg_heap_unref); - - if (self->cache != NULL) - { - gint64 count; - - count = g_hash_table_size (self->cache); - g_clear_pointer (&self->cache, g_hash_table_unref); - - g_debug ("Evicted cache of %"G_GINT64_FORMAT" items from %s", - count, self->name ?: "unnamed cache"); - - EGG_COUNTER_SUB (cached, count); - } - - if (self->queued != NULL) - { - gint64 count = 0; - - g_hash_table_foreach (self->queued, count_queued_cb, &count); - g_clear_pointer (&self->queued, g_hash_table_unref); - - EGG_COUNTER_SUB (queued, count); - } - - if (self->in_flight != NULL) - { - gint64 count; - - count = g_hash_table_size (self->in_flight); - g_clear_pointer (&self->in_flight, g_hash_table_unref); - - EGG_COUNTER_SUB (in_flight, count); - } - - if (self->populate_callback_data) - { - if (self->populate_callback_data_destroy) - self->populate_callback_data_destroy (self->populate_callback_data); - } - - G_OBJECT_CLASS (egg_task_cache_parent_class)->dispose (object); -} - -static void -egg_task_cache_finalize (GObject *object) -{ - EggTaskCache *self = (EggTaskCache *)object; - - g_clear_pointer (&self->name, g_free); - - G_OBJECT_CLASS (egg_task_cache_parent_class)->finalize (object); - - EGG_COUNTER_DEC (instances); -} - -static void -egg_task_cache_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggTaskCache *self = EGG_TASK_CACHE(object); - - switch (prop_id) - { - case PROP_KEY_COPY_FUNC: - self->key_copy_func = g_value_get_pointer (value); - break; - - case PROP_KEY_DESTROY_FUNC: - self->key_destroy_func = g_value_get_pointer (value); - break; - - case PROP_KEY_EQUAL_FUNC: - self->key_equal_func = g_value_get_pointer (value); - break; - - case PROP_KEY_HASH_FUNC: - self->key_hash_func = g_value_get_pointer (value); - break; - - case PROP_POPULATE_CALLBACK: - self->populate_callback = g_value_get_pointer (value); - break; - - case PROP_POPULATE_CALLBACK_DATA: - self->populate_callback_data = g_value_get_pointer (value); - break; - - case PROP_POPULATE_CALLBACK_DATA_DESTROY: - self->populate_callback_data_destroy = g_value_get_pointer (value); - break; - - case PROP_TIME_TO_LIVE: - self->time_to_live_usec = (g_value_get_int64 (value) * 1000L); - break; - - case PROP_VALUE_COPY_FUNC: - self->value_copy_func = g_value_get_pointer (value); - break; - - case PROP_VALUE_DESTROY_FUNC: - self->value_destroy_func = g_value_get_pointer (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - } -} - -static void -egg_task_cache_class_init (EggTaskCacheClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructed = egg_task_cache_constructed; - object_class->dispose = egg_task_cache_dispose; - object_class->finalize = egg_task_cache_finalize; - object_class->set_property = egg_task_cache_set_property; - - properties [PROP_KEY_HASH_FUNC] = - g_param_spec_pointer ("key-hash-func", - "Key Hash Func", - "Key Hash Func", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_KEY_EQUAL_FUNC] = - g_param_spec_pointer ("key-equal-func", - "Key Equal Func", - "Key Equal Func", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_KEY_COPY_FUNC] = - g_param_spec_pointer ("key-copy-func", - "Key Copy Func", - "Key Copy Func", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_KEY_DESTROY_FUNC] = - g_param_spec_pointer ("key-destroy-func", - "Key Destroy Func", - "Key Destroy Func", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_POPULATE_CALLBACK] = - g_param_spec_pointer ("populate-callback", - "Populate Callback", - "Populate Callback", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_POPULATE_CALLBACK_DATA] = - g_param_spec_pointer ("populate-callback-data", - "Populate Callback Data", - "Populate Callback Data", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_POPULATE_CALLBACK_DATA_DESTROY] = - g_param_spec_pointer ("populate-callback-data-destroy", - "Populate Callback Data Destroy", - "Populate Callback Data Destroy", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - /** - * EggTaskCache:time-to-live: - * - * This is the number of milliseconds before an item should be evicted - * from the cache. - * - * A value of zero indicates no eviction. - */ - properties [PROP_TIME_TO_LIVE] = - g_param_spec_int64 ("time-to-live", - "Time to Live", - "The time to live in milliseconds.", - 0, - G_MAXINT64, - 30 * 1000, - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_VALUE_COPY_FUNC] = - g_param_spec_pointer ("value-copy-func", - "Value Copy Func", - "Value Copy Func", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_VALUE_DESTROY_FUNC] = - g_param_spec_pointer ("value-destroy-func", - "Value Destroy Func", - "Value Destroy Func", - (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -void -egg_task_cache_init (EggTaskCache *self) -{ - EGG_COUNTER_INC (instances); - - self->evict_heap = egg_heap_new (sizeof (gpointer), - cache_item_compare_evict_at); -} - -/** - * egg_task_cache_new: (skip) - */ -EggTaskCache * -egg_task_cache_new (GHashFunc key_hash_func, - GEqualFunc key_equal_func, - GBoxedCopyFunc key_copy_func, - GBoxedFreeFunc key_destroy_func, - GBoxedCopyFunc value_copy_func, - GBoxedFreeFunc value_destroy_func, - gint64 time_to_live, - EggTaskCacheCallback populate_callback, - gpointer populate_callback_data, - GDestroyNotify populate_callback_data_destroy) -{ - g_return_val_if_fail (key_hash_func, NULL); - g_return_val_if_fail (key_equal_func, NULL); - g_return_val_if_fail (key_copy_func, NULL); - g_return_val_if_fail (key_destroy_func, NULL); - g_return_val_if_fail (populate_callback, NULL); - - return g_object_new (EGG_TYPE_TASK_CACHE, - "key-hash-func", key_hash_func, - "key-equal-func", key_equal_func, - "key-copy-func", key_copy_func, - "key-destroy-func", key_destroy_func, - "populate-callback", populate_callback, - "populate-callback-data", populate_callback_data, - "populate-callback-data-destroy", populate_callback_data_destroy, - "time-to-live", time_to_live, - "value-copy-func", value_copy_func, - "value-destroy-func", value_destroy_func, - NULL); -} - -/** - * egg_task_cache_get_values: (skip) - * - * Gets all the values in the cache. - * - * The caller owns the resulting GPtrArray, which itself owns a reference to the children. - * - * Returns: (transfer container): The values. - */ -GPtrArray * -egg_task_cache_get_values (EggTaskCache *self) -{ - GPtrArray *ar; - GHashTableIter iter; - gpointer value; - - g_return_val_if_fail (EGG_IS_TASK_CACHE (self), NULL); - - ar = g_ptr_array_new_with_free_func (self->value_destroy_func); - - g_hash_table_iter_init (&iter, self->cache); - - while (g_hash_table_iter_next (&iter, NULL, &value)) - { - CacheItem *item = value; - - g_ptr_array_add (ar, self->value_copy_func (item->value)); - } - - return ar; -} - -void -egg_task_cache_set_name (EggTaskCache *self, - const gchar *name) -{ - g_return_if_fail (EGG_IS_TASK_CACHE (self)); - - g_free (self->name); - self->name = g_strdup (name); - - if (name && self->evict_source) - { - g_autofree gchar *full_name = NULL; - - full_name = g_strdup_printf ("[egg_task_cache] %s", name); - g_source_set_name (self->evict_source, full_name); - } -} diff -Nru gnome-usage-3.30.0/external/egg/egg-task-cache.h gnome-usage-3.32.0/external/egg/egg-task-cache.h --- gnome-usage-3.30.0/external/egg/egg-task-cache.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-task-cache.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* egg-task-cache.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_TASK_CACHE_H -#define EGG_TASK_CACHE_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_TASK_CACHE (egg_task_cache_get_type()) - -G_DECLARE_FINAL_TYPE (EggTaskCache, egg_task_cache, EGG, TASK_CACHE, GObject) - -/** - * EggTaskCacheCallback: - * @self: An #EggTaskCache. - * @key: the key to fetch - * @task: the task to be completed - * @user_data: user_data registered at initialization. - * - * #EggTaskCacheCallback is the prototype for a function to be executed to - * populate an item in the cache. - * - * This function will be executed when a fault (cache miss) occurs from - * a caller requesting an item from the cache. - * - * The callee may complete the operation asynchronously, but MUST return - * either a GObject using g_task_return_pointer() or a #GError using - * g_task_return_error() or g_task_return_new_error(). - */ -typedef void (*EggTaskCacheCallback) (EggTaskCache *self, - gconstpointer key, - GTask *task, - gpointer user_data); - -EggTaskCache *egg_task_cache_new (GHashFunc key_hash_func, - GEqualFunc key_equal_func, - GBoxedCopyFunc key_copy_func, - GBoxedFreeFunc key_destroy_func, - GBoxedCopyFunc value_copy_func, - GBoxedFreeFunc value_free_func, - gint64 time_to_live_msec, - EggTaskCacheCallback populate_callback, - gpointer populate_callback_data, - GDestroyNotify populate_callback_data_destroy); -void egg_task_cache_set_name (EggTaskCache *self, - const gchar *name); -void egg_task_cache_get_async (EggTaskCache *self, - gconstpointer key, - gboolean force_update, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gpointer egg_task_cache_get_finish (EggTaskCache *self, - GAsyncResult *result, - GError **error); -gboolean egg_task_cache_evict (EggTaskCache *self, - gconstpointer key); -void egg_task_cache_evict_all (EggTaskCache *self); -gpointer egg_task_cache_peek (EggTaskCache *self, - gconstpointer key); -GPtrArray *egg_task_cache_get_values (EggTaskCache *self); - -G_END_DECLS - -#endif /* EGG_TASK_CACHE_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-three-grid.c gnome-usage-3.32.0/external/egg/egg-three-grid.c --- gnome-usage-3.30.0/external/egg/egg-three-grid.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-three-grid.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,804 +0,0 @@ -/* egg-three-grid.c - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-three-grid" - -#include - -#include "egg-three-grid.h" - -typedef struct -{ - GtkWidget *widget; - gint column; - gint row; - gint min_height; - gint nat_height; - gint min_baseline; - gint nat_baseline; -} EggThreeGridChild; - -typedef struct -{ - GPtrArray *children; - GHashTable *row_infos; - guint column_spacing; - guint row_spacing; -} EggThreeGridPrivate; - -typedef struct -{ - gint row; - gint min_above_baseline; - gint min_below_baseline; - gint nat_above_baseline; - gint nat_below_baseline; -} EggThreeGridRowInfo; - -G_DEFINE_TYPE_WITH_PRIVATE (EggThreeGrid, egg_three_grid, GTK_TYPE_CONTAINER) - -enum { - PROP_0, - PROP_COLUMN_SPACING, - PROP_ROW_SPACING, - N_PROPS -}; - -enum { - CHILD_PROP_0, - CHILD_PROP_ROW, - CHILD_PROP_COLUMN, - N_CHILD_PROPS -}; - -static GParamSpec *properties [N_PROPS]; -static GParamSpec *child_properties [N_CHILD_PROPS]; -static EggThreeGridChild dummy; - -static EggThreeGridChild * -egg_three_grid_child_new (void) -{ - return g_slice_new0 (EggThreeGridChild); -} - -static void -egg_three_grid_child_free (gpointer data) -{ - EggThreeGridChild *child = data; - - g_clear_object (&child->widget); - g_slice_free (EggThreeGridChild, child); -} - -static EggThreeGridChild * -egg_three_grid_find_child (EggThreeGrid *self, - GtkWidget *widget) -{ - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (guint i = 0; i < priv->children->len; i++) - { - EggThreeGridChild *child = g_ptr_array_index (priv->children, i); - - if (child->widget == widget) - return child; - } - - return &dummy; -} - -static void -egg_three_grid_add (GtkContainer *container, - GtkWidget *widget) -{ - EggThreeGrid *self = (EggThreeGrid *)container; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - EggThreeGridChild *child; - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (GTK_IS_WIDGET (widget)); - - child = egg_three_grid_child_new (); - child->widget = g_object_ref_sink (widget); - g_ptr_array_add (priv->children, child); - - gtk_widget_set_parent (widget, GTK_WIDGET (self)); -} - -static void -egg_three_grid_remove (GtkContainer *container, - GtkWidget *widget) -{ - EggThreeGrid *self = (EggThreeGrid *)container; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (GTK_IS_WIDGET (widget)); - - for (guint i = 0; i < priv->children->len; i++) - { - EggThreeGridChild *child = g_ptr_array_index (priv->children, i); - - if (child->widget == widget) - { - gtk_widget_unparent (child->widget); - g_ptr_array_remove_index (priv->children, i); - gtk_widget_queue_resize (GTK_WIDGET (self)); - return; - } - } -} - -static GtkSizeRequestMode -egg_three_grid_get_request_mode (GtkWidget *widget) -{ - return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; -} - -static void -egg_three_grid_get_column_width (EggThreeGrid *self, - EggThreeGridColumn column, - gint *min_width, - gint *nat_width) -{ - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - gint real_min_width = 0; - gint real_nat_width = 0; - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (column >= EGG_THREE_GRID_COLUMN_LEFT); - g_assert (column <= EGG_THREE_GRID_COLUMN_RIGHT); - g_assert (min_width != NULL); - g_assert (nat_width != NULL); - - for (guint i = 0; i < priv->children->len; i++) - { - EggThreeGridChild *child = g_ptr_array_index (priv->children, i); - - if (child->column == column) - { - gint child_min_width; - gint child_nat_width; - - gtk_widget_get_preferred_width (child->widget, &child_min_width, &child_nat_width); - - real_min_width = MAX (real_min_width, child_min_width); - real_nat_width = MAX (real_nat_width, child_nat_width); - } - } - - *min_width = real_min_width; - *nat_width = real_nat_width; -} - -static void -egg_three_grid_get_preferred_width (GtkWidget *widget, - gint *min_width, - gint *nat_width) -{ - EggThreeGrid *self = (EggThreeGrid *)widget; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - gint total_min_width = 0; - gint total_nat_width = 0; - gint min_widths[3]; - gint nat_widths[3]; - gint border_width; - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (min_width != NULL); - g_assert (nat_width != NULL); - - for (guint i = 0; i < 3; i++) - egg_three_grid_get_column_width (self, i, &min_widths[i], &nat_widths[i]); - - total_min_width = MAX (min_widths[0], min_widths[2]) * 2 + min_widths[1]; - total_nat_width = MAX (nat_widths[0], nat_widths[2]) * 2 + nat_widths[1]; - - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - - *min_width = total_min_width + (border_width * 2) + (priv->column_spacing * 2); - *nat_width = total_nat_width + (border_width * 2) + (priv->column_spacing * 2); -} - -static void -row_info_merge (EggThreeGridRowInfo *row_info, - const EggThreeGridRowInfo *other) -{ - g_assert (row_info); - g_assert (other); - - row_info->min_above_baseline = MAX (row_info->min_above_baseline, other->min_above_baseline); - row_info->min_below_baseline = MAX (row_info->min_below_baseline, other->min_below_baseline); - row_info->nat_above_baseline = MAX (row_info->nat_above_baseline, other->nat_above_baseline); - row_info->nat_below_baseline = MAX (row_info->nat_below_baseline, other->nat_below_baseline); -} - -static void -update_row_info (GHashTable *hashtable, - EggThreeGridChild *child) -{ - GtkBaselinePosition baseline_position = GTK_BASELINE_POSITION_CENTER; - EggThreeGridRowInfo *row_info; - EggThreeGridRowInfo current = { 0 }; - - g_assert (hashtable); - g_assert (child); - - row_info = g_hash_table_lookup (hashtable, GINT_TO_POINTER (child->row)); - - if (row_info == NULL) - { - row_info = g_new0 (EggThreeGridRowInfo, 1); - row_info->row = child->row; - g_hash_table_insert (hashtable, GINT_TO_POINTER (child->row), row_info); - } - - /* - * TODO: - * - * Allow setting baseline position per row. Right now we only support center - * because that is the easiest thing to start with. - */ - - if (child->min_baseline == -1) - { - if (baseline_position == GTK_BASELINE_POSITION_CENTER) - { - current.min_above_baseline = current.min_below_baseline = ceil (child->min_height / 2.0); - current.nat_above_baseline = current.nat_below_baseline = ceil (child->min_height / 2.0); - } - else if (baseline_position == GTK_BASELINE_POSITION_TOP) - { - g_assert_not_reached (); - } - else if (baseline_position == GTK_BASELINE_POSITION_BOTTOM) - { - g_assert_not_reached (); - } - } - else - { - current.min_above_baseline = child->min_baseline; - current.min_below_baseline = child->min_height - child->min_baseline; - current.nat_above_baseline = child->nat_baseline; - current.nat_below_baseline = child->nat_height - child->nat_baseline; - } - - row_info_merge (row_info, ¤t); -} - -static void -egg_three_grid_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *min_height, - gint *nat_height) -{ - EggThreeGrid *self = (EggThreeGrid *)widget; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - g_autoptr(GHashTable) row_infos = NULL; - EggThreeGridRowInfo *row_info; - GHashTableIter iter; - gint real_min_height = 0; - gint real_nat_height = 0; - gint column_min_widths[3]; - gint column_nat_widths[3]; - gint widths[3]; - gint border_width; - gint n_rows; - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (min_height != NULL); - g_assert (nat_height != NULL); - - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - width -= border_width * 2; - width -= priv->column_spacing * 2; - - egg_three_grid_get_column_width (self, EGG_THREE_GRID_COLUMN_LEFT, &column_min_widths[0], &column_nat_widths[0]); - egg_three_grid_get_column_width (self, EGG_THREE_GRID_COLUMN_CENTER, &column_min_widths[1], &column_nat_widths[1]); - egg_three_grid_get_column_width (self, EGG_THREE_GRID_COLUMN_RIGHT, &column_min_widths[2], &column_nat_widths[2]); - - if ((MAX (column_min_widths[0], column_min_widths[2]) * 2 + column_nat_widths[1]) >= width) - { - widths[0] = column_min_widths[0]; - widths[2] = column_min_widths[2]; - widths[1] = width - widths[0] - widths[2]; - } - else - { - /* Handle #1 and #2 */ - widths[1] = column_nat_widths[1]; - widths[0] = (width - widths[1]) / 2; - widths[2] = width - widths[1] - widths[0]; - } - - row_infos = g_hash_table_new_full (NULL, NULL, NULL, g_free); - - for (guint i = 0; i < priv->children->len; i++) - { - EggThreeGridChild *child = g_ptr_array_index (priv->children, i); - - if (!gtk_widget_get_visible (child->widget) || - !gtk_widget_get_child_visible (child->widget)) - continue; - - gtk_widget_get_preferred_height_and_baseline_for_width (child->widget, - widths[child->column], - &child->min_height, - &child->nat_height, - &child->min_baseline, - &child->nat_baseline); - update_row_info (row_infos, child); - } - - g_hash_table_iter_init (&iter, row_infos); - - while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&row_info)) - { -#if 0 - g_print ("Row %d: MIN Above %d Below %d\n", - row_info->row, - row_info->min_above_baseline, row_info->min_below_baseline); - g_print ("Row %d: NAT Above %d Below %d\n", - row_info->row, - row_info->nat_above_baseline, row_info->nat_below_baseline); -#endif - real_min_height += row_info->min_above_baseline + row_info->min_below_baseline; - real_nat_height += row_info->nat_above_baseline + row_info->nat_below_baseline; - } - - real_min_height += border_width * 2; - real_nat_height += border_width * 2; - - n_rows = g_hash_table_size (row_infos); - - if (n_rows > 1) - { - real_min_height += (n_rows - 1) * priv->row_spacing; - real_nat_height += (n_rows - 1) * priv->row_spacing; - } - - *min_height = real_min_height; - *nat_height = real_nat_height; - -#if 0 - g_print ("%d children in %d rows: %dx%d\n", - priv->children->len, - g_hash_table_size (row_infos), - real_min_height, real_nat_height); -#endif - - g_clear_pointer (&priv->row_infos, g_hash_table_unref); - priv->row_infos = g_steal_pointer (&row_infos); -} - -static gint -sort_by_row (gconstpointer a, - gconstpointer b) -{ - const EggThreeGridRowInfo *info_a = a; - const EggThreeGridRowInfo *info_b = b; - - return info_a->row - info_b->row; -} - -static void -egg_three_grid_size_allocate_children (EggThreeGrid *self, - EggThreeGridColumn column, - gint row, - GtkAllocation *allocation, - gint baseline) -{ - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (allocation != NULL); - - for (guint i = 0; i < priv->children->len; i++) - { - EggThreeGridChild *child = g_ptr_array_index (priv->children, i); - - if (child->row == row && child->column == column) - { - GtkAllocation copy = *allocation; - gtk_widget_size_allocate_with_baseline (child->widget, ©, baseline); - } - } -} - -static void -egg_three_grid_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EggThreeGrid *self = (EggThreeGrid *)widget; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - g_autofree GtkRequestedSize *rows = NULL; - const GList *iter; - GtkAllocation area; - GtkTextDirection dir; - GList *values; - guint i; - guint n_rows; - gint min_height; - gint nat_height; - gint border_width; - gint left_min_width; - gint left_nat_width; - gint center_min_width; - gint center_nat_width; - gint right_min_width; - gint right_nat_width; - gint left; - gint center; - gint right; - - g_assert (EGG_IS_THREE_GRID (self)); - g_assert (allocation != NULL); - - dir = gtk_widget_get_direction (widget); - - gtk_widget_set_allocation (widget, allocation); - - egg_three_grid_get_preferred_height_for_width (widget, allocation->width, &min_height, &nat_height); - - if (min_height > allocation->height) - g_warning ("%s requested a minimum height of %d and got %d", - G_OBJECT_TYPE_NAME (widget), min_height, allocation->height); - - if (priv->row_infos == NULL) - return; - - values = g_hash_table_get_values (priv->row_infos); - values = g_list_sort (values, sort_by_row); - - area = *allocation; - border_width = gtk_container_get_border_width (GTK_CONTAINER (self)); - - area.x += border_width; - area.y += border_width; - area.width -= border_width * 2; - area.height -= border_width * 2; - - egg_three_grid_get_column_width (self, EGG_THREE_GRID_COLUMN_LEFT, &left_min_width, &left_nat_width); - egg_three_grid_get_column_width (self, EGG_THREE_GRID_COLUMN_CENTER, ¢er_min_width, ¢er_nat_width); - egg_three_grid_get_column_width (self, EGG_THREE_GRID_COLUMN_RIGHT, &right_min_width, &right_nat_width); - - /* - * Determine how much to give to the center widget first. This is because we will - * just give the rest of the space on the sides to left/right columns and they - * can deal with alignment by using halign. - * - * We can be in one of a couple states: - * - * 1) There is enough room for all columns natural size. - * (We allocate the same to the left and the right). - * 2) There is enough for the natural size of the center - * but for some amount between natural and min sizing - * of the left/right columns. - * 3) There is only minimum size for columns and some - * amount between natural/minimum of the center. - * - * We can handle #1 and #2 with the same logic though. - */ - - if ((MAX (left_min_width, right_min_width) * 2 + center_nat_width) >= (area.width - (priv->column_spacing * 2))) - { - /* Handle #3 */ - left = left_min_width; - right = right_min_width; - center = area.width - left - right; - } - else - { - /* Handle #1 and #2 */ - center = center_nat_width; - right = left = (area.width - center) / 2 - priv->column_spacing; - } - - n_rows = g_list_length (values); - rows = g_new0 (GtkRequestedSize, n_rows); - - for (iter = values, i = 0; iter != NULL; iter = iter->next, i++) - { - EggThreeGridRowInfo *row_info = iter->data; - - rows[i].data = row_info; - rows[i].minimum_size = row_info->min_above_baseline + row_info->min_below_baseline; - rows[i].natural_size = row_info->nat_above_baseline + row_info->nat_below_baseline; - } - - gtk_distribute_natural_allocation (area.height, n_rows, rows); - - for (i = 0; i < n_rows; i++) - { - GtkRequestedSize *size = &rows[i]; - EggThreeGridRowInfo *row_info = size->data; - GtkAllocation child_alloc; - gint baseline; - - if (row_info->nat_above_baseline + row_info->nat_below_baseline <= size->minimum_size) - baseline = row_info->nat_above_baseline; - else - baseline = row_info->min_above_baseline; - - child_alloc.x = area.x; - child_alloc.width = left; - child_alloc.y = area.y; - child_alloc.height = size->minimum_size; - if (dir == GTK_TEXT_DIR_LTR) - egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_LEFT, row_info->row, &child_alloc, baseline); - else - egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_RIGHT, row_info->row, &child_alloc, baseline); - - child_alloc.x = area.x + left + priv->column_spacing; - child_alloc.width = center; - child_alloc.y = area.y; - child_alloc.height = size->minimum_size; - egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_CENTER, row_info->row, &child_alloc, baseline); - - child_alloc.x = area.x + area.width - right; - child_alloc.width = right; - child_alloc.y = area.y; - child_alloc.height = size->minimum_size; - if (dir == GTK_TEXT_DIR_LTR) - egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_RIGHT, row_info->row, &child_alloc, baseline); - else - egg_three_grid_size_allocate_children (self, EGG_THREE_GRID_COLUMN_LEFT, row_info->row, &child_alloc, baseline); - - area.y += child_alloc.height + priv->row_spacing; - area.height -= child_alloc.height + priv->row_spacing; - } -} - -static void -egg_three_grid_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer user_data) -{ - EggThreeGrid *self = (EggThreeGrid *)container; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - g_assert (GTK_IS_CONTAINER (self)); - g_assert (callback != NULL); - - for (guint i = priv->children->len; i > 0; i--) - { - EggThreeGridChild *child = g_ptr_array_index (priv->children, i - 1); - - callback (child->widget, user_data); - } -} - -static void -egg_three_grid_get_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggThreeGrid *self = (EggThreeGrid *)container; - EggThreeGridChild *child = egg_three_grid_find_child (self, widget); - - switch (prop_id) - { - case CHILD_PROP_COLUMN: - g_value_set_enum (value, child->column); - break; - - case CHILD_PROP_ROW: - g_value_set_uint (value, child->row); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } -} - -static void -egg_three_grid_set_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggThreeGrid *self = (EggThreeGrid *)container; - EggThreeGridChild *child = egg_three_grid_find_child (self, widget); - - switch (prop_id) - { - case CHILD_PROP_COLUMN: - child->column = g_value_get_enum (value); - break; - - case CHILD_PROP_ROW: - child->row = g_value_get_uint (value); - break; - - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, prop_id, pspec); - } - - gtk_widget_queue_resize (GTK_WIDGET (container)); -} - -static void -egg_three_grid_finalize (GObject *object) -{ - EggThreeGrid *self = (EggThreeGrid *)object; - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - g_clear_pointer (&priv->row_infos, g_hash_table_unref); - g_clear_pointer (&priv->children, g_ptr_array_unref); - - G_OBJECT_CLASS (egg_three_grid_parent_class)->finalize (object); -} - -static void -egg_three_grid_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggThreeGrid *self = EGG_THREE_GRID (object); - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - switch (prop_id) - { - case PROP_COLUMN_SPACING: - g_value_set_uint (value, priv->column_spacing); - break; - - case PROP_ROW_SPACING: - g_value_set_uint (value, priv->row_spacing); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_three_grid_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggThreeGrid *self = EGG_THREE_GRID (object); - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - switch (prop_id) - { - case PROP_COLUMN_SPACING: - priv->column_spacing = g_value_get_uint (value); - gtk_widget_queue_resize (GTK_WIDGET (self)); - break; - - case PROP_ROW_SPACING: - priv->row_spacing = g_value_get_uint (value); - gtk_widget_queue_resize (GTK_WIDGET (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_three_grid_class_init (EggThreeGridClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->finalize = egg_three_grid_finalize; - object_class->get_property = egg_three_grid_get_property; - object_class->set_property = egg_three_grid_set_property; - - widget_class->get_request_mode = egg_three_grid_get_request_mode; - widget_class->get_preferred_height_for_width = egg_three_grid_get_preferred_height_for_width; - widget_class->get_preferred_width = egg_three_grid_get_preferred_width; - widget_class->size_allocate = egg_three_grid_size_allocate; - - container_class->add = egg_three_grid_add; - container_class->forall = egg_three_grid_forall; - container_class->get_child_property = egg_three_grid_get_child_property; - container_class->remove = egg_three_grid_remove; - container_class->set_child_property = egg_three_grid_set_child_property; - - properties [PROP_COLUMN_SPACING] = - g_param_spec_uint ("column-spacing", - "Column Spacing", - "The amount of spacing to add between columns", - 0, - G_MAXUINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_ROW_SPACING] = - g_param_spec_uint ("row-spacing", - "Row Spacing", - "The amount of spacing to add between rows", - 0, - G_MAXUINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); - - child_properties [CHILD_PROP_COLUMN] = - g_param_spec_enum ("column", - "Column", - "Column", - EGG_TYPE_THREE_GRID_COLUMN, - EGG_THREE_GRID_COLUMN_LEFT, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - child_properties [CHILD_PROP_ROW] = - g_param_spec_uint ("row", - "Row", - "Row", - 0, - G_MAXUINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - gtk_container_class_install_child_properties (container_class, N_CHILD_PROPS, child_properties); - - gtk_widget_class_set_css_name (widget_class, "threegrid"); -} - -static void -egg_three_grid_init (EggThreeGrid *self) -{ - EggThreeGridPrivate *priv = egg_three_grid_get_instance_private (self); - - priv->children = g_ptr_array_new_with_free_func (egg_three_grid_child_free); - - gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); -} - -GtkWidget * -egg_three_grid_new (void) -{ - return g_object_new (EGG_TYPE_THREE_GRID, NULL); -} - -GType -egg_three_grid_column_get_type (void) -{ - static GType type_id; - - if (g_once_init_enter (&type_id)) - { - GType _type_id; - static const GEnumValue values[] = { - { EGG_THREE_GRID_COLUMN_LEFT, "EGG_THREE_GRID_COLUMN_LEFT", "left" }, - { EGG_THREE_GRID_COLUMN_CENTER, "EGG_THREE_GRID_COLUMN_CENTER", "center" }, - { EGG_THREE_GRID_COLUMN_RIGHT, "EGG_THREE_GRID_COLUMN_RIGHT", "right" }, - { 0 } - }; - _type_id = g_enum_register_static ("EggThreeGridColumn", values); - g_once_init_leave (&type_id, _type_id); - } - - return type_id; -} diff -Nru gnome-usage-3.30.0/external/egg/egg-three-grid.h gnome-usage-3.32.0/external/egg/egg-three-grid.h --- gnome-usage-3.30.0/external/egg/egg-three-grid.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-three-grid.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* egg-three-grid.h - * - * Copyright (C) 2016 Christian Hergert - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_THREE_GRID_H -#define EGG_THREE_GRID_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_THREE_GRID (egg_three_grid_get_type()) -#define EGG_TYPE_THREE_GRID_COLUMN (egg_three_grid_column_get_type()) - -G_DECLARE_DERIVABLE_TYPE (EggThreeGrid, egg_three_grid, EGG, THREE_GRID, GtkContainer) - -struct _EggThreeGridClass -{ - GtkContainerClass parent_class; - - gpointer _reserved1; - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; - gpointer _reserved5; - gpointer _reserved6; - gpointer _reserved7; - gpointer _reserved8; -}; - -typedef enum -{ - EGG_THREE_GRID_COLUMN_LEFT, - EGG_THREE_GRID_COLUMN_CENTER, - EGG_THREE_GRID_COLUMN_RIGHT -} EggThreeGridColumn; - -GType egg_three_grid_column_get_type (void); -GtkWidget *egg_three_grid_new (void); - -G_END_DECLS - -#endif /* EGG_THREE_GRID_H */ diff -Nru gnome-usage-3.30.0/external/egg/egg-widget-action-group.c gnome-usage-3.32.0/external/egg/egg-widget-action-group.c --- gnome-usage-3.30.0/external/egg/egg-widget-action-group.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-widget-action-group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,649 +0,0 @@ -/* egg-widget-action-group.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "egg-widget-action-group" - -#include - -#include "egg-widget-action-group.h" - -struct _EggWidgetActionGroup -{ - GObject parent_instance; - GtkWidget *widget; - GHashTable *enabled; -}; - -static void action_group_iface_init (GActionGroupInterface *iface); - -G_DEFINE_TYPE_EXTENDED (EggWidgetActionGroup, egg_widget_action_group, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, action_group_iface_init)) - -enum { - PROP_0, - PROP_WIDGET, - N_PROPS -}; - -static GHashTable *cached_types; -static GParamSpec *properties [N_PROPS]; - -static gboolean -supports_types (const GType *types, - guint n_types) -{ - guint i; - - g_assert (types != NULL || n_types == 0); - - for (i = 0; i < n_types; i++) - { - switch (types [i]) - { - case G_TYPE_STRING: - case G_TYPE_INT: - case G_TYPE_UINT: - case G_TYPE_INT64: - case G_TYPE_UINT64: - case G_TYPE_BOOLEAN: - case G_TYPE_DOUBLE: - case G_TYPE_FLOAT: - case G_TYPE_CHAR: - case G_TYPE_UCHAR: - case G_TYPE_ENUM: - case G_TYPE_FLAGS: - case G_TYPE_VARIANT: - case G_TYPE_NONE: - break; - - default: - if (G_TYPE_IS_FLAGS (types [i]) || G_TYPE_IS_ENUM (types [i])) - break; - - return FALSE; - } - } - - return TRUE; -} - -static const GVariantType * -create_variant_type (const GType *types, - guint n_types) -{ - const GVariantType *ret = NULL; - GString *str; - gint i; - - g_assert (types != NULL || n_types == 0); - - str = g_string_new ("("); - - for (i = 0; i < n_types; i++) - { - switch (types [i]) - { - case G_TYPE_STRING: - g_string_append_c (str, 's'); - break; - - case G_TYPE_INT: - g_string_append_c (str, 'i'); - break; - - case G_TYPE_UINT: - g_string_append_c (str, 'u'); - break; - - case G_TYPE_INT64: - g_string_append_c (str, 'x'); - break; - - case G_TYPE_UINT64: - g_string_append_c (str, 't'); - break; - - case G_TYPE_BOOLEAN: - g_string_append_c (str, 'b'); - break; - - case G_TYPE_DOUBLE: - case G_TYPE_FLOAT: - g_string_append_c (str, 'd'); - break; - - case G_TYPE_CHAR: - case G_TYPE_UCHAR: - g_string_append_c (str, 'y'); - break; - - case G_TYPE_VARIANT: - g_string_append_c (str, 'v'); - break; - - case G_TYPE_NONE: - break; - - default: - if (G_TYPE_IS_ENUM (types [i]) || G_TYPE_IS_FLAGS (types [i])) - { - g_string_append_c (str, 'u'); - break; - } - - return FALSE; - } - } - - g_string_append_c (str, ')'); - - if (g_str_equal (str->str, "()")) - { - g_string_free (str, TRUE); - return NULL; - } - - if (cached_types == NULL) - cached_types = g_hash_table_new (g_str_hash, g_str_equal); - - ret = g_hash_table_lookup (cached_types, str->str); - - if (ret == NULL) - { - gchar *type_str = g_string_free (str, FALSE); - g_hash_table_insert (cached_types, type_str, type_str); - ret = (const GVariantType *)type_str; - } - - return ret; -} - -static void -do_activate (EggWidgetActionGroup *self, - GtkWidget *widget, - GSignalQuery *query, - GVariant *params) -{ - g_auto(GValue) return_value = G_VALUE_INIT; - g_auto(GValue) instance = G_VALUE_INIT; - GArray *ar; - GVariantIter iter; - gsize n_children; - gint i; - - g_assert (query != NULL); - g_assert (GTK_IS_WIDGET (widget)); - - if (params != NULL) - g_debug ("Activating %s with %s\n", query->signal_name, g_variant_print (params, TRUE)); - - if (params == NULL && query->n_params != 0) - { - g_critical ("%s::%s() requires %d parameters", - G_OBJECT_TYPE_NAME (widget), query->signal_name, query->n_params); - return; - } - - if (query->return_type != G_TYPE_NONE) - g_value_init (&return_value, query->return_type); - - g_value_init (&instance, query->itype); - g_value_set_object (&instance, widget); - - if (params == NULL) - { - g_signal_emitv (&instance, query->signal_id, 0, &return_value); - return; - } - - g_assert (g_variant_is_container (params)); - g_assert (params != NULL); - - n_children = g_variant_iter_init (&iter, params); - - if (n_children != query->n_params) - { - g_critical ("%s::%s() requires %d params, got %d", - G_OBJECT_TYPE_NAME (widget), query->signal_name, - (gint)n_children, query->n_params); - return; - } - - ar = g_array_new (FALSE, FALSE, sizeof (GValue)); - - g_array_append_val (ar, instance); - - g_variant_iter_init (&iter, params); - - for (i = 0; i < query->n_params; i++) - { - g_autoptr(GVariant) param = NULL; - GValue value = G_VALUE_INIT; - - param = g_variant_iter_next_value (&iter); - -#define CONVERT_PARAM(TYPE, VARIANT_TYPE, setter, getter, ...) \ - case G_TYPE_##TYPE: \ - { \ - if (!g_variant_is_of_type (param, G_VARIANT_TYPE_##VARIANT_TYPE)) \ - { \ - g_critical ("parameter type mismatch for signal %s", \ - query->signal_name); \ - goto skip_emit; \ - } \ - g_value_init (&value, G_TYPE_##TYPE); \ - g_value_set_##setter (&value, g_variant_get_##getter (param, ##__VA_ARGS__)); \ - g_array_append_val (ar, value); \ - } \ - break - - switch (query->param_types [i]) - { - CONVERT_PARAM(STRING, STRING, string, string, NULL); - CONVERT_PARAM(INT, INT32, int, int32); - CONVERT_PARAM(UINT, UINT32, uint, uint32); - CONVERT_PARAM(INT64, INT64, int64, int64); - CONVERT_PARAM(UINT64, UINT64, uint64, uint64); - CONVERT_PARAM(BOOLEAN, BOOLEAN, boolean, boolean); - CONVERT_PARAM(DOUBLE, DOUBLE, double, double); - CONVERT_PARAM(FLOAT, DOUBLE, float, double); - CONVERT_PARAM(CHAR, BYTE, schar, byte); - CONVERT_PARAM(UCHAR, BYTE, uchar, byte); - CONVERT_PARAM(VARIANT, VARIANT, variant, variant); - - default: - if (G_TYPE_IS_ENUM(query->param_types [i])) - { - if (!g_variant_is_of_type (param, G_VARIANT_TYPE_UINT32)) - goto skip_emit; - g_value_init (&value, query->param_types [i]); - g_value_set_enum (&value, g_variant_get_uint32 (param)); - g_array_append_val (ar, value); - break; - } - else if (G_TYPE_IS_FLAGS (query->param_types [i])) - { - if (!g_variant_is_of_type (param, G_VARIANT_TYPE_UINT32)) - goto skip_emit; - g_value_init (&value, query->param_types [i]); - g_value_set_flags (&value, g_variant_get_uint32 (param)); - g_array_append_val (ar, value); - break; - } - - g_critical ("Unknown param type: %s", g_type_name (query->param_types [i])); - goto skip_emit; - } - -#undef CONVERT_PARAM - } - - g_signal_emitv ((GValue *)(gpointer)ar->data, query->signal_id, 0, &return_value); - -skip_emit: - /* ignore instance */ - for (i = 1; i < ar->len; i++) - g_value_unset (&g_array_index (ar, GValue, i)); - - g_array_unref (ar); -} - -static void -egg_widget_action_group_set_widget (EggWidgetActionGroup *self, - GtkWidget *widget) -{ - g_assert (EGG_IS_WIDGET_ACTION_GROUP (self)); - g_assert (!widget || GTK_IS_WIDGET (widget)); - - if (widget != self->widget) - { - if (self->widget != NULL) - { - g_signal_handlers_disconnect_by_func (self->widget, - G_CALLBACK (gtk_widget_destroyed), - &self->widget); - self->widget = NULL; - } - - if (widget != NULL) - { - self->widget = widget; - g_signal_connect (self->widget, - "destroy", - G_CALLBACK (gtk_widget_destroyed), - &self->widget); - } - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_WIDGET]); - } -} - -static void -egg_widget_action_group_finalize (GObject *object) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)object; - - g_clear_pointer (&self->enabled, g_hash_table_unref); - - G_OBJECT_CLASS (egg_widget_action_group_parent_class)->finalize (object); -} - -static void -egg_widget_action_group_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EggWidgetActionGroup *self = EGG_WIDGET_ACTION_GROUP (object); - - switch (prop_id) - { - case PROP_WIDGET: - g_value_set_object (value, self->widget); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_widget_action_group_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EggWidgetActionGroup *self = EGG_WIDGET_ACTION_GROUP (object); - - switch (prop_id) - { - case PROP_WIDGET: - egg_widget_action_group_set_widget (self, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -egg_widget_action_group_class_init (EggWidgetActionGroupClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = egg_widget_action_group_finalize; - object_class->get_property = egg_widget_action_group_get_property; - object_class->set_property = egg_widget_action_group_set_property; - - properties [PROP_WIDGET] = - g_param_spec_object ("widget", - "Widget", - "Widget", - GTK_TYPE_WIDGET, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); -} - -static void -egg_widget_action_group_init (EggWidgetActionGroup *self) -{ -} - -static gboolean -egg_widget_action_group_has_action (GActionGroup *group, - const gchar *action_name) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)group; - - g_assert (EGG_IS_WIDGET_ACTION_GROUP (self)); - g_assert (action_name != NULL); - - if (GTK_IS_WIDGET (self->widget)) - return (0 != g_signal_lookup (action_name, G_OBJECT_TYPE (self->widget))); - - return FALSE; -} - -static gchar ** -egg_widget_action_group_list_actions (GActionGroup *group) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)group; - GPtrArray *ar; - - g_assert (EGG_IS_WIDGET_ACTION_GROUP (self)); - - ar = g_ptr_array_new (); - - if (self->widget != NULL) - { - for (GType type = G_OBJECT_TYPE (self->widget); - type != G_TYPE_INVALID; - type = g_type_parent (type)) - { - g_autofree guint *signal_ids = NULL; - guint n_ids = 0; - guint i; - - signal_ids = g_signal_list_ids (type, &n_ids); - - for (i = 0; i < n_ids; i++) - { - GSignalQuery query; - - g_signal_query (signal_ids[i], &query); - - if ((query.signal_flags & G_SIGNAL_ACTION) != 0) - g_ptr_array_add (ar, g_strdup (query.signal_name)); - } - } - } - - g_ptr_array_add (ar, NULL); - - return (gchar **)g_ptr_array_free (ar, FALSE); -} - -static gboolean -egg_widget_action_group_get_action_enabled (GActionGroup *group, - const gchar *action_name) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)group; - - g_assert (EGG_IS_WIDGET_ACTION_GROUP (group)); - g_assert (action_name != NULL); - - if (self->enabled && g_hash_table_contains (self->enabled, action_name)) - return GPOINTER_TO_INT (g_hash_table_lookup (self->enabled, action_name)); - - return TRUE; -} - -const GVariantType * -egg_widget_action_group_get_action_parameter_type (GActionGroup *group, - const gchar *action_name) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)group; - GSignalQuery query; - guint signal_id; - - g_assert (EGG_IS_WIDGET_ACTION_GROUP (self)); - g_assert (action_name != NULL); - - if (!GTK_IS_WIDGET (self->widget)) - return NULL; - - signal_id = g_signal_lookup (action_name, G_OBJECT_TYPE (self->widget)); - if (signal_id == 0) - return NULL; - - g_signal_query (signal_id, &query); - - if (!supports_types (query.param_types, query.n_params)) - return NULL; - - return create_variant_type (query.param_types, query.n_params); -} - -const GVariantType * -egg_widget_action_group_get_action_state_type (GActionGroup *group, - const gchar *action_name) -{ - g_assert (EGG_IS_WIDGET_ACTION_GROUP (group)); - g_assert (action_name != NULL); - - return NULL; -} - -static void -egg_widget_action_group_activate_action (GActionGroup *group, - const gchar *action_name, - GVariant *params) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)group; - - g_assert (EGG_IS_WIDGET_ACTION_GROUP (group)); - g_assert (action_name != NULL); - - if (GTK_IS_WIDGET (self->widget)) - { - guint signal_id; - - signal_id = g_signal_lookup (action_name, G_OBJECT_TYPE (self->widget)); - - if (signal_id != 0) - { - GSignalQuery query; - - g_signal_query (signal_id, &query); - - if (query.signal_flags & G_SIGNAL_ACTION) - { - do_activate (self, self->widget, &query, params); - return; - } - } - } - - g_warning ("Failed to activate action %s due to missing widget or action", - action_name); -} - -static gboolean -egg_widget_action_group_query_action (GActionGroup *group, - const gchar *action_name, - gboolean *enabled, - const GVariantType **parameter_type, - const GVariantType **state_type, - GVariant **state_hint, - GVariant **state) -{ - EggWidgetActionGroup *self = (EggWidgetActionGroup *)group; - - g_assert (EGG_IS_WIDGET_ACTION_GROUP (group)); - - if (!GTK_IS_WIDGET (self->widget)) - return FALSE; - - if (!g_signal_lookup (action_name, G_OBJECT_TYPE (self->widget))) - return FALSE; - - if (state_hint) - *state_hint = NULL; - - if (state_type) - *state_type = NULL; - - if (state) - *state = NULL; - - if (parameter_type) - *parameter_type = egg_widget_action_group_get_action_parameter_type (group, action_name); - - if (enabled) - *enabled = egg_widget_action_group_get_action_enabled (group, action_name); - - return TRUE; -} - -static void -action_group_iface_init (GActionGroupInterface *iface) -{ - iface->has_action = egg_widget_action_group_has_action; - iface->list_actions = egg_widget_action_group_list_actions; - iface->get_action_enabled = egg_widget_action_group_get_action_enabled; - iface->get_action_parameter_type = egg_widget_action_group_get_action_parameter_type; - iface->get_action_state_type = egg_widget_action_group_get_action_state_type; - iface->activate_action = egg_widget_action_group_activate_action; - iface->query_action = egg_widget_action_group_query_action; -} - -/** - * egg_widget_action_group_new: - * - * Returns: (transfer full): An #EggWidgetActionGroup. - */ -GActionGroup * -egg_widget_action_group_new (GtkWidget *widget) -{ - return g_object_new (EGG_TYPE_WIDGET_ACTION_GROUP, - "widget", widget, - NULL); -} - -/** - * egg_widget_action_group_attach: - * @widget: (type Gtk.Widget): A #GtkWidget - * @group_name: the group name to use for the action group - * - * Helper function to create an #EggWidgetActionGroup and attach - * it to @widget using the group name @group_name. - */ -void -egg_widget_action_group_attach (gpointer widget, - const gchar *group_name) -{ - GActionGroup *group; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (group_name != NULL); - - group = egg_widget_action_group_new (widget); - gtk_widget_insert_action_group (widget, group_name, group); - g_object_unref (group); -} - -void -egg_widget_action_group_set_action_enabled (EggWidgetActionGroup *self, - const gchar *action_name, - gboolean enabled) -{ - g_return_if_fail (EGG_IS_WIDGET_ACTION_GROUP (self)); - g_return_if_fail (action_name != NULL); - g_return_if_fail (egg_widget_action_group_has_action (G_ACTION_GROUP (self), action_name)); - - enabled = !!enabled; - - if (self->enabled == NULL) - self->enabled = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - - g_hash_table_insert (self->enabled, g_strdup (action_name), GINT_TO_POINTER (enabled)); - g_action_group_action_enabled_changed (G_ACTION_GROUP (self), action_name, enabled); - - g_debug ("Action %s %s", action_name, enabled ? "enabled" : "disabled"); -} diff -Nru gnome-usage-3.30.0/external/egg/egg-widget-action-group.h gnome-usage-3.32.0/external/egg/egg-widget-action-group.h --- gnome-usage-3.30.0/external/egg/egg-widget-action-group.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/egg-widget-action-group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* egg-widget-action-group.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 of the License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef EGG_WIDGET_ACTION_GROUP_H -#define EGG_WIDGET_ACTION_GROUP_H - -#include - -G_BEGIN_DECLS - -#define EGG_TYPE_WIDGET_ACTION_GROUP (egg_widget_action_group_get_type()) - -G_DECLARE_FINAL_TYPE (EggWidgetActionGroup, egg_widget_action_group, EGG, WIDGET_ACTION_GROUP, GObject) - -GActionGroup *egg_widget_action_group_new (GtkWidget *widget); -void egg_widget_action_group_attach (gpointer widget, - const gchar *group_name); -void egg_widget_action_group_set_action_enabled (EggWidgetActionGroup *self, - const gchar *action_name, - gboolean enabled); - -G_END_DECLS - -#endif /* EGG_WIDGET_ACTION_GROUP_H */ diff -Nru gnome-usage-3.30.0/external/egg/meson.build gnome-usage-3.32.0/external/egg/meson.build --- gnome-usage-3.30.0/external/egg/meson.build 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/egg/meson.build 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -egg_inc = include_directories('.') - -sources = [ - 'egg-animation.c', - 'egg-binding-group.c', - 'egg-box.c', - 'egg-centering-bin.c', - 'egg-column-layout.c', - 'egg-counter.c', - 'egg-date-time.c', - 'egg-empty-state.c', - 'egg-entry-box.c', - 'egg-file-chooser-entry.c', - 'egg-frame-source.c', - 'egg-heap.c', - 'egg-list-box.c', - 'egg-menu-manager.c', - 'egg-pill-box.c', - 'egg-priority-box.c', - 'egg-radio-box.c', - 'egg-scrolled-window.c', - 'egg-search-bar.c', - 'egg-settings-flag-action.c', - 'egg-settings-sandwich.c', - 'egg-signal-group.c', - 'egg-simple-label.c', - 'egg-simple-popover.c', - 'egg-slider.c', - 'egg-state-machine-buildable.c', - 'egg-state-machine.c', - 'egg-task-cache.c', - 'egg-three-grid.c', - 'egg-widget-action-group.c' -] - -deps = [ - gio_dep, - glib_dep, - gobject_dep, - gtk_dep -] - -libegg = static_library( - 'egg', - sources: sources, - dependencies: deps -) - -libegg_dep = declare_dependency( - link_with: libegg, - include_directories: egg_inc -) diff -Nru gnome-usage-3.30.0/external/meson.build gnome-usage-3.32.0/external/meson.build --- gnome-usage-3.30.0/external/meson.build 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/meson.build 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -subdir('egg') -subdir('rg') diff -Nru gnome-usage-3.30.0/external/rg/meson.build gnome-usage-3.32.0/external/rg/meson.build --- gnome-usage-3.30.0/external/rg/meson.build 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/meson.build 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -sources = [ - 'rg-column.c', - 'rg-cpu-graph.c', - 'rg-cpu-table.c', - 'rg-graph.c', - 'rg-line-renderer.c', - 'rg-stacked-renderer.c', - 'rg-renderer.c', - 'rg-ring.c', - 'rg-table.c' -] - -deps = [ - gio_dep, - glib_dep, - gobject_dep, - gtk_dep -] - -librg = static_library( - 'rg', - sources: sources, - dependencies: deps, - include_directories: egg_inc -) - -librg_dep = declare_dependency( - link_with: librg, - include_directories: include_directories('.') -) diff -Nru gnome-usage-3.30.0/external/rg/realtime-graphs.h gnome-usage-3.32.0/external/rg/realtime-graphs.h --- gnome-usage-3.30.0/external/rg/realtime-graphs.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/realtime-graphs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* realtime-graphs.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef REALTIME_GRAPHS_H -#define REALTIME_GRAPHS_H - -#include - -G_BEGIN_DECLS - -#include "rg-column.h" -#include "rg-cpu-graph.h" -#include "rg-cpu-table.h" -#include "rg-graph.h" -#include "rg-line-renderer.h" -#include "rg-stacked-renderer.h" -#include "rg-renderer.h" -#include "rg-table.h" - -G_END_DECLS - -#endif /* REALTIME_GRAPHS_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-column.c gnome-usage-3.32.0/external/rg/rg-column.c --- gnome-usage-3.30.0/external/rg/rg-column.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-column.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,305 +0,0 @@ -/* rg-column.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include -#include - -#include "rg-column.h" -#include "rg-column-private.h" -#include "rg-ring.h" - -struct _RgColumn -{ - GObject parent_instance; - gchar *name; - RgRing *values; - GType value_type; -}; - -G_DEFINE_TYPE (RgColumn, rg_column, G_TYPE_OBJECT) - -enum { - PROP_0, - PROP_NAME, - PROP_VALUE_TYPE, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -RgColumn * -rg_column_new (const gchar *name, - GType value_type) -{ - return g_object_new (RG_TYPE_COLUMN, - "name", name, - "value-type", value_type, - NULL); -} - -const gchar * -rg_column_get_name (RgColumn *self) -{ - g_return_val_if_fail (RG_IS_COLUMN (self), NULL); - - return self->name; -} - -void -rg_column_set_name (RgColumn *self, - const gchar *name) -{ - g_return_if_fail (RG_IS_COLUMN (self)); - - if (g_strcmp0 (name, self->name) != 0) - { - g_free (self->name); - self->name = g_strdup (name); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_NAME]); - } -} - -static void -rg_column_copy_value (gpointer data, - gpointer user_data) -{ - const GValue *src_value = data; - RgRing *ring = user_data; - GValue copy = G_VALUE_INIT; - - if (G_IS_VALUE (src_value)) - { - g_value_init (©, G_VALUE_TYPE (src_value)); - g_value_copy (src_value, ©); - } - - rg_ring_append_val (ring, copy); -} - -void -_rg_column_set_n_rows (RgColumn *self, - guint n_rows) -{ - RgRing *ring; - - g_return_if_fail (RG_IS_COLUMN (self)); - g_return_if_fail (n_rows > 0); - - ring = rg_ring_sized_new (sizeof (GValue), n_rows, NULL); - rg_ring_foreach (self->values, rg_column_copy_value, ring); - g_clear_pointer (&self->values, rg_ring_unref); - self->values = ring; -} - -guint -_rg_column_push (RgColumn *self) -{ - GValue value = G_VALUE_INIT; - guint ret; - - g_return_val_if_fail (RG_IS_COLUMN (self), 0); - - g_value_init (&value, self->value_type); - ret = rg_ring_append_val (self->values, value); - - return ret; -} - -void -_rg_column_get_value (RgColumn *self, - guint index, - GValue *value) -{ - const GValue *src_value; - - g_return_if_fail (RG_IS_COLUMN (self)); - g_return_if_fail (value != NULL); - g_return_if_fail (index < self->values->len); - - src_value = &((GValue *)(gpointer)self->values->data)[index]; - - g_value_init (value, self->value_type); - if (G_IS_VALUE (src_value)) - g_value_copy (src_value, value); -} - -void -_rg_column_collect (RgColumn *self, - guint index, - va_list args) -{ - GValue *value; - gchar *errmsg = NULL; - - g_return_if_fail (RG_IS_COLUMN (self)); - g_return_if_fail (index < self->values->len); - - value = &((GValue *)(gpointer)self->values->data)[index]; - - G_VALUE_COLLECT (value, args, 0, &errmsg); - - if (G_UNLIKELY (errmsg != NULL)) - { - g_critical ("%s", errmsg); - g_free (errmsg); - } -} - -void -_rg_column_set (RgColumn *self, - guint index, - ...) -{ - va_list args; - - g_return_if_fail (RG_IS_COLUMN (self)); - g_return_if_fail (index < self->values->len); - - va_start (args, index); - _rg_column_collect (self, index, args); - va_end (args); -} - -void -_rg_column_get (RgColumn *self, - guint index, - ...) -{ - va_list args; - - g_return_if_fail (RG_IS_COLUMN (self)); - g_return_if_fail (index < self->values->len); - - va_start (args, index); - _rg_column_lcopy (self, index, args); - va_end (args); -} - -void -_rg_column_lcopy (RgColumn *self, - guint index, - va_list args) -{ - const GValue *value; - gchar *errmsg = NULL; - - g_return_if_fail (RG_IS_COLUMN (self)); - g_return_if_fail (index < self->values->len); - - value = &((GValue *)(gpointer)self->values->data)[index]; - - if (!G_IS_VALUE (value)) - return; - - G_VALUE_LCOPY (value, args, 0, &errmsg); - - if (G_UNLIKELY (errmsg != NULL)) - { - g_critical ("%s", errmsg); - g_free (errmsg); - } -} - -static void -rg_column_finalize (GObject *object) -{ - RgColumn *self = (RgColumn *)object; - - g_clear_pointer (&self->name, g_free); - g_clear_pointer (&self->values, rg_ring_unref); - - G_OBJECT_CLASS (rg_column_parent_class)->finalize (object); -} - -static void -rg_column_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - RgColumn *self = RG_COLUMN (object); - - switch (prop_id) - { - case PROP_NAME: - g_value_set_string (value, rg_column_get_name (self)); - break; - - case PROP_VALUE_TYPE: - g_value_set_gtype (value, self->value_type); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_column_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - RgColumn *self = RG_COLUMN (object); - - switch (prop_id) - { - case PROP_NAME: - rg_column_set_name (self, g_value_get_string (value)); - break; - - case PROP_VALUE_TYPE: - self->value_type = g_value_get_gtype (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_column_class_init (RgColumnClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = rg_column_finalize; - object_class->get_property = rg_column_get_property; - object_class->set_property = rg_column_set_property; - - properties [PROP_NAME] = - g_param_spec_string ("name", - "Name", - "The name of the column", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_VALUE_TYPE] = - g_param_spec_gtype ("value-type", - "Value Type", - "Value Type", - G_TYPE_NONE, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -rg_column_init (RgColumn *self) -{ - self->values = rg_ring_sized_new (sizeof (GValue), 60, (GDestroyNotify)g_value_unset); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-column.h gnome-usage-3.32.0/external/rg/rg-column.h --- gnome-usage-3.30.0/external/rg/rg-column.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-column.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* rg-column.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_COLUMN_H -#define RG_COLUMN_H - -#include - -G_BEGIN_DECLS - -#define RG_TYPE_COLUMN (rg_column_get_type()) - -G_DECLARE_FINAL_TYPE (RgColumn, rg_column, RG, COLUMN, GObject) - -struct _RgColumnClass -{ - GObjectClass parent; -}; - -RgColumn *rg_column_new (const gchar *name, - GType value_type); -const gchar *rg_column_get_name (RgColumn *self); -void rg_column_set_name (RgColumn *self, - const gchar *name); - -G_END_DECLS - -#endif /* RG_COLUMN_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-column-private.h gnome-usage-3.32.0/external/rg/rg-column-private.h --- gnome-usage-3.30.0/external/rg/rg-column-private.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-column-private.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* rg-column-private.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_COLUMN_PRIVATE_H -#define RG_COLUMN_PRIVATE_H - -#include - -#include "rg-column.h" - -G_BEGIN_DECLS - -void _rg_column_get_value (RgColumn *self, - guint index, - GValue *value); -void _rg_column_collect (RgColumn *self, - guint index, - va_list args); -void _rg_column_lcopy (RgColumn *self, - guint index, - va_list args); -void _rg_column_get (RgColumn *column, - guint index, - ...); -void _rg_column_set (RgColumn *column, - guint index, - ...); -guint _rg_column_push (RgColumn *column); -void _rg_column_set_n_rows (RgColumn *column, - guint n_rows); - -G_END_DECLS - -#endif /* RG_COLUMN_PRIVATE_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-cpu-graph.c gnome-usage-3.32.0/external/rg/rg-cpu-graph.c --- gnome-usage-3.30.0/external/rg/rg-cpu-graph.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-cpu-graph.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* rg-cpu-graph.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include - -#include "rg-cpu-graph.h" -#include "rg-cpu-table.h" -#include "rg-line-renderer.h" - -struct _RgCpuGraph -{ - RgGraph parent_instance; - - gint64 timespan; - guint max_samples; -}; - -G_DEFINE_TYPE (RgCpuGraph, rg_cpu_graph, RG_TYPE_GRAPH) - -enum { - PROP_0, - PROP_MAX_SAMPLES, - PROP_TIMESPAN, - LAST_PROP -}; - -static GParamSpec *properties[LAST_PROP]; - -static gchar *colors[] = { - "#73d216", - "#f57900", - "#3465a4", - "#ef2929", - "#75507b", - "#ce5c00", - "#c17d11", - "#cc0000", -}; - -GtkWidget * -rg_cpu_graph_new (void) -{ - return g_object_new (RG_TYPE_CPU_GRAPH, NULL); -} - -static void -rg_cpu_graph_constructed (GObject *object) -{ - static RgCpuTable *table; - RgCpuGraph *self = (RgCpuGraph *)object; - guint n_cpu; - guint i; - - G_OBJECT_CLASS (rg_cpu_graph_parent_class)->constructed (object); - - /* - * Create a table, but allow it to be destroyed after the last - * graph releases it. We will recreate it on demand. - */ - if (table == NULL) - { - table = g_object_new (RG_TYPE_CPU_TABLE, - "timespan", self->timespan, - "max-samples", self->max_samples + 1, - NULL); - g_object_add_weak_pointer (G_OBJECT (table), (gpointer *)&table); - rg_graph_set_table (RG_GRAPH (self), RG_TABLE (table)); - g_object_unref (table); - } - else - { - rg_graph_set_table (RG_GRAPH (self), RG_TABLE (table)); - } - - n_cpu = g_get_num_processors (); - - for (i = 0; i < n_cpu; i++) - { - RgRenderer *renderer; - - renderer = g_object_new (RG_TYPE_LINE_RENDERER, - "column", i, - "stroke-color", colors [i % G_N_ELEMENTS (colors)], - NULL); - rg_graph_add_renderer (RG_GRAPH (self), renderer); - g_clear_object (&renderer); - } -} - -static void -rg_cpu_graph_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - RgCpuGraph *self = RG_CPU_GRAPH (object); - - switch (prop_id) - { - case PROP_MAX_SAMPLES: - g_value_set_uint (value, self->max_samples); - break; - - case PROP_TIMESPAN: - g_value_set_int64 (value, self->timespan); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_cpu_graph_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - RgCpuGraph *self = RG_CPU_GRAPH (object); - - switch (prop_id) - { - case PROP_MAX_SAMPLES: - self->max_samples = g_value_get_uint (value); - break; - - case PROP_TIMESPAN: - self->timespan = g_value_get_int64 (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_cpu_graph_class_init (RgCpuGraphClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructed = rg_cpu_graph_constructed; - object_class->get_property = rg_cpu_graph_get_property; - object_class->set_property = rg_cpu_graph_set_property; - - properties [PROP_TIMESPAN] = - g_param_spec_int64 ("timespan", - "Timespan", - "Timespan", - 0, G_MAXINT64, - 0, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - properties [PROP_MAX_SAMPLES] = - g_param_spec_uint ("max-samples", - "Max Samples", - "Max Samples", - 0, G_MAXUINT, - 120, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -rg_cpu_graph_init (RgCpuGraph *self) -{ - self->max_samples = 120; - self->timespan = 60L * G_USEC_PER_SEC; -} diff -Nru gnome-usage-3.30.0/external/rg/rg-cpu-graph.h gnome-usage-3.32.0/external/rg/rg-cpu-graph.h --- gnome-usage-3.30.0/external/rg/rg-cpu-graph.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-cpu-graph.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* rg-cpu-graph.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_CPU_GRAPH_H -#define RG_CPU_GRAPH_H - -#include "rg-graph.h" - -G_BEGIN_DECLS - -#define RG_TYPE_CPU_GRAPH (rg_cpu_graph_get_type()) - -G_DECLARE_FINAL_TYPE (RgCpuGraph, rg_cpu_graph, RG, CPU_GRAPH, RgGraph) - -GtkWidget *rg_cpu_graph_new (void); - -G_END_DECLS - -#endif /* RG_CPU_GRAPH_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-cpu-table.c gnome-usage-3.32.0/external/rg/rg-cpu-table.c --- gnome-usage-3.30.0/external/rg/rg-cpu-table.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-cpu-table.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,329 +0,0 @@ -/* rg-cpu-table.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include -#include -#if defined(__FreeBSD__) -# include -# include -# include -# include -#endif - -#include "rg-cpu-table.h" - -typedef struct -{ - gdouble total; - gdouble freq; - glong last_user; - glong last_idle; - glong last_system; - glong last_nice; - glong last_iowait; - glong last_irq; - glong last_softirq; - glong last_steal; - glong last_guest; - glong last_guest_nice; -} CpuInfo; - -struct _RgCpuTable -{ - RgTable parent_instance; - - GArray *cpu_info; - guint n_cpu; - - guint poll_source; - guint poll_interval_msec; -}; - -G_DEFINE_TYPE (RgCpuTable, rg_cpu_table, RG_TYPE_TABLE) - -#ifdef __linux__ -static void -rg_cpu_table_poll (RgCpuTable *self) -{ - gchar cpu[64] = { 0 }; - glong user; - glong sys; - glong nice; - glong idle; - glong iowait; - glong irq; - glong softirq; - glong steal; - glong guest; - glong guest_nice; - glong user_calc; - glong system_calc; - glong nice_calc; - glong idle_calc; - glong iowait_calc; - glong irq_calc; - glong softirq_calc; - glong steal_calc; - glong guest_calc; - glong guest_nice_calc; - gchar *buf = NULL; - glong total; - gchar *line; - gint ret; - gint id; - gint i; - - if (g_file_get_contents("/proc/stat", &buf, NULL, NULL)) - { - line = buf; - for (i = 0; buf[i]; i++) - { - if (buf[i] == '\n') { - buf[i] = '\0'; - if (g_str_has_prefix(line, "cpu")) - { - if (isdigit(line[3])) - { - CpuInfo *cpu_info; - - user = nice = sys = idle = id = 0; - ret = sscanf (line, "%s %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", - cpu, &user, &nice, &sys, &idle, - &iowait, &irq, &softirq, &steal, &guest, &guest_nice); - if (ret != 11) - goto next; - - ret = sscanf(cpu, "cpu%d", &id); - - if (ret != 1 || id < 0 || id >= self->n_cpu) - goto next; - - cpu_info = &g_array_index (self->cpu_info, CpuInfo, id); - - user_calc = user - cpu_info->last_user; - nice_calc = nice - cpu_info->last_nice; - system_calc = sys - cpu_info->last_system; - idle_calc = idle - cpu_info->last_idle; - iowait_calc = iowait - cpu_info->last_iowait; - irq_calc = irq - cpu_info->last_irq; - softirq_calc = softirq - cpu_info->last_softirq; - steal_calc = steal - cpu_info->last_steal; - guest_calc = guest - cpu_info->last_guest; - guest_nice_calc = guest_nice - cpu_info->last_guest_nice; - - total = user_calc + nice_calc + system_calc + idle_calc + iowait_calc + irq_calc + softirq_calc + steal_calc + guest_calc + guest_nice_calc; - cpu_info->total = ((total - idle_calc) / (gdouble)total) * 100.0; - - cpu_info->last_user = user; - cpu_info->last_nice = nice; - cpu_info->last_idle = idle; - cpu_info->last_system = sys; - cpu_info->last_iowait = iowait; - cpu_info->last_irq = irq; - cpu_info->last_softirq = softirq; - cpu_info->last_steal = steal; - cpu_info->last_guest = guest; - cpu_info->last_guest_nice = guest_nice; - } - } else { - /* CPU info comes first. Skip further lines. */ - break; - } - - next: - line = &buf[i + 1]; - } - } - } - - g_free (buf); -} -#elif defined(__FreeBSD__) -static void -rg_cpu_table_poll (RgCpuTable *self) -{ - static gint mib_cp_times[2]; - static gsize len_cp_times = 2; - - if (mib_cp_times[0] == 0 || mib_cp_times[1] == 0) - { - if (sysctlnametomib ("kern.cp_times", mib_cp_times, &len_cp_times) == -1) - { - g_critical ("Cannot convert sysctl name kern.cp_times to a mib array: %s", - g_strerror (errno)); - return; - } - } - - gsize cp_times_size = sizeof (glong) * CPUSTATES * self->n_cpu; - glong *cp_times = g_malloc (cp_times_size); - - if (sysctl (mib_cp_times, 2, cp_times, &cp_times_size, NULL, 0) == -1) - { - g_critical ("Cannot get CPU usage by sysctl kern.cp_times: %s", - g_strerror (errno)); - g_free (cp_times); - return; - } - - for (guint i = 0, j = 0; i < self->n_cpu; i++, j += CPUSTATES) - { - CpuInfo *cpu_info = &g_array_index (self->cpu_info, CpuInfo, i); - - glong user = cp_times[j + CP_USER]; - glong nice = cp_times[j + CP_NICE]; - glong sys = cp_times[j + CP_SYS]; - glong irq = cp_times[j + CP_INTR]; - glong idle = cp_times[j + CP_IDLE]; - - glong user_calc = user - cpu_info->last_user; - glong nice_calc = nice - cpu_info->last_nice; - glong system_calc = sys - cpu_info->last_system; - glong irq_calc = irq - cpu_info->last_irq; - glong idle_calc = idle - cpu_info->last_idle; - - glong total = user_calc + nice_calc + system_calc + irq_calc + idle_calc; - cpu_info->total = ((total - idle_calc) / (gdouble)total) * 100.0; - - cpu_info->last_user = user; - cpu_info->last_nice = nice; - cpu_info->last_system = sys; - cpu_info->last_irq = irq; - cpu_info->last_idle = idle; - } - g_free (cp_times); -} -#else -static void -rg_cpu_table_poll (RgCpuTable *self) -{ - /* - * TODO: calculate cpu info for OpenBSD/etc. - * - * While we are at it, we should make the Linux code above non-shitty. - */ -} -#endif - -static gboolean -rg_cpu_table_poll_cb (gpointer user_data) -{ - RgCpuTable *self = user_data; - RgTableIter iter; - guint i; - - rg_cpu_table_poll (self); - - rg_table_push (RG_TABLE (self), &iter, g_get_monotonic_time ()); - - for (i = 0; i < self->cpu_info->len; i++) - { - CpuInfo *cpu_info; - - cpu_info = &g_array_index (self->cpu_info, CpuInfo, i); - rg_table_iter_set (&iter, i, cpu_info->total, -1); - } - - return G_SOURCE_CONTINUE; -} - -static void -rg_cpu_table_constructed (GObject *object) -{ - RgCpuTable *self = (RgCpuTable *)object; - gint64 timespan; - guint max_samples; - guint i; - - G_OBJECT_CLASS (rg_cpu_table_parent_class)->constructed (object); - - max_samples = rg_table_get_max_samples (RG_TABLE (self)); - timespan = rg_table_get_timespan (RG_TABLE (self)); - - self->poll_interval_msec = (gdouble)timespan / (gdouble)(max_samples - 1) / 1000L; - - if (self->poll_interval_msec == 0) - { - g_critical ("Implausible timespan/max_samples combination for graph."); - self->poll_interval_msec = 1000; - } - - self->n_cpu = g_get_num_processors (); - - for (i = 0; i < self->n_cpu; i++) - { - CpuInfo cpu_info = { 0 }; - RgColumn *column; - gchar *name; - - name = g_strdup_printf ("CPU %d", i + 1); - column = rg_column_new (name, G_TYPE_DOUBLE); - - rg_table_add_column (RG_TABLE (self), column); - g_array_append_val (self->cpu_info, cpu_info); - - g_object_unref (column); - g_free (name); - } - - rg_cpu_table_poll (self); - - self->poll_source = g_timeout_add (self->poll_interval_msec, rg_cpu_table_poll_cb, self); -} - -static void -rg_cpu_table_finalize (GObject *object) -{ - RgCpuTable *self = (RgCpuTable *)object; - - if (self->poll_source != 0) - { - g_source_remove (self->poll_source); - self->poll_source = 0; - } - - g_clear_pointer (&self->cpu_info, g_array_unref); - - G_OBJECT_CLASS (rg_cpu_table_parent_class)->finalize (object); -} - -static void -rg_cpu_table_class_init (RgCpuTableClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructed = rg_cpu_table_constructed; - object_class->finalize = rg_cpu_table_finalize; -} - -static void -rg_cpu_table_init (RgCpuTable *self) -{ - self->cpu_info = g_array_new (FALSE, FALSE, sizeof (CpuInfo)); - - g_object_set (self, - "value-min", 0.0, - "value-max", 100.0, - NULL); -} - -RgTable * -rg_cpu_table_new (void) -{ - return g_object_new (RG_TYPE_CPU_TABLE, NULL); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-cpu-table.h gnome-usage-3.32.0/external/rg/rg-cpu-table.h --- gnome-usage-3.30.0/external/rg/rg-cpu-table.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-cpu-table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* rg-cpu-table.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_CPU_TABLE_H -#define RG_CPU_TABLE_H - -#include "rg-table.h" - -G_BEGIN_DECLS - -#define RG_TYPE_CPU_TABLE (rg_cpu_table_get_type()) - -G_DECLARE_FINAL_TYPE (RgCpuTable, rg_cpu_table, RG, CPU_TABLE, RgTable) - -RgTable *rg_cpu_table_new (void); - -G_END_DECLS - -#endif /* RG_CPU_TABLE_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-graph.c gnome-usage-3.32.0/external/rg/rg-graph.c --- gnome-usage-3.30.0/external/rg/rg-graph.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-graph.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,421 +0,0 @@ -/* rg-graph.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include - -#include "egg-signal-group.h" - -#include "rg-graph.h" - -typedef struct -{ - RgTable *table; - EggSignalGroup *table_signals; - GPtrArray *renderers; - cairo_surface_t *surface; - guint tick_handler; - gdouble x_offset; - guint surface_dirty : 1; -} RgGraphPrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (RgGraph, rg_graph, GTK_TYPE_DRAWING_AREA) - -enum { - PROP_0, - PROP_TABLE, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -GtkWidget * -rg_graph_new (void) -{ - return g_object_new (RG_TYPE_GRAPH, NULL); -} - -static void -rg_graph_clear_surface (RgGraph *self) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - g_assert (RG_IS_GRAPH (self)); - - priv->surface_dirty = TRUE; -} - -/** - * rg_graph_get_table: - * - * Gets the #RgGraph:table property. - * - * Returns: (transfer none) (nullable): An #RgTable or %NULL. - */ -RgTable * -rg_graph_get_table (RgGraph *self) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - g_return_val_if_fail (RG_IS_GRAPH (self), NULL); - - return priv->table; -} - -void -rg_graph_set_table (RgGraph *self, - RgTable *table) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - g_return_if_fail (RG_IS_GRAPH (self)); - g_return_if_fail (!table || RG_IS_TABLE (table)); - - if (g_set_object (&priv->table, table)) - { - egg_signal_group_set_target (priv->table_signals, table); - gtk_widget_queue_allocate (GTK_WIDGET (self)); - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TABLE]); - } -} - -void -rg_graph_add_renderer (RgGraph *self, - RgRenderer *renderer) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - g_return_if_fail (RG_IS_GRAPH (self)); - g_return_if_fail (RG_IS_RENDERER (renderer)); - - g_ptr_array_add (priv->renderers, g_object_ref (renderer)); - rg_graph_clear_surface (self); -} - -static gboolean -rg_graph_tick_cb (GtkWidget *widget, - GdkFrameClock *frame_clock, - gpointer user_data) -{ - RgGraph *self = (RgGraph *)widget; - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - GtkAllocation alloc; - gint64 frame_time; - gint64 end_time; - gint64 timespan; - gdouble x_offset; - - g_assert (RG_IS_GRAPH (self)); - - if ((priv->surface == NULL) || (priv->table == NULL) || !gtk_widget_get_visible (widget)) - goto remove_handler; - - timespan = rg_table_get_timespan (priv->table); - if (timespan == 0) - goto remove_handler; - - gtk_widget_get_allocation (widget, &alloc); - - frame_time = gdk_frame_clock_get_frame_time (frame_clock); - end_time = rg_table_get_end_time (priv->table); - - x_offset = -((frame_time - end_time) / (gdouble)timespan); - - if (x_offset != priv->x_offset) - { - priv->x_offset = x_offset; - gtk_widget_queue_draw (widget); - } - - return G_SOURCE_CONTINUE; - -remove_handler: - if (priv->tick_handler != 0) - { - gtk_widget_remove_tick_callback (widget, priv->tick_handler); - priv->tick_handler = 0; - } - - return G_SOURCE_REMOVE; -} - -static void -rg_graph_ensure_surface (RgGraph *self) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - GtkAllocation alloc; - RgTableIter iter; - gint64 begin_time; - gint64 end_time; - gdouble y_begin; - gdouble y_end; - cairo_t *cr; - gsize i; - - g_assert (RG_IS_GRAPH (self)); - - gtk_widget_get_allocation (GTK_WIDGET (self), &alloc); - - if (priv->surface == NULL) - { - priv->surface_dirty = TRUE; - priv->surface = gdk_window_create_similar_surface (gtk_widget_get_window (GTK_WIDGET (self)), - CAIRO_CONTENT_COLOR_ALPHA, - alloc.width+(alloc.width/14), // + (alloc.width/14) is fix or hack for lagging graph in right - alloc.height); - } - - if (priv->table == NULL) - return; - - if (priv->surface_dirty) - { - priv->surface_dirty = FALSE; - - cr = cairo_create (priv->surface); - - cairo_save (cr); - cairo_rectangle (cr, 0, 0, alloc.width + (alloc.width/14), alloc.height); // + (alloc.width/14) is fix or hack for lagging graph in right - cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); - cairo_fill (cr); - cairo_restore (cr); - - g_object_get (priv->table, - "value-min", &y_begin, - "value-max", &y_end, - NULL); - - rg_table_get_iter_last (priv->table, &iter); - end_time = rg_table_iter_get_timestamp (&iter); - begin_time = end_time - rg_table_get_timespan (priv->table); - - for (i = 0; i < priv->renderers->len; i++) - { - RgRenderer *renderer; - - renderer = g_ptr_array_index (priv->renderers, i); - - cairo_save (cr); - GtkAllocation surface_alloc; - surface_alloc.x = alloc.x; - surface_alloc.y = alloc.y; - surface_alloc.width = alloc.width+(alloc.width/14); // + (alloc.width/14) is fix or hack for lagging graph in right - surface_alloc.height = alloc.height; - rg_renderer_render (renderer, priv->table, begin_time, end_time, y_begin, y_end, cr, &surface_alloc); - cairo_restore (cr); - } - - cairo_destroy (cr); - } - - if (priv->tick_handler == 0) - priv->tick_handler = gtk_widget_add_tick_callback (GTK_WIDGET (self), - rg_graph_tick_cb, - self, - NULL); -} - -static gboolean -rg_graph_draw (GtkWidget *widget, - cairo_t *cr) -{ - RgGraph *self = (RgGraph *)widget; - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - GtkStyleContext *style_context; - GtkAllocation alloc; - - g_assert (RG_IS_GRAPH (self)); - - gtk_widget_get_allocation (widget, &alloc); - - style_context = gtk_widget_get_style_context (widget); - - rg_graph_ensure_surface (self); - - gtk_style_context_save (style_context); - gtk_style_context_add_class (style_context, "view"); - gtk_render_background (style_context, cr, 0, 0, alloc.width, alloc.height); - gtk_style_context_restore (style_context); - - cairo_save (cr); - cairo_set_source_surface (cr, priv->surface, priv->x_offset * alloc.width, 0); - cairo_rectangle (cr, 0, 0, alloc.width, alloc.height); - cairo_fill (cr); - cairo_restore (cr); - - return GDK_EVENT_PROPAGATE; -} - -static void -rg_graph_size_allocate (GtkWidget *widget, - GtkAllocation *alloc) -{ - RgGraph *self = (RgGraph *)widget; - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - GtkAllocation old_alloc; - - g_assert (RG_IS_GRAPH (self)); - g_assert (alloc != NULL); - - gtk_widget_get_allocation (widget, &old_alloc); - - if ((old_alloc.width != alloc->width) || (old_alloc.height != alloc->height)) - g_clear_pointer (&priv->surface, cairo_surface_destroy); - - GTK_WIDGET_CLASS (rg_graph_parent_class)->size_allocate (widget, alloc); -} - -static void -rg_graph__table_changed (RgGraph *self, - RgTable *table) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - g_assert (RG_IS_GRAPH (self)); - g_assert (RG_IS_TABLE (table)); - - priv->x_offset = 0; - - rg_graph_clear_surface (self); -} - -static void -rg_graph_destroy (GtkWidget *widget) -{ - RgGraph *self = (RgGraph *)widget; - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - if (priv->tick_handler != 0) - { - gtk_widget_remove_tick_callback (widget, priv->tick_handler); - priv->tick_handler = 0; - } - - GTK_WIDGET_CLASS (rg_graph_parent_class)->destroy (widget); -} - -static void -rg_graph_finalize (GObject *object) -{ - RgGraph *self = (RgGraph *)object; - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - g_clear_object (&priv->table); - g_clear_object (&priv->table_signals); - g_clear_pointer (&priv->surface, cairo_surface_destroy); - g_clear_pointer (&priv->renderers, g_ptr_array_unref); - - G_OBJECT_CLASS (rg_graph_parent_class)->finalize (object); -} - -static void -rg_graph_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - RgGraph *self = RG_GRAPH (object); - - switch (prop_id) - { - case PROP_TABLE: - g_value_set_object (value, rg_graph_get_table (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_graph_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - RgGraph *self = RG_GRAPH (object); - - switch (prop_id) - { - case PROP_TABLE: - rg_graph_set_table (self, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_graph_class_init (RgGraphClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->finalize = rg_graph_finalize; - object_class->get_property = rg_graph_get_property; - object_class->set_property = rg_graph_set_property; - - widget_class->destroy = rg_graph_destroy; - widget_class->draw = rg_graph_draw; - widget_class->size_allocate = rg_graph_size_allocate; - - properties [PROP_TABLE] = - g_param_spec_object ("table", - "Table", - "The data table for the graph.", - RG_TYPE_TABLE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - gtk_widget_class_set_css_name (widget_class, "rggraph"); -} - -static void -rg_graph_init (RgGraph *self) -{ - RgGraphPrivate *priv = rg_graph_get_instance_private (self); - - priv->renderers = g_ptr_array_new_with_free_func (g_object_unref); - - priv->table_signals = egg_signal_group_new (RG_TYPE_TABLE); - - egg_signal_group_connect_object (priv->table_signals, - "notify::value-max", - G_CALLBACK (gtk_widget_queue_allocate), - self, - G_CONNECT_SWAPPED); - - egg_signal_group_connect_object (priv->table_signals, - "notify::value-min", - G_CALLBACK (gtk_widget_queue_allocate), - self, - G_CONNECT_SWAPPED); - - egg_signal_group_connect_object (priv->table_signals, - "notify::timespan", - G_CALLBACK (gtk_widget_queue_allocate), - self, - G_CONNECT_SWAPPED); - - egg_signal_group_connect_object (priv->table_signals, - "changed", - G_CALLBACK (rg_graph__table_changed), - self, - G_CONNECT_SWAPPED); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-graph.h gnome-usage-3.32.0/external/rg/rg-graph.h --- gnome-usage-3.30.0/external/rg/rg-graph.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-graph.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* rg-graph.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_GRAPH_H -#define RG_GRAPH_H - -#include - -#include "rg-table.h" -#include "rg-renderer.h" - -G_BEGIN_DECLS - -#define RG_TYPE_GRAPH (rg_graph_get_type()) - -G_DECLARE_DERIVABLE_TYPE (RgGraph, rg_graph, RG, GRAPH, GtkDrawingArea) - -struct _RgGraphClass -{ - GtkDrawingAreaClass parent_class; - gpointer padding[8]; -}; - -GtkWidget *rg_graph_new (void); -void rg_graph_set_table (RgGraph *self, - RgTable *table); -RgTable *rg_graph_get_table (RgGraph *self); -void rg_graph_add_renderer (RgGraph *self, - RgRenderer *renderer); - -G_END_DECLS - -#endif /* RG_GRAPH_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-line-renderer.c gnome-usage-3.32.0/external/rg/rg-line-renderer.c --- gnome-usage-3.30.0/external/rg/rg-line-renderer.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-line-renderer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,324 +0,0 @@ -/* rg-line-renderer.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include -#include - -#include "rg-line-renderer.h" - -struct _RgLineRenderer -{ - GObject parent_instance; - - GdkRGBA stroke_color; - gdouble line_width; - guint column; -}; - -static void rg_line_renderer_init_renderer (RgRendererInterface *iface); - -G_DEFINE_TYPE_WITH_CODE (RgLineRenderer, rg_line_renderer, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (RG_TYPE_RENDERER, - rg_line_renderer_init_renderer)) - -enum { - PROP_0, - PROP_COLUMN, - PROP_LINE_WIDTH, - PROP_STROKE_COLOR, - PROP_STROKE_COLOR_RGBA, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -RgLineRenderer * -rg_line_renderer_new (void) -{ - return g_object_new (RG_TYPE_LINE_RENDERER, NULL); -} - -static gdouble -calc_x (RgTableIter *iter, - gint64 begin, - gint64 end, - guint width) -{ - gint64 timestamp; - - timestamp = rg_table_iter_get_timestamp (iter); - - g_assert_cmpint (timestamp, !=, 0); - - return ((timestamp - begin) / (gdouble)(end - begin) * width); -} - -static gdouble -calc_y (RgTableIter *iter, - gdouble range_begin, - gdouble range_end, - guint height, - guint column) -{ - GValue value = G_VALUE_INIT; - gdouble y; - - rg_table_iter_get_value (iter, column, &value); - - switch (G_VALUE_TYPE (&value)) - { - case G_TYPE_DOUBLE: - y = g_value_get_double (&value); - break; - - case G_TYPE_UINT: - y = g_value_get_uint (&value); - break; - - case G_TYPE_UINT64: - y = g_value_get_uint64 (&value); - break; - - case G_TYPE_INT: - y = g_value_get_int (&value); - break; - - case G_TYPE_INT64: - y = g_value_get_int64 (&value); - break; - - default: - y = 0.0; - break; - } - - y -= range_begin; - y /= (range_end - range_begin); - y = height - (y * height); - - return y; -} - -static void -rg_line_renderer_render (RgRenderer *renderer, - RgTable *table, - gint64 x_begin, - gint64 x_end, - gdouble y_begin, - gdouble y_end, - cairo_t *cr, - const cairo_rectangle_int_t *area) -{ - RgLineRenderer *self = (RgLineRenderer *)renderer; - RgTableIter iter; - - g_assert (RG_IS_LINE_RENDERER (self)); - - cairo_save (cr); - - if (rg_table_get_iter_first (table, &iter)) - { - guint max_samples; - gdouble chunk; - gdouble last_x; - gdouble last_y; - - max_samples = rg_table_get_max_samples (table); - - chunk = area->width / (gdouble)(max_samples - 1) / 2.0; - - last_x = calc_x (&iter, x_begin, x_end, area->width); - last_y = calc_y (&iter, y_begin, y_end, area->height, self->column); - - cairo_move_to (cr, last_x, last_y); - - while (rg_table_iter_next (&iter)) - { - gdouble x; - gdouble y; - - x = calc_x (&iter, x_begin, x_end, area->width); - y = calc_y (&iter, y_begin, y_end, area->height, self->column); - - cairo_curve_to (cr, - last_x + chunk, - last_y, - last_x + chunk, - y, - x, - y); - - last_x = x; - last_y = y; - } - } - - cairo_set_line_width (cr, self->line_width); - gdk_cairo_set_source_rgba (cr, &self->stroke_color); - cairo_stroke (cr); - - cairo_restore (cr); -} - -static void -rg_line_renderer_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - RgLineRenderer *self = RG_LINE_RENDERER (object); - - switch (prop_id) - { - case PROP_COLUMN: - g_value_set_uint (value, self->column); - break; - - case PROP_LINE_WIDTH: - g_value_set_double (value, self->line_width); - break; - - case PROP_STROKE_COLOR: - g_value_take_string (value, gdk_rgba_to_string (&self->stroke_color)); - break; - - case PROP_STROKE_COLOR_RGBA: - g_value_set_boxed (value, &self->stroke_color); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_line_renderer_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - RgLineRenderer *self = RG_LINE_RENDERER (object); - - switch (prop_id) - { - case PROP_COLUMN: - self->column = g_value_get_uint (value); - break; - - case PROP_LINE_WIDTH: - self->line_width = g_value_get_double (value); - break; - - case PROP_STROKE_COLOR: - rg_line_renderer_set_stroke_color (self, g_value_get_string (value)); - break; - - case PROP_STROKE_COLOR_RGBA: - rg_line_renderer_set_stroke_color_rgba (self, g_value_get_boxed (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_line_renderer_class_init (RgLineRendererClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = rg_line_renderer_get_property; - object_class->set_property = rg_line_renderer_set_property; - - properties [PROP_COLUMN] = - g_param_spec_uint ("column", - "Column", - "Column", - 0, G_MAXUINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_LINE_WIDTH] = - g_param_spec_double ("line-width", - "Line Width", - "Line Width", - 0.0, G_MAXDOUBLE, - 1.0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_STROKE_COLOR] = - g_param_spec_string ("stroke-color", - "Stroke Color", - "Stroke Color", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_STROKE_COLOR_RGBA] = - g_param_spec_boxed ("stroke-color-rgba", - "Stroke Color RGBA", - "Stroke Color RGBA", - GDK_TYPE_RGBA, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -rg_line_renderer_init (RgLineRenderer *self) -{ - self->line_width = 1.0; -} - -static void -rg_line_renderer_init_renderer (RgRendererInterface *iface) -{ - iface->render = rg_line_renderer_render; -} - -void -rg_line_renderer_set_stroke_color_rgba (RgLineRenderer *self, - const GdkRGBA *rgba) -{ - const GdkRGBA black = { 0, 0, 0, 1.0 }; - - g_return_if_fail (RG_IS_LINE_RENDERER (self)); - - if (rgba == NULL) - rgba = &black; - - if (!gdk_rgba_equal (rgba, &self->stroke_color)) - { - self->stroke_color = *rgba; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_STROKE_COLOR_RGBA]); - } -} - -void -rg_line_renderer_set_stroke_color (RgLineRenderer *self, - const gchar *stroke_color) -{ - GdkRGBA rgba; - - g_return_if_fail (RG_IS_LINE_RENDERER (self)); - - if (stroke_color == NULL) - stroke_color = "#000000"; - - if (gdk_rgba_parse (&rgba, stroke_color)) - rg_line_renderer_set_stroke_color_rgba (self, &rgba); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-line-renderer.h gnome-usage-3.32.0/external/rg/rg-line-renderer.h --- gnome-usage-3.30.0/external/rg/rg-line-renderer.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-line-renderer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/* rg-line-renderer.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_LINE_RENDERER_H -#define RG_LINE_RENDERER_H - -#include - -#include "rg-renderer.h" - -G_BEGIN_DECLS - -#define RG_TYPE_LINE_RENDERER (rg_line_renderer_get_type()) - -G_DECLARE_FINAL_TYPE (RgLineRenderer, rg_line_renderer, RG, LINE_RENDERER, GObject) - -RgLineRenderer *rg_line_renderer_new (void); -void rg_line_renderer_set_stroke_color (RgLineRenderer *self, - const gchar *stroke_color); -void rg_line_renderer_set_stroke_color_rgba (RgLineRenderer *self, - const GdkRGBA *stroke_color_rgba); -const GdkRGBA *rg_line_renderer_get_stroke_color_rgba (RgLineRenderer *self); - -G_END_DECLS - -#endif /* RG_LINE_RENDERER_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-renderer.c gnome-usage-3.32.0/external/rg/rg-renderer.c --- gnome-usage-3.30.0/external/rg/rg-renderer.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-renderer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* rg-renderer.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include - -#include "rg-renderer.h" - -G_DEFINE_INTERFACE (RgRenderer, rg_renderer, G_TYPE_OBJECT) - -static void -dummy_render (RgRenderer *renderer, - RgTable *table, - gint64 x_begin, - gint64 x_end, - gdouble y_begin, - gdouble y_end, - cairo_t *cr, - const cairo_rectangle_int_t *area) -{ -} - -static void -rg_renderer_default_init (RgRendererInterface *iface) -{ - iface->render = dummy_render; -} - -void -rg_renderer_render (RgRenderer *self, - RgTable *table, - gint64 x_begin, - gint64 x_end, - gdouble y_begin, - gdouble y_end, - cairo_t *cr, - const cairo_rectangle_int_t *area) -{ - g_return_if_fail (RG_IS_RENDERER (self)); - g_return_if_fail (cr != NULL); - g_return_if_fail (area != NULL); - - RG_RENDERER_GET_IFACE (self)->render (self, table, x_begin, x_end, y_begin, y_end, cr, area); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-renderer.h gnome-usage-3.32.0/external/rg/rg-renderer.h --- gnome-usage-3.30.0/external/rg/rg-renderer.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-renderer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* rg-renderer.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_RENDERER_H -#define RG_RENDERER_H - -#include - -#include "rg-table.h" - -G_BEGIN_DECLS - -#define RG_TYPE_RENDERER (rg_renderer_get_type ()) - -G_DECLARE_INTERFACE (RgRenderer, rg_renderer, RG, RENDERER, GObject) - -struct _RgRendererInterface -{ - GTypeInterface parent; - - void (*render) (RgRenderer *self, - RgTable *table, - gint64 x_begin, - gint64 x_end, - gdouble y_begin, - gdouble y_end, - cairo_t *cr, - const cairo_rectangle_int_t *area); -}; - -void rg_renderer_render (RgRenderer *self, - RgTable *table, - gint64 x_begin, - gint64 x_end, - gdouble y_begin, - gdouble y_end, - cairo_t *cr, - const cairo_rectangle_int_t *area); - -G_END_DECLS - -#endif /* RG_RENDERER_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-ring.c gnome-usage-3.32.0/external/rg/rg-ring.c --- gnome-usage-3.30.0/external/rg/rg-ring.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-ring.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,206 +0,0 @@ -/* rg-ring.c - * - * Copyright (C) 2010 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#define G_LOG_DOMAIN "rg-ring" - -#include - -#include "rg-ring.h" - -#define get_element(r,i) ((r)->data + ((r)->elt_size * i)) - -typedef struct -{ - /*< public >*/ - guint8 *data; /* Pointer to real data. */ - guint len; /* Length of data allocation. */ - guint pos; /* Position in ring. */ - - /*< private >*/ - guint elt_size; /* Size of each element. */ - gboolean looped; /* Have we wrapped around at least once. */ - GDestroyNotify destroy; /* Destroy element callback. */ - volatile gint ref_count; /* Hidden Reference count. */ -} RgRingImpl; - -G_DEFINE_BOXED_TYPE (RgRing, rg_ring, rg_ring_ref, rg_ring_unref) - -/** - * rg_ring_sized_new: - * @element_size: (in): The size per element. - * @reserved_size: (in): The number of elements to allocate. - * @element_destroy: (in): Notification called when removing an element. - * - * Creates a new instance of #RgRing with the given number of elements. - * - * Returns: A new #RgRing. - */ -RgRing* -rg_ring_sized_new (guint element_size, - guint reserved_size, - GDestroyNotify element_destroy) -{ - RgRingImpl *ring_impl; - - ring_impl = g_slice_new0 (RgRingImpl); - ring_impl->elt_size = element_size; - ring_impl->len = reserved_size; - ring_impl->data = g_malloc0_n (reserved_size, element_size); - ring_impl->destroy = element_destroy; - ring_impl->ref_count = 1; - - return (RgRing *)ring_impl; -} - -/** - * rg_ring_append_vals: - * @ring: (in): A #RgRing. - * @data: (in): A pointer to the array of values. - * @len: (in): The number of values. - * - * Appends @len values located at @data. - * - * Returns: the index of the first item. - */ -guint -rg_ring_append_vals (RgRing *ring, - gconstpointer data, - guint len) -{ - RgRingImpl *ring_impl = (RgRingImpl *)ring; - gpointer idx; - gint ret = -1; - gint x; - gint i; - - g_return_val_if_fail (ring_impl != NULL, 0); - g_return_val_if_fail (len <= ring->len, 0); - g_return_val_if_fail (len > 0, 0); - - for (i = 0; i < len; i++) - { - x = ring->pos - i; - x = (x >= 0) ? x : ring->len + x; - idx = ring->data + (ring_impl->elt_size * x); - if (ring_impl->destroy && (ring_impl->looped == TRUE)) - ring_impl->destroy (idx); - if (ret == -1) - ret = x; - memcpy (idx, data, ring_impl->elt_size); - ring->pos++; - if (ring->pos >= ring->len) - ring_impl->looped = TRUE; - ring->pos %= ring->len; - data = ((guint8 *)data) + ring_impl->elt_size; - } - - return (guint)ret; -} - -/** - * rg_ring_foreach: - * @ring: (in): A #RgRing. - * @func: (in) (scope call): A #GFunc to call for each element. - * @user_data: (in): user data for @func. - * - * Calls @func for every item in the #RgRing starting from the most recently - * inserted element to the least recently inserted. - */ -void -rg_ring_foreach (RgRing *ring, - GFunc func, - gpointer user_data) -{ - RgRingImpl *ring_impl = (RgRingImpl *)ring; - gint i; - - g_return_if_fail (ring_impl != NULL); - g_return_if_fail (func != NULL); - - if (!ring_impl->looped) - { - for (i = 0; i < ring_impl->pos; i++) - func (get_element (ring_impl, i), user_data); - return; - } - - for (i = ring_impl->pos; i < ring_impl->len; i++) - func (get_element (ring_impl, i), user_data); - - for (i = 0; i < ring_impl->pos; i++) - func (get_element (ring_impl, i), user_data); -} - -/** - * rg_ring_destroy: - * @ring: (in): A #RgRing. - * - * Cleans up after a #RgRing that is no longer in use. - */ -void -rg_ring_destroy (RgRing *ring) -{ - RgRingImpl *ring_impl = (RgRingImpl *)ring; - - g_return_if_fail (ring != NULL); - g_return_if_fail (ring_impl->ref_count == 0); - - g_free (ring_impl->data); - - g_slice_free (RgRingImpl, ring_impl); -} - -/** - * rg_ring_ref: - * @ring: (in): A #RgRing. - * - * Atomically increments the reference count of @ring by one. - * - * Returns: The @ring pointer. - */ -RgRing * -rg_ring_ref (RgRing *ring) -{ - RgRingImpl *ring_impl = (RgRingImpl *)ring; - - g_return_val_if_fail (ring != NULL, NULL); - g_return_val_if_fail (ring_impl->ref_count > 0, NULL); - - g_atomic_int_inc (&ring_impl->ref_count); - - return ring; -} - -/** - * rg_ring_unref: - * @ring: (in): A #RgRing. - * - * Atomically decrements the reference count of @ring by one. When the - * reference count reaches zero, the structure is freed. - */ -void -rg_ring_unref (RgRing *ring) -{ - RgRingImpl *ring_impl = (RgRingImpl *)ring; - - g_return_if_fail (ring != NULL); - g_return_if_fail (ring_impl->ref_count > 0); - - if (g_atomic_int_dec_and_test (&ring_impl->ref_count)) - rg_ring_destroy (ring); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-ring.h gnome-usage-3.32.0/external/rg/rg-ring.h --- gnome-usage-3.30.0/external/rg/rg-ring.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-ring.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/* rg-ring.h - * - * Copyright (C) 2010 Christian Hergert - * - * This file 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 file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef __RG_RING_H__ -#define __RG_RING_H__ - -#include - -G_BEGIN_DECLS - -/** - * rg_ring_append_val: - * @ring: A #RgRing. - * @val: A value to append to the #RgRing. - * - * Appends a value to the ring buffer. @val must be a variable as it is - * referenced to. - * - * Returns: None. - */ -#define rg_ring_append_val(ring, val) rg_ring_append_vals(ring, &(val), 1) - -/** - * rg_ring_get_index: - * @ring: A #RgRing. - * @type: The type to extract. - * @i: The index within the #RgRing relative to the current position. - * - * Retrieves the value at the given index from the #RgRing. The value - * is cast to @type. You may retrieve a pointer to the value within the - * array by using &. - * - * [[ - * gdouble *v = &rg_ring_get_index(ring, gdouble, 0); - * gdouble v = rg_ring_get_index(ring, gdouble, 0); - * ]] - * - * Returns: The value at the given index. - */ -#define rg_ring_get_index(ring, type, i) \ - ((((type*)(ring)->data))[((i) + (ring)->pos) % (ring)->len]) - -typedef struct -{ - guint8 *data; - guint len; - guint pos; -} RgRing; - -GType rg_ring_get_type (void); -RgRing *rg_ring_sized_new (guint element_size, - guint reserved_size, - GDestroyNotify element_destroy); -guint rg_ring_append_vals (RgRing *ring, - gconstpointer data, - guint len); -void rg_ring_foreach (RgRing *ring, - GFunc func, - gpointer user_data); -RgRing *rg_ring_ref (RgRing *ring); -void rg_ring_unref (RgRing *ring); - -G_END_DECLS - -#endif /* __RG_RING_H__ */ diff -Nru gnome-usage-3.30.0/external/rg/rg-stacked-renderer.c gnome-usage-3.32.0/external/rg/rg-stacked-renderer.c --- gnome-usage-3.30.0/external/rg/rg-stacked-renderer.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-stacked-renderer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,416 +0,0 @@ -#include -#include - -#include "rg-stacked-renderer.h" - -struct _RgStackedRenderer -{ - GObject parent_instance; - - GdkRGBA stroke_color; - GdkRGBA stacked_color; - gdouble line_width; - guint column; -}; - -static void rg_stacked_renderer_init_renderer (RgRendererInterface *iface); - -G_DEFINE_TYPE_WITH_CODE (RgStackedRenderer, rg_stacked_renderer, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (RG_TYPE_RENDERER, - rg_stacked_renderer_init_renderer)) - -enum { - PROP_0, - PROP_COLUMN, - PROP_LINE_WIDTH, - PROP_STROKE_COLOR, - PROP_STROKE_COLOR_RGBA, - PROP_STACKED_COLOR, - PROP_STACKED_COLOR_RGBA, - LAST_PROP -}; - -static GParamSpec *properties [LAST_PROP]; - -RgStackedRenderer * -rg_stacked_renderer_new (void) -{ - return g_object_new (RG_TYPE_STACKED_RENDERER, NULL); -} - -static gdouble -calc_x (RgTableIter *iter, - gint64 begin, - gint64 end, - guint width) -{ - gint64 timestamp; - - timestamp = rg_table_iter_get_timestamp (iter); - - g_assert_cmpint (timestamp, !=, 0); - - return ((timestamp - begin) / (gdouble)(end - begin) * width); -} - -static gdouble -calc_y (RgTableIter *iter, - gdouble range_begin, - gdouble range_end, - guint height, - guint column) -{ - GValue value = G_VALUE_INIT; - gdouble y; - - rg_table_iter_get_value (iter, column, &value); - - switch (G_VALUE_TYPE (&value)) - { - case G_TYPE_DOUBLE: - y = g_value_get_double (&value); - break; - - case G_TYPE_UINT: - y = g_value_get_uint (&value); - break; - - case G_TYPE_UINT64: - y = g_value_get_uint64 (&value); - break; - - case G_TYPE_INT: - y = g_value_get_int (&value); - break; - - case G_TYPE_INT64: - y = g_value_get_int64 (&value); - break; - - default: - y = 0.0; - break; - } - - y -= range_begin; - y /= (range_end - range_begin); - y = height - (y * height); - - return y; -} - -static void -rg_stacked_renderer_render (RgRenderer *renderer, - RgTable *table, - gint64 x_begin, - gint64 x_end, - gdouble y_begin, - gdouble y_end, - cairo_t *cr, - const cairo_rectangle_int_t *area) -{ - RgStackedRenderer *self = (RgStackedRenderer *)renderer; - RgTableIter iter; - - g_assert (RG_IS_STACKED_RENDERER (self)); - - cairo_save (cr); - - if (rg_table_get_iter_first (table, &iter)) - { - guint max_samples; - gdouble chunk; - gdouble last_x; - gdouble last_y; - - max_samples = rg_table_get_max_samples (table); - - chunk = area->width / (gdouble)(max_samples - 1) / 2.0; - - last_x = calc_x (&iter, x_begin, x_end, area->width); - last_y = area->height; - - cairo_move_to (cr, last_x, area->height); - - while (rg_table_iter_next (&iter)) - { - gdouble x; - gdouble y; - - x = calc_x (&iter, x_begin, x_end, area->width); - y = calc_y (&iter, y_begin, y_end, area->height, self->column); - - cairo_curve_to (cr, - last_x + chunk, - last_y, - last_x + chunk, - y, - x, - y); - - last_x = x; - last_y = y; - } - } - - cairo_set_line_width (cr, self->line_width); - gdk_cairo_set_source_rgba (cr, &self->stacked_color); - cairo_rel_line_to (cr, 0, area->height); - cairo_stroke_preserve (cr); - cairo_close_path(cr); - cairo_fill(cr); - - - if (rg_table_get_iter_first (table, &iter)) - { - guint max_samples; - gdouble chunk; - gdouble last_x; - gdouble last_y; - - max_samples = rg_table_get_max_samples (table); - - chunk = area->width / (gdouble)(max_samples - 1) / 2.0; - - last_x = calc_x (&iter, x_begin, x_end, area->width); - last_y = area->height; - - cairo_move_to (cr, last_x, last_y); - - while (rg_table_iter_next (&iter)) - { - gdouble x; - gdouble y; - - x = calc_x (&iter, x_begin, x_end, area->width); - y = calc_y (&iter, y_begin, y_end, area->height, self->column); - - cairo_curve_to (cr, - last_x + chunk, - last_y, - last_x + chunk, - y, - x, - y); - - last_x = x; - last_y = y; - } - } - - gdk_cairo_set_source_rgba (cr, &self->stroke_color); - cairo_stroke (cr); - - cairo_restore (cr); -} - -static void -rg_stacked_renderer_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - RgStackedRenderer *self = RG_STACKED_RENDERER (object); - - switch (prop_id) - { - case PROP_COLUMN: - g_value_set_uint (value, self->column); - break; - - case PROP_LINE_WIDTH: - g_value_set_double (value, self->line_width); - break; - - case PROP_STROKE_COLOR: - g_value_take_string (value, gdk_rgba_to_string (&self->stroke_color)); - break; - - case PROP_STACKED_COLOR: - g_value_take_string (value, gdk_rgba_to_string (&self->stacked_color)); - break; - - case PROP_STROKE_COLOR_RGBA: - g_value_set_boxed (value, &self->stroke_color); - break; - - case PROP_STACKED_COLOR_RGBA: - g_value_set_boxed (value, &self->stacked_color); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_stacked_renderer_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - RgStackedRenderer *self = RG_STACKED_RENDERER (object); - - switch (prop_id) - { - case PROP_COLUMN: - self->column = g_value_get_uint (value); - break; - - case PROP_LINE_WIDTH: - self->line_width = g_value_get_double (value); - break; - - case PROP_STROKE_COLOR: - rg_stacked_renderer_set_stroke_color (self, g_value_get_string (value)); - break; - - case PROP_STROKE_COLOR_RGBA: - rg_stacked_renderer_set_stroke_color_rgba (self, g_value_get_boxed (value)); - break; - - case PROP_STACKED_COLOR: - rg_stacked_renderer_set_stacked_color (self, g_value_get_string (value)); - break; - - case PROP_STACKED_COLOR_RGBA: - rg_stacked_renderer_set_stacked_color_rgba (self, g_value_get_boxed (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_stacked_renderer_class_init (RgStackedRendererClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = rg_stacked_renderer_get_property; - object_class->set_property = rg_stacked_renderer_set_property; - - properties [PROP_COLUMN] = - g_param_spec_uint ("column", - "Column", - "Column", - 0, G_MAXUINT, - 0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_LINE_WIDTH] = - g_param_spec_double ("line-width", - "Line Width", - "Line Width", - 0.0, G_MAXDOUBLE, - 1.0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_STROKE_COLOR] = - g_param_spec_string ("stroke-color", - "Stroke Color", - "Stroke Color", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_STROKE_COLOR_RGBA] = - g_param_spec_boxed ("stroke-color-rgba", - "Stroke Color RGBA", - "Stroke Color RGBA", - GDK_TYPE_RGBA, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_STACKED_COLOR] = - g_param_spec_string ("stacked-color", - "Stacked Color", - "Stacked Color", - NULL, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_STACKED_COLOR_RGBA] = - g_param_spec_boxed ("stacked-color-rgba", - "Stacked Color RGBA", - "Stacked Color RGBA", - GDK_TYPE_RGBA, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); -} - -static void -rg_stacked_renderer_init (RgStackedRenderer *self) -{ - self->line_width = 1.0; -} - -static void -rg_stacked_renderer_init_renderer (RgRendererInterface *iface) -{ - iface->render = rg_stacked_renderer_render; -} - -void -rg_stacked_renderer_set_stroke_color_rgba (RgStackedRenderer *self, - const GdkRGBA *rgba) -{ - const GdkRGBA black = { 0, 0, 0, 1.0 }; - - g_return_if_fail (RG_IS_STACKED_RENDERER (self)); - - if (rgba == NULL) - rgba = &black; - - if (!gdk_rgba_equal (rgba, &self->stroke_color)) - { - self->stroke_color = *rgba; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_STROKE_COLOR_RGBA]); - } -} - -void -rg_stacked_renderer_set_stroke_color (RgStackedRenderer *self, - const gchar *stroke_color) -{ - GdkRGBA rgba; - - g_return_if_fail (RG_IS_STACKED_RENDERER (self)); - - if (stroke_color == NULL) - stroke_color = "#000000"; - - if (gdk_rgba_parse (&rgba, stroke_color)) - rg_stacked_renderer_set_stroke_color_rgba (self, &rgba); -} - -void -rg_stacked_renderer_set_stacked_color_rgba (RgStackedRenderer *self, - const GdkRGBA *rgba) -{ - const GdkRGBA black = { 0, 0, 0, 1.0 }; - - g_return_if_fail (RG_IS_STACKED_RENDERER (self)); - - if (rgba == NULL) - rgba = &black; - - if (!gdk_rgba_equal (rgba, &self->stacked_color)) - { - self->stacked_color = *rgba; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_STACKED_COLOR_RGBA]); - } -} - -void -rg_stacked_renderer_set_stacked_color (RgStackedRenderer *self, - const gchar *stacked_color) -{ - GdkRGBA rgba; - - g_return_if_fail (RG_IS_STACKED_RENDERER (self)); - - if (stacked_color == NULL) - stacked_color = "#000000"; - - if (gdk_rgba_parse (&rgba, stacked_color)) - rg_stacked_renderer_set_stroke_color_rgba (self, &rgba); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-stacked-renderer.h gnome-usage-3.32.0/external/rg/rg-stacked-renderer.h --- gnome-usage-3.30.0/external/rg/rg-stacked-renderer.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-stacked-renderer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -#ifndef RG_STACKED_RENDERER_H -#define RG_STACKED_RENDERER_H - -#include - -#include "rg-renderer.h" - -G_BEGIN_DECLS - -#define RG_TYPE_STACKED_RENDERER (rg_stacked_renderer_get_type()) - -G_DECLARE_FINAL_TYPE (RgStackedRenderer, rg_stacked_renderer, RG, STACKED_RENDERER, GObject) - -RgStackedRenderer *rg_stacked_renderer_new (void); -void rg_stacked_renderer_set_stroke_color (RgStackedRenderer *self, - const gchar *stroke_color); -void rg_stacked_renderer_set_stroke_color_rgba (RgStackedRenderer *self, - const GdkRGBA *stroke_color_rgba); -const GdkRGBA *rg_stacked_renderer_get_stroke_color_rgba (RgStackedRenderer *self); - -void rg_stacked_renderer_set_stacked_color (RgStackedRenderer *self, - const gchar *stacked_color); -void rg_stacked_renderer_set_stacked_color_rgba (RgStackedRenderer *self, - const GdkRGBA *stacked_color_rgba); -const GdkRGBA *rg_stacked_renderer_get_stacked_color_rgba (RgStackedRenderer *self); -G_END_DECLS - -#endif /* RG_STACKED_RENDERER_H */ diff -Nru gnome-usage-3.30.0/external/rg/rg-table.c gnome-usage-3.32.0/external/rg/rg-table.c --- gnome-usage-3.30.0/external/rg/rg-table.c 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-table.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,651 +0,0 @@ -/* rg-table.c - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#include - -#include "rg-column-private.h" -#include "rg-table.h" - -typedef struct -{ - GPtrArray *columns; - RgColumn *timestamps; - - guint last_index; - - guint max_samples; - GTimeSpan timespan; - gdouble value_max; - gdouble value_min; -} RgTablePrivate; - -typedef struct -{ - RgTable *table; - gint64 timestamp; - guint index; -} RgTableIterImpl; - -enum { - PROP_0, - PROP_MAX_SAMPLES, - PROP_TIMESPAN, - PROP_VALUE_MAX, - PROP_VALUE_MIN, - LAST_PROP -}; - -enum { - CHANGED, - LAST_SIGNAL -}; - -G_DEFINE_TYPE_WITH_PRIVATE (RgTable, rg_table, G_TYPE_OBJECT) - -static GParamSpec *properties [LAST_PROP]; -static guint signals [LAST_SIGNAL]; - -gint64 -rg_table_get_timespan (RgTable *self) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_return_val_if_fail (RG_IS_TABLE (self), 0); - - return priv->timespan; -} - -void -rg_table_set_timespan (RgTable *self, - GTimeSpan timespan) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_return_if_fail (RG_IS_TABLE (self)); - - if (timespan != priv->timespan) - { - priv->timespan = timespan; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TIMESPAN]); - } -} - -static void -rg_table_set_value_max (RgTable *self, - gdouble value_max) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_return_if_fail (RG_IS_TABLE (self)); - - if (priv->value_max != value_max) - { - priv->value_max = value_max; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_VALUE_MAX]); - } -} - -static void -rg_table_set_value_min (RgTable *self, - gdouble value_min) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_return_if_fail (RG_IS_TABLE (self)); - - if (priv->value_min != value_min) - { - priv->value_min = value_min; - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_VALUE_MIN]); - } -} - -RgTable * -rg_table_new (void) -{ - return g_object_new (RG_TYPE_TABLE, NULL); -} - -guint -rg_table_add_column (RgTable *self, - RgColumn *column) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_return_val_if_fail (RG_IS_TABLE (self), 0); - g_return_val_if_fail (RG_IS_COLUMN (column), 0); - - _rg_column_set_n_rows (column, priv->max_samples); - - g_ptr_array_add (priv->columns, g_object_ref (column)); - - return priv->columns->len - 1; -} - -guint -rg_table_get_max_samples (RgTable *self) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_return_val_if_fail (RG_IS_TABLE (self), 0); - - return priv->max_samples; -} - -void -rg_table_set_max_samples (RgTable *self, - guint max_samples) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - gsize i; - - g_return_if_fail (RG_IS_TABLE (self)); - g_return_if_fail (max_samples > 0); - - if (max_samples == priv->max_samples) - return; - - for (i = 0; i < priv->columns->len; i++) - { - RgColumn *column; - - column = g_ptr_array_index (priv->columns, i); - _rg_column_set_n_rows (column, max_samples); - } - - _rg_column_set_n_rows (priv->timestamps, max_samples); - - priv->max_samples = max_samples; - - g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MAX_SAMPLES]); -} - -gdouble -rg_table_get_max_iter_value (RgTable *self, - guint column_index) -{ - gdouble max_value = 0.0; - gdouble double_value = 0.0; - RgTableIter iter; - - if (rg_table_get_iter_first (self, &iter)) - { - GValue value = G_VALUE_INIT; - - rg_table_iter_get_value(&iter, column_index, &value); - - switch (G_VALUE_TYPE (&value)) - { - case G_TYPE_DOUBLE: - double_value = g_value_get_double (&value); - break; - - case G_TYPE_UINT: - double_value = g_value_get_uint (&value); - break; - - case G_TYPE_UINT64: - double_value = g_value_get_uint64 (&value); - break; - - case G_TYPE_INT: - double_value = g_value_get_int (&value); - break; - - case G_TYPE_INT64: - double_value = g_value_get_int64 (&value); - break; - - default: - double_value = 0.0; - break; - } - max_value = double_value; - - while (rg_table_iter_next (&iter)) - { - GValue value = G_VALUE_INIT; - - rg_table_iter_get_value(&iter, column_index, &value); - - switch (G_VALUE_TYPE (&value)) - { - case G_TYPE_DOUBLE: - double_value = g_value_get_double (&value); - break; - - case G_TYPE_UINT: - double_value = g_value_get_uint (&value); - break; - - case G_TYPE_UINT64: - double_value = g_value_get_uint64 (&value); - break; - - case G_TYPE_INT: - double_value = g_value_get_int (&value); - break; - - case G_TYPE_INT64: - double_value = g_value_get_int64 (&value); - break; - - default: - double_value = 0.0; - break; - } - - if(double_value > max_value) - max_value = double_value; - } - } - - return max_value; -} - -/** - * rg_table_push: - * @self: Table to push to - * @iter: (out): Newly created #RgTableIter - * @timestamp: Time of new event - */ -void -rg_table_push (RgTable *self, - RgTableIter *iter, - gint64 timestamp) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - guint pos; - gsize i; - - g_return_if_fail (RG_IS_TABLE (self)); - g_return_if_fail (iter != NULL); - g_return_if_fail (timestamp > 0); - - for (i = 0; i < priv->columns->len; i++) - { - RgColumn *column; - - column = g_ptr_array_index (priv->columns, i); - _rg_column_push (column); - } - - pos = _rg_column_push (priv->timestamps); - _rg_column_set (priv->timestamps, pos, timestamp); - - impl->table = self; - impl->timestamp = timestamp; - impl->index = pos; - - priv->last_index = pos; - - g_signal_emit (self, signals [CHANGED], 0); -} - -gboolean -rg_table_get_iter_last (RgTable *self, - RgTableIter *iter) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - - g_return_val_if_fail (RG_IS_TABLE (self), FALSE); - g_return_val_if_fail (iter != NULL, FALSE); - g_return_val_if_fail (impl != NULL, FALSE); - - impl->table = self; - impl->index = priv->last_index; - impl->timestamp = 0; - - _rg_column_get (priv->timestamps, impl->index, &impl->timestamp); - - return (impl->timestamp != 0); -} - -gint64 -rg_table_get_end_time (RgTable *self) -{ - RgTableIter iter; - - g_return_val_if_fail (RG_IS_TABLE (self), 0); - - if (rg_table_get_iter_last (self, &iter)) - return rg_table_iter_get_timestamp (&iter); - - return g_get_monotonic_time (); -} - -gboolean -rg_table_get_iter_first (RgTable *self, - RgTableIter *iter) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - - g_return_val_if_fail (RG_IS_TABLE (self), FALSE); - g_return_val_if_fail (iter != NULL, FALSE); - g_return_val_if_fail (impl != NULL, FALSE); - - impl->table = self; - impl->index = (priv->last_index + 1) % priv->max_samples; - impl->timestamp = 0; - - _rg_column_get (priv->timestamps, impl->index, &impl->timestamp); - - /* - * Maybe this is our first time around the ring, and we can just - * assume the 0 index is the real first entry. - */ - if (impl->timestamp == 0) - { - impl->index = 0; - _rg_column_get (priv->timestamps, impl->index, &impl->timestamp); - } - - return (impl->timestamp != 0); -} - -gboolean -rg_table_iter_next (RgTableIter *iter) -{ - RgTablePrivate *priv; - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - - g_return_val_if_fail (iter != NULL, FALSE); - g_return_val_if_fail (impl != NULL, FALSE); - g_return_val_if_fail (RG_IS_TABLE (impl->table), FALSE); - - priv = rg_table_get_instance_private (impl->table); - - if (impl->index == priv->last_index) - { - impl->table = NULL; - impl->index = 0; - impl->timestamp = 0; - return FALSE; - } - - do - { - impl->index = (impl->index + 1) % priv->max_samples; - - impl->timestamp = 0; - _rg_column_get (priv->timestamps, impl->index, &impl->timestamp); - - if (impl->timestamp > 0) - break; - } - while (impl->index < priv->last_index); - - return (impl->timestamp > 0); -} - -gint64 -rg_table_iter_get_timestamp (RgTableIter *iter) -{ - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - - g_return_val_if_fail (iter != NULL, 0); - - return impl->timestamp; -} - -void -rg_table_iter_set (RgTableIter *iter, - gint first_column, - ...) -{ - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - RgTablePrivate *priv; - gint column_id = first_column; - va_list args; - - g_return_if_fail (iter != NULL); - g_return_if_fail (impl != NULL); - g_return_if_fail (RG_IS_TABLE (impl->table)); - - priv = rg_table_get_instance_private (impl->table); - - va_start (args, first_column); - - while (column_id >= 0) - { - RgColumn *column; - - if (column_id >= priv->columns->len) - { - g_critical ("No such column %d", column_id); - goto cleanup; - } - - column = g_ptr_array_index (priv->columns, column_id); - - _rg_column_collect (column, impl->index, args); - - column_id = va_arg (args, gint); - } - - if (column_id != -1) - g_critical ("Invalid column sentinal: %d", column_id); - -cleanup: - va_end (args); -} - -void -rg_table_iter_get (RgTableIter *iter, - gint first_column, - ...) -{ - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - RgTablePrivate *priv; - gint column_id = first_column; - va_list args; - - g_return_if_fail (iter != NULL); - g_return_if_fail (impl != NULL); - g_return_if_fail (RG_IS_TABLE (impl->table)); - - priv = rg_table_get_instance_private (impl->table); - - va_start (args, first_column); - - while (column_id >= 0) - { - RgColumn *column; - - if (column_id >= priv->columns->len) - { - g_critical ("No such column %d", column_id); - goto cleanup; - } - - column = g_ptr_array_index (priv->columns, column_id); - - _rg_column_lcopy (column, impl->index, args); - - column_id = va_arg (args, gint); - } - - if (column_id != -1) - g_critical ("Invalid column sentinal: %d", column_id); - -cleanup: - va_end (args); -} - -void -rg_table_iter_get_value (RgTableIter *iter, - guint column, - GValue *value) -{ - RgTableIterImpl *impl = (RgTableIterImpl *)iter; - RgTablePrivate *priv; - RgColumn *col; - - g_return_if_fail (iter != NULL); - g_return_if_fail (impl != NULL); - g_return_if_fail (RG_IS_TABLE (impl->table)); - priv = rg_table_get_instance_private (impl->table); - g_return_if_fail (column < priv->columns->len); - - col = g_ptr_array_index (priv->columns, column); - _rg_column_get_value (col, impl->index, value); -} - -static void -rg_table_finalize (GObject *object) -{ - RgTable *self = (RgTable *)object; - RgTablePrivate *priv = rg_table_get_instance_private (self); - - g_clear_pointer (&priv->columns, g_ptr_array_unref); - - G_OBJECT_CLASS (rg_table_parent_class)->finalize (object); -} - -static void -rg_table_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - RgTable *self = (RgTable *)object; - RgTablePrivate *priv = rg_table_get_instance_private (self); - - switch (prop_id) - { - case PROP_TIMESPAN: - g_value_set_int64 (value, priv->timespan); - break; - - case PROP_MAX_SAMPLES: - g_value_set_uint (value, priv->max_samples); - break; - - case PROP_VALUE_MAX: - g_value_set_double (value, priv->value_max); - break; - - case PROP_VALUE_MIN: - g_value_set_double (value, priv->value_min); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_table_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - RgTable *self = (RgTable *)object; - - switch (prop_id) - { - case PROP_MAX_SAMPLES: - rg_table_set_max_samples (self, g_value_get_uint (value)); - break; - - case PROP_TIMESPAN: - rg_table_set_timespan (self, g_value_get_int64 (value)); - break; - - case PROP_VALUE_MAX: - rg_table_set_value_max (self, g_value_get_double (value)); - break; - - case PROP_VALUE_MIN: - rg_table_set_value_min (self, g_value_get_double (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -rg_table_class_init (RgTableClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = rg_table_finalize; - object_class->get_property = rg_table_get_property; - object_class->set_property = rg_table_set_property; - - properties [PROP_MAX_SAMPLES] = - g_param_spec_uint ("max-samples", - "Max Samples", - "Max Samples", - 1, G_MAXUINT, - 120, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - - properties [PROP_TIMESPAN] = - g_param_spec_int64 ("timespan", - "Timespan", - "Timespan to visualize, in microseconds.", - 1, G_MAXINT64, - G_USEC_PER_SEC * 60L, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - - properties [PROP_VALUE_MAX] = - g_param_spec_double ("value-max", - "Value Max", - "Value Max", - -G_MINDOUBLE, G_MAXDOUBLE, - 100.0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - properties [PROP_VALUE_MIN] = - g_param_spec_double ("value-min", - "Value Min", - "Value Min", - -G_MINDOUBLE, G_MAXDOUBLE, - 100.0, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, LAST_PROP, properties); - - signals [CHANGED] = g_signal_new ("changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, NULL, - G_TYPE_NONE, - 0); -} - -static void -rg_table_init (RgTable *self) -{ - RgTablePrivate *priv = rg_table_get_instance_private (self); - - priv->max_samples = 60; - priv->value_min = 0.0; - priv->value_max = 100.0; - - priv->columns = g_ptr_array_new_with_free_func (g_object_unref); - - priv->timestamps = rg_column_new (NULL, G_TYPE_INT64); - _rg_column_set_n_rows (priv->timestamps, priv->max_samples); -} diff -Nru gnome-usage-3.30.0/external/rg/rg-table.h gnome-usage-3.32.0/external/rg/rg-table.h --- gnome-usage-3.30.0/external/rg/rg-table.h 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/external/rg/rg-table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -/* rg-table.h - * - * Copyright (C) 2015 Christian Hergert - * - * This file 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 3 of the - * License, or (at your option) any later version. - * - * This file 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 General Public License - * along with this program. If not, see . - */ - -#ifndef RG_TABLE_H -#define RG_TABLE_H - -#include - -#include "rg-column.h" - -G_BEGIN_DECLS - -#define RG_TYPE_TABLE (rg_table_get_type()) - -G_DECLARE_DERIVABLE_TYPE (RgTable, rg_table, RG, TABLE, GObject) - -struct _RgTableClass -{ - GObjectClass parent; -}; - -typedef struct -{ - gpointer data[8]; -} RgTableIter; - -RgTable *rg_table_new (void); -guint rg_table_add_column (RgTable *self, - RgColumn *column); -GTimeSpan rg_table_get_timespan (RgTable *self); -void rg_table_set_timespan (RgTable *self, - GTimeSpan timespan); -gint64 rg_table_get_end_time (RgTable *self); -guint rg_table_get_max_samples (RgTable *self); -void rg_table_set_max_samples (RgTable *self, - guint n_rows); -void rg_table_push (RgTable *self, - RgTableIter *iter, - gint64 timestamp); -gboolean rg_table_get_iter_first (RgTable *self, - RgTableIter *iter); -gboolean rg_table_get_iter_last (RgTable *self, - RgTableIter *iter); -gboolean rg_table_iter_next (RgTableIter *iter); -void rg_table_iter_get (RgTableIter *iter, - gint first_column, - ...); -void rg_table_iter_get_value (RgTableIter *iter, - guint column, - GValue *value); -gint64 rg_table_iter_get_timestamp (RgTableIter *iter); -void rg_table_iter_set (RgTableIter *iter, - gint first_column, - ...); -gdouble rg_table_get_max_iter_value(RgTable *self, - guint column); - -G_END_DECLS - -#endif /* RG_TABLE_H */ diff -Nru gnome-usage-3.30.0/meson.build gnome-usage-3.32.0/meson.build --- gnome-usage-3.30.0/meson.build 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/meson.build 2019-03-22 14:43:03.000000000 +0000 @@ -1,6 +1,6 @@ project( 'gnome-usage', ['vala', 'c'], - version: '3.30.0', + version: '3.32.0', license: 'GPL3', meson_version: '>= 0.37.0' ) @@ -12,6 +12,7 @@ gobject_dep = dependency('gobject-2.0') gio_dep = dependency('gio-2.0') gtk_dep = dependency('gtk+-3.0', version : '>=3.20.10') +libdazzle_dep = dependency('libdazzle-1.0', version : '>=3.30') gnome = import('gnome') i18n = import('i18n') @@ -21,7 +22,6 @@ subdir('data') subdir('po') -subdir('external') subdir('src') meson.add_install_script( diff -Nru gnome-usage-3.30.0/NEWS gnome-usage-3.32.0/NEWS --- gnome-usage-3.30.0/NEWS 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/NEWS 2019-03-22 14:43:03.000000000 +0000 @@ -1,3 +1,57 @@ +3.32.0 - Mar 20, 2019 +===================== + + - Retire application menu + - Simplify the build scripts + - Drop RG and EGG libraries + - Use libdazzle + - Add filter processes option + - Support grouping system processes + - Add new application icon + - Added/updated/fixed translations: + - Polish + - Brazilian Portuguese + - Czech + - Swedish + - Finnish + - Spanish + - Hungarian + - Galician + - Turkish + - Danish + - Dutch + - Indonesian + - Italian + - Friulian + - Serbian + - Basque + - French + +All contributors to this release: + +Abderrahim Kitouni +Anders Jonsson +Asier Sarasua Garmendia +Ask Hjorth Larsen +Balázs Úr +Charles Monzat +Christopher Davis +Daniel Mustieles +Emin Tufan Çetin +Fabio Tomat +Felipe Borges +Fran Dieguez +Gianvito Cavasoli +Jiri Grönroos +Kukuh Syafaat +Марко Костић +Marek Cernocky +Petr Štětka +Piotr Drąg +Rafael Fontenelle +Rico Tzschichholz +yodatak + 3.30.0 - Sep 25, 2018 ===================== diff -Nru gnome-usage-3.30.0/org.gnome.Usage.json gnome-usage-3.32.0/org.gnome.Usage.json --- gnome-usage-3.30.0/org.gnome.Usage.json 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/org.gnome.Usage.json 2019-03-22 14:43:03.000000000 +0000 @@ -36,6 +36,16 @@ ] }, { + "name" : "libdazzle", + "buildsystem" : "meson", + "sources" : [ + { + "type" : "git", + "url" : "https://gitlab.gnome.org/GNOME/libdazzle.git" + } + ] + }, + { "buildsystem": "meson", "builddir": true, "name": "gnome-usage", diff -Nru gnome-usage-3.30.0/po/cs.po gnome-usage-3.32.0/po/cs.po --- gnome-usage-3.30.0/po/cs.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/cs.po 2019-03-22 14:43:03.000000000 +0000 @@ -2,14 +2,14 @@ # Copyright (C) 2017 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. # Zdeněk Hataš , 2017. -# Marek Černocký , 2017, 2018. +# Marek Černocký , 2017, 2018, 2019. # msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-03 14:27+0000\n" -"PO-Revision-Date: 2018-05-03 23:20+0200\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-01-07 11:30+0100\n" "Last-Translator: Marek Černocký \n" "Language-Team: čeština \n" "Language: cs\n" @@ -21,7 +21,7 @@ #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" -msgstr "Využití v GNOME" +msgstr "Využití GNOME" #: data/org.gnome.Usage.appdata.xml.in:6 msgid "A nice way to view information about use of system resources" @@ -36,7 +36,7 @@ "Jednoduchá aplikace pro GNOME 3 ke sledování a analýze systémových " "prostředků, jako jsou procesor, paměť nebo úložiště." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Využití" @@ -72,7 +72,7 @@ "Tento seznam je používám pro filtrování procesů, které uživatele nesmí " "ukončit." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Storno" @@ -86,7 +86,7 @@ msgstr "Použito" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Dostupné" @@ -98,6 +98,18 @@ msgid "Try a different search" msgstr "Zkuste hledat něco jiného" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "O aplikaci Využití GNOME" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Seskupovat systémové procesy" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Zobrazovat všechny procesy" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -143,15 +155,11 @@ msgid "Swap" msgstr "Odkládací prostor" -#: src/application.vala:56 -msgid "About" -msgstr "O aplikaci" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Ukončit" +#: src/app-item.vala:43 +msgid "System" +msgstr "Systém" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -159,11 +167,11 @@ "Elegantní způsob, jak zobrazit informace o využití systémových prostředků, " "jako jsou operační paměť a místo na disku." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Zdeněk Hataš " -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Webové stránky" @@ -171,15 +179,11 @@ msgid "Processor" msgstr "Procesor" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Ostatní" - #: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Paměť" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" @@ -187,15 +191,15 @@ msgstr[1] "%u vybrané" msgstr[2] "%u vybraných" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Položky vyberete kliknutím" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Vybrat vše" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Zrušit výběr" @@ -297,3 +301,12 @@ #: src/storage-view.vala:45 msgid "Storage" msgstr "Úložiště" + +#~ msgid "About" +#~ msgstr "O aplikaci" + +#~ msgid "Quit" +#~ msgstr "Ukončit" + +#~ msgid "Others" +#~ msgstr "Ostatní" diff -Nru gnome-usage-3.30.0/po/da.po gnome-usage-3.32.0/po/da.po --- gnome-usage-3.30.0/po/da.po 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/po/da.po 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,296 @@ +# Danish translation for gnome-usage. +# Copyright (C) 2019 gnome-usage's COPYRIGHT HOLDER +# This file is distributed under the same license as the gnome-usage package. +# scootergrisen, 2019. +msgid "" +msgstr "" +"Project-Id-Version: gnome-usage master\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" +"POT-Creation-Date: 2019-01-29 00:10+0000\n" +"PO-Revision-Date: 2019-02-19 00:00+0200\n" +"Last-Translator: scootergrisen\n" +"Language-Team: Danish\n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/org.gnome.Usage.appdata.xml.in:5 +msgid "GNOME Usage" +msgstr "GNOME Forbrug" + +#: data/org.gnome.Usage.appdata.xml.in:6 +msgid "A nice way to view information about use of system resources" +msgstr "En fin måde til at vise information om forbruget af systemressourcer" + +#: data/org.gnome.Usage.appdata.xml.in:8 +msgid "" +"A simple GNOME 3 application to monitor and analyze system resources such as " +"processing, memory, and storage." +msgstr "" +"Et simpelt GNOME 3-program til at overvåge og analysere systemressourcer " +"såsom processor, hukommelse og lager." + +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 +msgid "Usage" +msgstr "Forbrug" + +#: data/org.gnome.Usage.desktop.in:4 +msgid "" +"A nice way to view information about use of system resources, like memory " +"and disk space" +msgstr "" +"En fin måde til at vise information om forbruget af systemressourcer såsom " +"hukommelse og diskplads" + +#. Translators: Do NOT translate or transliterate this text (this is an icon file name)! +#: data/org.gnome.Usage.desktop.in:8 +msgid "org.gnome.Usage" +msgstr "org.gnome.Usage" + +#. Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! +#: data/org.gnome.Usage.desktop.in:13 +msgid "" +"Monitor;System;Process;CPU;Memory;Network;History;Usage;Performance;Task;" +"Manager;" +msgstr "" +"Overvåg;System;Processor;CPU;Hukommelse;Netværk;Historik;Forbrug;Ydelse;Opga" +"ve;Håndtering;" + +#: data/org.gnome.Usage.gschema.xml:5 +msgid "A list of processes which we don’t want killed" +msgstr "En liste over processer som ikke skal dræbes" + +#: data/org.gnome.Usage.gschema.xml:6 +msgid "This list is used for filtering which processes the user can’t stop." +msgstr "" +"Listen bruges til at filtrere hvilke processer brugeren ikke kan stoppe." + +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 +#: src/storage-actionbar.vala:90 src/storage-row.vala:393 +msgid "Cancel" +msgstr "Annullér" + +#: data/ui/memory-speedometer.ui:38 +msgid "RAM" +msgstr "RAM" + +#: data/ui/memory-speedometer.ui:53 data/ui/swap-speedometer.ui:51 +msgid "Used" +msgstr "Anvendt" + +#: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 +#: src/storage-item.vala:140 +msgid "Available" +msgstr "Tilgængelig" + +#: data/ui/no-results-found-view.ui:23 +msgid "No results found" +msgstr "Fandt ingen resultater" + +#: data/ui/no-results-found-view.ui:32 +msgid "Try a different search" +msgstr "Prøv en anden søgning" + +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Om Forbrug" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Gruppér systemressourcer" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Vis alle processer" + +#. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” +#: data/ui/quit-process-dialog.ui:9 +msgid "Force Quit %s?" +msgstr "Tving %s til at afslutte?" + +#: data/ui/quit-process-dialog.ui:10 +msgid "Unsaved work might be lost." +msgstr "Arbejde, der ikke er gemt, kan gå tabt." + +#: data/ui/quit-process-dialog.ui:24 +msgid "Force Quit" +msgstr "Tving afslutning" + +#: data/ui/storage-actionbar.ui:9 src/storage-row.vala:274 +msgid "Move to" +msgstr "Flyt til" + +#: data/ui/storage-actionbar.ui:18 src/storage-row.vala:278 +msgid "Delete" +msgstr "Slet" + +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 +msgid "Move to Trash" +msgstr "Flyt til papirkurv" + +#: data/ui/storage-actionbar.ui:45 +msgid "Empty folder" +msgstr "Tøm mappe" + +#: data/ui/storage-actionbar.ui:57 src/storage-row.vala:263 +msgid "Restore" +msgstr "Gendan" + +#: data/ui/storage-actionbar.ui:66 src/storage-row.vala:266 +msgid "Delete from Trash" +msgstr "Slet fra papirkurv" + +#: data/ui/storage-view.ui:63 +msgid "No content here" +msgstr "Her er ikke noget indhold" + +#: data/ui/swap-speedometer.ui:36 +msgid "Swap" +msgstr "Swap" + +#: src/app-item.vala:43 +msgid "System" +msgstr "System" + +#: src/application.vala:80 +msgid "" +"A nice way to view information about use of system resources, like memory " +"and disk space." +msgstr "" +"En fin måde til at vise information om forbruget af systemressourcer såsom " +"hukommelse og diskplads." + +#: src/application.vala:83 +msgid "translator-credits" +msgstr "scootergrisen" + +#: src/application.vala:85 +msgid "Websites" +msgstr "Websteder" + +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 +msgid "Processor" +msgstr "Processor" + +#: src/graph-stack-switcher.vala:46 +msgid "Memory" +msgstr "Hukommelse" + +#: src/header-bar.vala:149 +#, c-format +msgid "%u selected" +msgid_plural "%u selected" +msgstr[0] "%u valgt" +msgstr[1] "%u valgt" + +#: src/header-bar.vala:151 +msgid "Click on items to select them" +msgstr "Klik på elementerne for at vælge dem" + +#: src/header-bar.vala:215 +msgid "Select all" +msgstr "Vælg alle" + +#: src/header-bar.vala:219 +msgid "Select None" +msgstr "Vælg ingen" + +#: src/performance-view.vala:48 +msgid "Performance" +msgstr "Ydelse" + +#: src/storage-actionbar.vala:89 src/storage-row.vala:392 +msgid "Select destination folder" +msgstr "Vælg destinationsmappe" + +#: src/storage-actionbar.vala:92 src/storage-row.vala:395 +msgid "Select" +msgstr "Vælg" + +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 +#, c-format +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Er du sikker på, at du vil slette “%s” permanent?" + +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, c-format +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "Er du sikker på, at du vil slette det valgte element permanent?" +msgstr[1] "Er du sikker på, at du vil slette de %d valgte elementer permanent?" + +#: src/storage-actionbar.vala:152 +msgid "If you delete these items, they will be permanently lost." +msgstr "Hvis du sletter elementerne, så går de tabt permanent." + +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 +msgid "Empty all items from Trash?" +msgstr "Tøm alle elementerne fra papirkurven?" + +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 +msgid "All items in the Trash will be permanently deleted." +msgstr "Alle elementerne i papirkurven vil blive slettet permanent." + +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 +#, c-format +msgid "Empty all items from %s?" +msgstr "Tøm alle elementerne fra %s?" + +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 +#, c-format +msgid "All items in the %s will be moved to the Trash." +msgstr "Alle elementerne i %s flyttes til papirkurven." + +#: src/storage-analyzer.vala:94 +msgid "Storage 1" +msgstr "Lager 1" + +#: src/storage-analyzer.vala:98 +msgid "Storage 2" +msgstr "Lager 2" + +#: src/storage-analyzer.vala:105 +msgid "Capacity" +msgstr "Kapacitet" + +#: src/storage-analyzer.vala:647 +msgid "Home" +msgstr "Hjem" + +#: src/storage-item.vala:104 +msgid "Trash" +msgstr "Papirkurv" + +#: src/storage-item.vala:128 +msgid "Operating System" +msgstr "Styresystem" + +#: src/storage-row.vala:248 +msgid "Empty" +msgstr "Tøm" + +#: src/storage-row.vala:253 +msgid "Empty Trash" +msgstr "Tøm papirkurv" + +#: src/storage-row.vala:273 src/storage-row.vala:367 +msgid "Rename" +msgstr "Omdøb" + +#: src/storage-row.vala:439 +#, c-format +msgid "Are you sure you want to permanently delete %s?" +msgstr "Er du sikker på, at du vil slette %s permanent?" + +#: src/storage-row.vala:440 +msgid "If you delete an item, it will be permanently lost." +msgstr "Hvis du sletter et element, så går det tabt permanent." + +#: src/storage-view.vala:45 +msgid "Storage" +msgstr "Lager" diff -Nru gnome-usage-3.30.0/po/es.po gnome-usage-3.32.0/po/es.po --- gnome-usage-3.30.0/po/es.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/es.po 2019-03-22 14:43:03.000000000 +0000 @@ -1,14 +1,14 @@ # Spanish translation for gnome-usage. # Copyright (C) 2017 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. -# Daniel Mustieles , 2017, 2018. +# Daniel Mustieles , 2017-2019. # msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-15 09:26+0000\n" -"PO-Revision-Date: 2018-06-22 09:49+0200\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-01-28 15:05+0100\n" "Last-Translator: Daniel Mustieles \n" "Language-Team: es \n" "Language: es\n" @@ -16,7 +16,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Gtranslator 2.91.6\n" +"X-Generator: Gtranslator 3.31.0\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -35,8 +35,7 @@ "Una sencilla aplicación de GNOME 3 para monitorizar y a analizar los " "recursos del sistema como el procesador, la memoria y el almacenamiento." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 -#: src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Uso" @@ -71,7 +70,7 @@ msgstr "" "Esta lista se usa para filtrar qué procesos no puede el usuario detener." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Cancelar" @@ -85,7 +84,7 @@ msgstr "Usada" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Disponible" @@ -97,6 +96,18 @@ msgid "Try a different search" msgstr "Pruebe a hacer una búsqueda diferente" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Acerca de Uso de GNOME" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Agrupar procesos del sistema" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Mostrar todos los procesos" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -142,15 +153,11 @@ msgid "Swap" msgstr "Intercambio" -#: src/application.vala:56 -msgid "About" -msgstr "Acerca de" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Salir" +#: src/app-item.vala:43 +msgid "System" +msgstr "Sistema" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -158,11 +165,11 @@ "Una buena manera de ver información sobre el uso de los recursos del " "sistema, como la memoria y el espacio en disco." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Daniel Mustieles , 2017" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Sitios web" @@ -170,30 +177,26 @@ msgid "Processor" msgstr "Procesador" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Otros" - #: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Memoria" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u seleccionado" msgstr[1] "%u seleccionados" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Pulse en los elementos para seleccionarlos" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Seleccionar todo" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "No seleccionar nada" @@ -212,16 +215,12 @@ #. Translators: %s is the name of the file to be deleted. #: src/storage-actionbar.vala:144 #, c-format -#| msgid "Are you sure you want to permanently delete %s?" msgid "Are you sure you want to permanently delete “%s”?" msgstr "¿Está seguro de que quiere eliminar permanentemente «%s»?" #. Translators: %d is the number of files to be deleted. #: src/storage-actionbar.vala:148 #, c-format -#| msgid "Are you sure you want to permanently delete the %d selected items?" -#| msgid_plural "" -#| "Are you sure you want to permanently delete the %d selected items?" msgid "Are you sure you want to permanently delete the %d selected item?" msgid_plural "" "Are you sure you want to permanently delete the %d selected items?" @@ -302,6 +301,15 @@ msgid "Storage" msgstr "Almacenamiento" +#~ msgid "Others" +#~ msgstr "Otros" + +#~ msgid "About" +#~ msgstr "Acerca de" + +#~ msgid "Quit" +#~ msgstr "Salir" + #~| msgid "Are you sure you want to permanently delete %s?" #~ msgid "Are you sure you want to permanently delete \"%s\" ?" #~ msgstr "¿Está seguro de que quiere eliminar «%s» permanentemente?" diff -Nru gnome-usage-3.30.0/po/eu.po gnome-usage-3.32.0/po/eu.po --- gnome-usage-3.30.0/po/eu.po 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/po/eu.po 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,283 @@ +# Basque translation for gnome-usage. +# Copyright (C) 2019 gnome-usage's COPYRIGHT HOLDER +# This file is distributed under the same license as the gnome-usage package. +# Asier Sarasua Garmendia , 2019. +# +msgid "" +msgstr "Project-Id-Version: gnome-usage gnome-3-30\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" +"POT-Creation-Date: 2019-03-11 18:12+0000\n" +"PO-Revision-Date: 2019-03-17 10:00+0100\n" +"Last-Translator: Asier Sarasua Garmendia \n" +"Language-Team: Basque \n" +"Language: eu\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: data/org.gnome.Usage.appdata.xml.in:5 +msgid "GNOME Usage" +msgstr "GNOME Erabilera" + +#: data/org.gnome.Usage.appdata.xml.in:6 +msgid "A nice way to view information about use of system resources" +msgstr "Sistema-baliabideen erabilerari buruzko informazioa ikusteko modu egokia" + +#: data/org.gnome.Usage.appdata.xml.in:8 +msgid "" +"A simple GNOME 3 application to monitor and analyze system resources such as " +"processing, memory, and storage." +msgstr "Prozesuak, memoria, biltegiratzea eta sistemaren beste baliabide batzuk monitorizatu eta analizatzeko GNOME 3 aplikazio sinplea." + +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +msgid "Usage" +msgstr "Erabilera" + +#: data/org.gnome.Usage.desktop.in:4 +msgid "" +"A nice way to view information about use of system resources, like memory " +"and disk space" +msgstr "Sistema-baliabideak, esaterako memoria eta diskoko espazioa, nola erabiltzen ari diren ezagutzeko modu egokia" + +#. Translators: Do NOT translate or transliterate this text (this is an icon file name)! +#: data/org.gnome.Usage.desktop.in:8 +msgid "org.gnome.Usage" +msgstr "org.gnome.Usage" + +#. Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! +#: data/org.gnome.Usage.desktop.in:13 +msgid "" +"Monitor;System;Process;CPU;Memory;Network;History;Usage;Performance;Task;" +"Manager;" +msgstr "Monitorea;Sistema;Prozesua;PUZ;Memoria;Sarea;Historia;Erabilera;Errendimendua;Zeregina;Kudeatzailea;" + +#: data/org.gnome.Usage.gschema.xml:5 +msgid "A list of processes which we don’t want killed" +msgstr "Hil ez daitezen nahi ditugun prozesuen zerrenda" + +#: data/org.gnome.Usage.gschema.xml:6 +msgid "This list is used for filtering which processes the user can’t stop." +msgstr "Erabiltzaileak gelditu ezingo dituen prozesuak iragazteko erabiliko da zerrenda hau." + +#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: src/storage-actionbar.vala:90 src/storage-row.vala:393 +msgid "Cancel" +msgstr "Utzi" + +#: data/ui/memory-speedometer.ui:38 +msgid "RAM" +msgstr "RAMa" + +#: data/ui/memory-speedometer.ui:53 data/ui/swap-speedometer.ui:51 +msgid "Used" +msgstr "Erabilita" + +#: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 +#: src/graph-block.vala:67 src/storage-item.vala:140 +msgid "Available" +msgstr "Erabilgarri" + +#: data/ui/no-results-found-view.ui:23 +msgid "No results found" +msgstr "Ez da emaitzarik aurkitu" + +#: data/ui/no-results-found-view.ui:32 +msgid "Try a different search" +msgstr "Saiatu bestelako bilaketa" + +#. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” +#: data/ui/quit-process-dialog.ui:9 +msgid "Force Quit %s?" +msgstr "Behartu %s irtetea?" + +#: data/ui/quit-process-dialog.ui:10 +msgid "Unsaved work might be lost." +msgstr "Gorde gabeko lana galdu egin daiteke." + +#: data/ui/quit-process-dialog.ui:24 +msgid "Force Quit" +msgstr "Behartu irtetea" + +#: data/ui/storage-actionbar.ui:9 src/storage-row.vala:274 +msgid "Move to" +msgstr "Eraman hona:" + +#: data/ui/storage-actionbar.ui:18 src/storage-row.vala:278 +msgid "Delete" +msgstr "Ezabatu" + +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 +msgid "Move to Trash" +msgstr "Bota zakarrontzira" + +#: data/ui/storage-actionbar.ui:45 +msgid "Empty folder" +msgstr "Karpeta hutsa" + +#: data/ui/storage-actionbar.ui:57 src/storage-row.vala:263 +msgid "Restore" +msgstr "Leheneratu" + +#: data/ui/storage-actionbar.ui:66 src/storage-row.vala:266 +msgid "Delete from Trash" +msgstr "Ezabatu zakarrontzitik" + +#: data/ui/storage-view.ui:63 +msgid "No content here" +msgstr "Ez dago edukirik hemen" + +#: data/ui/swap-speedometer.ui:36 +msgid "Swap" +msgstr "Trukatze-espazioa" + +#: src/application.vala:56 +msgid "About" +msgstr "Honi buruz" + +#: src/application.vala:59 +msgid "Quit" +msgstr "Irten" + +#: src/application.vala:92 +msgid "" +"A nice way to view information about use of system resources, like memory " +"and disk space." +msgstr "Sistema-baliabideak, esaterako memoria eta diskoko espazioa, nola erabiltzen ari diren ezagutzeko modu egokia." + +#: src/application.vala:95 +msgid "translator-credits" +msgstr "Asier Sarasua Garmendia " + +#: src/application.vala:97 +msgid "Websites" +msgstr "Webguneak" + +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 +msgid "Processor" +msgstr "Prozesadorea" + +#: src/graph-block.vala:65 +msgid "Others" +msgstr "Bestelakoak" + +#: src/graph-stack-switcher.vala:46 +msgid "Memory" +msgstr "Memoria" + +#: src/header-bar.vala:143 +#, c-format +msgid "%u selected" +msgid_plural "%u selected" +msgstr[0] "%u hautatuta" +msgstr[1] "%u hautatuta" + +#: src/header-bar.vala:145 +msgid "Click on items to select them" +msgstr "Egin klik elementuen gainean hautatzeko" + +#: src/header-bar.vala:209 +msgid "Select all" +msgstr "Hautatu dena" + +#: src/header-bar.vala:213 +msgid "Select None" +msgstr "Hautatu bat ere ez" + +#: src/performance-view.vala:48 +msgid "Performance" +msgstr "Errendimendua" + +#: src/storage-actionbar.vala:89 src/storage-row.vala:392 +msgid "Select destination folder" +msgstr "Hautatu helburuko karpeta" + +#: src/storage-actionbar.vala:92 src/storage-row.vala:395 +msgid "Select" +msgstr "Hautatu" + +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 +#, c-format +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Ziur zaude “%s“ behin betiko ezabatu nahi duzula?" + +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, c-format +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "Ziur zaude hautatutako elementu %d betiko ezabatu nahi duzula?" +msgstr[1] "Ziur zaude hautatutako %d elementuak betiko ezabatu nahi dituzula?" + +#: src/storage-actionbar.vala:152 +msgid "If you delete these items, they will be permanently lost." +msgstr "Elementu horiek ezabatzen badituzu, betiko galduko dira." + +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 +msgid "Empty all items from Trash?" +msgstr "Hustu zakarrontziko elementu guztiak?" + +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 +msgid "All items in the Trash will be permanently deleted." +msgstr "Zakarrontziko elementu guztiak betirako ezabatuko dira." + +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 +#, c-format +msgid "Empty all items from %s?" +msgstr "Hustu elementu guztiak %s kokagunetik?" + +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 +#, c-format +msgid "All items in the %s will be moved to the Trash." +msgstr "%s kokaguneko elementu guztiak zakarrontzira botako dira." + +#: src/storage-analyzer.vala:94 +msgid "Storage 1" +msgstr "1 biltegiratzea" + +#: src/storage-analyzer.vala:98 +msgid "Storage 2" +msgstr "2 biltegiratzea" + +#: src/storage-analyzer.vala:105 +msgid "Capacity" +msgstr "Edukiera" + +#: src/storage-analyzer.vala:647 +msgid "Home" +msgstr "Karpeta nagusia" + +#: src/storage-item.vala:104 +msgid "Trash" +msgstr "Zakarrontzia" + +#: src/storage-item.vala:128 +msgid "Operating System" +msgstr "Sistema eragilea" + +#: src/storage-row.vala:248 +msgid "Empty" +msgstr "Hustu" + +#: src/storage-row.vala:253 +msgid "Empty Trash" +msgstr "Hustu zakarrontzia" + +#: src/storage-row.vala:273 src/storage-row.vala:367 +msgid "Rename" +msgstr "Aldatu izena" + +#: src/storage-row.vala:439 +#, c-format +msgid "Are you sure you want to permanently delete %s?" +msgstr "Ziur zaude %s behin betiko ezabatu nahi duzula?" + +#: src/storage-row.vala:440 +msgid "If you delete an item, it will be permanently lost." +msgstr "Elementu bat ezabatzen baduzu, betirako galduko duzu." + +#: src/storage-view.vala:45 +msgid "Storage" +msgstr "Biltegiratzea" diff -Nru gnome-usage-3.30.0/po/fi.po gnome-usage-3.32.0/po/fi.po --- gnome-usage-3.30.0/po/fi.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/fi.po 2019-03-22 14:43:03.000000000 +0000 @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-02-12 10:43+0000\n" -"PO-Revision-Date: 2018-03-03 22:20+0200\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-01-16 20:08+0200\n" "Last-Translator: Jiri Grönroos \n" "Language-Team: suomi \n" "Language: fi\n" @@ -16,7 +16,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.8.7.1\n" +"X-Generator: Poedit 2.0.6\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -31,8 +31,10 @@ "A simple GNOME 3 application to monitor and analyze system resources such as " "processing, memory, and storage." msgstr "" +"Yksinkertainen Gnome 3 -sovellus järjestelmäresurssien, kuten suorittimen, " +"muistin ja tallennustilan, valvontaan sekä analysointiin." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Käyttötiedot" @@ -68,7 +70,7 @@ "Tätä luettelo käytetään lähteenä sille, mitä prosesseja käyttäjä ei voi " "pysäyttää." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Peru" @@ -82,7 +84,7 @@ msgstr "Käytetty" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Käytettävissä" @@ -94,6 +96,18 @@ msgid "Try a different search" msgstr "Yritä eri hakuehtoja" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Tietoja - Käyttötiedot" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Ryhmitä järjestelmäprosessit" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Näytä kaikki prosessit" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -115,7 +129,7 @@ msgid "Delete" msgstr "Poista" -#: data/ui/storage-actionbar.ui:33 +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 msgid "Move to Trash" msgstr "Siirrä roskakoriin" @@ -139,15 +153,11 @@ msgid "Swap" msgstr "Swap" -#: src/application.vala:56 -msgid "About" -msgstr "Tietoja" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Lopeta" +#: src/app-item.vala:43 +msgid "System" +msgstr "Järjestelmä" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -155,46 +165,42 @@ "Mukava tapa seurata järjestelmän resurssien, esimerkiksi muistin ja " "levytilan, käyttöä." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Jiri Grönroos" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Verkkosivustot" -#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Suoritin" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Muut" - -#: src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Muisti" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u valittu" msgstr[1] "%u valittu" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Napsauta kohteita valitaksesi ne" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Valitse kaikki" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Älä valitse mitään" -#: src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Suorituskyky" @@ -206,29 +212,40 @@ msgid "Select" msgstr "Valitse" -#: src/storage-actionbar.vala:143 +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "" +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Haluatko varmasti poistaa kohteen “%s” pysyvästi?" -#: src/storage-actionbar.vala:144 +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, fuzzy, c-format +#| msgid "Are you sure you want to permanently delete %s?" +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "Haluatko varmasti poistaa kohteen %s pysyvästi?" +msgstr[1] "Haluatko varmasti poistaa kohteen %s pysyvästi?" + +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "" -#: src/storage-actionbar.vala:197 src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Poistetaanko kaikki kohteet roskakorista?" -#: src/storage-actionbar.vala:198 src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Kaikki roskakorissa olevat kohteet poistetaan pysyvästi." -#: src/storage-actionbar.vala:219 src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "" -#: src/storage-actionbar.vala:220 src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "" @@ -269,10 +286,6 @@ msgid "Rename" msgstr "Nimeä uudelleen" -#: src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Siirrä roskakoriin" - #: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" @@ -286,6 +299,18 @@ msgid "Storage" msgstr "Tallennustila" +#~ msgid "About" +#~ msgstr "Tietoja" + +#~ msgid "Quit" +#~ msgstr "Lopeta" + +#~ msgid "Others" +#~ msgstr "Muut" + +#~ msgid "Move to trash" +#~ msgstr "Siirrä roskakoriin" + #~ msgid "No applications using processor." #~ msgstr "Mikään sovellus ei käytä suoritinta." diff -Nru gnome-usage-3.30.0/po/fr.po gnome-usage-3.32.0/po/fr.po --- gnome-usage-3.30.0/po/fr.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/fr.po 2019-03-22 14:43:03.000000000 +0000 @@ -2,21 +2,22 @@ # Copyright (C) 2017 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. # JeanDeLaMouche , 2017. +# Charles Monzat , 2019. # msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-03-06 14:29+0000\n" -"PO-Revision-Date: 2018-03-06 23:01+0100\n" -"Last-Translator: Alain Lojewski , 2018\n" -"Language-Team: French \n" +"POT-Creation-Date: 2018-09-25 15:30+0000\n" +"PO-Revision-Date: 2019-01-08 15:59+0100\n" +"Last-Translator: Charles Monzat \n" +"Language-Team: GNOME French Team \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Generator: Poedit 2.0.4\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"X-Generator: Gtranslator 3.30.0\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -60,7 +61,7 @@ "Manager;" msgstr "" "surveiller;système;processus;traitement;processeur;mémoire;réseau;historique;" -"utilisation;performance;tâche;gestionaire;" +"utilisation;performance;tâche;gestionnaire;" #: data/org.gnome.Usage.gschema.xml:5 msgid "A list of processes which we don’t want killed" @@ -119,7 +120,7 @@ msgid "Delete" msgstr "Supprimer" -#: data/ui/storage-actionbar.ui:33 +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 msgid "Move to Trash" msgstr "Mettre à la corbeille" @@ -167,7 +168,7 @@ msgid "Websites" msgstr "Sites Web" -#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Processeur" @@ -175,7 +176,7 @@ msgid "Others" msgstr "Autres" -#: src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Mémoire" @@ -198,7 +199,7 @@ msgid "Select None" msgstr "Ne rien sélectionner" -#: src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Performance" @@ -210,29 +211,43 @@ msgid "Select" msgstr "Sélectionner" -#: src/storage-actionbar.vala:143 +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "Êtes-vous sûr de vouloir supprimer définitivement ces éléments %s ?" +#| msgid "Are you sure you want to permanently delete %s?" +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Voulez-vous vraiment supprimer définitivement « %s » ?" -#: src/storage-actionbar.vala:144 +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, c-format +#| msgid "Are you sure you want to permanently delete this items %s?" +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "" +"Voulez-vous vraiment supprimer définitivement l’élément sélectionné ?" +msgstr[1] "" +"Voulez-vous vraiment supprimer définitivement les %d éléments sélectionnés ?" + +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "Si vous supprimez ces éléments, ils seront définitivement perdus." -#: src/storage-actionbar.vala:197 src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Vider tous les éléments de la corbeille ?" -#: src/storage-actionbar.vala:198 src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Tous les éléments de la corbeille seront définitivement supprimés." -#: src/storage-actionbar.vala:219 src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "Vider tous les éléments de %s ?" -#: src/storage-actionbar.vala:220 src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "Tous les éléments dans %s seront déplacés dans la corbeille." @@ -273,14 +288,10 @@ msgid "Rename" msgstr "Renommer" -#: src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Déplacer dans la corbeille" - #: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" -msgstr "Êtes-vous sûr de vouloir supprimer définitivement %s ?" +msgstr "Voulez-vous vraiment supprimer définitivement %s ?" #: src/storage-row.vala:440 msgid "If you delete an item, it will be permanently lost." @@ -289,3 +300,6 @@ #: src/storage-view.vala:45 msgid "Storage" msgstr "Stockage" + +#~ msgid "Move to trash" +#~ msgstr "Déplacer dans la corbeille" diff -Nru gnome-usage-3.30.0/po/fur.po gnome-usage-3.32.0/po/fur.po --- gnome-usage-3.30.0/po/fur.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/fur.po 2019-03-22 14:43:03.000000000 +0000 @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-02-12 10:43+0000\n" -"PO-Revision-Date: 2018-03-08 16:14+0100\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-03-11 15:41+0100\n" "Last-Translator: Fabio Tomat \n" "Language-Team: Friulian \n" "Language: fur\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.3\n" +"X-Generator: Poedit 2.2.1\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: data/org.gnome.Usage.appdata.xml.in:5 @@ -34,7 +34,7 @@ "Une semplice aplicazion di GNOME 3 par monitorâ e analizâ lis risorsis di " "sisteme come par esempli elaborazion, memorie e archiviazion." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Ûs" @@ -69,7 +69,7 @@ msgstr "" "Cheste liste e je doprade par filtrâ cuâl procès l'utent nol pues fermâ." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Anule" @@ -83,7 +83,7 @@ msgstr "Doprât" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Disponibil" @@ -95,6 +95,18 @@ msgid "Try a different search" msgstr "Prove une ricercje diferente" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Informazions su Utilizazion" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Procès di sisteme dal grup" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Mostre ducj i procès" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -116,7 +128,7 @@ msgid "Delete" msgstr "Elimine" -#: data/ui/storage-actionbar.ui:33 +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 msgid "Move to Trash" msgstr "Sposte te scovacere" @@ -140,15 +152,11 @@ msgid "Swap" msgstr "Swap" -#: src/application.vala:56 -msgid "About" -msgstr "Informazions" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Jes" +#: src/app-item.vala:43 +msgid "System" +msgstr "Sisteme" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -156,46 +164,42 @@ "Un biel mût par viodi lis informazions sul ûs des risorsis di sisteme, come " "Memorie e spazi dal disc." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Fabio Tomat , 2018" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Sîts Web" -#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Procesôr" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Altris" - -#: src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Memorie" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u selezionât" msgstr[1] "%u selezionâts" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Fâs clic sui elements par selezionâju" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Selezione dut" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Nissune selezion" -#: src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Prestazions" @@ -207,29 +211,39 @@ msgid "Select" msgstr "Selezione" -#: src/storage-actionbar.vala:143 +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 +#, c-format +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Sigûrs di eliminâ par simpri “%s”?" + +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "Sigûrs di eliminâ par simpri chescj elements %s?" +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "Sigûrs di eliminâ par simpri %d element selezionât?" +msgstr[1] "Sigûrs di eliminâ par simpri %d elements selezionâts?" -#: src/storage-actionbar.vala:144 +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "Se si elimine chescj elements, a vignaran pierdûts par simpri." -#: src/storage-actionbar.vala:197 src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Disvuedâ ducj i elements de scovacere?" -#: src/storage-actionbar.vala:198 src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Ducj i elements inte scovacere a vignaran eliminâts par simpri." -#: src/storage-actionbar.vala:219 src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "Disvuedâ ducj i elements di %s?" -#: src/storage-actionbar.vala:220 src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "Ducj i elements in %s a vignaran spostâts te scovacere." @@ -270,10 +284,6 @@ msgid "Rename" msgstr "Cambie non" -#: src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Sposte te scovacere" - #: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" @@ -287,6 +297,18 @@ msgid "Storage" msgstr "Archivi" +#~ msgid "About" +#~ msgstr "Informazions" + +#~ msgid "Quit" +#~ msgstr "Jes" + +#~ msgid "Others" +#~ msgstr "Altris" + +#~ msgid "Move to trash" +#~ msgstr "Sposte te scovacere" + #~ msgid "View current application and monitor system state" #~ msgstr "Viôt la aplicazion atuâl e monitore il stât dal sisteme" diff -Nru gnome-usage-3.30.0/po/gl.po gnome-usage-3.32.0/po/gl.po --- gnome-usage-3.30.0/po/gl.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/gl.po 2019-03-22 14:43:03.000000000 +0000 @@ -1,45 +1,164 @@ # Galician translation for gnome-usage. # Copyright (C) 2018 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. -# Fran Dieguez , 2018. +# Fran Dieguez , 2018-2019. +# msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-17 01:50+0100\n" -"PO-Revision-Date: 2018-02-17 01:45+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-01-29 01:09+0100\n" "Last-Translator: Fran Dieguez \n" -"Language-Team: Galician\n" +"Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Virtaal 0.7.1\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"X-Generator: Gtranslator 3.30.0\n" "X-Project-Style: gnome\n" -#: ../data/org.gnome.Usage.gschema.xml.h:1 +#: data/org.gnome.Usage.appdata.xml.in:5 +msgid "GNOME Usage" +msgstr "Uso de GNOME" + +#: data/org.gnome.Usage.appdata.xml.in:6 +msgid "A nice way to view information about use of system resources" +msgstr "" +"Unha forma sinxela de ver información sobre o uso dos recursos do sistema" + +#: data/org.gnome.Usage.appdata.xml.in:8 +msgid "" +"A simple GNOME 3 application to monitor and analyze system resources such as " +"processing, memory, and storage." +msgstr "" +"Un aplicativo de GNOME 3 sinxelo para monitorizar e analizar os recursos do " +"sistema como o procesamento, memoria e almacenamento." + +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 +msgid "Usage" +msgstr "Uso" + +#: data/org.gnome.Usage.desktop.in:4 +msgid "" +"A nice way to view information about use of system resources, like memory " +"and disk space" +msgstr "" +"Unha forma sinxela de ver información sobre o uso dos recursos do sistema, " +"como a memoria e o espazo en disco" + +#. Translators: Do NOT translate or transliterate this text (this is an icon file name)! +#: data/org.gnome.Usage.desktop.in:8 +msgid "org.gnome.Usage" +msgstr "org.gnome.Usage" + +#. Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! +#: data/org.gnome.Usage.desktop.in:13 +msgid "" +"Monitor;System;Process;CPU;Memory;Network;History;Usage;Performance;Task;" +"Manager;" +msgstr "" +"Monitor;Sistema;Procesos;CPU;Memoria;Rede;Historial;Uso;Rendemento;Tarefas;" +"Xestor;" + +#: data/org.gnome.Usage.gschema.xml:5 msgid "A list of processes which we don’t want killed" msgstr "Unha lista de procesos que non queremos matar" -#: ../data/org.gnome.Usage.gschema.xml.h:2 +#: data/org.gnome.Usage.gschema.xml:6 msgid "This list is used for filtering which processes the user can’t stop." msgstr "" "Esta lista úsase para filtrar os procesos que o usuario non pode deter." -#: ../src/application.vala:56 -msgid "About" -msgstr "Sobre" - -#: ../src/application.vala:59 -msgid "Quit" -msgstr "Saír" +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 +#: src/storage-actionbar.vala:90 src/storage-row.vala:393 +msgid "Cancel" +msgstr "Cancelar" -#: ../src/application.vala:91 ../src/window.vala:41 -msgid "Usage" -msgstr "Uso" +#: data/ui/memory-speedometer.ui:38 +msgid "RAM" +msgstr "RAM" + +#: data/ui/memory-speedometer.ui:53 data/ui/swap-speedometer.ui:51 +msgid "Used" +msgstr "Usado" + +#: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 +#: src/storage-item.vala:140 +msgid "Available" +msgstr "Dispoñíbel" + +#: data/ui/no-results-found-view.ui:23 +msgid "No results found" +msgstr "Non se atoparon resultados" + +#: data/ui/no-results-found-view.ui:32 +msgid "Try a different search" +msgstr "Probe unha busca diferente" + +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Sobre Uso" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Grupo dos procesos do sistema" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Mostrar todos os procesos" + +#. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” +#: data/ui/quit-process-dialog.ui:9 +msgid "Force Quit %s?" +msgstr "Forzar a saída de %s?" + +#: data/ui/quit-process-dialog.ui:10 +msgid "Unsaved work might be lost." +msgstr "O traballo sen gardar perderase." + +#: data/ui/quit-process-dialog.ui:24 +msgid "Force Quit" +msgstr "Forzar a saída" + +#: data/ui/storage-actionbar.ui:9 src/storage-row.vala:274 +msgid "Move to" +msgstr "Mover a" + +#: data/ui/storage-actionbar.ui:18 src/storage-row.vala:278 +msgid "Delete" +msgstr "Eliminar" + +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 +msgid "Move to Trash" +msgstr "Mover ao lixo" + +#: data/ui/storage-actionbar.ui:45 +msgid "Empty folder" +msgstr "Cartafol baleiro" -#: ../src/application.vala:92 +#: data/ui/storage-actionbar.ui:57 src/storage-row.vala:263 +msgid "Restore" +msgstr "Restaurar" + +#: data/ui/storage-actionbar.ui:66 src/storage-row.vala:266 +msgid "Delete from Trash" +msgstr "Eliminar do lixo" + +#: data/ui/storage-view.ui:63 +msgid "No content here" +msgstr "Non hai contidos aquí" + +#: data/ui/swap-speedometer.ui:36 +msgid "Swap" +msgstr "Intercambio" + +#: src/app-item.vala:43 +msgid "System" +msgstr "Sistema" + +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -47,222 +166,152 @@ "Unha forma sinxela de ver información sobre o uso dos recursos do sistema, " "como a memoria e o espazo en disco." -#: ../src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Fran Dieguez , 2018." -#: ../src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Sitios web" -#: ../src/cpu-sub-view.vala:32 ../src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Procesador" -#: ../src/graph-block.vala:65 -msgid "Others" -msgstr "Outros" - -#: ../src/graph-block.vala:67 ../src/storage-item.vala:140 -msgid "Available" -msgstr "Dispoñíbel" - -#: ../src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Memoria" -#: ../src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u seleccionado" msgstr[1] "%u seleccionados" -#: ../src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Prema nos elementos para seleccionalos" -#: ../src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Seleccionar todos" -#: ../src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Deseleccionar todos" -#: ../src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Rendemento" -#: ../src/storage-actionbar.vala:89 ../src/storage-row.vala:392 +#: src/storage-actionbar.vala:89 src/storage-row.vala:392 msgid "Select destination folder" msgstr "Seleccionar o cartafol de destino" -#: ../src/storage-actionbar.vala:90 ../src/storage-row.vala:393 -msgid "Cancel" -msgstr "Cancelar" - -#: ../src/storage-actionbar.vala:92 ../src/storage-row.vala:395 +#: src/storage-actionbar.vala:92 src/storage-row.vala:395 msgid "Select" msgstr "Seleccionar" -#: ../src/storage-actionbar.vala:143 +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "" -"Ten certeza que quere eliminar de forma permanente estos elementos «%s»?" +#| msgid "Are you sure you want to permanently delete %s?" +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Está seguro que quere eliminar de forma permanente «%s»?" + +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, c-format +#| msgid "Are you sure you want to permanently delete this items %s?" +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "" +"Ten certeza que quere eliminar de forma permanente %d elemento seleccionado?" +msgstr[1] "" +"Ten certeza que quere eliminar de forma permanente %d elementos " +"seleccionados?" -#: ../src/storage-actionbar.vala:144 +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "Se elimina estos elementos, perderánse de forma permanente." -#: ../src/storage-actionbar.vala:197 ../src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Desea baleirar todos os elementos do Lixo?" -#: ../src/storage-actionbar.vala:198 ../src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Eliminaranse todos os elementos do Lixo de forma permanente." -#: ../src/storage-actionbar.vala:219 ../src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "Baleirar todos os elementos de %s?" -#: ../src/storage-actionbar.vala:220 ../src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "Moveranse ao lixo todos os elementos de %s." -#: ../src/storage-analyzer.vala:94 +#: src/storage-analyzer.vala:94 msgid "Storage 1" msgstr "Almacenamento 1" -#: ../src/storage-analyzer.vala:98 +#: src/storage-analyzer.vala:98 msgid "Storage 2" msgstr "Almacenamento 2" -#: ../src/storage-analyzer.vala:105 +#: src/storage-analyzer.vala:105 msgid "Capacity" msgstr "Capacidade" -#: ../src/storage-analyzer.vala:647 +#: src/storage-analyzer.vala:647 msgid "Home" msgstr "Cartafol persoal" -#: ../src/storage-item.vala:104 +#: src/storage-item.vala:104 msgid "Trash" msgstr "Lixo" -#: ../src/storage-item.vala:128 +#: src/storage-item.vala:128 msgid "Operating System" msgstr "Sistema operativo" -#: ../src/storage-row.vala:248 +#: src/storage-row.vala:248 msgid "Empty" msgstr "Baleirar" -#: ../src/storage-row.vala:253 +#: src/storage-row.vala:253 msgid "Empty Trash" msgstr "Baleirar lixo" -#: ../src/storage-row.vala:263 -msgid "Restore" -msgstr "Restaurar" - -#: ../src/storage-row.vala:266 -msgid "Delete from Trash" -msgstr "Eliminar do lixo" - -#: ../src/storage-row.vala:273 ../src/storage-row.vala:367 +#: src/storage-row.vala:273 src/storage-row.vala:367 msgid "Rename" msgstr "Renomear" -#: ../src/storage-row.vala:274 -msgid "Move to" -msgstr "Mover a" - -#: ../src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Mover ao lixo" - -#: ../src/storage-row.vala:278 -msgid "Delete" -msgstr "Eliminar" - -#: ../src/storage-row.vala:439 +#: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" msgstr "Está seguro que quere eliminar de forma permanente %s?" -#: ../src/storage-row.vala:440 +#: src/storage-row.vala:440 msgid "If you delete an item, it will be permanently lost." msgstr "Se elimina un elemento, perderáse de forma permanente." -#: ../src/storage-view.vala:45 +#: src/storage-view.vala:45 msgid "Storage" msgstr "Almacenamento" -#~ msgid "GNOME Usage" -#~ msgstr "Uso de GNOME" +#~ msgid "About" +#~ msgstr "Sobre" -#~ msgid "A nice way to view information about use of system resources" -#~ msgstr "" -#~ "Unha forma sinxela de ver información sobre o uso dos recursos do sistema" - -#~ msgid "" -#~ "A simple GNOME 3 application to monitor and analyze system resources such " -#~ "as processing, memory, and storage." -#~ msgstr "" -#~ "Un aplicativo de GNOME 3 sinxelo para monitorizar e analizar os recursos " -#~ "do sistema como o procesamento, memoria e almacenamento." - -#~ msgid "" -#~ "A nice way to view information about use of system resources, like memory " -#~ "and disk space" -#~ msgstr "" -#~ "Unha forma sinxela de ver información sobre o uso dos recursos do " -#~ "sistema, como a memoria e o espazo en disco" - -#~ msgid "org.gnome.Usage" -#~ msgstr "org.gnome.Usage" - -#~ msgid "" -#~ "Monitor;System;Process;CPU;Memory;Network;History;Usage;Performance;Task;" -#~ "Manager;" -#~ msgstr "" -#~ "Monitor;Sistema;Procesos;CPU;Memoria;Rede;Historial;Uso;Rendemento;" -#~ "Tarefas;Xestor;" - -#~ msgid "RAM" -#~ msgstr "RAM" - -#~ msgid "Used" -#~ msgstr "Usado" - -#~ msgid "No results found" -#~ msgstr "Non se atoparon resultados" - -#~ msgid "Try a different search" -#~ msgstr "Probe unha busca diferente" - -#~ msgid "Force Quit %s?" -#~ msgstr "Forzar a saída de %s?" +#~ msgid "Quit" +#~ msgstr "Saír" -#~ msgid "Unsaved work might be lost." -#~ msgstr "O traballo sen gardar perderase." +#~ msgid "Others" +#~ msgstr "Outros" -#~ msgid "Force Quit" -#~ msgstr "Forzar a saída" - -#~ msgid "Move to Trash" +#~ msgid "Move to trash" #~ msgstr "Mover ao lixo" - -#~ msgid "Empty folder" -#~ msgstr "Cartafol baleiro" - -#~ msgid "No content here" -#~ msgstr "Non hai contidos aquí" - -#~ msgid "Swap" -#~ msgstr "Intercambio" diff -Nru gnome-usage-3.30.0/po/hu.po gnome-usage-3.32.0/po/hu.po --- gnome-usage-3.30.0/po/hu.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/hu.po 2019-03-22 14:43:03.000000000 +0000 @@ -1,17 +1,17 @@ # Hungarian translation for gnome-usage. -# Copyright (C) 2017, 2018 Free Software Foundation, Inc. +# Copyright (C) 2017, 2018, 2019 Free Software Foundation, Inc. # This file is distributed under the same license as the gnome-usage package. # -# Balázs Úr , 2017, 2018. +# Balázs Úr , 2017, 2018, 2019. # Gabor Kelemen , 2017, 2018. msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-03 14:27+0000\n" -"PO-Revision-Date: 2018-09-14 00:11+0200\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-01-27 01:06+0100\n" "Last-Translator: Balázs Úr \n" -"Language-Team: Hungarian \n" +"Language-Team: Hungarian \n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -36,7 +36,7 @@ "Egyszerű GNOME 3 alkalmazás a rendszererőforrások figyelésére és elemzésére: " "processzor, memória és tárolás." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Használat" @@ -72,7 +72,7 @@ "Ez a lista használható annak szűréséhez, hogy mely folyamatokat nem tud a " "felhasználó leállítani." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Mégse" @@ -86,7 +86,7 @@ msgstr "Használt" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Elérhető" @@ -98,6 +98,18 @@ msgid "Try a different search" msgstr "Próbáljon másfajta keresést" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "A Használat _névjegye" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Rendszerfolyamatok csoportosítása" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Összes folyamat megjelenítése" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -143,15 +155,11 @@ msgid "Swap" msgstr "Cserehely" -#: src/application.vala:56 -msgid "About" -msgstr "Névjegy" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Kilépés" +#: src/app-item.vala:43 +msgid "System" +msgstr "Rendszer" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -159,11 +167,11 @@ "Jó módja rendszererőforrások használatáról szóló információk " "megjelenítésének, mint például a memória és a lemezterület." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Meskó Balázs " -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Weboldalak" @@ -171,30 +179,26 @@ msgid "Processor" msgstr "Processzor" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Egyebek" - #: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Memória" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u kiválasztva" msgstr[1] "%u kiválasztva" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Kattintson az elemekre a kijelölésükhöz" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Összes kijelölése" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Kijelölés megszüntetése" diff -Nru gnome-usage-3.30.0/po/id.po gnome-usage-3.32.0/po/id.po --- gnome-usage-3.30.0/po/id.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/id.po 2019-03-22 14:43:03.000000000 +0000 @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-03 14:27+0000\n" -"PO-Revision-Date: 2018-07-06 14:17+0700\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-02-28 14:09+0700\n" "Last-Translator: Kukuh Syafaat \n" "Language-Team: Indonesian \n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.6\n" +"X-Generator: Poedit 2.2.1\n" "Plural-Forms: nplurals=1; plural=0;\n" #: data/org.gnome.Usage.appdata.xml.in:5 @@ -35,7 +35,7 @@ "Aplikasi GNOME 3 sederhana untuk memantau dan menganalisis sumber daya " "sistem seperti pemrosesan, memori, dan penyimpanan." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Pemakaian" @@ -71,7 +71,7 @@ "Daftar ini digunakan untuk menyaring proses yang pengguna tidak bisa " "hentikan." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Batal" @@ -85,7 +85,7 @@ msgstr "Terpakai" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Tersedia" @@ -97,6 +97,18 @@ msgid "Try a different search" msgstr "Coba pencarian berbeda" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "Tent_ang Pemakaian" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Proses sistem grup" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Tampilkan semua proses" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -142,15 +154,11 @@ msgid "Swap" msgstr "Swap" -#: src/application.vala:56 -msgid "About" -msgstr "Tentang" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Keluar" +#: src/app-item.vala:43 +msgid "System" +msgstr "Sistem" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -158,11 +166,11 @@ "Cara yang baik untuk melihat informasi tentang penggunaan sumber daya " "sistem, seperti memori dan ruang diska." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" -msgstr "Kukuh Syafaat , 2017, 2018." +msgstr "Kukuh Syafaat , 2017, 2018, 2019." -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Situs Web" @@ -170,29 +178,25 @@ msgid "Processor" msgstr "Prosesor" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Lainnya" - #: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Memori" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u dipilih" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Klik pada butir untuk memilihnya" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Pilih semua" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Pilih Tak Satupun" @@ -293,6 +297,15 @@ msgid "Storage" msgstr "Penyimpanan" +#~ msgid "Others" +#~ msgstr "Lainnya" + +#~ msgid "About" +#~ msgstr "Tentang" + +#~ msgid "Quit" +#~ msgstr "Keluar" + #~ msgid "Are you sure you want to permanently delete \"%s\" ?" #~ msgstr "Anda yakin akan menghapus permanen \"%s\"?" diff -Nru gnome-usage-3.30.0/po/it.po gnome-usage-3.32.0/po/it.po --- gnome-usage-3.30.0/po/it.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/it.po 2019-03-22 14:43:03.000000000 +0000 @@ -1,14 +1,14 @@ # Italian translation for gnome-usage. -# Copyright (C) 2018 gnome-usage's COPYRIGHT HOLDER +# Copyright (C) 2018-2019 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. -# Gianvito Cavasoli , 2018. +# Gianvito Cavasoli , 2018-2019. # msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-02-20 10:31+0000\n" -"PO-Revision-Date: 2018-03-10 14:46+0100\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-02-27 14:33+0100\n" "Last-Translator: Gianvito Cavasoli \n" "Language-Team: Italiano \n" "Language: it\n" @@ -16,7 +16,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Gtranslator 2.91.7\n" +"X-Generator: Gtranslator 3.30.1\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -35,7 +35,7 @@ "Una semplice applicazione di GNOME 3 per monitorare e analizzare le risorse " "di sistema come l'elaborazione, la memoria e l'archiviazione." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Utilizzo" @@ -70,7 +70,7 @@ msgstr "" "Questo elenco è usato per filtrare quali processi l'utente non può terminare." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Annulla" @@ -84,7 +84,7 @@ msgstr "Usata" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Disponibile" @@ -96,6 +96,18 @@ msgid "Try a different search" msgstr "Provare una differente ricerca" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "I_nformazioni su Utilizzo" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Processi di sistema di gruppo" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Mostra tutti i processi" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -117,7 +129,7 @@ msgid "Delete" msgstr "Elimina" -#: data/ui/storage-actionbar.ui:33 +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 msgid "Move to Trash" msgstr "Sposta nel cestino" @@ -141,15 +153,11 @@ msgid "Swap" msgstr "Swap" -#: src/application.vala:56 -msgid "About" -msgstr "Informazioni" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Esci" +#: src/app-item.vala:43 +msgid "System" +msgstr "Sistema" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -157,46 +165,42 @@ "Un buon modo per visualizzare informazioni sull'uso delle risorse di " "sistema, come la memoria e lo spazio su disco." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Gianvito Cavasoli " -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Siti web" -#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Processore" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Altri" - -#: src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Memoria" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u selezionato" msgstr[1] "%u selezionati" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Fare clic sugli elementi per selezionarli" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Seleziona tutti" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Nessuna selezione" -#: src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Prestazione" @@ -208,29 +212,41 @@ msgid "Select" msgstr "Seleziona" -#: src/storage-actionbar.vala:143 +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "Eliminare definitivamente questi oggetti %s?" +#| msgid "Are you sure you want to permanently delete %s?" +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Eliminare definitivamente «%s»?" -#: src/storage-actionbar.vala:144 +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, c-format +#| msgid "Are you sure you want to permanently delete this items %s?" +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "Eliminare definitivamente %d oggetto selezionato?" +msgstr[1] "Eliminare definitivamente %d oggetti selezionati?" + +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "Se si eliminano questi oggetti, saranno persi definitivamente?" -#: src/storage-actionbar.vala:197 src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Svuotare il cestino da tutti gli oggetti?" -#: src/storage-actionbar.vala:198 src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Tutti gli oggetti nel cestino saranno eliminati definitivamente." -#: src/storage-actionbar.vala:219 src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "Svuotare %s da tutti gli oggetti?" -#: src/storage-actionbar.vala:220 src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "Tutti gli oggetti in %s saranno spostati nel cestino." @@ -271,10 +287,6 @@ msgid "Rename" msgstr "Rinomina" -#: src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Sposta nel cestino" - #: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" diff -Nru gnome-usage-3.30.0/po/LINGUAS gnome-usage-3.32.0/po/LINGUAS --- gnome-usage-3.30.0/po/LINGUAS 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/LINGUAS 2019-03-22 14:43:03.000000000 +0000 @@ -1,9 +1,11 @@ # Please keep this list sorted alphabetically ca cs +da de en_GB es +eu fi fr fur diff -Nru gnome-usage-3.30.0/po/nl.po gnome-usage-3.32.0/po/nl.po --- gnome-usage-3.30.0/po/nl.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/nl.po 2019-03-22 14:43:03.000000000 +0000 @@ -2,15 +2,15 @@ # Copyright (C) 2017 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. # -# Nathan Follens , 2017-2018. +# Nathan Follens , 2017-2019. # Hannie Dumoleyn , 2017. # Justin van Steijn , 2017. msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-02-12 10:43+0000\n" -"PO-Revision-Date: 2018-02-26 15:08+0100\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-02-26 13:36+0100\n" "Last-Translator: Nathan Follens \n" "Language-Team: Dutch \n" "Language: nl\n" @@ -18,7 +18,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.6\n" +"X-Generator: Poedit 2.2.1\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -38,7 +38,7 @@ "Een eenvoudige Gnome 3-toepassing om systeembronnen zoals processor, " "geheugen en opslag te monitoren en analyseren." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Gebruik" @@ -75,7 +75,7 @@ "Deze lijst wordt gebruikt voor het filteren van processen die de gebruiker " "niet kan stoppen." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Annuleren" @@ -89,7 +89,7 @@ msgstr "Gebruikt" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Beschikbaar" @@ -101,6 +101,18 @@ msgid "Try a different search" msgstr "Probeer een andere zoekopdracht" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Over Gebruik" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Systeemprocessen groeperen" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Alle processen tonen" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -122,7 +134,7 @@ msgid "Delete" msgstr "Verwijderen" -#: data/ui/storage-actionbar.ui:33 +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 msgid "Move to Trash" msgstr "Verplaatsen naar prullenbak" @@ -146,15 +158,11 @@ msgid "Swap" msgstr "Wisselgeheugen" -#: src/application.vala:56 -msgid "About" -msgstr "Over" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Afsluiten" +#: src/app-item.vala:43 +msgid "System" +msgstr "Systeem" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -162,7 +170,7 @@ "Een leuke manier om informatie te bekijken over het gebruik van " "systeembronnen, zoals geheugen en schijfruimte." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "" "Nathan Follens \n" @@ -171,42 +179,38 @@ "\n" "Meer info over Gnome-NL http://nl.gnome.org" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Websites" -#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Processor" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Andere" - -#: src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Geheugen" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u geselecteerd" msgstr[1] "%u geselecteerd" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Klik op items om ze te selecteren" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Alles selecteren" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Niets selecteren" -#: src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Prestaties" @@ -218,30 +222,42 @@ msgid "Select" msgstr "Selecteren" +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 +#, c-format +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Weet u zeker dat u ‘%s’ voorgoed wilt verwijderen?" + # This item? Taalfoutje. Gaat het hier om bestanden? - Hannie -#: src/storage-actionbar.vala:143 +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "Weet u zeker dat u de bestanden ‘%s’ voorgoed wilt verwijderen?" +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "" +"Weet u zeker dat u het geselecteerde item voorgoed wilt verwijderen?" +msgstr[1] "" +"Weet u zeker dat u de %d geselecteerde items voorgoed wilt verwijderen?" -#: src/storage-actionbar.vala:144 +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "Als u deze items verwijdert, gaan ze voorgoed verloren." -#: src/storage-actionbar.vala:197 src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Alle items uit prullenbak verwijderen?" -#: src/storage-actionbar.vala:198 src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Alle items in de prullenbak zullen voorgoed worden verwijderd." -#: src/storage-actionbar.vala:219 src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "Alle items uit %s verwijderen?" -#: src/storage-actionbar.vala:220 src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "Alle items in de map %s zullen naar de prullenbak worden verplaatst." @@ -282,10 +298,6 @@ msgid "Rename" msgstr "Hernoemen" -#: src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Verplaatsen naar prullenbak" - #: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" @@ -299,6 +311,18 @@ msgid "Storage" msgstr "Opslag" +#~ msgid "About" +#~ msgstr "Over" + +#~ msgid "Quit" +#~ msgstr "Afsluiten" + +#~ msgid "Others" +#~ msgstr "Andere" + +#~ msgid "Move to trash" +#~ msgstr "Verplaatsen naar prullenbak" + #~ msgid "Stop" #~ msgstr "Stoppen" diff -Nru gnome-usage-3.30.0/po/pl.po gnome-usage-3.32.0/po/pl.po --- gnome-usage-3.30.0/po/pl.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/pl.po 2019-03-22 14:43:03.000000000 +0000 @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: gnome-usage\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-03 14:27+0000\n" -"PO-Revision-Date: 2018-05-06 19:01+0200\n" +"POT-Creation-Date: 2018-12-20 19:35+0000\n" +"PO-Revision-Date: 2018-12-22 12:53+0100\n" "Last-Translator: Piotr Drąg \n" "Language-Team: Polish \n" "Language: pl\n" @@ -35,7 +35,7 @@ "Prosty program dla środowiska GNOME 3 do monitorowania i analizowania " "zasobów komputera, takich jak procesor, pamięć i miejsce na dysku." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Monitor" @@ -72,7 +72,7 @@ "Ta lista jest używana do filtrowania, których procesów użytkownik nie może " "zatrzymywać." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Anuluj" @@ -98,6 +98,18 @@ msgid "Try a different search" msgstr "Proszę spróbować innych słów" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_O programie" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Grupowanie procesów systemowych" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Wszystkie procesy" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -143,15 +155,11 @@ msgid "Swap" msgstr "Pamięć wymiany" -#: src/application.vala:56 -msgid "About" -msgstr "O programie" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Zakończ" +#: src/app-item.vala:43 +msgid "System" +msgstr "System" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -159,13 +167,13 @@ "Wygodny sposób na wyświetlanie informacji o użyciu zasobów komputera, takich " "jak pamięć i miejsce na dysku." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "" "Piotr Drąg , 2017-2018\n" "Aviary.pl , 2017-2018" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Strona WWW" @@ -181,7 +189,7 @@ msgid "Memory" msgstr "Pamięć" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" @@ -189,15 +197,15 @@ msgstr[1] "Zaznaczono: %u" msgstr[2] "Zaznaczono: %u" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Kliknięcie elementów zaznacza je" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Zaznacz wszystko" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Odznacz wszystko" diff -Nru gnome-usage-3.30.0/po/POTFILES.in gnome-usage-3.32.0/po/POTFILES.in --- gnome-usage-3.30.0/po/POTFILES.in 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/POTFILES.in 2019-03-22 14:43:03.000000000 +0000 @@ -7,13 +7,14 @@ data/ui/memory-speedometer.ui data/ui/no-results-found-view.ui data/ui/performance-view.ui +data/ui/primary-menu.ui data/ui/quit-process-dialog.ui data/ui/storage-actionbar.ui data/ui/storage-view.ui data/ui/swap-speedometer.ui +src/app-item.vala src/application.vala src/cpu-sub-view.vala -src/graph-block.vala src/graph-stack-switcher.vala src/header-bar.vala src/memory-sub-view.vala diff -Nru gnome-usage-3.30.0/po/POTFILES.skip gnome-usage-3.32.0/po/POTFILES.skip --- gnome-usage-3.30.0/po/POTFILES.skip 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/POTFILES.skip 2019-03-22 14:43:03.000000000 +0000 @@ -1,12 +1,8 @@ # List of source files that should *not* be translated. # Please keep this file sorted alphabetically. -external/egg/egg-animation.c -external/egg/egg-date-time.c -external/egg/egg-file-chooser-entry.c -external/egg/egg-search-bar.c +src/app-item.c src/application.c src/cpu-sub-view.c -src/graph-block.c src/graph-stack-switcher.c src/header-bar.c src/memory-sub-view.c diff -Nru gnome-usage-3.30.0/po/pt_BR.po gnome-usage-3.32.0/po/pt_BR.po --- gnome-usage-3.30.0/po/pt_BR.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/pt_BR.po 2019-03-22 14:43:03.000000000 +0000 @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-03 14:27+0000\n" -"PO-Revision-Date: 2018-05-04 10:46-0200\n" +"POT-Creation-Date: 2018-12-20 19:35+0000\n" +"PO-Revision-Date: 2018-12-25 14:47-0200\n" "Last-Translator: Rafael Fontenelle \n" "Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" @@ -35,7 +35,7 @@ "Um aplicativo simples do GNOME 3 para monitorar e analisar recursos do " "sistema, como processamento, memória e armazenamento." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Uso" @@ -70,7 +70,7 @@ msgstr "" "Essa lista é usada para filtrar quais processos o usuário não pode parar." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Cancelar" @@ -96,6 +96,18 @@ msgid "Try a different search" msgstr "Tente uma pesquisa diferente" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Sobre Uso" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Agrupar processos de sistema" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Mostrar todos os processos" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -141,15 +153,11 @@ msgid "Swap" msgstr "Swap" -#: src/application.vala:56 -msgid "About" -msgstr "Sobre" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Sair" +#: src/app-item.vala:43 +msgid "System" +msgstr "Sistema" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -157,13 +165,13 @@ "Uma forma legal de ver informações sobre o uso dos recursos do sistema, como " "memória e espaço em disco." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "" "Enrico Nicoletto , 2017, 2018\n" "Rafael Fontenelle , 2017, 2018" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Sites" @@ -179,22 +187,22 @@ msgid "Memory" msgstr "Memória" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u selecionado" msgstr[1] "%u selecionados" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Clique nos itens para selecioná-los" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Selecionar todos" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Desmarcar seleção" @@ -213,16 +221,12 @@ #. Translators: %s is the name of the file to be deleted. #: src/storage-actionbar.vala:144 #, c-format -#| msgid "Are you sure you want to permanently delete %s?" msgid "Are you sure you want to permanently delete “%s”?" msgstr "Você tem certeza de que deseja excluir permanentemente “%s”?" #. Translators: %d is the number of files to be deleted. #: src/storage-actionbar.vala:148 #, c-format -#| msgid "Are you sure you want to permanently delete the %d selected items?" -#| msgid_plural "" -#| "Are you sure you want to permanently delete the %d selected items?" msgid "Are you sure you want to permanently delete the %d selected item?" msgid_plural "" "Are you sure you want to permanently delete the %d selected items?" @@ -303,6 +307,12 @@ msgid "Storage" msgstr "Armazenamento" +#~ msgid "About" +#~ msgstr "Sobre" + +#~ msgid "Quit" +#~ msgstr "Sair" + #~| msgid "Are you sure you want to permanently delete %s?" #~ msgid "Are you sure you want to permanently delete \"%s\" ?" #~ msgstr "Você tem certeza de que deseja excluir permanentemente \"%s\"?" diff -Nru gnome-usage-3.30.0/po/sr.po gnome-usage-3.32.0/po/sr.po --- gnome-usage-3.30.0/po/sr.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/sr.po 2019-03-22 14:43:03.000000000 +0000 @@ -6,8 +6,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-02-12 10:43+0000\n" -"PO-Revision-Date: 2018-02-19 18:16+0100\n" +"POT-Creation-Date: 2018-09-25 15:30+0000\n" +"PO-Revision-Date: 2019-03-11 19:10+0100\n" "Last-Translator: Марко М. Костић \n" "Language-Team: српски \n" "Language: sr\n" @@ -17,7 +17,7 @@ "Plural-Forms: nplurals=4; plural=n==1? 3 : n%10==1 && n%100!=11 ? 0 : n" "%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Project-Style: gnome\n" -"X-Generator: Poedit 2.0.3\n" +"X-Generator: Poedit 2.2.1\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -119,7 +119,7 @@ msgid "Delete" msgstr "Обриши" -#: data/ui/storage-actionbar.ui:33 +#: data/ui/storage-actionbar.ui:33 src/storage-row.vala:277 msgid "Move to Trash" msgstr "Премести у смеће" @@ -171,7 +171,7 @@ msgid "Websites" msgstr "Веб сајтови" -#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:40 +#: src/cpu-sub-view.vala:32 src/graph-stack-switcher.vala:45 msgid "Processor" msgstr "Процесор" @@ -179,7 +179,7 @@ msgid "Others" msgstr "Остало" -#: src/graph-stack-switcher.vala:41 +#: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Меморија" @@ -204,7 +204,7 @@ msgid "Select None" msgstr "Поништи избор" -#: src/performance-view.vala:45 +#: src/performance-view.vala:48 msgid "Performance" msgstr "Учинак" @@ -216,29 +216,41 @@ msgid "Select" msgstr "Изабери" -#: src/storage-actionbar.vala:143 +#. Translators: %s is the name of the file to be deleted. +#: src/storage-actionbar.vala:144 #, c-format -msgid "Are you sure you want to permanently delete this items %s?" -msgstr "Дa ли сигурно желите трајно да обришете ове ставке „%s“?" +msgid "Are you sure you want to permanently delete “%s”?" +msgstr "Да ли сигурно желите трајно да обришете „%s“?" -#: src/storage-actionbar.vala:144 +#. Translators: %d is the number of files to be deleted. +#: src/storage-actionbar.vala:148 +#, c-format +msgid "Are you sure you want to permanently delete the %d selected item?" +msgid_plural "" +"Are you sure you want to permanently delete the %d selected items?" +msgstr[0] "Дa ли сигурно желите трајно обрисати %d изабрану ставку?" +msgstr[1] "Дa ли сигурно желите трајно обрисати %d изабране ставке?" +msgstr[2] "Дa ли сигурно желите трајно обрисати %d изабраних ставки?" +msgstr[3] "Дa ли сигурно желите трајно обрисати једну изабрану ставку?" + +#: src/storage-actionbar.vala:152 msgid "If you delete these items, they will be permanently lost." msgstr "Ако обришете ове ставке, биће трајно изгубљене." -#: src/storage-actionbar.vala:197 src/storage-row.vala:342 +#: src/storage-actionbar.vala:203 src/storage-row.vala:342 msgid "Empty all items from Trash?" msgstr "Да избацим све ставке из смећа?" -#: src/storage-actionbar.vala:198 src/storage-row.vala:343 +#: src/storage-actionbar.vala:204 src/storage-row.vala:343 msgid "All items in the Trash will be permanently deleted." msgstr "Све ставке из смећа биће трајно обрисане." -#: src/storage-actionbar.vala:219 src/storage-row.vala:322 +#: src/storage-actionbar.vala:225 src/storage-row.vala:322 #, c-format msgid "Empty all items from %s?" msgstr "Да избацим све ставке из „%s“?" -#: src/storage-actionbar.vala:220 src/storage-row.vala:323 +#: src/storage-actionbar.vala:226 src/storage-row.vala:323 #, c-format msgid "All items in the %s will be moved to the Trash." msgstr "Све ставке у „%s“ биће премештене у смеће." @@ -279,10 +291,6 @@ msgid "Rename" msgstr "Преименуј" -#: src/storage-row.vala:277 -msgid "Move to trash" -msgstr "Премести у смеће" - #: src/storage-row.vala:439 #, c-format msgid "Are you sure you want to permanently delete %s?" @@ -296,6 +304,9 @@ msgid "Storage" msgstr "Складиште" +#~ msgid "Move to trash" +#~ msgstr "Премести у смеће" + #~ msgid "No applications using processor." #~ msgstr "Ниједан програм не користи процесор." diff -Nru gnome-usage-3.30.0/po/sv.po gnome-usage-3.32.0/po/sv.po --- gnome-usage-3.30.0/po/sv.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/sv.po 2019-03-22 14:43:03.000000000 +0000 @@ -1,15 +1,15 @@ # Swedish translation for gnome-usage. -# Copyright © 2017, 2018 gnome-usage's COPYRIGHT HOLDER +# Copyright © 2017, 2018, 2019 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. # Josef Andersson , 2017. -# Anders Jonsson , 2018. +# Anders Jonsson , 2018, 2019. # msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-03 14:27+0000\n" -"PO-Revision-Date: 2018-07-18 13:48+0200\n" +"POT-Creation-Date: 2019-01-03 18:03+0000\n" +"PO-Revision-Date: 2019-01-07 22:43+0100\n" "Last-Translator: Anders Jonsson \n" "Language-Team: Swedish \n" "Language: sv\n" @@ -17,7 +17,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.8\n" +"X-Generator: Poedit 2.2\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -35,7 +35,7 @@ "Ett enkelt GNOME 3-program för att övervaka och analysera systemresurser så " "som processorkraft, minne och lagring." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Användning" @@ -70,7 +70,7 @@ msgstr "" "Listan används för att filtrera vilka processer användaren inte kan stoppa." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "Avbryt" @@ -84,7 +84,7 @@ msgstr "Använt" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Tillgängligt" @@ -96,6 +96,18 @@ msgid "Try a different search" msgstr "Försök med en annan sökning" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "_Om Användning" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Gruppera systemprocesser" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Visa alla processer" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -141,15 +153,11 @@ msgid "Swap" msgstr "Växlingsutrymme" -#: src/application.vala:56 -msgid "About" -msgstr "Om" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Avsluta" +#: src/app-item.vala:43 +msgid "System" +msgstr "System" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -157,11 +165,11 @@ "Ett trevligt sätt att se information om användning av systemresurser så som " "minne och diskutrymme." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Josef Andersson , 2016, 2017" -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Webbplatser" @@ -169,30 +177,26 @@ msgid "Processor" msgstr "Processor" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Andra" - #: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Minne" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u markerat" msgstr[1] "%u markerade" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Klicka på objekt för att markera dem" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Välj alla" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Välj inget" @@ -296,6 +300,15 @@ msgid "Storage" msgstr "Lagring" +#~ msgid "About" +#~ msgstr "Om" + +#~ msgid "Quit" +#~ msgstr "Avsluta" + +#~ msgid "Others" +#~ msgstr "Andra" + #~ msgid "Move to trash" #~ msgstr "Flytta till papperskorgen" diff -Nru gnome-usage-3.30.0/po/tr.po gnome-usage-3.32.0/po/tr.po --- gnome-usage-3.30.0/po/tr.po 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/po/tr.po 2019-03-22 14:43:03.000000000 +0000 @@ -1,14 +1,14 @@ # Turkish translation for gnome-usage. # Copyright (C) 2017 gnome-usage's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-usage package. -# Emin Tufan Çetin , 2017, 2018. +# Emin Tufan Çetin , 2017-2019. # msgid "" msgstr "" "Project-Id-Version: gnome-usage master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-usage/issues\n" -"POT-Creation-Date: 2018-05-15 09:26+0000\n" -"PO-Revision-Date: 2018-08-11 11:02+0300\n" +"POT-Creation-Date: 2019-01-07 21:45+0000\n" +"PO-Revision-Date: 2019-02-20 00:27+0300\n" "Last-Translator: Emin Tufan Çetin \n" "Language-Team: Türkçe \n" "Language: tr\n" @@ -16,7 +16,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Gtranslator 2.91.7\n" +"X-Generator: Gtranslator 3.30.1\n" #: data/org.gnome.Usage.appdata.xml.in:5 msgid "GNOME Usage" @@ -35,7 +35,7 @@ "İşleme, bellek ve depolama gibi sistem kaynaklarını çözümlemek ve " "gözlemlemek için basit bir GNOME 3 uygulaması." -#: data/org.gnome.Usage.desktop.in:3 src/application.vala:91 src/window.vala:41 +#: data/org.gnome.Usage.desktop.in:3 src/application.vala:79 src/window.vala:41 msgid "Usage" msgstr "Kullanım" @@ -70,7 +70,7 @@ msgstr "" "Bu liste kullanıcının durdurmaması gereken süreçleri süzmek için kullanılır." -#: data/ui/header-bar.ui:72 data/ui/quit-process-dialog.ui:16 +#: data/ui/header-bar.ui:87 data/ui/quit-process-dialog.ui:16 #: src/storage-actionbar.vala:90 src/storage-row.vala:393 msgid "Cancel" msgstr "İptal" @@ -84,7 +84,7 @@ msgstr "Kullanılan" #: data/ui/memory-speedometer.ui:77 data/ui/swap-speedometer.ui:75 -#: src/graph-block.vala:67 src/storage-item.vala:140 +#: src/storage-item.vala:140 msgid "Available" msgstr "Uygun" @@ -96,6 +96,18 @@ msgid "Try a different search" msgstr "Başka bir arama deneyin" +#: data/ui/primary-menu.ui:14 +msgid "_About Usage" +msgstr "Kullanım _Hakkında" + +#: data/ui/primary-menu.ui:29 +msgid "Group system processes" +msgstr "Sistem süreçlerini kümele" + +#: data/ui/primary-menu.ui:37 +msgid "Show all processes" +msgstr "Tüm süreçleri göster" + #. Translators: This sentence is later suffixed with an application name. Example: “Force Quit Videos?” #: data/ui/quit-process-dialog.ui:9 msgid "Force Quit %s?" @@ -141,15 +153,11 @@ msgid "Swap" msgstr "Takas" -#: src/application.vala:56 -msgid "About" -msgstr "Hakkında" - -#: src/application.vala:59 -msgid "Quit" -msgstr "Çık" +#: src/app-item.vala:43 +msgid "System" +msgstr "Sistem" -#: src/application.vala:92 +#: src/application.vala:80 msgid "" "A nice way to view information about use of system resources, like memory " "and disk space." @@ -157,11 +165,11 @@ "Bellek ve disk alanı gibi sistem kaynaklarının kullanımıyla ilgili bilgiyi " "görmek için güzel bir yol." -#: src/application.vala:95 +#: src/application.vala:83 msgid "translator-credits" msgstr "Emin Tufan Çetin " -#: src/application.vala:97 +#: src/application.vala:85 msgid "Websites" msgstr "Web siteleri" @@ -169,29 +177,25 @@ msgid "Processor" msgstr "İşlemci" -#: src/graph-block.vala:65 -msgid "Others" -msgstr "Diğerleri" - #: src/graph-stack-switcher.vala:46 msgid "Memory" msgstr "Bellek" -#: src/header-bar.vala:143 +#: src/header-bar.vala:149 #, c-format msgid "%u selected" msgid_plural "%u selected" msgstr[0] "%u seçili" -#: src/header-bar.vala:145 +#: src/header-bar.vala:151 msgid "Click on items to select them" msgstr "Ögeleri seçmek için tıklayın" -#: src/header-bar.vala:209 +#: src/header-bar.vala:215 msgid "Select all" msgstr "Tümünü seç" -#: src/header-bar.vala:213 +#: src/header-bar.vala:219 msgid "Select None" msgstr "Hiçbirini seçme" @@ -210,14 +214,12 @@ #. Translators: %s is the name of the file to be deleted. #: src/storage-actionbar.vala:144 #, c-format -#| msgid "Are you sure you want to permanently delete %s?" msgid "Are you sure you want to permanently delete “%s”?" msgstr "“%s” dosyasını kalıcı olarak silmek istediğinizden emin misiniz?" #. Translators: %d is the number of files to be deleted. #: src/storage-actionbar.vala:148 #, c-format -#| msgid "Are you sure you want to permanently delete this items %s?" msgid "Are you sure you want to permanently delete the %d selected item?" msgid_plural "" "Are you sure you want to permanently delete the %d selected items?" @@ -294,5 +296,14 @@ msgid "Storage" msgstr "Depolama" +#~ msgid "About" +#~ msgstr "Hakkında" + +#~ msgid "Quit" +#~ msgstr "Çık" + +#~ msgid "Others" +#~ msgstr "Diğerleri" + #~ msgid "Move to trash" #~ msgstr "Çöpe taşı" diff -Nru gnome-usage-3.30.0/src/app-item.vala gnome-usage-3.32.0/src/app-item.vala --- gnome-usage-3.30.0/src/app-item.vala 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/src/app-item.vala 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,148 @@ +namespace Usage +{ + public class AppItem : Object + { + public HashTable? processes { get; set; } + public string display_name { get; private set; } + public string representative_cmdline { get; private set; } + public uint representative_uid { get; private set; } + public double cpu_load { get; private set; } + public uint64 mem_usage { get; private set; } + public Fdo.AccountsUser? user { get; private set; default = null; } + + private static HashTable? apps_info; + private AppInfo? app_info = null; + + public static void init() { + apps_info = new HashTable(str_hash, str_equal); + var _apps_info = AppInfo.get_all(); + + foreach (AppInfo info in _apps_info) { + string cmd = info.get_commandline(); + sanity_cmd(ref cmd); + + if(cmd != null) + apps_info.insert(cmd, info); + } + } + + public static bool have_app_info(string cmdline) { + return apps_info.get(cmdline) != null ? true : false; + } + + public AppItem(Process process) { + app_info = apps_info.get(process.cmdline); + representative_cmdline = process.cmdline; + representative_uid = process.uid; + display_name = find_display_name(); + processes.insert(process.pid, process); + load_user_account.begin(); + } + + public AppItem.system() { + display_name = _("System"); + representative_cmdline = "system"; + } + + construct { + processes = new HashTable(int_hash, int_equal); + } + + public bool contains_process(Pid pid) { + return processes.contains(pid); + } + + public Icon get_icon() + { + var app_icon = (app_info == null) ? null : app_info.get_icon(); + + if (app_info == null || app_icon == null) + return new GLib.ThemedIcon("system-run-symbolic"); + else + return app_icon; + } + + public Process get_process_by_pid(Pid pid) { + return processes.get(pid); + } + + public void insert_process(Process process) { + processes.insert(process.pid, process); + } + + public void kill() { + foreach(var process in processes.get_values()) { + debug ("Terminating %d", (int) process.pid); + Posix.kill(process.pid, Posix.Signal.KILL); + } + } + + public void mark_as_not_updated() { + foreach(var process in processes.get_values()) + process.mark_as_updated = false; + } + + public void remove_processes() { + cpu_load = 0; + mem_usage = 0; + + foreach(var process in processes.get_values()) { + if(!process.mark_as_updated) + processes.remove(process.pid); + else { + cpu_load += process.cpu_load; + mem_usage += process.mem_usage; + } + } + + cpu_load = double.min(100, cpu_load); + } + + public void replace_process(Process process) { + processes.replace(process.pid, process); + } + + private string find_display_name() { + if(app_info != null) + return app_info.get_display_name(); + else + return representative_cmdline; + } + + private async void load_user_account() { + try { + Fdo.Accounts accounts = yield Bus.get_proxy (BusType.SYSTEM, + "org.freedesktop.Accounts", + "/org/freedesktop/Accounts"); + var user_account_path = yield accounts.FindUserById ((int64) representative_uid); + user = yield Bus.get_proxy (BusType.SYSTEM, + "org.freedesktop.Accounts", + user_account_path); + } catch (Error e) { + warning ("Unable to obtain user account: %s", e.message); + } + } + + private static void sanity_cmd(ref string? commandline) { + if(commandline != null) { + //flatpak + if(commandline.contains("flatpak run")) { + var index = commandline.index_of("--command=") + 10; + commandline = commandline.substring(index); + } + + try { + var rgx = new Regex("[^a-zA-Z0-9._-]"); + + commandline = Path.get_basename(commandline.split(" ")[0]); + commandline = rgx.replace(commandline, commandline.length, 0, ""); + } catch (RegexError e) { + warning ("Unable to obtain process command: %s", e.message); + } + + if(commandline.contains("google-chrome-stable")) //Workaround for google-chrome + commandline = "chrome"; + } + } + } +} \ No newline at end of file diff -Nru gnome-usage-3.30.0/src/application.vala gnome-usage-3.32.0/src/application.vala --- gnome-usage-3.30.0/src/application.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/application.vala 2019-03-22 14:43:03.000000000 +0000 @@ -30,7 +30,8 @@ { { "about", on_about }, { "search", on_search }, - { "quit", on_quit } + { "quit", on_quit }, + { "filter-processes", on_activate_radio, "s", "'group-system'", change_filter_processes_state } }; public Application () @@ -50,21 +51,8 @@ window = new Window(this); - // Create menu - GLib.Menu menu_preferences = new GLib.Menu(); - GLib.Menu menu_common = new GLib.Menu(); - var item = new GLib.MenuItem (_("About"), "app.about"); - menu_common.append_item(item); - - item = new GLib.MenuItem (_("Quit"), "app.quit"); - item.set_attribute("accel", "s", "q"); - menu_common.append_item(item); - - GLib.Menu menu = new GLib.Menu(); - menu.append_section(null, menu_preferences); - menu.append_section(null, menu_common); + set_accels_for_action("app.quit", {"q"}); - set_app_menu(menu); window.show_all(); } @@ -108,5 +96,16 @@ { window.get_header_bar().action_on_search(); } + + private void on_activate_radio (GLib.SimpleAction action, GLib.Variant? state) + { + action.change_state(state); + } + + private void change_filter_processes_state(GLib.SimpleAction action, GLib.Variant? state) + { + action.set_state(state); + SystemMonitor.get_default().group_system_apps = state.get_string() == "group-system" ? true : false; + } } } diff -Nru gnome-usage-3.30.0/src/cpu-graph-model.vala gnome-usage-3.32.0/src/cpu-graph-model.vala --- gnome-usage-3.30.0/src/cpu-graph-model.vala 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/src/cpu-graph-model.vala 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,131 @@ +/* cpu-graph-model.vala + * + * Copyright (C) 2018 Red Hat, Inc. + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: Petr Štětka + */ + +using Dazzle; + +namespace Usage { + + public class CpuGraphModel : GraphModel { + public signal void big_process_usage (int column); + public signal void small_process_usage (int column); + private bool[] change_big_process_usage; + private bool[] change_small_process_usage; + + public CpuGraphModel () { + var settings = Settings.get_default(); + set_timespan (settings.graph_timespan * 1000); + set_max_samples (settings.graph_max_samples); + + var column_total = new GraphColumn("TOTAL CPU", Type.from_name("gdouble")); + add_column(column_total); + + change_big_process_usage = new bool[get_num_processors()]; + change_small_process_usage = new bool[get_num_processors()]; + + for (int i = 0; i < get_num_processors(); i++) { + var column_x_cpu = new GraphColumn("CPU: " + i.to_string(), Type.from_name("gdouble")); + add_column(column_x_cpu); + + change_big_process_usage[i] = true; + change_small_process_usage[i] = true; + } + + Timeout.add(settings.graph_update_interval, update_data); + } + + bool update_data() { + GraphModelIter iter; + push (out iter, get_monotonic_time ()); + + SystemMonitor monitor = SystemMonitor.get_default(); + + for (int i = 0; i < get_num_processors(); i++) { + iter_set_value(iter, i, monitor.x_cpu_load[i]); + + if(monitor.x_cpu_load[i] >= 90) { + if(change_big_process_usage[i]) { + big_process_usage(i); + change_big_process_usage[i] = false; + change_small_process_usage[i] = true; + } + } + else { + if(change_small_process_usage[i]) { + small_process_usage(i); + change_small_process_usage[i] = false; + change_big_process_usage[i] = true; + } + } + } + + return true; + } + } + + public class CpuGraphModelMostUsedCore : GraphModel { + public signal void big_process_usage (); + public signal void small_process_usage (); + private bool change_big_process_usage = true; + private bool change_small_process_usage = true; + + public CpuGraphModelMostUsedCore () { + var settings = Settings.get_default(); + set_timespan (settings.graph_timespan * 1000); + set_max_samples (settings.graph_max_samples); + + var column = new GraphColumn("MOST USED CORE", Type.from_name("gdouble")); + add_column(column); + + Timeout.add(settings.graph_update_interval, update_data); + } + + bool update_data() { + GraphModelIter iter; + push (out iter, get_monotonic_time ()); + + SystemMonitor monitor = SystemMonitor.get_default(); + double most_used_core = monitor.x_cpu_load[0]; + + for (int i = 1; i < get_num_processors(); i++) { + if(monitor.x_cpu_load[i] > most_used_core) + most_used_core = monitor.x_cpu_load[i]; + } + + iter_set_value(iter, 0, most_used_core); + + if(most_used_core >= 90) { + if(change_big_process_usage) { + big_process_usage(); + change_big_process_usage = false; + change_small_process_usage = true; + } + } + else { + if(change_small_process_usage) { + small_process_usage(); + change_small_process_usage = false; + change_big_process_usage = true; + } + } + + return true; + } + } +} diff -Nru gnome-usage-3.30.0/src/cpu-graph-table.vala gnome-usage-3.32.0/src/cpu-graph-table.vala --- gnome-usage-3.30.0/src/cpu-graph-table.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/cpu-graph-table.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ -/* cpu-graph-table.vala - * - * Copyright (C) 2017 Red Hat, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Authors: Petr Štětka - */ - -using Rg; - -namespace Usage { - - public class CpuGraphTableComplex : Rg.Table - { - public signal void big_process_usage (int column); - public signal void small_process_usage (int column); - private bool[] change_big_process_usage; - private bool[] change_small_process_usage; - - public CpuGraphTableComplex () - { - var settings = Settings.get_default(); - set_timespan (settings.graph_timespan * 1000); - set_max_samples (settings.graph_max_samples); - - var column_total = new Rg.Column("TOTAL CPU", Type.from_name("gdouble")); - add_column(column_total); - - change_big_process_usage = new bool[get_num_processors()]; - change_small_process_usage = new bool[get_num_processors()]; - - for (int i = 0; i < get_num_processors(); i++) - { - var column_x_cpu = new Rg.Column("CPU: " + i.to_string(), Type.from_name("gdouble")); - add_column(column_x_cpu); - - change_big_process_usage[i] = true; - change_small_process_usage[i] = true; - } - - Timeout.add(settings.graph_update_interval, update_data); - } - - bool update_data() - { - Rg.TableIter iter; - push (out iter, get_monotonic_time ()); - - SystemMonitor monitor = SystemMonitor.get_default(); - - for (int i = 0; i < get_num_processors(); i++) - { - iter.set (i, monitor.x_cpu_load[i], -1); - - if(monitor.x_cpu_load[i] >= 90) - { - if(change_big_process_usage[i]) - { - big_process_usage(i); - change_big_process_usage[i] = false; - change_small_process_usage[i] = true; - } - } - else - { - if(change_small_process_usage[i]) - { - small_process_usage(i); - change_small_process_usage[i] = false; - change_big_process_usage[i] = true; - } - } - } - - return true; - } - } - - public class CpuGraphTableMostUsedCore : Rg.Table - { - public signal void big_process_usage (); - public signal void small_process_usage (); - private bool change_big_process_usage = true; - private bool change_small_process_usage = true; - - public CpuGraphTableMostUsedCore () - { - var settings = Settings.get_default(); - set_timespan (settings.graph_timespan * 1000); - set_max_samples (settings.graph_max_samples); - - var column = new Rg.Column("MOST USED CORE", Type.from_name("gdouble")); - add_column(column); - - Timeout.add(settings.graph_update_interval, update_data); - } - - bool update_data() - { - Rg.TableIter iter; - push (out iter, get_monotonic_time ()); - - SystemMonitor monitor = SystemMonitor.get_default(); - double most_used_core = monitor.x_cpu_load[0]; - - for (int i = 1; i < get_num_processors(); i++) - { - if(monitor.x_cpu_load[i] > most_used_core) - most_used_core = monitor.x_cpu_load[i]; - } - - iter.set (0, most_used_core, -1); - - if(most_used_core >= 90) - { - if(change_big_process_usage) - { - big_process_usage(); - change_big_process_usage = false; - change_small_process_usage = true; - } - } - else - { - if(change_small_process_usage) - { - small_process_usage(); - change_small_process_usage = false; - change_big_process_usage = true; - } - } - - return true; - } - } -} diff -Nru gnome-usage-3.30.0/src/cpu-graph.vala gnome-usage-3.32.0/src/cpu-graph.vala --- gnome-usage-3.30.0/src/cpu-graph.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/cpu-graph.vala 2019-03-22 14:43:03.000000000 +0000 @@ -1,6 +1,6 @@ /* cpu-graph.vala * - * Copyright (C) 2017 Red Hat, Inc. + * Copyright (C) 2018 Red Hat, Inc. * * 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 @@ -18,17 +18,17 @@ * Authors: Petr Štětka */ -using Rg; +using Dazzle; namespace Usage { /** * Graph showing most used core **/ - public class CpuGraphMostUsed : Rg.Graph + public class CpuGraphMostUsedCore : GraphView { - private static CpuGraphTableMostUsedCore rg_table; - private StackedRenderer renderer; + private static CpuGraphModelMostUsedCore graph_model; + private GraphStackedRenderer renderer; private Gdk.RGBA line_color_max; private Gdk.RGBA line_color_normal; private Gdk.RGBA color_max; @@ -39,7 +39,7 @@ set_css_name("rg-graph"); } - public CpuGraphMostUsed () + public CpuGraphMostUsedCore () { get_style_context().add_class("line_max"); line_color_max = get_style_context().get_color(get_style_context().get_state()); @@ -54,23 +54,23 @@ color_normal = get_style_context().get_color(get_style_context().get_state()); get_style_context().remove_class("stacked"); - if(rg_table == null) - rg_table = new CpuGraphTableMostUsedCore(); + if(graph_model == null) + graph_model = new CpuGraphModelMostUsedCore(); - set_table(rg_table); + set_model(graph_model); - renderer = new StackedRenderer(); + renderer = new GraphStackedRenderer(); renderer.stroke_color_rgba = line_color_normal; renderer.stacked_color_rgba = color_normal; renderer.line_width = 1.0; add_renderer(renderer); - rg_table.big_process_usage.connect (() => { + graph_model.big_process_usage.connect (() => { renderer.stroke_color_rgba = line_color_max; renderer.stacked_color_rgba = color_max; }); - rg_table.small_process_usage.connect (() => { + graph_model.small_process_usage.connect (() => { renderer.stroke_color_rgba = line_color_normal; renderer.stacked_color_rgba = color_normal; }); @@ -80,10 +80,10 @@ /** * Graph showing all processor cores. **/ - public class CpuGraphBig : Rg.Graph + public class CpuGraph : GraphView { - private static CpuGraphTableComplex rg_table; - private LineRenderer[] renderers; + private static CpuGraphModel graph_model; + private GraphLineRenderer[] renderers; private Gdk.RGBA line_color_max; private Gdk.RGBA line_color_normal; @@ -92,7 +92,7 @@ set_css_name("rg-graph"); } - public CpuGraphBig() + public CpuGraph() { get_style_context().add_class("line_max"); line_color_max = get_style_context().get_color(get_style_context().get_state()); @@ -102,27 +102,27 @@ get_style_context().remove_class("line"); get_style_context().add_class("big"); - if(rg_table == null) - rg_table = new CpuGraphTableComplex(); + if(graph_model == null) + graph_model = new CpuGraphModel(); - set_table(rg_table); + set_model(graph_model); - renderers = new LineRenderer[get_num_processors()]; + renderers = new GraphLineRenderer[get_num_processors()]; for(int i = 0; i < get_num_processors(); i++) { - renderers[i] = new LineRenderer(); + renderers[i] = new GraphLineRenderer(); renderers[i].column = i; renderers[i].stroke_color_rgba = line_color_normal; renderers[i].line_width = 1.5; add_renderer(renderers[i]); } - rg_table.big_process_usage.connect ((column) => { + graph_model.big_process_usage.connect ((column) => { renderers[column].stroke_color_rgba = line_color_max; renderers[column].line_width = 2.5; }); - rg_table.small_process_usage.connect ((column) => { + graph_model.small_process_usage.connect ((column) => { renderers[column].stroke_color_rgba = line_color_normal; renderers[column].line_width = 1.5; }); diff -Nru gnome-usage-3.30.0/src/cpu-sub-view.vala gnome-usage-3.32.0/src/cpu-sub-view.vala --- gnome-usage-3.30.0/src/cpu-sub-view.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/cpu-sub-view.vala 2019-03-22 14:43:03.000000000 +0000 @@ -34,7 +34,7 @@ label.margin_top = 25; label.margin_bottom = 15; - var cpu_graph = new CpuGraphBig(); + var cpu_graph = new CpuGraph(); cpu_graph.hexpand = true; var cpu_graph_box = new GraphBox(cpu_graph); cpu_graph_box.height_request = 225; @@ -48,7 +48,7 @@ var spinner = new Gtk.Spinner(); spinner.active = true; spinner.margin_top = 30; - spinner.margin_bottom = 20; + spinner.height_request = 250; no_process_view = new NoResultsFoundView(); @@ -59,11 +59,16 @@ cpu_box.pack_start(spinner, true, true, 0); cpu_box.add(no_process_view); - SystemMonitor.get_default().cpu_processes_ready.connect(() => - { - cpu_box.pack_start(process_list_box, false, false, 0); - process_list_box.update(); - cpu_box.remove(spinner); + var system_monitor = SystemMonitor.get_default(); + system_monitor.notify["process-list-ready"].connect ((sender, property) => { + if(system_monitor.process_list_ready) { + cpu_box.pack_start(process_list_box, false, false, 0); + cpu_box.remove(spinner); + } + else { + cpu_box.pack_start(spinner, true, true, 0); + cpu_box.remove(process_list_box); + } }); process_list_box.bind_property ("empty", no_process_view, "visible", BindingFlags.BIDIRECTIONAL); @@ -78,7 +83,7 @@ public void search_in_processes(string text) { - process_list_box.search(text); + process_list_box.search_text = text; } } } diff -Nru gnome-usage-3.30.0/src/graph-block-row.vala gnome-usage-3.32.0/src/graph-block-row.vala --- gnome-usage-3.30.0/src/graph-block-row.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/graph-block-row.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/* graph-block-row.vala - * - * Copyright (C) 2017 Red Hat, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Authors: Petr Štětka - */ - -using Gtk; - -namespace Usage { - - public class GraphBlockRow : Gtk.Box - { - Gtk.Label value_label; - GraphBlockType type; - - public GraphBlockRow(GraphBlockType type, string label_text, string css_class) - { - Object(orientation: Gtk.Orientation.HORIZONTAL); - var color_rectangle = new ColorRectangle.new_from_css(css_class); - var label = new Gtk.Label(label_text); - label.margin = 5; - label.ellipsize = Pango.EllipsizeMode.END; - label.max_width_chars = 15; - value_label = new Gtk.Label("0 %"); - value_label.width_chars = 5; - value_label.width_chars = 5; - value_label.xalign = 1; - this.pack_start(color_rectangle, false, false); - this.pack_start(label, false, true, 5); - this.pack_end(value_label, false, true, 10); - this.type = type; - } - - public void update(uint64 value) - { - switch(type) - { - case GraphBlockType.PROCESSOR: - value_label.set_text(value.to_string() + " %"); - break; - case GraphBlockType.MEMORY: - value_label.set_text(Utils.format_size_values(value)); - break; - case GraphBlockType.NETWORK: - value_label.set_text(Utils.format_size_speed_values(value)); - break; - } - } - } -} diff -Nru gnome-usage-3.30.0/src/graph-block.vala gnome-usage-3.32.0/src/graph-block.vala --- gnome-usage-3.30.0/src/graph-block.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/graph-block.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* graph-block.vala - * - * Copyright (C) 2017 Red Hat, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Authors: Petr Štětka - */ - -using Gtk; - -namespace Usage -{ - public enum GraphBlockType { - PROCESSOR, - MEMORY, - DISK, - NETWORK - } - - public class GraphBlock : Gtk.Grid - { - PieChart graph; - GraphBlockRow application_row; - GraphBlockRow others_row; - GraphBlockRow available_row; - Gtk.Label label; - string block_name; - bool show_avaiable; - GraphBlockType type; - - class construct - { - set_css_name("GraphBlock"); - } - - public GraphBlock(GraphBlockType type, string block_name, string app_name, bool show_avaiable = true) - { - this.type = type; - this.expand = true; - this.block_name = block_name; - this.show_avaiable = show_avaiable; - label = new Gtk.Label("" + block_name + ""); - label.set_use_markup(true); - this.attach(label, 0, 0, 1, 1); - - graph = new PieChart(); - graph.margin = 15; - graph.height_request = 90; - graph.width_request = 90; - this.attach(graph, 0, 1, 1, 1); - - application_row = new GraphBlockRow(type, app_name, "used"); - others_row = new GraphBlockRow(type, _("Others"), "others"); - if(show_avaiable) - available_row = new GraphBlockRow(type, _("Available"), "available"); - - Gtk.Box box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); - box.margin_left = 15; - box.valign = Align.CENTER; - box.pack_start(application_row, false, false); - box.pack_start(others_row , false, false); - if(show_avaiable) - box.pack_start(available_row, false, false); - this.attach(box, 1, 1, 1, 1); - } - - public void update(uint64 application, uint64 other, uint64 all, int processor_core = -1) - { - if(processor_core != -1) - { - label.set_text("" + block_name + " " + processor_core.to_string() + ""); - label.use_markup = true; - } - else - { - label.set_text("" + block_name + ""); - label.use_markup = true; - } - - int application_percentages = 0; - if(all != 0) - application_percentages = (int) (((double) application / all) * 100); - - int other_percentages = 0; - if(all != 0) - other_percentages = (int) (((double) other / all) * 100); - - graph.update(application_percentages, other_percentages); - application_row.update(application); - others_row.update(other); - if(show_avaiable) - available_row.update(all-other-application); - } - } -} diff -Nru gnome-usage-3.30.0/src/graph-box.vala gnome-usage-3.32.0/src/graph-box.vala --- gnome-usage-3.30.0/src/graph-box.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/graph-box.vala 2019-03-22 14:43:03.000000000 +0000 @@ -29,7 +29,7 @@ set_css_name("graph-box"); } - public GraphBox (Rg.Graph graph) { + public GraphBox (Dazzle.GraphView graph) { add(graph); } } diff -Nru gnome-usage-3.30.0/src/graph-stacked-renderer.vala gnome-usage-3.32.0/src/graph-stacked-renderer.vala --- gnome-usage-3.30.0/src/graph-stacked-renderer.vala 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/src/graph-stacked-renderer.vala 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,126 @@ +/* graph-stacked-renderer.vala + * + * Copyright (C) 2018 Red Hat, Inc. + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: Petr Štětka + */ + +using Dazzle; +using Cairo; + +namespace Usage { + + public class GraphStackedRenderer : Object, GraphRenderer { + + public uint column { set; get; } + public double line_width { set; get; default = 1.0; } + public Gdk.RGBA stroke_color_rgba { set; get; } + public Gdk.RGBA stacked_color_rgba { set; get; } + + public void render(GraphModel model, int64 x_begin, int64 x_end, double y_begin, double y_end, Context cr, RectangleInt area) { + GraphModelIter iter; + cr.save(); + + if (model.get_iter_first(out iter)) { + double chunk = area.width / (double) (model.max_samples - 1) / 2.0; + double last_x = calc_x (iter, x_begin, x_end, area.width); + double last_y = area.height; + + cr.move_to (last_x, area.height); + + while (GraphModel.iter_next (ref iter)) + { + double x = calc_x (iter, x_begin, x_end, area.width); + double y = calc_y (iter, y_begin, y_end, area.height, column); + + cr.curve_to (last_x + chunk, last_y, last_x + chunk, y, x, y); + + last_x = x; + last_y = y; + } + } + + cr.set_line_width (line_width); + cr.set_source_rgba (stacked_color_rgba.red, stacked_color_rgba.green, stacked_color_rgba.blue, stacked_color_rgba.alpha); + cr.rel_line_to (0, area.height); + cr.stroke_preserve (); + cr.close_path(); + cr.fill(); + + if (model.get_iter_first(out iter)) { + double chunk = area.width / (double) (model.max_samples - 1) / 2.0; + double last_x = calc_x (iter, x_begin, x_end, area.width); + double last_y = area.height; + + cr.move_to (last_x, last_y); + + while (GraphModel.iter_next (ref iter)) + { + double x = calc_x (iter, x_begin, x_end, area.width); + double y = calc_y (iter, y_begin, y_end, area.height, column); + + cr.curve_to (last_x + chunk, last_y, last_x + chunk, y, x, y); + + last_x = x; + last_y = y; + } + } + + cr.set_source_rgba (stroke_color_rgba.red, stroke_color_rgba.green, stroke_color_rgba.blue, stacked_color_rgba.alpha); + cr.stroke (); + cr.restore (); + } + + private static double calc_x (GraphModelIter iter, int64 begin, int64 end, uint width) { + var timestamp = GraphModel.iter_get_timestamp(iter); + + return ((timestamp - begin) / (double) (end - begin) * width); + } + + private static double calc_y (GraphModelIter iter, double range_begin, double range_end, uint height, uint column) { + double y; + + var val = GraphModel.iter_get_value(iter, column); + switch (val.type()) + { + case Type.DOUBLE: + y = val.get_double(); + break; + case Type.UINT: + y = val.get_uint(); + break; + case Type.UINT64: + y = val.get_uint64(); + break; + case Type.INT: + y = val.get_int(); + break; + case Type.INT64: + y = val.get_int64(); + break; + default: + y = 0.0; + break; + } + + y -= range_begin; + y /= (range_end - range_begin); + y = height - (y * height); + + return y; + } + } +} diff -Nru gnome-usage-3.30.0/src/graph-switcher-button.vala gnome-usage-3.32.0/src/graph-switcher-button.vala --- gnome-usage-3.30.0/src/graph-switcher-button.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/graph-switcher-button.vala 2019-03-22 14:43:03.000000000 +0000 @@ -26,17 +26,17 @@ public GraphSwitcherButton.processor(string label) { - Rg.Graph processor_graph = new CpuGraphMostUsed(); + var processor_graph = new CpuGraphMostUsedCore(); child = createContent(processor_graph, label); } public GraphSwitcherButton.memory(string label) { - Rg.Graph memory_graph = new MemoryGraph(); + var memory_graph = new MemoryGraph(); child = createContent(memory_graph, label); } - private Gtk.Box createContent(Rg.Graph graph, string label_text) + private Gtk.Box createContent(Dazzle.GraphView graph, string label_text) { graph.height_request = 80; graph.hexpand = true; diff -Nru gnome-usage-3.30.0/src/header-bar.vala gnome-usage-3.32.0/src/header-bar.vala --- gnome-usage-3.30.0/src/header-bar.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/header-bar.vala 2019-03-22 14:43:03.000000000 +0000 @@ -49,9 +49,13 @@ [GtkChild] private Gtk.Button storage_cancel_button; + [GtkChild] + private Gtk.MenuButton primary_menu_button; + private Gtk.MenuButton? storage_selection_menu; private string title_text = ""; private HeaderBarMode mode; + private Usage.PrimaryMenu menu; const GLib.ActionEntry[] select_action_entries = { { "select-all", select_all }, @@ -61,7 +65,9 @@ public HeaderBar(Gtk.Stack stack) { mode = HeaderBarMode.PERFORMANCE; + menu = new Usage.PrimaryMenu(); stack_switcher.set_stack(stack); + this.primary_menu_button.set_popover(menu); set_mode(HeaderBarMode.PERFORMANCE); } @@ -85,7 +91,6 @@ { case HeaderBarMode.PERFORMANCE: show_stack_switcher(); - performance_search_button.show(); break; case HeaderBarMode.STORAGE: @@ -99,6 +104,7 @@ break; } + menu.mode = mode; this.mode = mode; } diff -Nru gnome-usage-3.30.0/src/memory-graph-model.vala gnome-usage-3.32.0/src/memory-graph-model.vala --- gnome-usage-3.30.0/src/memory-graph-model.vala 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/src/memory-graph-model.vala 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,80 @@ +/* memory-graph-model.vala + * + * Copyright (C) 2018 Red Hat, Inc. + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: Petr Štětka + */ + +using Dazzle; + +namespace Usage { + + public class MemoryGraphModel : GraphModel { + public const int COLUMN_RAM = 0; + public const int COLUMN_SWAP = 1; + public signal void big_ram_usage(); + public signal void small_ram_usage(); + private bool change_big_ram_usage = true; + private bool change_small_ram_usage = true; + + public MemoryGraphModel () { + var settings = Settings.get_default(); + set_timespan (settings.graph_timespan * 1000); + set_max_samples (settings.graph_max_samples); + + var column_ram = new GraphColumn("RAM", Type.from_name("gdouble")); + add_column(column_ram); + var column_swap = new GraphColumn("SWAP", Type.from_name("gdouble")); + add_column(column_swap); + + Timeout.add(settings.graph_update_interval, update_data); + } + + bool update_data() { + GraphModelIter iter; + push (out iter, get_monotonic_time ()); + + SystemMonitor monitor = SystemMonitor.get_default(); + double ram_usage = 0; + if(monitor.ram_total != 0) + ram_usage = (((double) monitor.ram_usage / monitor.ram_total) * 100); + + double swap_usage = 0; + if(monitor.ram_total != 0) + swap_usage = (((double) monitor.swap_usage / monitor.swap_total) * 100); + + iter_set_value(iter, COLUMN_RAM, ram_usage); + iter_set_value(iter, COLUMN_SWAP, swap_usage); + + if(ram_usage >= 90) { + if(change_big_ram_usage) { + big_ram_usage(); + change_big_ram_usage = false; + change_small_ram_usage = true; + } + } + else { + if(change_small_ram_usage) { + small_ram_usage(); + change_small_ram_usage = false; + change_big_ram_usage = true; + } + } + + return true; + } + } +} diff -Nru gnome-usage-3.30.0/src/memory-graph-table.vala gnome-usage-3.32.0/src/memory-graph-table.vala --- gnome-usage-3.30.0/src/memory-graph-table.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/memory-graph-table.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* memory-graph-table.vala - * - * Copyright (C) 2017 Red Hat, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Authors: Petr Štětka - */ - -using Rg; - -namespace Usage { - - public class MemoryGraphTable : Rg.Table - { - public const int column_ram_id = 0; - public const int column_swap_id = 1; - public signal void big_ram_usage(); - public signal void small_ram_usage(); - private bool change_big_ram_usage = true; - private bool change_small_ram_usage = true; - - public MemoryGraphTable () - { - var settings = Settings.get_default(); - set_timespan (settings.graph_timespan * 1000); - set_max_samples (settings.graph_max_samples); - - var column_ram = new Rg.Column("RAM", Type.from_name("gdouble")); - add_column(column_ram); - var column_swap = new Rg.Column("SWAP", Type.from_name("gdouble")); - add_column(column_swap); - - Timeout.add(settings.graph_update_interval, update_data); - } - - bool update_data() - { - Rg.TableIter iter; - push (out iter, get_monotonic_time ()); - - SystemMonitor monitor = SystemMonitor.get_default(); - double ram_usage = 0; - if(monitor.ram_total != 0) - ram_usage = (((double) monitor.ram_usage / monitor.ram_total) * 100); - - double swap_usage = 0; - if(monitor.ram_total != 0) - swap_usage = (((double) monitor.swap_usage / monitor.swap_total) * 100); - - iter.set (column_ram_id, ram_usage, -1); - iter.set (column_swap_id, swap_usage, -1); - - if(ram_usage >= 90) - { - if(change_big_ram_usage) - { - big_ram_usage(); - change_big_ram_usage = false; - change_small_ram_usage = true; - } - } - else - { - if(change_small_ram_usage) - { - small_ram_usage(); - change_small_ram_usage = false; - change_big_ram_usage = true; - } - } - - return true; - } - } -} diff -Nru gnome-usage-3.30.0/src/memory-graph.vala gnome-usage-3.32.0/src/memory-graph.vala --- gnome-usage-3.30.0/src/memory-graph.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/memory-graph.vala 2019-03-22 14:43:03.000000000 +0000 @@ -1,6 +1,6 @@ /* memory-graph.vala * - * Copyright (C) 2017 Red Hat, Inc. + * Copyright (C) 2018 Red Hat, Inc. * * 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 @@ -18,13 +18,13 @@ * Authors: Petr Štětka */ -using Rg; +using Dazzle; namespace Usage { - public class MemoryGraph : Rg.Graph + public class MemoryGraph : GraphView { - private static MemoryGraphTable rg_table; + private static MemoryGraphModel graph_model; private Gdk.RGBA line_color_max; private Gdk.RGBA line_color_normal; private Gdk.RGBA color_max; @@ -50,83 +50,27 @@ color_normal = get_style_context().get_color(get_style_context().get_state()); get_style_context().remove_class("stacked"); - if(rg_table == null) + if(graph_model == null) { - rg_table = new MemoryGraphTable(); - set_table(rg_table); + graph_model = new MemoryGraphModel(); + set_model(graph_model); } else - set_table(rg_table); + set_model(graph_model); - var renderer_ram = new StackedRenderer(); - renderer_ram.column = MemoryGraphTable.column_ram_id; + var renderer_ram = new GraphStackedRenderer(); + renderer_ram.column = MemoryGraphModel.COLUMN_RAM; renderer_ram.stroke_color_rgba = line_color_normal; renderer_ram.stacked_color_rgba = color_normal; renderer_ram.line_width = 1.2; add_renderer(renderer_ram); - rg_table.big_ram_usage.connect (() => { + graph_model.big_ram_usage.connect (() => { renderer_ram.stroke_color_rgba = line_color_max; renderer_ram.stacked_color_rgba = color_max; }); - rg_table.small_ram_usage.connect (() => { - renderer_ram.stroke_color_rgba = line_color_normal; - renderer_ram.stacked_color_rgba = color_normal; - }); - } - } - - public class MemoryGraphBig : Rg.Graph - { - private static MemoryGraphTable rg_table; - private Gdk.RGBA line_color_max; - private Gdk.RGBA line_color_normal; - private Gdk.RGBA color_max; - private Gdk.RGBA color_normal; - - class construct - { - set_css_name("rg-graph"); - } - - public MemoryGraphBig() - { - get_style_context().add_class("line_max"); - line_color_max = get_style_context().get_color(get_style_context().get_state()); - get_style_context().remove_class("line_max"); - get_style_context().add_class("line"); - line_color_normal = get_style_context().get_color(get_style_context().get_state()); - get_style_context().remove_class("line"); - get_style_context().add_class("stacked_max"); - color_max = get_style_context().get_color(get_style_context().get_state()); - get_style_context().remove_class("stacked_max"); - get_style_context().add_class("stacked"); - color_normal = get_style_context().get_color(get_style_context().get_state()); - get_style_context().remove_class("stacked"); - get_style_context().add_class("big"); - - if(rg_table == null) - { - rg_table = new MemoryGraphTable(); - set_table(rg_table); - } - else - set_table(rg_table); - - var renderer_ram = new StackedRenderer(); - renderer_ram.column = MemoryGraphTable.column_ram_id; - renderer_ram.stroke_color_rgba = line_color_normal; - renderer_ram.stacked_color_rgba = color_normal; - renderer_ram.line_width = 1.5; - add_renderer(renderer_ram); - - rg_table.big_ram_usage.connect (() => { - renderer_ram.stroke_color_rgba = line_color_normal; - renderer_ram.stacked_color_rgba = color_normal; - }); - - rg_table.small_ram_usage.connect (() => { + graph_model.small_ram_usage.connect (() => { renderer_ram.stroke_color_rgba = line_color_normal; renderer_ram.stacked_color_rgba = color_normal; }); diff -Nru gnome-usage-3.30.0/src/memory-sub-view.vala gnome-usage-3.32.0/src/memory-sub-view.vala --- gnome-usage-3.30.0/src/memory-sub-view.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/memory-sub-view.vala 2019-03-22 14:43:03.000000000 +0000 @@ -36,7 +36,7 @@ var spinner = new Gtk.Spinner(); spinner.active = true; spinner.margin_top = 30; - spinner.margin_bottom = 20; + spinner.height_request = 250; no_process_view = new NoResultsFoundView(); @@ -55,15 +55,19 @@ memory_box.pack_start(spinner, true, true, 0); memory_box.add(no_process_view); - SystemMonitor.get_default().cpu_processes_ready.connect(() => - { - memory_box.pack_start(process_list_box, false, false, 0); - process_list_box.update(); - memory_box.remove(spinner); + var system_monitor = SystemMonitor.get_default(); + system_monitor.notify["process-list-ready"].connect ((sender, property) => { + if(system_monitor.process_list_ready) { + memory_box.pack_start(process_list_box, false, false, 0); + memory_box.remove(spinner); + } + else { + memory_box.pack_start(spinner, true, true, 0); + memory_box.remove(process_list_box); + } }); process_list_box.bind_property ("empty", no_process_view, "visible", BindingFlags.BIDIRECTIONAL); - add(memory_box); } @@ -74,7 +78,7 @@ public void search_in_processes(string text) { - process_list_box.search(text); + process_list_box.search_text = text; } } } diff -Nru gnome-usage-3.30.0/src/meson.build gnome-usage-3.32.0/src/meson.build --- gnome-usage-3.30.0/src/meson.build 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/meson.build 2019-03-22 14:43:03.000000000 +0000 @@ -1,19 +1,19 @@ vala_sources = [ 'animated-scrolled-window.vala', + 'app-item.vala', 'application.vala', 'color-rectangle.vala', - 'cpu-graph-table.vala', + 'cpu-graph-model.vala', 'cpu-graph.vala', 'cpu-monitor.vala', 'cpu-sub-view.vala', 'gnome-usage.vala', - 'graph-block-row.vala', - 'graph-block.vala', 'graph-box.vala', + 'graph-stacked-renderer.vala', 'graph-stack-switcher.vala', 'graph-switcher-button.vala', 'header-bar.vala', - 'memory-graph-table.vala', + 'memory-graph-model.vala', 'memory-graph.vala', 'memory-monitor.vala', 'memory-speedometer.vala', @@ -22,6 +22,7 @@ 'no-results-found-view.vala', 'performance-view.vala', 'pie-chart.vala', + 'primary-menu.vala', 'process-list-box.vala', 'process-row.vala', 'process.vala', @@ -48,14 +49,11 @@ glib_dep, gobject_dep, gtk_dep, - libegg_dep, - librg_dep, dependency('libgtop-2.0', version : '>= 2.34.0'), + libdazzle_dep, cc.find_library('m'), valac.find_library('config', dirs: vapi_dir), - valac.find_library('egg', dirs: vapi_dir), - valac.find_library('posix'), - valac.find_library('rg', dirs: vapi_dir) + valac.find_library('posix') ] c_args = [ diff -Nru gnome-usage-3.30.0/src/primary-menu.vala gnome-usage-3.32.0/src/primary-menu.vala --- gnome-usage-3.30.0/src/primary-menu.vala 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/src/primary-menu.vala 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,45 @@ +/* primary-menu.vala + * + * Copyright 2018 Christopher Davis + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +using Gtk; + +namespace Usage { + [GtkTemplate (ui="/org/gnome/Usage/ui/primary-menu.ui")] + public class PrimaryMenu : Gtk.Popover { + + [GtkChild] + private Gtk.Box performance_container; + + public HeaderBarMode mode { get; set; } + + public PrimaryMenu() { + notify["mode"].connect ((sender, property) => { + switch(mode) { + case HeaderBarMode.PERFORMANCE: + performance_container.show(); + break; + case HeaderBarMode.STORAGE: + performance_container.hide(); + break; + } + }); + } + } +} diff -Nru gnome-usage-3.30.0/src/process-list-box.vala gnome-usage-3.32.0/src/process-list-box.vala --- gnome-usage-3.30.0/src/process-list-box.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/process-list-box.vala 2019-03-22 14:43:03.000000000 +0000 @@ -28,47 +28,36 @@ public class ProcessListBox : Gtk.ListBox { public bool empty { get; set; default = true; } + public string search_text { get; set; default = ""; } - ListStore model; - ProcessRow? opened_row = null; - string focused_row_cmdline; - ProcessListBoxType type; - string search_text = ""; + private const double APP_CPU_MIN_LOAD_LIMIT = 1; + private const double APP_MEM_MIN_USAGE_LIMIT = 0; + private ListStore model; + private ProcessListBoxType type; public ProcessListBox(ProcessListBoxType type) { - this.type = type; set_selection_mode (Gtk.SelectionMode.NONE); set_header_func (update_header); - row_activated.connect((row) => { - var process_row = (ProcessRow) row; - if(opened_row != null) - opened_row.activate(); + this.type = type; + model = new ListStore(typeof(AppItem)); + bind_model(model, on_row_created); - if(opened_row != process_row) - { - process_row.activate(); - if(process_row.process.sub_processes != null) - opened_row = process_row; - else - opened_row = null; - } - else - opened_row = null; + row_activated.connect((row) => { + var process_row = (ProcessRow) row; + process_row.activate(); }); - set_focus_child.connect((child) => - { - if(child != null) - { - focused_row_cmdline = ((ProcessRow) child).process.cmdline; - //GLib.stdout.printf("focused: " + focused_row_cmdline+ "\n"); - } + this.notify["search-text"].connect ((sender, property) => { + update(); }); - model = new ListStore(typeof(Process)); - bind_model(model, on_row_created); + var system_monitor = SystemMonitor.get_default(); + system_monitor.notify["process-list-ready"].connect (() => { + if(system_monitor.process_list_ready) + update(); + }); var settings = Settings.get_default(); Timeout.add(settings.list_update_interval_UI, update); @@ -76,98 +65,65 @@ bind_property ("empty", this, "visible", BindingFlags.INVERT_BOOLEAN); } - public bool update() + private bool update() { - CompareDataFunc processcmp = (a, b) => { - Process p_a = (Process) a; - Process p_b = (Process) b; + model.remove_all(); - switch(type) - { + CompareDataFunc app_cmp = (a, b) => { + AppItem app_a = (AppItem) a; + AppItem app_b = (AppItem) b; + + switch(type) { default: case ProcessListBoxType.PROCESSOR: - return (int) ((uint64) (p_a.cpu_load < p_b.cpu_load) - (uint64) (p_a.cpu_load > p_b.cpu_load)); + return (int) ((uint64) (app_a.cpu_load < app_b.cpu_load) - (uint64) (app_a.cpu_load > app_b.cpu_load)); case ProcessListBoxType.MEMORY: - return (int) ((uint64) (p_a.mem_usage < p_b.mem_usage) - (uint64) (p_a.mem_usage > p_b.mem_usage)); + return (int) ((uint64) (app_a.mem_usage < app_b.mem_usage) - (uint64) (app_a.mem_usage > app_b.mem_usage)); } }; - bind_model(null, null); - model.remove_all(); - - SystemMonitor system_monitor = SystemMonitor.get_default(); - if(search_text == "") - { + var system_monitor = SystemMonitor.get_default(); + if(search_text == "") { switch(type) { default: case ProcessListBoxType.PROCESSOR: - foreach(unowned Process process in system_monitor.get_cpu_processes()) - model.insert_sorted(process, processcmp); + foreach(unowned AppItem app in system_monitor.get_apps()) { + if(app.cpu_load > APP_CPU_MIN_LOAD_LIMIT) + model.insert_sorted(app, app_cmp); + } break; case ProcessListBoxType.MEMORY: - foreach(unowned Process process in system_monitor.get_ram_processes()) - model.insert_sorted(process, processcmp); + foreach(unowned AppItem app in system_monitor.get_apps()) + if(app.mem_usage > APP_MEM_MIN_USAGE_LIMIT) + model.insert_sorted(app, app_cmp); break; } } - else - { - foreach(unowned Process process in system_monitor.get_ram_processes()) //because ram contains all processes - { - if(process.display_name.down().contains(search_text.down()) || process.cmdline.down().contains(search_text.down())) - model.insert_sorted(process, processcmp); + else { + foreach(unowned AppItem app in system_monitor.get_apps()) { + if(app.display_name.down().contains(search_text.down()) || app.representative_cmdline.down().contains(search_text.down())) + model.insert_sorted(app, app_cmp); } } empty = (model.get_n_items() == 0); - - bind_model(model, on_row_created); return true; } - public void search(string text) - { - search_text = text; - update(); - } - - private Gtk.Widget on_row_created (Object item) - { - Process process = (Process) item; - bool opened = false; - - if(opened_row != null) - if(process.cmdline == opened_row.process.cmdline) - opened = true; - - var row = new ProcessRow(process, type, opened); - if(opened) - opened_row = row; - - if(focused_row_cmdline != null) - { - if(process.cmdline == focused_row_cmdline) - { - //row.grab_focus(); TODO not working - //GLib.stdout.printf("grab focus for: " + focused_row_cmdline+ "\n"); - } - } - - return row; + private Gtk.Widget on_row_created (Object item) { + return new ProcessRow((AppItem) item, type); } - private void update_header(Gtk.ListBoxRow row, Gtk.ListBoxRow? before_row) - { - if(before_row == null) - row.set_header(null); - else - { + private void update_header(Gtk.ListBoxRow row, Gtk.ListBoxRow? before_row) { + if(before_row == null) + row.set_header(null); + else { var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL); separator.get_style_context().add_class("list"); - separator.show(); - row.set_header(separator); - } + separator.show(); + row.set_header(separator); + } } } } diff -Nru gnome-usage-3.30.0/src/process-row.vala gnome-usage-3.32.0/src/process-row.vala --- gnome-usage-3.30.0/src/process-row.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/process-row.vala 2019-03-22 14:43:03.000000000 +0000 @@ -23,7 +23,12 @@ [GtkTemplate (ui = "/org/gnome/Usage/ui/process-row.ui")] public class ProcessRow : Gtk.ListBoxRow { - ProcessListBoxType type; + public AppItem app { get; private set; } + public bool max_usage { get; private set; } + + private const string CSS_TAG_USER = "tag-user"; + private const string CSS_TAG_ROOT = "tag-root"; + private const string CSS_TAG_SYSTEM = "tag-system"; [GtkChild] private Gtk.Image icon; @@ -40,93 +45,40 @@ [GtkChild] private Gtk.Label load_label; - private Fdo.AccountsUser user; - - public Process process { get; private set; } - public bool max_usage { get; private set; } - public bool group { - get { - return process.sub_processes != null; - } - } - - private const int MAX_CPU_USAGE_LIMIT = 90; - private const int MAX_MEMORY_USAGE_LIMIT = 90; + private ProcessListBoxType type; - private const string CSS_TAG_USER = "tag-user"; - private const string CSS_TAG_ROOT = "tag-root"; - private const string CSS_TAG_SYSTEM = "tag-system"; - - public ProcessRow(Process process, ProcessListBoxType type, bool opened = false) + public ProcessRow(AppItem app, ProcessListBoxType type) { this.type = type; - this.process = process; - - load_icon(process.display_name); + this.app = app; + this.icon.gicon = app.get_icon(); update(); - - load_user_account(); - } - - private async void load_user_account() { - try { - Fdo.Accounts accounts = yield Bus.get_proxy (BusType.SYSTEM, - "org.freedesktop.Accounts", - "/org/freedesktop/Accounts"); - var user_account_path = yield accounts.FindUserById ((int64)process.uid); - this.user = yield Bus.get_proxy (BusType.SYSTEM, - "org.freedesktop.Accounts", - user_account_path); - update_user_tag(); - } catch (Error e) { - warning ("Unable to obtain user account: %s", e.message); - } - } - - private void load_icon(string display_name) - { - var app_info = SystemMonitor.get_default().get_app_info(display_name); - var app_icon = (app_info == null) ? null : app_info.get_icon(); - - if (app_info == null || app_icon == null) - icon.gicon = new GLib.ThemedIcon("system-run-symbolic"); - else - icon.gicon = app_icon; } private void update() { update_load_label(); update_user_tag(); - check_max_usage(); - set_styles(); - if(group) - title_label.label = process.display_name + " (" + process.sub_processes.size().to_string() + ")"; - else - title_label.label = process.display_name; + title_label.label = app.display_name; } private void update_load_label() { - CompareFunc sort = (a, b) => { - return (int) ((uint64) (a < b) - (uint64) (a > b)); - }; - switch(type) { case ProcessListBoxType.PROCESSOR: - load_label.label = ((int) process.cpu_load).to_string() + " %"; + load_label.label = ((int) app.cpu_load).to_string() + " %"; break; case ProcessListBoxType.MEMORY: - load_label.label = Utils.format_size_values(process.mem_usage); + load_label.label = Utils.format_size_values(app.mem_usage); break; } } private void update_user_tag() { - if (user == null) + if (app.user == null) return; remove_user_tag(); @@ -144,67 +96,37 @@ private void create_user_tag() { string class_name = ""; - if(user.LocalAccount) + if(app.user.LocalAccount) { class_name = CSS_TAG_USER; } - else if(user.AccountType == UserAccountType.ADMINISTRATOR) + else if(app.user.AccountType == UserAccountType.ADMINISTRATOR) { class_name = CSS_TAG_ROOT; } - else if(user.SystemAccount) + else if(app.user.SystemAccount) { class_name = CSS_TAG_SYSTEM; } user_tag_box.get_style_context().add_class(class_name); - user_tag_label.label = user.UserName; + user_tag_label.label = app.user.UserName; user_tag_box.visible = !is_logged_in(); } private bool is_logged_in(){ - return user.UserName == GLib.Environment.get_user_name(); - } - - private void check_max_usage() - { - switch(type) - { - case ProcessListBoxType.PROCESSOR: - if(process.cpu_load >= MAX_CPU_USAGE_LIMIT) - max_usage = true; - else - max_usage = false; - break; - - case ProcessListBoxType.MEMORY: - SystemMonitor monitor = SystemMonitor.get_default(); - - if((((double) process.mem_usage / monitor.ram_total) * 100) >= MAX_MEMORY_USAGE_LIMIT) - max_usage = true; - else - max_usage = false; - break; - } + return app.user.UserName == GLib.Environment.get_user_name(); } public new void activate() { var settings = Settings.get_default(); - if (process.cmdline in settings.get_strv ("unkillable-processes")) + if (app.representative_cmdline in settings.get_strv ("unkillable-processes")) return; - var dialog = new QuitProcessDialog(process); + var dialog = new QuitProcessDialog(app); dialog.set_transient_for(get_toplevel() as Gtk.Window); dialog.show_all(); } - - private void set_styles() - { - if(max_usage) - get_style_context().add_class("max"); - else - get_style_context().remove_class("max"); - } } } diff -Nru gnome-usage-3.30.0/src/process.vala gnome-usage-3.32.0/src/process.vala --- gnome-usage-3.30.0/src/process.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/process.vala 2019-03-22 14:43:03.000000000 +0000 @@ -24,8 +24,6 @@ { public Pid pid { get; private set; } public string cmdline { get; private set; } - public string cmdline_parameter { get; private set; } //Isn't parameters as "-p" etc, but parameter for running app, for ex. "--writer' with libreoffice, or "privacy" with gnome-control-center - public string display_name { get; private set; } public uint uid { get; private set; } public double cpu_load { get; set; default = 0; } @@ -36,30 +34,50 @@ public uint64 mem_usage { get; set; default = 0; } - public HashTable? sub_processes { get; set; } + public bool mark_as_updated { get; set; default = true; } + public ProcessStatus status { get; private set; default = ProcessStatus.SLEEPING; } - public bool alive { get; set; default = true; } - public ProcessStatus status { get; set; default = ProcessStatus.SLEEPING; } - - public Process(Pid pid, string cmdline, string cmdline_parameter, string display_name, uint uid) + public Process(Pid pid, string cmdline) { this.pid = pid; this.cmdline = cmdline; - this.cmdline_parameter = cmdline_parameter; - this.display_name = display_name; - this.uid = uid; + this.uid = _get_uid(); + } + + public void update_status () + { + GTop.ProcState proc_state; + GTop.get_proc_state (out proc_state, pid); + + switch(proc_state.state) + { + case GTop.PROCESS_RUNNING: + case GTop.PROCESS_UNINTERRUPTIBLE: + status = ProcessStatus.RUNNING; + break; + case GTop.PROCESS_SWAPPING: + case GTop.PROCESS_INTERRUPTIBLE: + case GTop.PROCESS_STOPPED: + status = ProcessStatus.SLEEPING; + break; + case GTop.PROCESS_DEAD: + case GTop.PROCESS_ZOMBIE: + default: + status = ProcessStatus.DEAD; + break; + } + + if(cpu_load > 0) + status = ProcessStatus.RUNNING; + + mark_as_updated = true; } - public void update_from_process(Process process) + private uint _get_uid() { - this.last_processor = process.last_processor; - this.cpu_load = process.cpu_load; - this.x_cpu_load = process.x_cpu_load; - this.cpu_last_used = process.cpu_last_used; - this.x_cpu_last_used = process.x_cpu_last_used; - this.mem_usage = process.mem_usage; - this.alive = process.alive; - this.status = process.status; + GTop.ProcUid procUid; + GTop.get_proc_uid(out procUid, pid); + return procUid.uid; } } diff -Nru gnome-usage-3.30.0/src/quit-process-dialog.vala gnome-usage-3.32.0/src/quit-process-dialog.vala --- gnome-usage-3.30.0/src/quit-process-dialog.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/quit-process-dialog.vala 2019-03-22 14:43:03.000000000 +0000 @@ -16,6 +16,7 @@ * along with this program. If not, see . * * Authors: Felipe Borges + * Petr Štětka */ using Gtk; @@ -25,36 +26,21 @@ [GtkTemplate (ui = "/org/gnome/Usage/ui/quit-process-dialog.ui")] public class QuitProcessDialog : Gtk.MessageDialog { - private Process process; + private AppItem app; - public QuitProcessDialog(Process process) + public QuitProcessDialog(AppItem app) { - this.process = process; - - this.text = this.text.printf(process.display_name); + this.app = app; + this.text = this.text.printf(app.display_name); } [GtkCallback] private void on_force_quit_button_clicked () { - if(this.process.sub_processes != null) - { - var sub_processes_pids = this.process.sub_processes.get_keys(); - foreach(Pid pid in sub_processes_pids) - kill(pid); - } - - kill(this.process.pid); - + app.kill(); this.destroy(); } - private void kill (Pid pid) - { - debug ("Terminating %d", (int) pid); - Posix.kill(pid, Posix.Signal.KILL); - } - [GtkCallback] public void cancel () { diff -Nru gnome-usage-3.30.0/src/speedometer.vala gnome-usage-3.32.0/src/speedometer.vala --- gnome-usage-3.30.0/src/speedometer.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/speedometer.vala 2019-03-22 14:43:03.000000000 +0000 @@ -88,9 +88,12 @@ { /* This is a Vala bug. It will cause a "warning". (content_area as Buildable).add_child(builder, child, type);*/ - if (child is Gtk.Label) + if (child is Gtk.Label) { content_area.add(child as Gtk.Widget); + return; + } + base.add_child(builder, child, type); } } diff -Nru gnome-usage-3.30.0/src/sub-process-list-box.vala gnome-usage-3.32.0/src/sub-process-list-box.vala --- gnome-usage-3.30.0/src/sub-process-list-box.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/sub-process-list-box.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -/* sub-process-list-box.vala - * - * Copyright (C) 2017 Red Hat, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Authors: Petr Štětka - */ - -namespace Usage -{ - [GtkTemplate (ui = "/org/gnome/Usage/ui/sub-process-list-box.ui")] - public class SubProcessListBox : Gtk.ListBox - { - ListStore model; - Process parent_process; - ProcessListBoxType type; - - class construct - { - set_css_name("subprocess-list"); - } - - construct - { - set_selection_mode (Gtk.SelectionMode.NONE); - set_header_func (update_header); - - row_activated.connect( (row) => { - var sub_process_row = (SubProcessSubRow) row; - sub_process_row.activate(); - }); - } - - public void init(Process process, ProcessListBoxType type) - { - this.type = type; - parent_process = process; - - model = new ListStore(typeof(Process)); - bind_model(model, on_row_created); - update(); - } - - private void update() - { - CompareDataFunc processcmp = (a, b) => { - Process p_a = (Process) a; - Process p_b = (Process) b; - - switch(type) - { - default: - case ProcessListBoxType.PROCESSOR: - return (int) ((uint64) (p_a.cpu_load < p_b.cpu_load) - (uint64) (p_a.cpu_load > p_b.cpu_load)); - case ProcessListBoxType.MEMORY: - return (int) ((uint64) (p_a.mem_usage < p_b.mem_usage) - (uint64) (p_a.mem_usage > p_b.mem_usage)); - } - }; - - if(parent_process.sub_processes != null) - { - foreach(unowned Process process in parent_process.sub_processes.get_values()) - { - model.insert_sorted(process, processcmp); - } - } - } - - private Gtk.Widget on_row_created (Object item) - { - Process process = (Process) item; - var row = new SubProcessSubRow(process, type); - return row; - } - - private void update_header(Gtk.ListBoxRow row, Gtk.ListBoxRow? before_row) - { - if(before_row == null) - row.set_header(null); - else - { - var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL); - separator.get_style_context().add_class("list"); - separator.show(); - row.set_header(separator); - } - } - } -} diff -Nru gnome-usage-3.30.0/src/system-monitor.vala gnome-usage-3.32.0/src/system-monitor.vala --- gnome-usage-3.30.0/src/system-monitor.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/system-monitor.vala 2019-03-22 14:43:03.000000000 +0000 @@ -22,24 +22,20 @@ { public class SystemMonitor : Object { - public signal void cpu_processes_ready(); + public bool process_list_ready { get; private set; default = false; } public double cpu_load { get; private set; } public double[] x_cpu_load { get; private set; } public uint64 ram_usage { get; private set; } public uint64 ram_total { get; private set; } public uint64 swap_usage { get; private set; } public uint64 swap_total { get; private set; } + public bool group_system_apps { get; set; default = true; } private CpuMonitor cpu_monitor; private MemoryMonitor memory_monitor; - private HashTable process_table; - private HashTable cpu_process_table; - private HashTable ram_process_table; - + private HashTable app_table; private int process_mode = GTop.KERN_PROC_ALL; - private GLib.List apps_info; - private static SystemMonitor system_monitor; public static SystemMonitor get_default() @@ -50,74 +46,55 @@ return system_monitor; } - public List get_processes() - { - return process_table.get_values(); - } - - public unowned Process get_process_by_pid(Pid pid) - { - return process_table.get(pid); - } - - public List get_cpu_processes() - { - return cpu_process_table.get_values(); - } - - public unowned Process get_cpu_process(string cmdline) - { - return cpu_process_table[cmdline]; - } - - public List get_ram_processes() + public List get_apps() { - return ram_process_table.get_values(); + return app_table.get_values(); } - public unowned Process get_ram_process(string cmdline) + public unowned AppItem get_app_by_name(string name) { - return ram_process_table[cmdline]; - } - - public unowned GLib.List get_apps_info() - { - return apps_info; - } - - public AppInfo? get_app_info(string desktop_id) - { - foreach(var app_info in apps_info) - if (app_info.get_display_name() == desktop_id) - return app_info; - - return null; + return app_table.get(name); } public SystemMonitor() { GTop.init(); + AppItem.init(); cpu_monitor = new CpuMonitor(); memory_monitor = new MemoryMonitor(); - process_table = new HashTable(int_hash, int_equal); - cpu_process_table = new HashTable(str_hash, str_equal); - ram_process_table = new HashTable(str_hash, str_equal); + app_table = new HashTable(str_hash, str_equal); + var settings = Settings.get_default(); + + init(); + this.notify["group-system-apps"].connect ((sender, property) => { + init(); + }); + Timeout.add(settings.data_update_interval, update_data); + } + + private void init() + { var settings = Settings.get_default(); - apps_info = AppInfo.get_all(); + app_table.remove_all(); + process_list_ready = false; + + if(group_system_apps) { + var system = new AppItem.system(); + app_table.insert("system" , system); + } update_data(); - Timeout.add(settings.data_update_interval, update_data); Timeout.add(settings.data_update_interval, () => { - cpu_processes_ready(); + process_list_ready = true; return false; }); } - public bool update_data() + private bool update_data() { cpu_monitor.update(); memory_monitor.update(); @@ -129,128 +106,84 @@ swap_usage = memory_monitor.get_swap_usage(); swap_total = memory_monitor.get_swap_total(); - foreach(unowned Process process in process_table.get_values()) - { - process.alive = false; - } - - set_alive_false(ref cpu_process_table); - set_alive_false(ref ram_process_table); - GTop.Proclist proclist; var pids = GTop.get_proclist (out proclist, process_mode); + foreach(var app in app_table.get_values()) + app.mark_as_not_updated(); + for(uint i = 0; i < proclist.number; i++) { - if (!(pids[i] in process_table)) + string cmd = get_full_process_cmd(pids[i]); + string app_id = cmd; + + if(group_system_apps && is_system_app(cmd)) + app_id = "system"; + + if (!(app_id in app_table)) { - string cmdline_parameter; - string cmdline = get_full_process_cmd(pids[i], out cmdline_parameter); - string display_name = get_display_name(cmdline, cmdline_parameter); - uint uid = get_uid(pids[i]); - var process = new Process(pids[i], cmdline, cmdline_parameter, display_name, uid); - cpu_monitor.update_process(ref process); - process_table.insert (pids[i], (owned) process); + var process = new Process(pids[i], cmd); + update_process(ref process); + var app = new AppItem(process); + app_table.insert (app_id, (owned) app); } else { - Process process = process_table[pids[i]]; - process.alive = true; - update_process_status(ref process); - cpu_monitor.update_process(ref process); - memory_monitor.update_process(ref process); - } - } + AppItem app = app_table[app_id]; - foreach(unowned Process process in process_table.get_values()) - { - if (!process.alive) - { - process.status = ProcessStatus.DEAD; - process_table.remove (process.pid); + if (!app.contains_process(pids[i])) + { + var process = new Process(pids[i], cmd); + update_process(ref process); + app.insert_process(process); + } + else + { + var process = app.get_process_by_pid(pids[i]); + update_process(ref process); + app.replace_process(process); + } } } - var process_table_temp = new HashTable(int_hash, int_equal); - foreach(unowned Process process in process_table.get_values()) - { - if(process.cpu_load >= 1) - process_table_temp.insert(process.pid, process); - } - update_processes(process_table_temp, ref cpu_process_table); - - process_table_temp.remove_all(); - foreach(unowned Process process in process_table.get_values()) - { - if(process.mem_usage >= 1) - process_table_temp.insert(process.pid, process); - } - update_processes(process_table_temp, ref ram_process_table); + foreach(var app in app_table.get_values()) + app.remove_processes(); return true; } - private uint get_uid(Pid pid) + private void update_process(ref Process process) { - GTop.ProcUid procUid; - GTop.get_proc_uid(out procUid, pid); - return procUid.uid; + cpu_monitor.update_process(ref process); + memory_monitor.update_process(ref process); + process.update_status(); } - private string get_display_name(string cmdline, string cmdline_parameter) - { - AppInfo app_info = null; - foreach (AppInfo info in apps_info) - { - string commandline = info.get_commandline(); - if(commandline != null) - { - for (int i = 0; i < commandline.length; i++) - { - if(commandline[i] == ' ' && commandline[i] == '%') - commandline = commandline.substring(0, i); - } - - commandline = Path.get_basename(commandline); - string process_full_cmd = cmdline + " " + cmdline_parameter; - if(commandline == process_full_cmd) - app_info = info; - else if(commandline.contains("google-" + cmdline + "-")) //Fix for Google Chrome naming - app_info = info; + private string? sanity_cmd(string commandline) + { + string? cmd = null; - if(app_info == null) - { - commandline = info.get_commandline(); - for (int i = 0; i < commandline.length; i++) - { - if(commandline[i] == ' ') - commandline = commandline.substring(0, i); - } - - if(info.get_commandline().has_prefix(commandline + " " + commandline + "://")) //Fix for Steam naming - commandline = info.get_commandline(); - - commandline = Path.get_basename(commandline); - if(commandline == cmdline) - app_info = info; - } + if(commandline != null) + { + try { + var rgx = new Regex("[^a-zA-Z0-9._-]"); + cmd = Path.get_basename(commandline.split(" ")[0]); + cmd = rgx.replace(commandline, commandline.length, 0, ""); + } catch (RegexError e) { + warning ("Unable to obtain process command: %s", e.message); } } + return cmd; + } - if(app_info != null) - return app_info.get_display_name(); - else - return cmdline; - } - - private string get_full_process_cmd (Pid pid, out string cmd_parameter) + private string get_full_process_cmd (Pid pid) { GTop.ProcArgs proc_args; GTop.ProcState proc_state; string[] args = GTop.get_proc_argv (out proc_args, pid, 0); GTop.get_proc_state (out proc_state, pid); string cmd = (string) proc_state.cmd; - cmd_parameter = ""; + string cmd_parameter = ""; var secure_arguments = new string[2]; @@ -285,147 +218,16 @@ else cmd_parameter = secure_arguments[0]; - return name; + return sanity_cmd(name); } } - return cmd; - } - - private void update_process_status (ref Process process) - { - GTop.ProcState proc_state; - GTop.get_proc_state (out proc_state, process.pid); - - switch(proc_state.state) - { - case GTop.PROCESS_RUNNING: - case GTop.PROCESS_UNINTERRUPTIBLE: - process.status = ProcessStatus.RUNNING; - break; - case GTop.PROCESS_SWAPPING: - case GTop.PROCESS_INTERRUPTIBLE: - case GTop.PROCESS_STOPPED: - process.status = ProcessStatus.SLEEPING; - break; - case GTop.PROCESS_DEAD: - case GTop.PROCESS_ZOMBIE: - default: - process.status = ProcessStatus.DEAD; - break; - } - - if(process.cpu_load > 0) - process.status = ProcessStatus.RUNNING; + return sanity_cmd(cmd); } - private void set_alive_false(ref HashTable process_table) + private bool is_system_app(string cmdline) { - foreach(unowned Process process in process_table.get_values()) - { - if(process.sub_processes == null) - process.alive = false; - else - { - foreach(unowned Process sub_process in process.sub_processes.get_values()) - { - sub_process.alive = false; - } - } - } - } - - private void update_processes(HashTable from_table, ref HashTable to_table) - { - foreach(unowned Process process_it in from_table.get_values()) - { - if(process_it.cmdline in to_table) //subprocess or update process - { - if(to_table[process_it.cmdline].sub_processes != null) //subprocess - { - if(process_it.pid in to_table[process_it.cmdline].sub_processes) //update subprocess - { - unowned Process process = to_table[process_it.cmdline].sub_processes[process_it.pid]; - process.update_from_process(process_it); - } - else //add subrow - { - var process = new Process(process_it.pid, process_it.cmdline, process_it.cmdline_parameter, process_it.display_name, process_it.uid); - process.update_from_process(process_it); - to_table[process.cmdline].sub_processes.insert(process.pid, (owned) process); - } - } - else //update process or transform to group and add subrow - { - if(process_it.pid == to_table[process_it.cmdline].pid) //update process - { - unowned Process process = to_table[process_it.cmdline]; - process.update_from_process(process_it); - } - else //transform to group and add subrow - { - to_table[process_it.cmdline].sub_processes = new HashTable(int_hash, int_equal); - unowned Process process = to_table[process_it.cmdline]; - - var sub_process_one = new Process(process.pid, process.cmdline, process.cmdline_parameter, process.display_name, process.uid); - sub_process_one.update_from_process(process); - to_table[process_it.cmdline].sub_processes.insert(sub_process_one.pid, (owned) sub_process_one); - - var sub_process = new Process(process_it.pid, process_it.cmdline, process_it.cmdline_parameter, process_it.display_name, process_it.uid); - sub_process.update_from_process(process_it); - to_table[process_it.cmdline].sub_processes.insert(process_it.pid, (owned) sub_process); - } - } - } - else //add process - { - var process = new Process(process_it.pid, process_it.cmdline, process_it.cmdline_parameter, process_it.display_name, process_it.uid); - process.update_from_process(process_it); - to_table.insert(process.cmdline, (owned) process); - } - } - - foreach(unowned Process process in to_table.get_values()) - { - if(process.sub_processes == null) - { - if(!process.alive) - to_table.remove (process.cmdline); - } - else - { - double cpu_load = 0; - uint64 mem_usage = 0; - foreach(unowned Process sub_process in process.sub_processes.get_values()) - { - if (!sub_process.alive) - process.sub_processes.remove(sub_process.pid); - else - { - cpu_load += sub_process.cpu_load; - mem_usage += sub_process.mem_usage; - } - } - process.cpu_load = cpu_load; - process.mem_usage = mem_usage; - - if(process.sub_processes.length == 1) //tranform to process - { - foreach(unowned Process sub_process in process.sub_processes.get_values()) //only one - { - process.sub_processes = null; - process = sub_process; - } - } - else if(process.sub_processes.length == 0) - { - process.sub_processes = null; - process.alive = false; - process.status = ProcessStatus.DEAD; - to_table.remove(process.cmdline); - } - } - } + return !AppItem.have_app_info(cmdline); } } } diff -Nru gnome-usage-3.30.0/src/utils.vala gnome-usage-3.32.0/src/utils.vala --- gnome-usage-3.30.0/src/utils.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/utils.vala 2019-03-22 14:43:03.000000000 +0000 @@ -88,7 +88,7 @@ [DBus (name = "org.freedesktop.Accounts")] public interface Fdo.Accounts : Object { - public abstract async string FindUserById (int64 id) throws IOError; + public abstract async string FindUserById (int64 id) throws GLib.Error; } [DBus (name = "org.freedesktop.Accounts.User")] diff -Nru gnome-usage-3.30.0/src/view.vala gnome-usage-3.32.0/src/view.vala --- gnome-usage-3.30.0/src/view.vala 2018-09-25 13:38:05.000000000 +0000 +++ gnome-usage-3.32.0/src/view.vala 2019-03-22 14:43:03.000000000 +0000 @@ -24,7 +24,7 @@ { public string title; - public View () + protected View () { visible = true; } diff -Nru gnome-usage-3.30.0/vapi/libdazzle-1.0.vapi gnome-usage-3.32.0/vapi/libdazzle-1.0.vapi --- gnome-usage-3.30.0/vapi/libdazzle-1.0.vapi 1970-01-01 00:00:00.000000000 +0000 +++ gnome-usage-3.32.0/vapi/libdazzle-1.0.vapi 2019-03-22 14:43:03.000000000 +0000 @@ -0,0 +1,2019 @@ +/* libdazzle-1.0.vapi generated by vapigen, do not modify. */ + +[CCode (cprefix = "Dzl", gir_namespace = "Dazzle", gir_version = "1.0", lower_case_cprefix = "dzl_")] +namespace Dazzle { + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_animation_get_type ()")] + public class Animation : GLib.InitiallyUnowned { + [CCode (has_construct_function = false)] + protected Animation (); + public void add_property (GLib.ParamSpec pspec, GLib.Value value); + public static uint calculate_duration (Gdk.Monitor monitor, double from_value, double to_value); + public void start (); + public void stop (); + [NoAccessorMethod] + public uint duration { construct; } + [NoAccessorMethod] + public Gdk.FrameClock frame_clock { construct; } + [NoAccessorMethod] + public Dazzle.AnimationMode mode { construct; } + [NoAccessorMethod] + public GLib.Object target { construct; } + public signal void tick (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_application_get_type ()")] + public class Application : Gtk.Application, GLib.ActionGroup, GLib.ActionMap { + [CCode (has_construct_function = false)] + protected Application (); + public virtual void add_resources (string resource_path); + public unowned GLib.Menu get_menu_by_id (string menu_id); + public unowned Dazzle.MenuManager get_menu_manager (); + public unowned Dazzle.ShortcutManager get_shortcut_manager (); + public unowned Dazzle.ThemeManager get_theme_manager (); + public virtual void remove_resources (string resource_path); + public Dazzle.MenuManager menu_manager { get; } + public Dazzle.ShortcutManager shortcut_manager { get; } + public Dazzle.ThemeManager theme_manager { get; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_application_window_get_type ()")] + public class ApplicationWindow : Gtk.ApplicationWindow, Atk.Implementor, GLib.ActionGroup, GLib.ActionMap, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected ApplicationWindow (); + [Version (since = "3.26")] + public virtual bool get_fullscreen (); + [Version (since = "3.26")] + public unowned Gtk.Widget get_titlebar (); + [Version (since = "3.26")] + public virtual void set_fullscreen (bool fullscreen); + [Version (since = "3.26")] + public void set_titlebar (Gtk.Widget titlebar); + public bool fullscreen { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_bin_get_type ()")] + public class Bin : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public Bin (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_binding_group_get_type ()")] + public class BindingGroup : GLib.Object { + [CCode (has_construct_function = false)] + public BindingGroup (); + public void bind (string source_property, GLib.Object target, string target_property, GLib.BindingFlags flags); + public void bind_full (string source_property, GLib.Object target, string target_property, GLib.BindingFlags flags, GLib.BindingTransformFunc? transform_to, owned GLib.BindingTransformFunc? transform_from); + public void bind_with_closures (string source_property, GLib.Object target, string target_property, GLib.BindingFlags flags, GLib.Closure? transform_to, GLib.Closure? transform_from); + public unowned GLib.Object? get_source (); + public void set_source (GLib.Object? source); + public GLib.Object source { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_bolding_label_get_type ()")] + public class BoldingLabel : Gtk.Label, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected BoldingLabel (); + public void set_bold (bool bold); + public void set_weight (Pango.Weight weight); + public bool bold { set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_box_get_type ()")] + public class Box : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public Box (); + public int get_max_width_request (); + public unowned Gtk.Widget? get_nth_child (uint nth); + public void set_max_width_request (int max_width_request); + public int max_width_request { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_box_theatric_get_type ()")] + public class BoxTheatric : GLib.Object { + [CCode (has_construct_function = false)] + protected BoxTheatric (); + [NoAccessorMethod] + public double alpha { get; set; } + [NoAccessorMethod] + public string background { owned get; set; } + [NoAccessorMethod] + public int height { get; set; } + [NoAccessorMethod] + public GLib.Icon icon { owned get; set; } + [NoAccessorMethod] + public void* surface { construct; } + [NoAccessorMethod] + public Gtk.Widget target { owned get; construct; } + [NoAccessorMethod] + public int width { get; set; } + [NoAccessorMethod] + public int x { get; set; } + [NoAccessorMethod] + public int y { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_centering_bin_get_type ()")] + public class CenteringBin : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public CenteringBin (); + [NoAccessorMethod] + public int max_width_request { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_child_property_action_get_type ()")] + public class ChildPropertyAction : GLib.Object, GLib.Action { + [CCode (has_construct_function = false)] + protected ChildPropertyAction (); + public static GLib.Action @new (string name, Gtk.Container container, Gtk.Widget child, string child_property_name); + [NoAccessorMethod] + public Gtk.Widget child { owned get; } + [NoAccessorMethod] + public string child_property_name { owned get; } + [NoAccessorMethod] + public Gtk.Container container { owned get; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_column_layout_get_type ()")] + public class ColumnLayout : Gtk.Container, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ColumnLayout (); + public int get_column_spacing (); + public int get_column_width (); + public uint get_max_columns (); + public int get_row_spacing (); + public void set_column_spacing (int column_spacing); + public void set_column_width (int column_width); + public void set_max_columns (uint max_columns); + public void set_row_spacing (int row_spacing); + public int column_spacing { get; set; } + public int column_width { get; set; } + public uint max_columns { get; set; } + public int row_spacing { get; set; } + } + [CCode (cheader_filename = "dazzle.h", ref_function = "dzl_counter_arena_ref", type_id = "dzl_counter_arena_get_type ()", unref_function = "dzl_counter_arena_unref")] + [Compact] + public class CounterArena { + [CCode (has_construct_function = false)] + public CounterArena.for_pid (GLib.Pid pid); + public void @foreach (Dazzle.CounterForeachFunc func); + [CCode (cheader_filename = "dazzle.h")] + public static Dazzle.CounterArena get_default (); + public Dazzle.CounterArena @ref (); + public void register (Dazzle.Counter counter); + public void unref (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_counters_window_get_type ()")] + public class CountersWindow : Gtk.Window, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public CountersWindow (); + public unowned Dazzle.CounterArena? get_arena (); + public void set_arena (Dazzle.CounterArena arena); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_cpu_graph_get_type ()")] + public class CpuGraph : Dazzle.GraphView, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected CpuGraph (); + [CCode (has_construct_function = false, type = "GtkWidget*")] + public CpuGraph.full (int64 timespan, uint max_samples); + [NoAccessorMethod] + public uint max_samples { get; construct; } + [NoAccessorMethod] + public int64 timespan { get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_cpu_model_get_type ()")] + public class CpuModel : Dazzle.GraphModel { + [CCode (has_construct_function = false, type = "DzlGraphModel*")] + public CpuModel (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_css_provider_get_type ()")] + public class CssProvider : Gtk.CssProvider, Gtk.StyleProvider { + [CCode (has_construct_function = false, type = "GtkCssProvider*")] + public CssProvider (string base_path); + [NoAccessorMethod] + public string base_path { owned get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_directory_model_get_type ()")] + public class DirectoryModel : GLib.Object, GLib.ListModel { + [CCode (has_construct_function = false)] + protected DirectoryModel (); + public unowned GLib.File get_directory (); + public static GLib.ListModel @new (GLib.File directory); + public void set_directory (GLib.File directory); + public void set_visible_func (owned Dazzle.DirectoryModelVisibleFunc visible_func); + public GLib.File directory { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_directory_reaper_get_type ()")] + public class DirectoryReaper : GLib.Object { + [CCode (has_construct_function = false)] + public DirectoryReaper (); + public void add_directory (GLib.File directory, GLib.TimeSpan min_age); + public void add_file (GLib.File file, GLib.TimeSpan min_age); + public void add_glob (GLib.File directory, string glob, GLib.TimeSpan min_age); + public bool execute (GLib.Cancellable? cancellable = null) throws GLib.Error; + public async bool execute_async (GLib.Cancellable? cancellable = null) throws GLib.Error; + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_bin_get_type ()")] + public class DockBin : Gtk.Container, Atk.Implementor, Dazzle.Dock, Dazzle.DockItem, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockBin (); + public unowned Gtk.Widget get_bottom_edge (); + public unowned Gtk.Widget? get_center_widget (); + public unowned Gtk.Widget get_left_edge (); + public unowned Gtk.Widget get_right_edge (); + public unowned Gtk.Widget get_top_edge (); + [NoAccessorMethod] + public bool bottom_visible { get; set; } + [NoAccessorMethod] + public bool left_visible { get; set; } + [NoAccessorMethod] + public bool right_visible { get; set; } + [NoAccessorMethod] + public bool top_visible { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_bin_edge_get_type ()")] + public class DockBinEdge : Dazzle.DockRevealer, Atk.Implementor, Dazzle.DockItem, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected DockBinEdge (); + public Gtk.PositionType get_edge (); + [NoAccessorMethod] + public Gtk.PositionType edge { get; set; } + public virtual signal void move_to_bin_child (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_manager_get_type ()")] + public class DockManager : GLib.Object { + [CCode (has_construct_function = false)] + public DockManager (); + [Version (since = "3.26")] + public void pause_grabs (); + public void release_transient_grab (); + [Version (since = "3.26")] + public void unpause_grabs (); + [HasEmitter] + public virtual signal void register_dock (Dazzle.Dock dock); + [HasEmitter] + public virtual signal void unregister_dock (Dazzle.Dock dock); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_overlay_get_type ()")] + public class DockOverlay : Gtk.EventBox, Atk.Implementor, Dazzle.Dock, Dazzle.DockItem, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockOverlay (); + public unowned Dazzle.DockOverlayEdge get_edge (Gtk.PositionType position); + public unowned Gtk.Adjustment get_edge_adjustment (Gtk.PositionType position); + public virtual signal void hide_edges (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_overlay_edge_get_type ()")] + public class DockOverlayEdge : Dazzle.Bin, Atk.Implementor, Dazzle.DockItem, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected DockOverlayEdge (); + public Gtk.PositionType get_edge (); + public int get_position (); + public void set_edge (Gtk.PositionType edge); + public void set_position (int position); + public Gtk.PositionType edge { get; set; } + public int position { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_paned_get_type ()")] + public class DockPaned : Dazzle.MultiPaned, Atk.Implementor, Dazzle.DockItem, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockPaned (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_revealer_get_type ()")] + public class DockRevealer : Dazzle.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockRevealer (); + public void animate_to_position (int position, uint transition_duration); + public bool get_child_revealed (); + public int get_position (); + public bool get_position_set (); + public bool get_reveal_child (); + public uint get_transition_duration (); + public Dazzle.DockRevealerTransitionType get_transition_type (); + public bool is_animating (); + public void set_position (int position); + public void set_position_set (bool position_set); + public void set_reveal_child (bool reveal_child); + public void set_transition_duration (uint transition_duration); + public void set_transition_type (Dazzle.DockRevealerTransitionType transition_type); + public bool child_revealed { get; } + public int position { get; set; } + public bool position_set { get; set; } + public bool reveal_child { get; set; } + public uint transition_duration { get; set; } + public Dazzle.DockRevealerTransitionType transition_type { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_stack_get_type ()")] + public class DockStack : Gtk.Box, Atk.Implementor, Dazzle.DockItem, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockStack (); + public Gtk.PositionType get_edge (); + public bool get_show_pinned_button (); + public Dazzle.TabStyle get_style (); + public void set_edge (Gtk.PositionType edge); + public void set_show_pinned_button (bool show_pinned_button); + public void set_style (Dazzle.TabStyle style); + public Gtk.PositionType edge { get; set; } + public bool show_pinned_button { get; set; } + public Dazzle.TabStyle style { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_transient_grab_get_type ()")] + public class DockTransientGrab : GLib.Object { + [CCode (has_construct_function = false)] + public DockTransientGrab (); + public void acquire (); + public void add_item (Dazzle.DockItem item); + public void cancel (); + public bool contains (Dazzle.DockItem item); + public uint get_timeout (); + public bool is_descendant (Gtk.Widget widget); + public void release (); + public void remove_item (Dazzle.DockItem item); + public void set_timeout (uint timeout); + public void steal_common_ancestors (Dazzle.DockTransientGrab other); + public uint timeout { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_widget_get_type ()")] + public class DockWidget : Dazzle.Bin, Atk.Implementor, Dazzle.DockItem, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockWidget (); + public void set_icon_name (string icon_name); + public void set_title (string title); + [NoAccessorMethod] + public bool can_close { get; set; } + [NoAccessorMethod] + public string icon_name { owned get; set; } + [NoAccessorMethod] + public Dazzle.DockManager manager { owned get; set; } + [NoAccessorMethod] + public string title { owned get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_dock_window_get_type ()")] + public class DockWindow : Gtk.Window, Atk.Implementor, Dazzle.Dock, Dazzle.DockItem, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public DockWindow (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_elastic_bin_get_type ()")] + public class ElasticBin : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ElasticBin (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_empty_state_get_type ()")] + public class EmptyState : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public EmptyState (); + public unowned string get_icon_name (); + public unowned string get_subtitle (); + public unowned string get_title (); + public void set_icon_name (string icon_name); + public void set_resource (string resource); + public void set_subtitle (string title); + public void set_title (string title); + public string icon_name { get; set; } + [NoAccessorMethod] + public int pixel_size { get; set; } + public string resource { set; } + public string subtitle { get; set; } + public string title { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_entry_box_get_type ()")] + public class EntryBox : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public EntryBox (); + [NoAccessorMethod] + public int max_width_chars { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_file_chooser_entry_get_type ()")] + public class FileChooserEntry : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public FileChooserEntry (string title, Gtk.FileChooserAction action); + public GLib.File? get_file (); + public void set_file (GLib.File file); + [NoAccessorMethod] + public Gtk.FileChooserAction action { get; set; } + [NoAccessorMethod] + public bool create_folders { get; set; } + [NoAccessorMethod] + public bool do_overwrite_confirmation { get; set; } + public GLib.File file { owned get; set; } + [NoAccessorMethod] + public Gtk.FileFilter filter { owned get; set; } + [NoAccessorMethod] + public bool local_only { get; set; } + [NoAccessorMethod] + public int max_width_chars { get; set; } + [NoAccessorMethod] + public bool show_hidden { get; set; } + [NoAccessorMethod] + public string title { owned get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_file_transfer_get_type ()")] + public class FileTransfer : GLib.Object { + [CCode (has_construct_function = false)] + public FileTransfer (); + public void add (GLib.File src, GLib.File dest); + public bool execute (int io_priority = GLib.Priority.LOW, GLib.Cancellable? cancellable = null) throws GLib.Error; + public async bool execute_async (int io_priority = GLib.Priority.LOW, GLib.Cancellable? cancellable = null) throws GLib.Error; + public Dazzle.FileTransferFlags get_flags (); + public double get_progress (); + public void set_flags (Dazzle.FileTransferFlags flags); + [Version (since = "3.28")] + public Dazzle.FileTransferStat stat (); + public Dazzle.FileTransferFlags flags { get; set; } + public double progress { get; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_fuzzy_index_get_type ()")] + public class FuzzyIndex : GLib.Object { + [CCode (has_construct_function = false)] + public FuzzyIndex (); + public GLib.Variant? get_metadata (string key); + public unowned string get_metadata_string (string key); + public uint32 get_metadata_uint32 (string key); + public uint64 get_metadata_uint64 (string key); + public bool load_file (GLib.File file, GLib.Cancellable? cancellable = null) throws GLib.Error; + public async bool load_file_async (GLib.File file, GLib.Cancellable? cancellable = null) throws GLib.Error; + public async GLib.ListModel query_async (string query, uint max_matches, GLib.Cancellable? cancellable = null) throws GLib.Error; + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_fuzzy_index_builder_get_type ()")] + public class FuzzyIndexBuilder : GLib.Object { + [CCode (has_construct_function = false)] + public FuzzyIndexBuilder (); + public bool get_case_sensitive (); + public unowned GLib.Variant get_document (uint64 document_id); + public uint64 insert (string key, GLib.Variant document, uint priority); + public void set_case_sensitive (bool case_sensitive); + public void set_metadata (string key, GLib.Variant value); + public void set_metadata_string (string key, string value); + public void set_metadata_uint32 (string key, uint32 value); + public void set_metadata_uint64 (string key, uint64 value); + public bool write (GLib.File file, int io_priority = GLib.Priority.LOW, GLib.Cancellable? cancellable = null) throws GLib.Error; + public async bool write_async (GLib.File file, int io_priority = GLib.Priority.LOW, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool case_sensitive { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_fuzzy_index_cursor_get_type ()")] + public class FuzzyIndexCursor : GLib.Object, GLib.AsyncInitable, GLib.ListModel { + [CCode (has_construct_function = false)] + protected FuzzyIndexCursor (); + public unowned Dazzle.FuzzyIndex get_index (); + [NoAccessorMethod] + public bool case_sensitive { get; construct; } + [NoAccessorMethod] + public Dazzle.FuzzyIndex index { construct; } + [NoAccessorMethod] + public uint max_matches { get; construct; } + [NoAccessorMethod] + public string query { owned get; construct; } + [NoAccessorMethod] + public GLib.VariantDict tables { construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_fuzzy_index_match_get_type ()")] + public class FuzzyIndexMatch : GLib.Object { + [CCode (has_construct_function = false)] + protected FuzzyIndexMatch (); + public unowned GLib.Variant get_document (); + public unowned string get_key (); + public uint get_priority (); + public float get_score (); + public GLib.Variant document { get; construct; } + public string key { get; construct; } + public uint priority { get; construct; } + public float score { get; construct; } + } + [CCode (cheader_filename = "dazzle.h", ref_function = "dzl_fuzzy_mutable_index_ref", type_id = "dzl_fuzzy_mutable_index_get_type ()", unref_function = "dzl_fuzzy_mutable_index_unref")] + [Compact] + public class FuzzyMutableIndex { + [CCode (has_construct_function = false)] + public FuzzyMutableIndex (bool case_sensitive); + public void begin_bulk_insert (); + public bool contains (string key); + public void end_bulk_insert (); + public void insert (string key, void* value); + public GLib.Array match (string needle, size_t max_matches); + public Dazzle.FuzzyMutableIndex @ref (); + public void remove (string key); + public void set_free_func (GLib.DestroyNotify free_func); + public void unref (); + [CCode (has_construct_function = false)] + public FuzzyMutableIndex.with_free_func (bool case_sensitive, GLib.DestroyNotify free_func); + } + [CCode (cheader_filename = "dazzle.h", lower_case_csuffix = "graph_view_column", type_id = "dzl_graph_view_column_get_type ()")] + public class GraphColumn : GLib.Object { + [CCode (has_construct_function = false)] + public GraphColumn (string name, GLib.Type value_type); + public unowned string get_name (); + public void set_name (string name); + public string name { get; set; } + [NoAccessorMethod] + public GLib.Type value_type { get; construct; } + } + [CCode (cheader_filename = "dazzle.h", lower_case_csuffix = "graph_view_line_renderer", type_id = "dzl_graph_view_line_renderer_get_type ()")] + public class GraphLineRenderer : GLib.Object, Dazzle.GraphRenderer { + [CCode (has_construct_function = false)] + public GraphLineRenderer (); + public unowned Gdk.RGBA? get_stroke_color_rgba (); + public void set_stroke_color (string stroke_color); + public void set_stroke_color_rgba (Gdk.RGBA stroke_color_rgba); + [NoAccessorMethod] + public uint column { get; set; } + [NoAccessorMethod] + public double line_width { get; set; } + [NoAccessorMethod] + public string stroke_color { owned get; set; } + public Gdk.RGBA stroke_color_rgba { get; set; } + } + [CCode (cheader_filename = "dazzle.h", lower_case_csuffix = "graph_view_model", type_id = "dzl_graph_view_model_get_type ()")] + public class GraphModel : GLib.Object { + [CCode (has_construct_function = false)] + public GraphModel (); + public uint add_column (Dazzle.GraphColumn column); + public int64 get_end_time (); + public bool get_iter_first (out Dazzle.GraphModelIter iter); + public bool get_iter_last (out Dazzle.GraphModelIter iter); + public uint get_max_samples (); + public uint get_n_columns (); + public GLib.TimeSpan get_timespan (); + public static int64 iter_get_timestamp (Dazzle.GraphModelIter iter); + public static GLib.Value iter_get_value (Dazzle.GraphModelIter iter, uint column); + public static bool iter_next (ref Dazzle.GraphModelIter iter); + [Version (since = "3.30")] + public static void iter_set_value (Dazzle.GraphModelIter iter, uint column, GLib.Value value); + public void push (out Dazzle.GraphModelIter iter, int64 timestamp); + public void set_max_samples (uint n_rows); + public void set_timespan (GLib.TimeSpan timespan); + public uint max_samples { get; set construct; } + public int64 timespan { get; set construct; } + [NoAccessorMethod] + public double value_max { get; set; } + [NoAccessorMethod] + public double value_min { get; set; } + public signal void changed (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_graph_view_get_type ()")] + public class GraphView : Gtk.DrawingArea, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public GraphView (); + public void add_renderer (Dazzle.GraphRenderer renderer); + public unowned Dazzle.GraphModel? get_model (); + public void set_model (Dazzle.GraphModel model); + public Dazzle.GraphModel model { get; set; } + } + [CCode (cheader_filename = "dazzle.h", ref_function = "dzl_heap_ref", type_id = "dzl_heap_get_type ()", unref_function = "dzl_heap_unref")] + [Compact] + public class Heap { + public weak string data; + public size_t len; + [CCode (has_construct_function = false)] + public Heap (uint element_size, [CCode (scope = "async")] GLib.CompareFunc compare_func); + public bool extract (void* result); + public bool extract_index (size_t index_, void* result); + public void insert_vals (void* data, uint len); + public Dazzle.Heap @ref (); + public void unref (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_joined_menu_get_type ()")] + public class JoinedMenu : GLib.MenuModel { + [CCode (has_construct_function = false)] + public JoinedMenu (); + public void append_menu (GLib.MenuModel model); + public uint get_n_joined (); + public void prepend_menu (GLib.MenuModel model); + public void remove_index (uint index); + public void remove_menu (GLib.MenuModel model); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_list_box_get_type ()")] + public class ListBox : Gtk.ListBox, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ListBox (GLib.Type row_type, string property_name); + public unowned GLib.ListModel? get_model (); + public unowned string get_property_name (); + public GLib.Type get_row_type (); + public void set_model (GLib.ListModel model); + [Version (since = "3.28")] + public void set_recycle_max (uint recycle_max); + public string property_name { get; construct; } + public GLib.Type row_type { get; construct; } + [NoAccessorMethod] + public string row_type_name { construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_list_box_row_get_type ()")] + public abstract class ListBoxRow : Gtk.ListBoxRow, Atk.Implementor, Gtk.Actionable, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ListBoxRow (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_list_model_filter_get_type ()")] + public class ListModelFilter : GLib.Object, GLib.ListModel { + [CCode (has_construct_function = false)] + public ListModelFilter (GLib.ListModel child_model); + public unowned GLib.ListModel get_child_model (); + public void invalidate (); + public void set_filter_func (owned Dazzle.ListModelFilterFunc filter_func); + public GLib.ListModel child_model { get; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_list_store_adapter_get_type ()")] + public class ListStoreAdapter : GLib.Object, Gtk.TreeModel { + [CCode (has_construct_function = false)] + public ListStoreAdapter (GLib.ListModel model); + [Version (since = "3.26")] + public unowned GLib.ListModel get_model (); + public void set_model (GLib.ListModel model); + public GLib.ListModel model { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_menu_button_get_type ()")] + public class MenuButton : Gtk.MenuButton, Atk.Implementor, Gtk.Actionable, Gtk.Activatable, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected MenuButton (); + [Version (since = "3.26")] + public unowned GLib.MenuModel? get_model (); + public bool get_show_accels (); + public bool get_show_arrow (); + public bool get_show_icons (); + public void set_model (GLib.MenuModel model); + [Version (since = "3.26")] + public void set_show_accels (bool show_accels); + [Version (since = "3.26")] + public void set_show_arrow (bool show_arrow); + [Version (since = "3.26")] + public void set_show_icons (bool show_icons); + [CCode (has_construct_function = false, type = "GtkWidget*")] + public MenuButton.with_model (string icon_name, GLib.MenuModel? model); + [NoAccessorMethod] + public string icon_name { set; } + [NoAccessorMethod] + [Version (since = "3.26")] + public string menu_id { set; } + public GLib.MenuModel model { get; set; } + public bool show_accels { get; set; } + public bool show_arrow { get; set; } + public bool show_icons { get; set; } + [NoAccessorMethod] + public bool transitions_enabled { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_menu_manager_get_type ()")] + [Version (since = "3.26")] + public class MenuManager : GLib.Object { + [CCode (has_construct_function = false)] + public MenuManager (); + public uint add_filename (string filename) throws GLib.Error; + public uint add_resource (string resource) throws GLib.Error; + public unowned GLib.Menu get_menu_by_id (string menu_id); + public uint merge (string menu_id, GLib.MenuModel model); + public void remove (uint merge_id); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_multi_paned_get_type ()")] + public class MultiPaned : Gtk.Container, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public MultiPaned (); + [Version (since = "3.28")] + public unowned Gtk.Widget? get_at_point (int x, int y); + public uint get_n_children (); + public unowned Gtk.Widget get_nth_child (uint nth); + [NoAccessorMethod] + public Gtk.Orientation orientation { get; set; } + public virtual signal void resize_drag_begin (Gtk.Widget child); + public virtual signal void resize_drag_end (Gtk.Widget child); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_path_get_type ()")] + public class Path : GLib.Object { + [CCode (has_construct_function = false)] + public Path (); + public void append (Dazzle.PathElement element); + public unowned Dazzle.PathElement? get_element (uint index); + public unowned GLib.List get_elements (); + public uint get_length (); + public bool has_prefix (Dazzle.Path prefix); + public bool is_empty (); + public void prepend (Dazzle.PathElement element); + public string printf (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_path_bar_get_type ()")] + public class PathBar : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public PathBar (); + public unowned Dazzle.Path get_path (); + public void set_path (Dazzle.Path path); + public void set_selected_index (uint index); + public Dazzle.Path path { get; set; } + public signal void element_selected (Dazzle.Path object, Dazzle.PathElement p0); + public signal void populate_menu (Dazzle.Path object, Dazzle.PathElement p0, GLib.Menu p1); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_path_element_get_type ()")] + public class PathElement : GLib.Object { + [CCode (has_construct_function = false)] + [Version (since = "3.26")] + public PathElement (string? id, string? icon_name, string title); + [Version (since = "3.26")] + public unowned string? get_icon_name (); + [Version (since = "3.26")] + public unowned string get_id (); + [Version (since = "3.26")] + public unowned string? get_title (); + [Version (since = "3.26")] + public string icon_name { get; construct; } + [Version (since = "3.26")] + public string id { get; construct; } + [Version (since = "3.26")] + public string title { get; construct; } + } + [CCode (cheader_filename = "dazzle.h", ref_function = "dzl_pattern_spec_ref", type_id = "dzl_pattern_spec_get_type ()", unref_function = "dzl_pattern_spec_unref")] + [Compact] + public class PatternSpec { + [CCode (has_construct_function = false)] + public PatternSpec (string keywords); + public unowned string get_text (); + public bool match (string haystack); + public Dazzle.PatternSpec @ref (); + public void unref (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_pill_box_get_type ()")] + public class PillBox : Gtk.EventBox, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public PillBox (string label); + public unowned string get_label (); + public void set_label (string label); + public string label { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_bin_get_type ()")] + public class PreferencesBin : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesBin (); + [NoWrapper] + public virtual void connect (GLib.Settings settings); + [NoWrapper] + public virtual void disconnect (GLib.Settings settings); + [NoWrapper] + public virtual bool matches (Dazzle.PatternSpec spec); + [NoAccessorMethod] + public string keywords { owned get; construct; } + [NoAccessorMethod] + public string path { owned get; construct; } + [NoAccessorMethod] + public int priority { get; construct; } + [NoAccessorMethod] + public string schema_id { owned get; construct; } + public signal void preference_activated (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_entry_get_type ()")] + public class PreferencesEntry : Dazzle.PreferencesBin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesEntry (); + public unowned Gtk.Widget get_entry_widget (); + public unowned Gtk.Widget get_title_widget (); + [NoAccessorMethod] + public string text { owned get; set; } + [NoAccessorMethod] + public string title { owned get; set; } + public signal void activate (); + public signal void changed (string object); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_file_chooser_button_get_type ()")] + public class PreferencesFileChooserButton : Dazzle.PreferencesBin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesFileChooserButton (); + [NoAccessorMethod] + public Gtk.FileChooserAction action { get; construct; } + [NoAccessorMethod] + public string key { owned get; construct; } + [NoAccessorMethod] + public string subtitle { owned get; construct; } + [NoAccessorMethod] + public string title { owned get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_flow_box_get_type ()")] + public class PreferencesFlowBox : Dazzle.ColumnLayout, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public PreferencesFlowBox (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_font_button_get_type ()")] + public class PreferencesFontButton : Dazzle.PreferencesBin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesFontButton (); + [NoAccessorMethod] + public string key { owned get; construct; } + [NoAccessorMethod] + public string title { owned get; construct; } + public signal void activate (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_group_get_type ()")] + public class PreferencesGroup : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesGroup (); + public void add (Gtk.Widget widget); + public int get_priority (); + public unowned Gtk.SizeGroup get_size_group (uint column); + public unowned string get_title (); + public uint refilter (Dazzle.PatternSpec spec); + public void set_map (GLib.HashTable map); + [NoAccessorMethod] + public bool is_list { get; construct; } + [NoAccessorMethod] + public Gtk.SelectionMode mode { get; set; } + public int priority { get; construct; } + public string title { get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_page_get_type ()")] + public class PreferencesPage : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesPage (); + public void add_group (Dazzle.PreferencesGroup group); + public unowned Dazzle.PreferencesGroup? get_group (string group_name); + public void refilter (Dazzle.PatternSpec spec); + public void set_map (GLib.HashTable map); + [NoAccessorMethod] + public int priority { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_spin_button_get_type ()")] + public class PreferencesSpinButton : Dazzle.PreferencesBin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesSpinButton (); + public unowned Gtk.Widget get_spin_button (); + [NoAccessorMethod] + public string key { owned get; construct; } + [NoAccessorMethod] + public string subtitle { owned get; construct; } + [NoAccessorMethod] + public string title { owned get; construct; } + public signal void activate (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_switch_get_type ()")] + public class PreferencesSwitch : Dazzle.PreferencesBin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected PreferencesSwitch (); + [NoAccessorMethod] + public bool is_radio { get; construct; } + [NoAccessorMethod] + public string key { owned get; construct; } + [NoAccessorMethod] + public string subtitle { owned get; set; } + [NoAccessorMethod] + public GLib.Variant target { owned get; construct; } + [NoAccessorMethod] + public string title { owned get; set; } + public signal void activated (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_preferences_view_get_type ()")] + public class PreferencesView : Gtk.Bin, Atk.Implementor, Dazzle.Preferences, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public PreferencesView (); + public bool get_use_sidebar (); + public void reapply_filter (); + public void set_use_sidebar (bool use_sidebar); + public bool use_sidebar { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_priority_box_get_type ()")] + public class PriorityBox : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public PriorityBox (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_progress_button_get_type ()")] + public class ProgressButton : Gtk.Button, Atk.Implementor, Gtk.Actionable, Gtk.Activatable, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ProgressButton (); + public uint get_progress (); + public bool get_show_progress (); + public void set_progress (uint percentage); + public void set_show_progress (bool show_progress); + public uint progress { get; set; } + public bool show_progress { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_progress_icon_get_type ()")] + public class ProgressIcon : Gtk.DrawingArea, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ProgressIcon (); + public double get_progress (); + public void set_progress (double progress); + public double progress { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_progress_menu_button_get_type ()")] + public class ProgressMenuButton : Gtk.MenuButton, Atk.Implementor, Gtk.Actionable, Gtk.Activatable, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ProgressMenuButton (); + public double get_progress (); + public bool get_show_theatric (); + public void reset_theatrics (); + public void set_progress (double progress); + public void set_show_theatric (bool show_theatic); + public double progress { get; set; } + public bool show_theatric { get; set; } + [NoAccessorMethod] + public string theatric_icon_name { owned get; set; } + [NoAccessorMethod] + public uint transition_duration { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_properties_group_get_type ()")] + public class PropertiesGroup : GLib.Object, GLib.ActionGroup { + [CCode (has_construct_function = false)] + [Version (since = "3.26")] + public PropertiesGroup (GLib.Object object); + [Version (since = "3.26")] + public void add_all_properties (); + [Version (since = "3.26")] + public void add_property (string name, string property_name); + [Version (since = "3.26")] + public void add_property_full (string name, string property_name, Dazzle.PropertiesFlags flags); + [CCode (has_construct_function = false)] + public PropertiesGroup.for_type (GLib.Type object_type); + [Version (since = "3.26")] + public void remove (string name); + [NoAccessorMethod] + public GLib.Object object { owned get; set; } + [NoAccessorMethod] + public GLib.Type object_type { get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_radio_box_get_type ()")] + public class RadioBox : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public RadioBox (); + public void add_item (string id, string text); + public unowned string get_active_id (); + public void set_active_id (string id); + public string active_id { get; set; } + [NoAccessorMethod] + public bool has_more { get; } + [NoAccessorMethod] + public bool show_more { get; set; } + public signal void changed (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_read_only_list_model_get_type ()")] + public class ReadOnlyListModel : GLib.Object, GLib.ListModel { + [CCode (has_construct_function = false)] + protected ReadOnlyListModel (); + [Version (since = "3.30")] + public static GLib.ListModel @new (GLib.ListModel base_model); + [NoAccessorMethod] + [Version (since = "3.30")] + public GLib.ListModel base_model { construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_recursive_file_monitor_get_type ()")] + public class RecursiveFileMonitor : GLib.Object { + [CCode (has_construct_function = false)] + public RecursiveFileMonitor (GLib.File root); + [Version (since = "3.28")] + public void cancel (); + [Version (since = "3.28")] + public unowned GLib.File get_root (); + [Version (since = "3.28")] + public void set_ignore_func (owned Dazzle.RecursiveIgnoreFunc ignore_func); + public async bool start_async (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.File root { get; construct; } + [Version (since = "3.28")] + public signal void changed (GLib.File file, GLib.File? other_file, GLib.FileMonitorEvent event); + } + [CCode (cheader_filename = "dazzle.h", ref_function = "dzl_ring_ref", type_id = "dzl_ring_get_type ()", unref_function = "dzl_ring_unref")] + [Compact] + public class Ring { + public uint8 data; + public uint len; + public uint pos; + public uint append_vals (void* data, uint len); + public void @foreach (GLib.Func func); + public Dazzle.Ring @ref (); + [CCode (cname = "dzl_ring_sized_new", has_construct_function = false)] + public Ring.sized_new (uint element_size, uint reserved_size, GLib.DestroyNotify element_destroy); + public void unref (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_scrolled_window_get_type ()")] + public class ScrolledWindow : Gtk.ScrolledWindow, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected ScrolledWindow (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_search_bar_get_type ()")] + public class SearchBar : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public SearchBar (); + public unowned Gtk.SearchEntry get_entry (); + public bool get_search_mode_enabled (); + public bool get_show_close_button (); + public void set_search_mode_enabled (bool search_mode_enabled); + public void set_show_close_button (bool show_close_button); + public bool search_mode_enabled { get; set; } + public bool show_close_button { get; set; } + public signal void activate (); + public signal void reveal (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_settings_flag_action_get_type ()")] + public class SettingsFlagAction : GLib.Object, GLib.Action { + [CCode (has_construct_function = false)] + protected SettingsFlagAction (); + public static GLib.Action @new (string schema_id, string schema_key, string flag_nick); + [NoAccessorMethod] + public string flag_nick { owned get; construct; } + [NoAccessorMethod] + public string schema_id { owned get; construct; } + [NoAccessorMethod] + public string schema_key { owned get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_settings_sandwich_get_type ()")] + public class SettingsSandwich : GLib.Object { + [CCode (has_construct_function = false)] + public SettingsSandwich (string schema_id, string path); + public void append (GLib.Settings settings); + public void bind (string key, void* object, string property, GLib.SettingsBindFlags flags); + public void bind_with_mapping (string key, void* object, string property, GLib.SettingsBindFlags flags, [CCode (delegate_target_pos = 6.1, destroy_notify_pos = 6.2)] owned GLib.SettingsBindGetMapping get_mapping, owned GLib.SettingsBindSetMapping set_mapping); + public bool get_boolean (string key); + public GLib.Variant get_default_value (string key); + public double get_double (string key); + public int get_int (string key); + public string get_string (string key); + public uint get_uint (string key); + public GLib.Variant get_user_value (string key); + public GLib.Variant get_value (string key); + public void set_boolean (string key, bool val); + public void set_double (string key, double val); + public void set_int (string key, int val); + public void set_string (string key, string val); + public void set_uint (string key, uint val); + public void set_value (string key, GLib.Variant value); + public void unbind (string property); + [NoAccessorMethod] + public string path { owned get; construct; } + [NoAccessorMethod] + public string schema_id { owned get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_accel_dialog_get_type ()")] + public class ShortcutAccelDialog : Gtk.Dialog, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ShortcutAccelDialog (); + public string get_accelerator (); + public unowned Dazzle.ShortcutChord get_chord (); + public unowned string get_shortcut_title (); + public void set_accelerator (string accelerator); + public void set_shortcut_title (string title); + public string accelerator { owned get; set; } + public string shortcut_title { get; set; } + } + [CCode (cheader_filename = "dazzle.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "dzl_shortcut_chord_get_type ()")] + [Compact] + public class ShortcutChord { + public bool append_event (Gdk.EventKey event); + public Dazzle.ShortcutChord copy (); + [CCode (cheader_filename = "dazzle.h")] + public static bool equal (void* data1, void* data2); + public void free (); + [CCode (has_construct_function = false)] + public ShortcutChord.from_event (Gdk.EventKey event); + [CCode (has_construct_function = false)] + public ShortcutChord.from_string (string accelerator); + public string get_label (); + public uint get_length (); + public void get_nth_key (uint nth, uint keyval, Gdk.ModifierType modifier); + public bool has_modifier (); + [CCode (cheader_filename = "dazzle.h")] + public static uint hash (void* data); + public Dazzle.ShortcutMatch match (Dazzle.ShortcutChord other); + public string to_string (); + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + [Compact] + public class ShortcutChordTable { + public void add (Dazzle.ShortcutChord chord, void* data); + public void @foreach (Dazzle.ShortcutChordTableForeach foreach_func); + public void free (); + [CCode (cheader_filename = "dazzle.h")] + public static GLib.Type get_type (); + public Dazzle.ShortcutMatch lookup (Dazzle.ShortcutChord chord, void* data); + public unowned Dazzle.ShortcutChord lookup_data (void* data); + public void printf (); + public bool remove (Dazzle.ShortcutChord chord); + public bool remove_data (void* data); + public void set_free_func (GLib.DestroyNotify notify); + public uint size (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_context_get_type ()")] + public class ShortcutContext : GLib.Object { + [CCode (has_construct_function = false)] + public ShortcutContext (string name); + public Dazzle.ShortcutMatch activate (Gtk.Widget widget, Dazzle.ShortcutChord chord); + public void add_action (string accel, string detailed_action_name); + public void add_command (string accel, string command); + public void add_signalv (string accel, string signal_name, GLib.Array? values); + public unowned string get_name (); + public bool load_from_data (string data, ssize_t len) throws GLib.Error; + public bool load_from_resource (string resource_path) throws GLib.Error; + public bool remove (string accel); + public string name { get; construct; } + [NoAccessorMethod] + public bool use_binding_sets { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_controller_get_type ()")] + public class ShortcutController : GLib.Object { + [CCode (has_construct_function = false)] + public ShortcutController (Gtk.Widget widget); + public void add_command_action (string command_id, string default_accel, Dazzle.ShortcutPhase phase, string action); + public void add_command_callback (string command_id, string default_accel, Dazzle.ShortcutPhase phase, owned Gtk.Callback callback); + public bool execute_command (string command); + public static unowned Dazzle.ShortcutController find (Gtk.Widget widget); + [Version (since = "3.26")] + public unowned Dazzle.ShortcutContext? get_context (); + [Version (since = "3.26")] + public unowned Dazzle.ShortcutContext? get_context_for_phase (Dazzle.ShortcutPhase phase); + public unowned Dazzle.ShortcutChord? get_current_chord (); + public unowned Dazzle.ShortcutManager get_manager (); + [Version (since = "3.26")] + public void set_context_by_name (string? name); + public void set_manager (Dazzle.ShortcutManager? manager); + public static unowned Dazzle.ShortcutController? try_find (Gtk.Widget widget); + public Dazzle.ShortcutContext context { get; } + public Dazzle.ShortcutChord current_chord { get; } + public Dazzle.ShortcutManager manager { get; set; } + [NoAccessorMethod] + public Gtk.Widget widget { owned get; construct; } + public signal void reset (); + public signal void set_context_named (string name); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_label_get_type ()")] + public class ShortcutLabel : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ShortcutLabel (); + public string get_accelerator (); + public unowned Dazzle.ShortcutChord? get_chord (); + public void set_accelerator (string accelerator); + public void set_chord (Dazzle.ShortcutChord chord); + public string accelerator { owned get; set; } + public Dazzle.ShortcutChord chord { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_manager_get_type ()")] + public class ShortcutManager : GLib.Object, GLib.Initable, GLib.ListModel { + [CCode (has_construct_function = false)] + protected ShortcutManager (); + public void add_action (string detailed_action_name, string section, string group, string title, string subtitle); + public void add_command (string command, string section, string group, string title, string subtitle); + public void add_shortcut_entries ([CCode (array_length_cname = "n_shortcuts", array_length_pos = 1.5, array_length_type = "guint")] Dazzle.ShortcutEntry[] shortcuts, string? translation_domain); + public void add_shortcuts_to_window (Dazzle.ShortcutsWindow window); + public void append_search_path (string directory); + public static unowned Dazzle.ShortcutManager get_default (); + public unowned Dazzle.ShortcutTheme get_theme (); + public unowned Dazzle.ShortcutTheme? get_theme_by_name (string? theme_name); + public unowned string get_theme_name (); + public unowned string get_user_dir (); + public bool handle_event (Gdk.EventKey event, Gtk.Widget toplevel); + public void prepend_search_path (string directory); + public void queue_reload (); + public void reload (GLib.Cancellable? cancellable = null); + public void remove_search_path (string directory); + public void set_theme (Dazzle.ShortcutTheme theme); + public void set_theme_name (string theme_name); + public void set_user_dir (string user_dir); + public Dazzle.ShortcutTheme theme { get; set; } + public string theme_name { get; set; } + public string user_dir { get; set; } + public signal void changed (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_model_get_type ()")] + public class ShortcutModel : Gtk.TreeStore, Gtk.Buildable, Gtk.TreeDragDest, Gtk.TreeDragSource, Gtk.TreeModel, Gtk.TreeSortable { + [CCode (has_construct_function = false)] + protected ShortcutModel (); + public unowned Dazzle.ShortcutManager get_manager (); + public unowned Dazzle.ShortcutTheme get_theme (); + public static Gtk.TreeModel @new (); + public void rebuild (); + public void set_chord (Gtk.TreeIter iter, Dazzle.ShortcutChord chord); + public void set_manager (Dazzle.ShortcutManager manager); + public void set_theme (Dazzle.ShortcutTheme theme); + public Dazzle.ShortcutManager manager { get; set; } + public Dazzle.ShortcutTheme theme { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_simple_label_get_type ()")] + public class ShortcutSimpleLabel : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ShortcutSimpleLabel (); + public unowned string get_accel (); + public unowned string get_action (); + public unowned string get_command (); + public unowned string get_title (); + public void set_accel (string accel); + public void set_action (string action); + public void set_command (string command); + public void set_title (string title); + public string accel { get; set; } + public string action { get; set; } + public string command { get; set; } + [NoAccessorMethod] + public bool show_accel { get; set; } + public string title { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_theme_get_type ()")] + public class ShortcutTheme : GLib.Object { + [CCode (has_construct_function = false)] + public ShortcutTheme (string name); + public void add_command (string accelerator, string command); + public void add_context (Dazzle.ShortcutContext context); + public void add_css_resource (string path); + public unowned Dazzle.ShortcutContext find_context_by_name (string name); + public unowned Dazzle.ShortcutContext? find_default_context (Gtk.Widget widget); + public unowned Dazzle.ShortcutChord get_chord_for_action (string detailed_action_name); + public unowned Dazzle.ShortcutChord get_chord_for_command (string command); + public unowned string get_name (); + public unowned Dazzle.ShortcutTheme? get_parent (); + public unowned string? get_parent_name (); + public unowned string get_subtitle (); + public unowned string get_title (); + public bool load_from_data (string data, ssize_t len) throws GLib.Error; + public bool load_from_file (GLib.File file, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool load_from_path (string path, GLib.Cancellable? cancellable = null) throws GLib.Error; + public void remove_css_resource (string path); + public bool save_to_file (GLib.File file, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool save_to_path (string path, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool save_to_stream (GLib.OutputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error; + public void set_accel_for_action (string detailed_action_name, string accel, Dazzle.ShortcutPhase phase); + public void set_accel_for_command (string? command, string? accel, Dazzle.ShortcutPhase phase); + public void set_chord_for_action (string detailed_action_name, Dazzle.ShortcutChord chord, Dazzle.ShortcutPhase phase); + public void set_chord_for_command (string? command, Dazzle.ShortcutChord? chord, Dazzle.ShortcutPhase phase); + public void set_parent_name (string parent_name); + public string name { get; construct; } + public string parent_name { get; set; } + [NoAccessorMethod] + public string subtitle { owned get; set; } + [NoAccessorMethod] + public string title { owned get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_theme_editor_get_type ()")] + public class ShortcutThemeEditor : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ShortcutThemeEditor (); + public unowned Dazzle.ShortcutTheme? get_theme (); + public void set_theme (Dazzle.ShortcutTheme theme); + public Dazzle.ShortcutTheme theme { get; set; } + public signal void changed (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcut_tooltip_get_type ()")] + public class ShortcutTooltip : GLib.Object { + [CCode (has_construct_function = false)] + [Version (since = "3.32")] + public ShortcutTooltip (); + [Version (since = "3.320")] + public unowned string? get_accel (); + [Version (since = "3.32")] + public unowned string? get_command_id (); + [Version (since = "3.32")] + public unowned string? get_title (); + [Version (since = "3.32")] + public unowned Gtk.Widget? get_widget (); + [Version (since = "3.32")] + public void set_accel (string? accel); + [Version (since = "3.32")] + public void set_command_id (string command_id); + [Version (since = "3.32")] + public void set_title (string? title); + [Version (since = "3.32")] + public void set_widget (Gtk.Widget? widget); + public string accel { get; set; } + public string command_id { get; set; } + [Version (since = "3.32")] + public string title { get; set; } + public Gtk.Widget widget { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcuts_group_get_type ()")] + public class ShortcutsGroup : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false)] + protected ShortcutsGroup (); + [NoAccessorMethod] + public Gtk.SizeGroup accel_size_group { set; } + [NoAccessorMethod] + public uint height { get; } + [NoAccessorMethod] + public string title { owned get; set; } + [NoAccessorMethod] + public Gtk.SizeGroup title_size_group { set; } + [NoAccessorMethod] + public string view { owned get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcuts_section_get_type ()")] + public class ShortcutsSection : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false)] + protected ShortcutsSection (); + [NoAccessorMethod] + public uint max_height { get; set; } + [NoAccessorMethod] + public string section_name { owned get; set; } + [NoAccessorMethod] + public string title { owned get; set; } + [NoAccessorMethod] + public string view_name { owned get; set; } + public signal bool change_current_page (int object); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcuts_shortcut_get_type ()")] + public class ShortcutsShortcut : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false)] + protected ShortcutsShortcut (); + [NoAccessorMethod] + public Gtk.SizeGroup accel_size_group { set; } + [NoAccessorMethod] + public string accelerator { owned get; set; } + [NoAccessorMethod] + [Version (since = "3.22")] + public string action_name { owned get; set; } + [NoAccessorMethod] + public Gtk.TextDirection direction { get; set; } + [NoAccessorMethod] + public GLib.Icon icon { owned get; set; } + [NoAccessorMethod] + public bool icon_set { get; set; } + [NoAccessorMethod] + public Gtk.ShortcutType shortcut_type { get; set; } + [NoAccessorMethod] + public string subtitle { owned get; set; } + [NoAccessorMethod] + public bool subtitle_set { get; set; } + [NoAccessorMethod] + public string title { owned get; set; } + [NoAccessorMethod] + public Gtk.SizeGroup title_size_group { set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_shortcuts_window_get_type ()")] + public class ShortcutsWindow : Gtk.Window, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected ShortcutsWindow (); + [NoAccessorMethod] + public string section_name { owned get; set; } + [NoAccessorMethod] + public string view_name { owned get; set; } + public virtual signal void close (); + public virtual signal void search (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_signal_group_get_type ()")] + public class SignalGroup : GLib.Object { + [CCode (has_construct_function = false)] + public SignalGroup (GLib.Type target_type); + public void block (); + public void connect_data (string detailed_signal, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667)] owned GLib.Callback c_handler, GLib.ConnectFlags flags); + public void connect_swapped (string detailed_signal, [CCode (scope = "async")] GLib.Callback c_handler); + public unowned GLib.Object? get_target (); + public void set_target (GLib.Object? target); + public void unblock (); + public GLib.Object target { get; set; } + [NoAccessorMethod] + public GLib.Type target_type { get; construct; } + public signal void bind (GLib.Object instance); + public signal void unbind (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_simple_label_get_type ()")] + public class SimpleLabel : Gtk.Widget, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public SimpleLabel (string label); + public unowned string get_label (); + public int get_width_chars (); + public float get_xalign (); + public void set_label (string label); + public void set_width_chars (int width_chars); + public void set_xalign (float xalign); + public string label { get; set; } + public int width_chars { get; set; } + public float xalign { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_simple_popover_get_type ()")] + public class SimplePopover : Gtk.Popover, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public SimplePopover (); + public unowned string get_button_text (); + public unowned string get_message (); + public bool get_ready (); + public unowned string get_text (); + public unowned string get_title (); + public void set_button_text (string button_text); + public void set_message (string message); + public void set_ready (bool ready); + public void set_text (string text); + public void set_title (string title); + public string button_text { get; set; } + public string message { get; set; } + public bool ready { get; set; } + public string text { get; set; } + public string title { get; set; } + public virtual signal void activate (string text); + public virtual signal void changed (); + public virtual signal bool insert_text (uint position, string chars, uint n_chars); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_slider_get_type ()")] + public class Slider : Gtk.Container, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public Slider (); + public void add_slider (Gtk.Widget widget, Dazzle.SliderPosition position); + public Dazzle.SliderPosition get_position (); + public void set_position (Dazzle.SliderPosition position); + public Dazzle.SliderPosition position { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_stack_list_get_type ()")] + public class StackList : Gtk.Bin, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public StackList (); + public void clear (); + public uint get_depth (); + public unowned GLib.ListModel get_model (); + public void pop (); + public void push (Gtk.Widget header, GLib.ListModel model, owned Dazzle.StackListCreateWidgetFunc? create_widget_func); + public GLib.ListModel model { get; } + public virtual signal void header_activated (Gtk.ListBoxRow row); + public virtual signal void row_activated (Gtk.ListBoxRow row); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_state_machine_get_type ()")] + public class StateMachine : GLib.Object, Gtk.Buildable { + [CCode (has_construct_function = false)] + public StateMachine (); + public void add_binding (string state, void* source_object, string source_property, void* target_object, string target_property, GLib.BindingFlags flags); + public void add_propertyv (string state, void* object, string property, GLib.Value value); + public void add_style (string state, Gtk.Widget widget, string style); + public GLib.Action create_action (string name); + public unowned string get_state (); + [Version (since = "3.28")] + public bool is_state (string? state); + public void set_state (string state); + public string state { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_suggestion_get_type ()")] + public class Suggestion : GLib.Object { + [CCode (has_construct_function = false)] + public Suggestion (); + [Version (since = "3.30")] + public virtual GLib.Icon? get_icon (); + public unowned string get_icon_name (); + [Version (since = "3.30")] + public virtual Cairo.Surface? get_icon_surface (Gtk.Widget widget); + public unowned string get_id (); + public unowned string get_subtitle (); + public unowned string get_title (); + public void set_icon_name (string icon_name); + public void set_id (string id); + public void set_subtitle (string subtitle); + public void set_title (string title); + public GLib.Icon icon { owned get; } + public string icon_name { get; set; } + public string id { get; set; } + public string subtitle { get; set; } + public string title { get; set; } + [HasEmitter] + public virtual signal string replace_typed_text (string typed_text); + [HasEmitter] + public virtual signal string suggest_suffix (string typed_text); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_suggestion_entry_get_type ()")] + public class SuggestionEntry : Gtk.Entry, Atk.Implementor, Gtk.Buildable, Gtk.CellEditable, Gtk.Editable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public SuggestionEntry (); + public void default_position_func (Gdk.Rectangle area, bool is_absolute, void* user_data); + public bool get_activate_on_single_click (); + public unowned GLib.ListModel? get_model (); + public unowned Dazzle.Suggestion? get_suggestion (); + public unowned string get_typed_text (); + public void set_activate_on_single_click (bool activate_on_single_click); + public void set_model (GLib.ListModel model); + [Version (since = "3.26")] + public void set_position_func (owned Dazzle.SuggestionPositionFunc? func); + public void set_suggestion (Dazzle.Suggestion suggestion); + public void window_position_func (Gdk.Rectangle area, bool is_absolute, void* user_data); + [Version (since = "3.30")] + public bool activate_on_single_click { get; set; } + public GLib.ListModel model { get; set; } + [Version (since = "3.30")] + public Dazzle.Suggestion suggestion { get; set; } + public string typed_text { get; } + public signal void activate_suggestion (); + [HasEmitter] + public virtual signal void hide_suggestions (); + public virtual signal void move_suggestion (int amount); + public virtual signal void show_suggestions (); + public virtual signal void suggestion_activated (Dazzle.Suggestion suggestion); + [Version (since = "3.30")] + public virtual signal void suggestion_selected (Dazzle.Suggestion suggestion); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_suggestion_entry_buffer_get_type ()")] + public class SuggestionEntryBuffer : Gtk.EntryBuffer { + [CCode (has_construct_function = false)] + public SuggestionEntryBuffer (); + public void clear (); + public void commit (); + public unowned Dazzle.Suggestion? get_suggestion (); + public uint get_typed_length (); + public unowned string get_typed_text (); + public void set_suggestion (Dazzle.Suggestion? suggestion); + public Dazzle.Suggestion suggestion { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_suggestion_popover_get_type ()")] + public class SuggestionPopover : Gtk.Window, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public SuggestionPopover (); + public void activate_selected (); + public unowned GLib.ListModel? get_model (); + public unowned Gtk.Widget? get_relative_to (); + public unowned Dazzle.Suggestion? get_selected (); + public void move_by (int amount); + public void popdown (); + public void popup (); + public void set_model (GLib.ListModel model); + public void set_relative_to (Gtk.Widget widget); + public void set_selected (Dazzle.Suggestion suggestion); + public Dazzle.Suggestion model { get; set; } + public Gtk.Widget relative_to { get; set; } + public Dazzle.Suggestion selected { get; set; } + [NoAccessorMethod] + public Pango.EllipsizeMode subtitle_ellipsize { get; set; } + [NoAccessorMethod] + public Pango.EllipsizeMode title_ellipsize { get; set; } + public signal void suggestion_activated (Dazzle.Suggestion object); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_suggestion_row_get_type ()")] + public class SuggestionRow : Dazzle.ListBoxRow, Atk.Implementor, Gtk.Actionable, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public SuggestionRow (); + public unowned Dazzle.Suggestion get_suggestion (); + public void set_suggestion (Dazzle.Suggestion suggestion); + public Dazzle.Suggestion suggestion { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_tab_get_type ()")] + public class Tab : Dazzle.Bin, Atk.Implementor, Gtk.Actionable, Gtk.Buildable { + [CCode (has_construct_function = false)] + protected Tab (); + public bool get_active (); + public bool get_can_close (); + public Gtk.PositionType get_edge (); + public unowned string get_icon_name (); + public Dazzle.TabStyle get_style (); + public unowned string get_title (); + public unowned Gtk.Widget? get_widget (); + public void set_active (bool active); + public void set_can_close (bool can_close); + public void set_edge (Gtk.PositionType edge); + public void set_icon_name (string icon_name); + public void set_style (Dazzle.TabStyle style); + public void set_title (string title); + public void set_widget (Gtk.Widget widget); + public bool active { get; set; } + public bool can_close { get; set; } + public Gtk.PositionType edge { get; set; } + public Dazzle.TabStyle style { get; set; } + public string title { get; set; } + public Gtk.Widget widget { get; set; } + public signal void clicked (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_tab_strip_get_type ()")] + public class TabStrip : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public TabStrip (); + public void add_control (Gtk.Widget widget); + public Gtk.PositionType get_edge (); + public unowned Gtk.Stack? get_stack (); + public Dazzle.TabStyle get_style (); + public void set_edge (Gtk.PositionType edge); + public void set_stack (Gtk.Stack stack); + public void set_style (Dazzle.TabStyle style); + public Gtk.PositionType edge { get; set; } + public Gtk.Stack stack { get; set; } + public Dazzle.TabStyle style { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_task_cache_get_type ()")] + public class TaskCache : GLib.Object { + [CCode (has_construct_function = false)] + protected TaskCache (); + public bool evict (void* key); + public void evict_all (); + public async void* get_async (void* key, bool force_update, GLib.Cancellable? cancellable = null) throws GLib.Error; + public unowned GLib.Object? peek (void* key); + public void set_name (string name); + [NoAccessorMethod] + public void* key_copy_func { construct; } + [NoAccessorMethod] + public void* key_destroy_func { construct; } + [NoAccessorMethod] + public void* key_equal_func { construct; } + [NoAccessorMethod] + public void* key_hash_func { construct; } + [NoAccessorMethod] + public void* populate_callback { construct; } + [NoAccessorMethod] + public void* populate_callback_data { construct; } + [NoAccessorMethod] + public void* populate_callback_data_destroy { construct; } + [NoAccessorMethod] + public int64 time_to_live { construct; } + [NoAccessorMethod] + public void* value_copy_func { construct; } + [NoAccessorMethod] + public void* value_destroy_func { construct; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_theme_manager_get_type ()")] + public class ThemeManager : GLib.Object { + [CCode (has_construct_function = false)] + public ThemeManager (); + public void add_resources (string resource_path); + public void remove_resources (string resource_path); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_three_grid_get_type ()")] + public class ThreeGrid : Gtk.Container, Atk.Implementor, Gtk.Buildable { + [CCode (has_construct_function = false, type = "GtkWidget*")] + public ThreeGrid (); + [NoAccessorMethod] + public uint column_spacing { get; set; } + [NoAccessorMethod] + public uint row_spacing { get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_tree_get_type ()")] + public class Tree : Gtk.TreeView, Atk.Implementor, Gtk.Buildable, Gtk.Scrollable { + [CCode (has_construct_function = false)] + protected Tree (); + public void add_builder (Dazzle.TreeBuilder builder); + public void expand_to_node (Dazzle.TreeNode node); + public unowned Dazzle.TreeNode? find_child_node (Dazzle.TreeNode node, Dazzle.TreeFindFunc find_func); + public unowned Dazzle.TreeNode? find_custom (GLib.EqualFunc equal_func, void* key); + public unowned Dazzle.TreeNode? find_item (GLib.Object? item); + public unowned GLib.MenuModel? get_context_menu (); + public unowned Dazzle.TreeNode? get_root (); + public unowned Dazzle.TreeNode get_selected (); + public bool get_show_icons (); + public void rebuild (); + public void remove_builder (Dazzle.TreeBuilder builder); + public void scroll_to_node (Dazzle.TreeNode node); + public void set_context_menu (GLib.MenuModel context_menu); + public void set_filter (owned Dazzle.TreeFilterFunc filter_func); + public void set_root (Dazzle.TreeNode node); + public void set_show_icons (bool show_icons); + public void unselect_all (); + [NoAccessorMethod] + public bool always_expand { get; construct; } + public GLib.MenuModel context_menu { get; set; } + public Dazzle.TreeNode root { get; set; } + [NoAccessorMethod] + public Dazzle.TreeNode selection { owned get; set; } + public bool show_icons { get; set; } + public virtual signal void action (string action_group, string action_name, string param); + public virtual signal void populate_popup (Gtk.Widget widget); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_tree_builder_get_type ()")] + public class TreeBuilder : GLib.InitiallyUnowned { + [CCode (has_construct_function = false)] + public TreeBuilder (); + [NoWrapper] + public virtual void cell_data_func (Dazzle.TreeNode node, Gtk.CellRenderer cell); + public unowned Dazzle.Tree? get_tree (); + public Dazzle.Tree tree { get; } + public virtual signal void added (Dazzle.Tree tree); + public virtual signal void build_children (Dazzle.TreeNode parent); + public virtual signal void build_node (Dazzle.TreeNode node); + public virtual signal bool drag_data_get (Dazzle.TreeNode node, Gtk.SelectionData data); + public virtual signal bool drag_data_received (Dazzle.TreeNode drop_node, Dazzle.TreeDropPosition position, Gdk.DragAction action, Gtk.SelectionData data); + public virtual signal bool drag_node_delete (Dazzle.TreeNode node); + public virtual signal bool drag_node_received (Dazzle.TreeNode drag_node, Dazzle.TreeNode drop_node, Dazzle.TreeDropPosition position, Gdk.DragAction action, Gtk.SelectionData data); + public virtual signal bool node_activated (Dazzle.TreeNode node); + public virtual signal void node_collapsed (Dazzle.TreeNode node); + public virtual signal bool node_draggable (Dazzle.TreeNode node); + public virtual signal bool node_droppable (Dazzle.TreeNode node, Gtk.SelectionData data); + public virtual signal void node_expanded (Dazzle.TreeNode node); + public virtual signal void node_popup (Dazzle.TreeNode node, GLib.Menu menu); + public virtual signal void node_selected (Dazzle.TreeNode node); + public virtual signal void node_unselected (Dazzle.TreeNode node); + public virtual signal void removed (Dazzle.Tree tree); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_tree_node_get_type ()")] + public class TreeNode : GLib.InitiallyUnowned { + [CCode (has_construct_function = false)] + public TreeNode (); + public void add_emblem (string emblem_name); + public void append (Dazzle.TreeNode child); + public void clear_emblems (); + public void collapse (); + public bool expand (bool expand_ancestors); + public void get_area (Gdk.Rectangle area); + public bool get_children_possible (); + public bool get_expanded (); + [Version (since = "3.28")] + public unowned Gdk.RGBA? get_foreground_rgba (); + public unowned GLib.Icon get_gicon (); + public unowned string get_icon_name (); + public unowned GLib.Object get_item (); + public bool get_iter (Gtk.TreeIter iter); + public unowned Dazzle.TreeNode get_parent (); + public Gtk.TreePath? get_path (); + public bool get_reset_on_collapse (); + public unowned string get_text (); + public unowned Dazzle.Tree get_tree (); + public bool get_use_dim_label (); + public bool get_use_markup (); + public bool has_emblem (string emblem_name); + [Version (since = "3.28")] + public void insert (Dazzle.TreeNode child, uint position); + public void insert_sorted (Dazzle.TreeNode child, Dazzle.TreeNodeCompareFunc compare_func); + public void invalidate (); + public bool is_root (); + public uint n_children (); + public Dazzle.TreeNode? nth_child (uint nth); + public void prepend (Dazzle.TreeNode child); + [Version (since = "3.28")] + public void rebuild (); + public void remove (Dazzle.TreeNode child); + public void remove_emblem (string emblem_name); + public void select (); + public void set_children_possible (bool children_possible); + public void set_emblems (string emblems); + [Version (since = "3.28")] + public void set_foreground_rgba (Gdk.RGBA? foreground_rgba); + public void set_gicon (GLib.Icon icon); + public void set_icon_name (string? icon_name); + public void set_item (GLib.Object item); + public void set_reset_on_collapse (bool reset_on_collapse); + public void set_text (string? text); + public void set_use_dim_label (bool use_dim_label); + public void set_use_markup (bool use_markup); + public void show_popover (Gtk.Popover popover); + public bool children_possible { get; set; } + [NoAccessorMethod] + public string expanded_icon_name { owned get; set; } + public GLib.Icon gicon { get; set; } + public string icon_name { get; set; } + public GLib.Object item { get; set; } + public Dazzle.TreeNode parent { get; } + [Version (since = "3.28")] + public bool reset_on_collapse { get; set; } + public string text { get; set; } + [NoAccessorMethod] + public Dazzle.Tree tree { owned get; set; } + public bool use_dim_label { get; set; } + public bool use_markup { get; set; } + } + [CCode (cheader_filename = "dazzle.h", ref_function = "dzl_trie_ref", type_id = "dzl_trie_get_type ()", unref_function = "dzl_trie_unref")] + [Compact] + public class Trie { + [CCode (has_construct_function = false)] + public Trie (GLib.DestroyNotify value_destroy); + public void destroy (); + public void insert (string key, void* value); + public void* lookup (string key); + public Dazzle.Trie @ref (); + public bool remove (string key); + public void traverse (string key, GLib.TraverseType order, GLib.TraverseFlags flags, int max_depth, Dazzle.TrieTraverseFunc func); + public void unref (); + } + [CCode (cheader_filename = "dazzle.h", type_id = "dzl_widget_action_group_get_type ()")] + public class WidgetActionGroup : GLib.Object, GLib.ActionGroup { + [CCode (has_construct_function = false)] + protected WidgetActionGroup (); + public static void attach (Gtk.Widget widget, string group_name); + public static GLib.ActionGroup @new (Gtk.Widget widget); + public void set_action_enabled (string action_name, bool enabled); + [NoAccessorMethod] + public Gtk.Widget widget { owned get; construct; } + } + [CCode (cheader_filename = "dazzle.h", type_cname = "DzlDockInterface", type_id = "dzl_dock_get_type ()")] + public interface Dock : Gtk.Container { + [NoAccessorMethod] + public abstract Dazzle.DockManager manager { owned get; set; } + } + [CCode (cheader_filename = "dazzle.h", type_cname = "DzlDockItemInterface", type_id = "dzl_dock_item_get_type ()")] + public interface DockItem : Gtk.Widget { + public bool adopt (Dazzle.DockItem child); + public abstract bool close (); + [Version (since = "3.30")] + public void emit_presented (); + public abstract bool get_can_close (); + [CCode (vfunc_name = "can_minimize")] + public abstract bool get_can_minimize (Dazzle.DockItem descendant); + public abstract bool get_child_visible (Dazzle.DockItem child); + public abstract string? get_icon_name (); + public abstract unowned Dazzle.DockManager? get_manager (); + public unowned Dazzle.DockItem? get_parent (); + public abstract string? get_title (); + public bool has_widgets (); + public abstract bool minimize (Dazzle.DockItem child, ref Gtk.PositionType position); + public void present (); + public abstract void present_child (Dazzle.DockItem child); + public abstract void release (Dazzle.DockItem child); + public abstract void set_child_visible (Dazzle.DockItem child, bool child_visible); + public abstract void set_manager (Dazzle.DockManager? manager); + public abstract void update_visibility (); + public virtual signal void manager_set (Dazzle.DockManager old_manager); + public virtual signal void presented (); + } + [CCode (cheader_filename = "dazzle.h", lower_case_csuffix = "graph_view_renderer", type_cname = "DzlGraphRendererInterface", type_id = "dzl_graph_view_renderer_get_type ()")] + public interface GraphRenderer : GLib.Object { + public abstract void render (Dazzle.GraphModel table, int64 x_begin, int64 x_end, double y_begin, double y_end, Cairo.Context cr, Cairo.RectangleInt area); + } + [CCode (cheader_filename = "dazzle.h", type_cname = "DzlPreferencesInterface", type_id = "dzl_preferences_get_type ()")] + public interface Preferences : GLib.Object { + public abstract uint add_custom (string page_name, string group_name, Gtk.Widget widget, string? keywords, int priority); + public abstract uint add_file_chooser (string page_name, string group_name, string schema_id, string key, string path, string title, string subtitle, Gtk.FileChooserAction action, string keywords, int priority); + public abstract uint add_font_button (string page_name, string group_name, string schema_id, string key, string title, string keywords, int priority); + public abstract void add_group (string page_name, string group_name, string title, int priority); + public abstract void add_list_group (string page_name, string group_name, string title, Gtk.SelectionMode mode, int priority); + public abstract void add_page (string page_name, string title, int priority); + public abstract uint add_radio (string page_name, string group_name, string schema_id, string key, string? path, string? variant_string, string? title, string? subtitle, string? keywords, int priority); + public abstract uint add_spin_button (string page_name, string group_name, string schema_id, string key, string path, string title, string subtitle, string keywords, int priority); + public abstract uint add_switch (string page_name, string group_name, string schema_id, string key, string? path, string? variant_string, string? title, string? subtitle, string? keywords, int priority); + public abstract unowned Gtk.Widget? get_widget (uint widget_id); + public abstract bool remove_id (uint widget_id); + public abstract void set_page (string page_name, GLib.HashTable map); + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + public struct Counter { + public Dazzle.CounterValue values; + public weak string category; + public weak string name; + public weak string description; + public int64 @get (); + public void reset (); + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + public struct CounterValue { + public int64 value; + [CCode (array_length = false)] + public weak int64 padding[7]; + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + public struct FileTransferStat { + public int64 n_files_total; + public int64 n_files; + public int64 n_dirs_total; + public int64 n_dirs; + public int64 n_bytes_total; + public int64 n_bytes; + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + public struct FuzzyMutableIndexMatch { + public weak string key; + public void* value; + public float score; + public uint id; + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + public struct GraphModelIter { + [CCode (array_length = false)] + public weak void* data[8]; + } + [CCode (cheader_filename = "dazzle.h", has_type_id = false)] + public struct ShortcutEntry { + public weak string command; + public Dazzle.ShortcutPhase phase; + public weak string default_accel; + public weak string section; + public weak string group; + public weak string title; + public weak string subtitle; + } + [CCode (cheader_filename = "dazzle.h", cname = "_DzlGraphColumnClass", has_type_id = false)] + public struct _GraphColumnClass { + public weak GLib.ObjectClass parent; + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_ANIMATION_", type_id = "dzl_animation_mode_get_type ()")] + public enum AnimationMode { + LINEAR, + EASE_IN_QUAD, + EASE_IN_OUT_QUAD, + EASE_OUT_QUAD, + EASE_IN_CUBIC, + EASE_OUT_CUBIC, + EASE_IN_OUT_CUBIC + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_DOCK_REVEALER_TRANSITION_TYPE_", type_id = "dzl_dock_revealer_transition_type_get_type ()")] + public enum DockRevealerTransitionType { + NONE, + SLIDE_RIGHT, + SLIDE_LEFT, + SLIDE_UP, + SLIDE_DOWN + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_FILE_TRANSFER_FLAGS_", type_id = "dzl_file_transfer_flags_get_type ()")] + [Flags] + public enum FileTransferFlags { + NONE, + MOVE + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_PROPERTIES_FLAGS_", has_type_id = false)] + [Flags] + public enum PropertiesFlags { + NONE, + STATEFUL_BOOLEANS + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_SHORTCUT_MATCH_", type_id = "dzl_shortcut_match_get_type ()")] + public enum ShortcutMatch { + NONE, + EQUAL, + PARTIAL + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_SHORTCUT_PHASE_", type_id = "dzl_shortcut_phase_get_type ()")] + [Flags] + public enum ShortcutPhase { + DISPATCH, + CAPTURE, + BUBBLE, + GLOBAL + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_SHORTCUT_", has_type_id = false)] + [Version (since = "3.20")] + public enum ShortcutType { + ACCELERATOR, + GESTURE_PINCH, + GESTURE_STRETCH, + GESTURE_ROTATE_CLOCKWISE, + GESTURE_ROTATE_COUNTERCLOCKWISE, + GESTURE_TWO_FINGER_SWIPE_LEFT, + GESTURE_TWO_FINGER_SWIPE_RIGHT, + GESTURE + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_SLIDER_", type_id = "dzl_slider_position_get_type ()")] + public enum SliderPosition { + NONE, + TOP, + RIGHT, + BOTTOM, + LEFT + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_TAB_", type_id = "dzl_tab_style_get_type ()")] + [Flags] + public enum TabStyle { + ICONS, + TEXT, + BOTH + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_THREE_GRID_COLUMN_", type_id = "dzl_three_grid_column_get_type ()")] + public enum ThreeGridColumn { + LEFT, + CENTER, + RIGHT + } + [CCode (cheader_filename = "dazzle.h", cprefix = "DZL_TREE_DROP_", type_id = "dzl_tree_drop_position_get_type ()")] + public enum TreeDropPosition { + INTO, + BEFORE, + AFTER + } + [CCode (cheader_filename = "dazzle.h", instance_pos = 1.9)] + public delegate void CounterForeachFunc (Dazzle.Counter counter); + [CCode (cheader_filename = "dazzle.h", instance_pos = 3.9)] + public delegate bool DirectoryModelVisibleFunc (Dazzle.DirectoryModel self, GLib.File directory, GLib.FileInfo file_info); + [CCode (cheader_filename = "dazzle.h", instance_pos = 1.9)] + public delegate bool ListModelFilterFunc (GLib.Object object); + [CCode (cheader_filename = "dazzle.h", instance_pos = 1.9)] + public delegate bool RecursiveIgnoreFunc (GLib.File file); + [CCode (cheader_filename = "dazzle.h", instance_pos = 2.9)] + public delegate void ShortcutChordTableForeach (Dazzle.ShortcutChord chord, void* chord_data); + [CCode (cheader_filename = "dazzle.h", instance_pos = 1.9)] + public delegate Gtk.Widget StackListCreateWidgetFunc ([CCode (type = "gpointer")] GLib.Object item); + [CCode (cheader_filename = "dazzle.h", instance_pos = 3.9)] + [Version (since = "3.26")] + public delegate void SuggestionPositionFunc (Dazzle.SuggestionEntry entry, ref Gdk.Rectangle area, ref bool is_absolute); + [CCode (cheader_filename = "dazzle.h", instance_pos = 3.9)] + public delegate void TaskCacheCallback (Dazzle.TaskCache self, void* key, GLib.Task task); + [CCode (cheader_filename = "dazzle.h", instance_pos = 2.9)] + public delegate bool TreeFilterFunc (Dazzle.Tree tree, Dazzle.TreeNode node); + [CCode (cheader_filename = "dazzle.h", instance_pos = 3.9)] + public delegate bool TreeFindFunc (Dazzle.Tree tree, Dazzle.TreeNode node, Dazzle.TreeNode child); + [CCode (cheader_filename = "dazzle.h", instance_pos = 2.9)] + public delegate int TreeNodeCompareFunc (Dazzle.TreeNode a, Dazzle.TreeNode b); + [CCode (cheader_filename = "dazzle.h", instance_pos = 3.9)] + public delegate bool TrieTraverseFunc (Dazzle.Trie dzl_trie, string key, void* value); + [CCode (cheader_filename = "dazzle.h", cname = "DZL_COUNTER_REQUIRES_ATOMIC")] + public const int COUNTER_REQUIRES_ATOMIC; + [CCode (cheader_filename = "dazzle.h", cname = "DZL_DOCK_BIN_STYLE_CLASS_PINNED")] + public const string DOCK_BIN_STYLE_CLASS_PINNED; + [CCode (cheader_filename = "dazzle.h", cname = "DZL_ENABLE_TRACE")] + public const int ENABLE_TRACE; + [CCode (cheader_filename = "dazzle.h", cname = "DZL_MAJOR_VERSION")] + public const int MAJOR_VERSION; + [CCode (cheader_filename = "dazzle.h", cname = "DZL_MICRO_VERSION")] + public const int MICRO_VERSION; + [CCode (cheader_filename = "dazzle.h", cname = "DZL_MINOR_VERSION")] + public const int MINOR_VERSION; + [CCode (cheader_filename = "dazzle.h", cname = "DZL_VERSION_S")] + public const string VERSION_S; + [CCode (cheader_filename = "dazzle.h")] + public static Cairo.Region cairo_region_create_from_clip_extents (Cairo.Context cr); + [CCode (cheader_filename = "dazzle.h")] + public static void cairo_rounded_rectangle (Cairo.Context cr, Gdk.Rectangle rect, int x_radius, int y_radius); + [CCode (cheader_filename = "dazzle.h")] + [Version (since = "3.28")] + public static unowned GLib.Cancellable? cancellable_chain (GLib.Cancellable? self = null, GLib.Cancellable? other = null); + [CCode (array_length = false, array_null_terminated = true, cheader_filename = "dazzle.h")] + public static string[] dnd_get_uri_list (Gtk.SelectionData selection_data); + [CCode (cheader_filename = "dazzle.h")] + public static bool file_manager_show (GLib.File file) throws GLib.Error; + [CCode (cheader_filename = "dazzle.h")] + public static string fuzzy_highlight (string str, string query, bool case_sensitive); + [CCode (cheader_filename = "dazzle.h")] + public static string g_date_time_format_for_display (GLib.DateTime self); + [CCode (cheader_filename = "dazzle.h")] + public static string g_time_span_to_label (GLib.TimeSpan span); + [CCode (cheader_filename = "dazzle.h")] + public static bool g_time_span_to_label_mapping (GLib.Binding binding, GLib.Value from_value, GLib.Value to_value, void* user_data); + [CCode (cheader_filename = "dazzle.h")] + public static uint g_variant_hash (void* data); + [CCode (cheader_filename = "dazzle.h")] + public static uint get_current_cpu_call (); + [CCode (cheader_filename = "dazzle.h")] + [Version (since = "3.26")] + public static void gtk_list_store_insert_sorted (Gtk.ListStore store, out Gtk.TreeIter iter, void* key, uint compare_column, GLib.CompareDataFunc compare_func); + [CCode (cheader_filename = "dazzle.h")] + public static void gtk_text_buffer_remove_tag (Gtk.TextBuffer buffer, Gtk.TextTag tag, Gtk.TextIter start, Gtk.TextIter end, bool minimal_damage); + [CCode (cheader_filename = "dazzle.h")] + public static bool gtk_widget_action (Gtk.Widget widget, string group, string name, GLib.Variant param); + [CCode (cheader_filename = "dazzle.h")] + public static bool gtk_widget_action_with_string (Gtk.Widget widget, string group, string name, string param); + [CCode (cheader_filename = "dazzle.h")] + public static void gtk_widget_add_style_class (Gtk.Widget widget, string class_name); + [CCode (cheader_filename = "dazzle.h")] + public static unowned Gtk.Widget? gtk_widget_find_child_typed (Gtk.Widget widget, GLib.Type type); + [CCode (cheader_filename = "dazzle.h")] + public static unowned Gtk.Widget? gtk_widget_get_relative (Gtk.Widget widget, GLib.Type relative_type); + [CCode (cheader_filename = "dazzle.h")] + public static void gtk_widget_hide_with_fade (Gtk.Widget widget); + [CCode (cheader_filename = "dazzle.h")] + [Version (since = "3.26")] + public static bool gtk_widget_is_ancestor_or_relative (Gtk.Widget widget, Gtk.Widget ancestor); + [CCode (cheader_filename = "dazzle.h")] + public static void gtk_widget_mux_action_groups (Gtk.Widget widget, Gtk.Widget from_widget, string? mux_key); + [CCode (cheader_filename = "dazzle.h")] + public static void gtk_widget_remove_style_class (Gtk.Widget widget, string class_name); + [CCode (cheader_filename = "dazzle.h")] + public static void gtk_widget_show_with_fade (Gtk.Widget widget); + [CCode (cheader_filename = "dazzle.h")] + public static int levenshtein (string needle, string haystack); + [CCode (cheader_filename = "dazzle.h")] + public static void overlay_add_child (Dazzle.DockOverlay self, Gtk.Widget child, string type); + [CCode (cheader_filename = "dazzle.h")] + public static string pango_font_description_to_css (Pango.FontDescription font_desc); + [CCode (cheader_filename = "dazzle.h")] + public static void rgba_shade (Gdk.RGBA rgba, Gdk.RGBA dst, double k); +}