├── .clang-format ├── .github └── FUNDING.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── NEWS ├── README.md ├── THANKS ├── TODO ├── data ├── appstream │ ├── meson.build │ └── org.gnome.GPaste.Ui.appdata.xml.in ├── completions │ ├── _gpaste-client │ ├── gpaste-client │ └── meson.build ├── control-center │ ├── 42-gpaste.control-center.xml.in │ └── meson.build ├── dbus │ ├── meson.build │ ├── org.gnome.GPaste.Preferences.dbus.in │ ├── org.gnome.GPaste.Ui.dbus.in │ └── org.gnome.GPaste.dbus.in ├── desktop │ ├── meson.build │ ├── org.gnome.GPaste.Preferences.desktop.in.in │ └── org.gnome.GPaste.Ui.desktop.in.in ├── gsettings │ ├── meson.build │ └── org.gnome.GPaste.gschema.xml.in ├── meson.build ├── search-provider │ ├── meson.build │ └── org.gnome.GPaste.search-provider.ini └── systemd │ ├── meson.build │ ├── org.gnome.GPaste.Preferences.systemd.in │ ├── org.gnome.GPaste.Ui.systemd.in │ └── org.gnome.GPaste.systemd.in ├── man ├── 1 │ ├── gpaste-client.1 │ └── meson.build └── meson.build ├── meson.build ├── meson_options.txt ├── po ├── GPaste.pot ├── LINGUAS ├── Makevars ├── POTFILES.in ├── POTFILES.skip ├── ar.po ├── cs.po ├── da.po ├── de.po ├── es.po ├── fa.po ├── fi.po ├── fr.po ├── gl.po ├── gpaste-gpaste-fi.po ├── is.po ├── it.po ├── ja.po ├── ka.po ├── ko.po ├── meson.build ├── nb_NO.po ├── nl_NL.po ├── oc.po ├── pl.po ├── pt_BR.po ├── ru.po ├── sl.po ├── sv.po ├── ta.po ├── tok.po ├── tr.po ├── uk.po ├── vi.po ├── zh_CN.po └── zh_Hant.po ├── release.sh ├── src ├── client │ ├── gpaste-client.c │ └── meson.build ├── daemon │ ├── gpaste-daemon.c │ ├── meson.build │ ├── next │ │ ├── gpaste-keybinder.c │ │ ├── gpaste-keybinder.h │ │ ├── gpaste-keybinding.c │ │ └── gpaste-keybinding.h │ └── tmp │ │ ├── gpaste-bus-object.c │ │ ├── gpaste-bus-object.h │ │ ├── gpaste-bus.c │ │ ├── gpaste-bus.h │ │ ├── gpaste-clipboard.c │ │ ├── gpaste-clipboard.h │ │ ├── gpaste-clipboards-manager.c │ │ ├── gpaste-clipboards-manager.h │ │ ├── gpaste-daemon.c │ │ ├── gpaste-daemon.h │ │ ├── gpaste-file-backend.c │ │ ├── gpaste-file-backend.h │ │ ├── gpaste-history.c │ │ ├── gpaste-history.h │ │ ├── gpaste-image-item.c │ │ ├── gpaste-image-item.h │ │ ├── gpaste-item.c │ │ ├── gpaste-item.h │ │ ├── gpaste-keybinder.c │ │ ├── gpaste-keybinder.h │ │ ├── gpaste-keybinding.c │ │ ├── gpaste-keybinding.h │ │ ├── gpaste-make-password-keybinding.c │ │ ├── gpaste-make-password-keybinding.h │ │ ├── gpaste-password-item.c │ │ ├── gpaste-password-item.h │ │ ├── gpaste-pop-keybinding.c │ │ ├── gpaste-pop-keybinding.h │ │ ├── gpaste-search-provider.c │ │ ├── gpaste-search-provider.h │ │ ├── gpaste-show-history-keybinding.c │ │ ├── gpaste-show-history-keybinding.h │ │ ├── gpaste-special-atom.c │ │ ├── gpaste-special-atom.h │ │ ├── gpaste-storage-backend.c │ │ ├── gpaste-storage-backend.h │ │ ├── gpaste-sync-clipboard-to-primary-keybinding.c │ │ ├── gpaste-sync-clipboard-to-primary-keybinding.h │ │ ├── gpaste-sync-primary-to-clipboard-keybinding.c │ │ ├── gpaste-sync-primary-to-clipboard-keybinding.h │ │ ├── gpaste-text-item.c │ │ ├── gpaste-text-item.h │ │ ├── gpaste-ui-keybinding.c │ │ ├── gpaste-ui-keybinding.h │ │ ├── gpaste-upload-keybinding.c │ │ ├── gpaste-upload-keybinding.h │ │ ├── gpaste-uris-item.c │ │ └── gpaste-uris-item.h ├── gnome-shell │ ├── aboutItem.js │ ├── actionButton.js │ ├── actionButtonActor.js │ ├── actions.js │ ├── checkerBypass.js │ ├── deleteButton.js │ ├── deleteItemPart.js │ ├── dependencies.js │ ├── dummyHistoryItem.js │ ├── emptyHistoryItem.js │ ├── extension.js │ ├── indicator.js │ ├── item.js │ ├── meson.build │ ├── metadata.json.in │ ├── padding.js │ ├── pageItem.js │ ├── pageSwitcher.js │ ├── prefs.js │ ├── searchItem.js │ ├── stateSwitch.js │ ├── statusIcon.js │ └── uiItem.js ├── libgpaste │ ├── gpaste-gtk3.h │ ├── gpaste-gtk3 │ │ ├── gpaste-gtk-macros.h │ │ ├── gpaste-gtk-settings-ui-panel.c │ │ ├── gpaste-gtk-settings-ui-panel.h │ │ ├── gpaste-gtk-settings-ui-stack.c │ │ ├── gpaste-gtk-settings-ui-stack.h │ │ ├── gpaste-gtk-settings-ui-widget.c │ │ ├── gpaste-gtk-settings-ui-widget.h │ │ ├── gpaste-gtk-util.c │ │ └── gpaste-gtk-util.h │ ├── gpaste-gtk4.h │ ├── gpaste-gtk4 │ │ ├── gpaste-gtk-macros.h │ │ ├── gpaste-gtk-preferences-behaviour-page.c │ │ ├── gpaste-gtk-preferences-behaviour-page.h │ │ ├── gpaste-gtk-preferences-dialog.c │ │ ├── gpaste-gtk-preferences-dialog.h │ │ ├── gpaste-gtk-preferences-group.c │ │ ├── gpaste-gtk-preferences-group.h │ │ ├── gpaste-gtk-preferences-history-settings-page.c │ │ ├── gpaste-gtk-preferences-history-settings-page.h │ │ ├── gpaste-gtk-preferences-manager.c │ │ ├── gpaste-gtk-preferences-manager.h │ │ ├── gpaste-gtk-preferences-page.c │ │ ├── gpaste-gtk-preferences-page.h │ │ ├── gpaste-gtk-preferences-shortcuts-page.c │ │ ├── gpaste-gtk-preferences-shortcuts-page.h │ │ ├── gpaste-gtk-preferences-widget.c │ │ ├── gpaste-gtk-preferences-widget.h │ │ ├── gpaste-gtk-util.c │ │ └── gpaste-gtk-util.h │ ├── gpaste.h │ ├── gpaste │ │ ├── gpaste-client-item.c │ │ ├── gpaste-client-item.h │ │ ├── gpaste-client.c │ │ ├── gpaste-client.h │ │ ├── gpaste-gdbus-defines.h │ │ ├── gpaste-gdbus-macros.h │ │ ├── gpaste-gnome-shell-client.c │ │ ├── gpaste-gnome-shell-client.h │ │ ├── gpaste-gsettings-keys.h │ │ ├── gpaste-item-enums.c │ │ ├── gpaste-item-enums.h │ │ ├── gpaste-macros.h │ │ ├── gpaste-screensaver-client.c │ │ ├── gpaste-screensaver-client.h │ │ ├── gpaste-settings.c │ │ ├── gpaste-settings.h │ │ ├── gpaste-update-enums.c │ │ ├── gpaste-update-enums.h │ │ ├── gpaste-util.c │ │ └── gpaste-util.h │ ├── libgpaste-gtk3.sym │ ├── libgpaste-gtk4.sym │ ├── libgpaste.sym │ └── meson.build ├── meson.build ├── preferences │ ├── gpaste-preferences.c │ └── meson.build └── ui │ ├── gpaste-ui-about.c │ ├── gpaste-ui-about.h │ ├── gpaste-ui-backup-history.c │ ├── gpaste-ui-backup-history.h │ ├── gpaste-ui-delete-history.c │ ├── gpaste-ui-delete-history.h │ ├── gpaste-ui-delete-item.c │ ├── gpaste-ui-delete-item.h │ ├── gpaste-ui-edit-item.c │ ├── gpaste-ui-edit-item.h │ ├── gpaste-ui-empty-history.c │ ├── gpaste-ui-empty-history.h │ ├── gpaste-ui-empty-item.c │ ├── gpaste-ui-empty-item.h │ ├── gpaste-ui-header.c │ ├── gpaste-ui-header.h │ ├── gpaste-ui-history-action.c │ ├── gpaste-ui-history-action.h │ ├── gpaste-ui-history-actions.c │ ├── gpaste-ui-history-actions.h │ ├── gpaste-ui-history.c │ ├── gpaste-ui-history.h │ ├── gpaste-ui-item-action.c │ ├── gpaste-ui-item-action.h │ ├── gpaste-ui-item-skeleton.c │ ├── gpaste-ui-item-skeleton.h │ ├── gpaste-ui-item.c │ ├── gpaste-ui-item.h │ ├── gpaste-ui-new-item.c │ ├── gpaste-ui-new-item.h │ ├── gpaste-ui-panel-history.c │ ├── gpaste-ui-panel-history.h │ ├── gpaste-ui-panel.c │ ├── gpaste-ui-panel.h │ ├── gpaste-ui-reexec.c │ ├── gpaste-ui-reexec.h │ ├── gpaste-ui-search-bar.c │ ├── gpaste-ui-search-bar.h │ ├── gpaste-ui-search.c │ ├── gpaste-ui-search.h │ ├── gpaste-ui-settings.c │ ├── gpaste-ui-settings.h │ ├── gpaste-ui-shortcuts-window.c │ ├── gpaste-ui-shortcuts-window.h │ ├── gpaste-ui-switch.c │ ├── gpaste-ui-switch.h │ ├── gpaste-ui-upload-item.c │ ├── gpaste-ui-upload-item.h │ ├── gpaste-ui-window.c │ ├── gpaste-ui-window.h │ ├── gpaste-ui.c │ └── meson.build ├── tests ├── gnome-shell-client │ ├── meson.build │ └── test-gnome-shell-client.c └── meson.build └── tools └── check-includes.sh /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AlignAfterOpenBracket: true 3 | AlignOperands: true 4 | AlignTrailingComments: true 5 | AlwaysBreakAfterDefinitionReturnType: All 6 | BinPackArguments: false 7 | BreakBeforeBraces: Allman 8 | ColumnLimit: 0 9 | IndentWidth: 4 10 | MaxEmptyLinesToKeep: 1 11 | SpaceBeforeParens: Always 12 | UseTab: Never 13 | ... 14 | Language: JavaScript 15 | DisableFormat: true 16 | ... 17 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: Keruspe 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.buildconfig 2 | /.cache 3 | /Makefile 4 | /bin/* 5 | /build 6 | /tests/bin/* 7 | /data/appstream/*.appdata.xml 8 | /data/appstream/*.appdata.valid 9 | /data/control-center/*.xml 10 | /data/desktop/*.desktop 11 | /data/desktop/*.desktop.in 12 | /data/dbus/*.service 13 | /data/gsettings/*.gschema.xml 14 | /data/systemd/*.service 15 | /bindings 16 | /data/pkg-config/*.pc 17 | /man/*.1 18 | /ABOUT-NLS 19 | /po/Makefile 20 | /po/Makevars.template 21 | /po/Rules-quot 22 | /po/boldquot.sed 23 | /po/en@boldquot.header 24 | /po/en@quot.header 25 | /po/insert-header.sin 26 | /po/quot.sed 27 | /po/remove-potcdate.sed 28 | /po/remove-potcdate.sin 29 | /src/gnome-shell/metadata.json 30 | /test-suite.log 31 | *.mo 32 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lead developer 2 | Marc-Antoine Perennou 3 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2018, Marc-Antoine Perennou 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following 8 | disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 14 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 16 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 18 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 19 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2011-06-29 Marc-Antoine Perennou 2 | 3 | * *: The ChangeLog is autogenerated when releasing, see git log for changes 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Coverity Scan Build Status 4 | 5 | 6 | GPaste is a clipboard management system. 7 | See for more information about what clipboard 8 | managers are. 9 | 10 | Translators can use [weblate](https://hosted.weblate.org/projects/gpaste/gpaste/) to contribute. 11 | 12 | A library is available for development purposes: 13 | 14 | * `libgpaste` contains all the basic objects used by GPaste and allows you to manage preferences and the GPaste daemon. 15 | 16 | A default daemon named `gpaste-daemon` is provided, with seven keybindings: 17 | 18 | * show history 19 | * pop the item from the history 20 | * sync primary selection with clipboard 21 | * sync clipboard with primary selection 22 | * mark the active item as being a password 23 | * upload the active item to a pastebin service (using wgetpaste) 24 | * launch the graphical tool 25 | 26 | A simple CLI interface is provided: `gpaste-client`, with a subcommands: `gpaste-client ui` which makes the graphical tool pop. 27 | 28 | A native gnome-shell extension is provided. 29 | 30 | /!\ Don't forget to run `gpaste-client dr` aka `gpaste-client daemon-reexec` after upgrading GPaste to activate new functionalities ;) 31 | 32 | You can then run `gpaste-client daemon-version` to check the correct daemon is now running. 33 | 34 | Steps to install it after cloning: 35 | 36 | mkdir builddir 37 | cd builddir 38 | meson .. 39 | ninja 40 | sudo ninja install 41 | sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ 42 | 43 | You can see everything I'll post about GPaste [there](https://www.imagination-land.org/tags/GPaste.html). 44 | 45 | Latest release for GNOME 45 to 48 is: [GPaste 45.3](https://www.imagination-land.org/posts/2025-04-14-gpaste-45.3-released.html). 46 | 47 | Direct link to download: 48 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | Christian Kluge 2 | Christian Schendel 3 | Elder Marco 4 | Gary van der Merwe 5 | Heimen Stoffels 6 | Jan Alexander Steffens (heftig) 7 | Jesse Jaara 8 | Julien Durillon 9 | Jérémy Lal 10 | Louis 11 | Lukas Zapletal 12 | Mog 13 | Toni TC 14 | camporez 15 | renataogarcia 16 | whyoh 17 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | general: 2 | wayland support 3 | properties all the way (when GProperty stuff lands) 4 | libgpaste-client: 5 | specify errors types when possible in g-i 6 | tests: 7 | split test, add interactive wrapper 8 | -------------------------------------------------------------------------------- /data/appstream/meson.build: -------------------------------------------------------------------------------- 1 | i18n.merge_file( 2 | input: 'org.gnome.GPaste.Ui.appdata.xml.in', 3 | po_dir: gpaste_po_dir, 4 | output: 'org.gnome.GPaste.Ui.appdata.xml', 5 | install: true, 6 | install_dir: join_paths(get_option('datadir'), 'metainfo'), 7 | ) 8 | -------------------------------------------------------------------------------- /data/completions/gpaste-client: -------------------------------------------------------------------------------- 1 | _gpaste-client() 2 | { 3 | local cur 4 | 5 | cur="${COMP_WORDS[${COMP_CWORD}]}" 6 | COMPREPLY=() 7 | 8 | if [[ ${COMP_CWORD} == 1 ]]; then 9 | 10 | local opts 11 | 12 | opts="about add add-password backup-history daemon daemon-reexec daemon-version delete delete-history --decoration -d delete-password empty file get get-history help --help -h history history-size list-histories merge --oneline -o preferences quit remove --raw -r rename-password replace --reverse -e select --separator -s set set-password settings show-history start stop switch-history upload ui version --version -v --zero -z" 13 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur} ) ) 14 | 15 | elif [[ ${COMP_CWORD} == 2 ]]; then 16 | 17 | local action 18 | 19 | action="${COMP_WORDS[1]}" 20 | case "${action}" in 21 | file|f) 22 | COMPREPLY=( $(compgen -f ) ) 23 | ;; 24 | get|g) 25 | COMPREPLY=( compgen -W "--raw -r" -- ${cur} ) 26 | ;; 27 | history|h) 28 | COMPREPLY=( compgen -W "--oneline -o --raw -r --reverse -e --zero -z" -- ${cur} ) 29 | ;; 30 | esac 31 | 32 | fi 33 | } 34 | 35 | complete -F _gpaste-client gpaste-client 36 | -------------------------------------------------------------------------------- /data/completions/meson.build: -------------------------------------------------------------------------------- 1 | if get_option('bash-completion') 2 | install_data( 3 | 'gpaste-client', 4 | install_dir: join_paths(get_option('datadir'), 'bash-completion', 'completions'), 5 | ) 6 | endif 7 | 8 | if get_option('zsh-completion') 9 | install_data( 10 | '_gpaste-client', 11 | install_dir: join_paths(get_option('datadir'), 'zsh', 'site-functions'), 12 | ) 13 | endif 14 | -------------------------------------------------------------------------------- /data/control-center/42-gpaste.control-center.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /data/control-center/meson.build: -------------------------------------------------------------------------------- 1 | configure_file( 2 | input: '42-gpaste.control-center.xml.in', 3 | configuration: conf, 4 | output: '42-gpaste.xml', 5 | install: true, 6 | install_dir: keybindings_dir, 7 | ) 8 | -------------------------------------------------------------------------------- /data/dbus/meson.build: -------------------------------------------------------------------------------- 1 | configure_file( 2 | input: 'org.gnome.GPaste.Ui.dbus.in', 3 | configuration: conf, 4 | output: 'org.gnome.GPaste.Ui.service', 5 | install: true, 6 | install_dir: dbus_service_dir, 7 | ) 8 | 9 | configure_file( 10 | input: 'org.gnome.GPaste.Preferences.dbus.in', 11 | configuration: conf, 12 | output: 'org.gnome.GPaste.Preferences.service', 13 | install: true, 14 | install_dir: dbus_service_dir, 15 | ) 16 | 17 | configure_file( 18 | input: 'org.gnome.GPaste.dbus.in', 19 | configuration: conf, 20 | output: 'org.gnome.GPaste.service', 21 | install: true, 22 | install_dir: dbus_service_dir, 23 | ) 24 | -------------------------------------------------------------------------------- /data/dbus/org.gnome.GPaste.Preferences.dbus.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.gnome.GPaste.Preferences 3 | Exec=@pkglibexecdir@/gpaste-preferences --gapplication-service 4 | SystemdService=org.gnome.GPaste.Preferences.service 5 | -------------------------------------------------------------------------------- /data/dbus/org.gnome.GPaste.Ui.dbus.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.gnome.GPaste.Ui 3 | Exec=@pkglibexecdir@/gpaste-ui --gapplication-service 4 | SystemdService=org.gnome.GPaste.Ui.service 5 | -------------------------------------------------------------------------------- /data/dbus/org.gnome.GPaste.dbus.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.gnome.GPaste 3 | Exec=@pkglibexecdir@/gpaste-daemon 4 | SystemdService=org.gnome.GPaste.service 5 | -------------------------------------------------------------------------------- /data/desktop/meson.build: -------------------------------------------------------------------------------- 1 | preferences_untranslated_desktop_file = configure_file( 2 | input: 'org.gnome.GPaste.Preferences.desktop.in.in', 3 | configuration: conf, 4 | output: 'org.gnome.GPaste.Preferences.desktop.in', 5 | ) 6 | 7 | i18n.merge_file( 8 | input: preferences_untranslated_desktop_file, 9 | po_dir: gpaste_po_dir, 10 | type: 'desktop', 11 | output: 'org.gnome.GPaste.Preferences.desktop', 12 | install: true, 13 | install_dir: join_paths(get_option('datadir'), 'applications'), 14 | ) 15 | 16 | ui_untranslated_desktop_file = configure_file( 17 | input: 'org.gnome.GPaste.Ui.desktop.in.in', 18 | configuration: conf, 19 | output: 'org.gnome.GPaste.Ui.desktop.in', 20 | ) 21 | 22 | i18n.merge_file( 23 | input: ui_untranslated_desktop_file, 24 | po_dir: gpaste_po_dir, 25 | type: 'desktop', 26 | output: 'org.gnome.GPaste.Ui.desktop', 27 | install: true, 28 | install_dir: join_paths(get_option('datadir'), 'applications'), 29 | ) 30 | -------------------------------------------------------------------------------- /data/desktop/org.gnome.GPaste.Preferences.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=GPaste Preferences 4 | Comment=Manage your GPaste preferences 5 | Keywords=Clipboard;Manager;Settings;Preferences;Configuration; 6 | Icon=edit-paste 7 | Exec=@pkglibexecdir@/gpaste-preferences 8 | DBusActivatable=true 9 | Terminal=false 10 | Categories=GTK;GNOME;Settings;X-GNOME-PersonalSettings; 11 | StartupNotify=true 12 | -------------------------------------------------------------------------------- /data/desktop/org.gnome.GPaste.Ui.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=GPaste 4 | Comment=Manage your clipboard history 5 | Keywords=Clipboard;Manager;Settings;Preferences;Configuration; 6 | Icon=edit-paste 7 | Exec=@pkglibexecdir@/gpaste-ui 8 | DBusActivatable=true 9 | Terminal=false 10 | Categories=GTK;GNOME;Settings;X-GNOME-PersonalSettings; 11 | StartupNotify=true 12 | -------------------------------------------------------------------------------- /data/gsettings/meson.build: -------------------------------------------------------------------------------- 1 | configure_file( 2 | input: 'org.gnome.GPaste.gschema.xml.in', 3 | configuration: conf, 4 | output: 'org.gnome.GPaste.gschema.xml', 5 | install: true, 6 | install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'), 7 | ) 8 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | subdir('appstream') 2 | subdir('completions') 3 | subdir('control-center') 4 | subdir('dbus') 5 | subdir('desktop') 6 | subdir('gsettings') 7 | 8 | if get_option('gnome-shell') 9 | subdir('search-provider') 10 | endif 11 | 12 | if get_option('systemd') 13 | subdir('systemd') 14 | endif 15 | -------------------------------------------------------------------------------- /data/search-provider/meson.build: -------------------------------------------------------------------------------- 1 | install_data( 2 | 'org.gnome.GPaste.search-provider.ini', 3 | install_dir: join_paths(get_option('datadir'), 'gnome-shell', 'search-providers'), 4 | ) -------------------------------------------------------------------------------- /data/search-provider/org.gnome.GPaste.search-provider.ini: -------------------------------------------------------------------------------- 1 | [Shell Search Provider] 2 | DesktopId=org.gnome.GPaste.Ui.desktop 3 | BusName=org.gnome.GPaste 4 | ObjectPath=/org/gnome/GPaste/SearchProvider 5 | Version=2 6 | -------------------------------------------------------------------------------- /data/systemd/meson.build: -------------------------------------------------------------------------------- 1 | configure_file( 2 | input: 'org.gnome.GPaste.Ui.systemd.in', 3 | configuration: conf, 4 | output: 'org.gnome.GPaste.Ui.service', 5 | install: get_option('systemd'), 6 | install_dir: userunit_dir, 7 | ) 8 | 9 | configure_file( 10 | input: 'org.gnome.GPaste.Preferences.systemd.in', 11 | configuration: conf, 12 | output: 'org.gnome.GPaste.Preferences.service', 13 | install: get_option('systemd'), 14 | install_dir: userunit_dir, 15 | ) 16 | 17 | configure_file( 18 | input: 'org.gnome.GPaste.systemd.in', 19 | configuration: conf, 20 | output: 'org.gnome.GPaste.service', 21 | install: get_option('systemd'), 22 | install_dir: userunit_dir, 23 | ) 24 | -------------------------------------------------------------------------------- /data/systemd/org.gnome.GPaste.Preferences.systemd.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=GPaste preferences 3 | 4 | [Service] 5 | Type=dbus 6 | BusName=org.gnome.GPaste.Preferences 7 | ExecStart=@pkglibexecdir@/gpaste-preferences --gapplication-service 8 | -------------------------------------------------------------------------------- /data/systemd/org.gnome.GPaste.Ui.systemd.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=GPaste user interface 3 | 4 | [Service] 5 | Type=dbus 6 | BusName=org.gnome.GPaste.Ui 7 | ExecStart=@pkglibexecdir@/gpaste-ui --gapplication-service 8 | -------------------------------------------------------------------------------- /data/systemd/org.gnome.GPaste.systemd.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=GPaste daemon 3 | PartOf=graphical-session.target 4 | After=graphical-session.target 5 | 6 | [Service] 7 | Type=dbus 8 | BusName=org.gnome.GPaste 9 | ExecStart=@pkglibexecdir@/gpaste-daemon 10 | 11 | [Install] 12 | WantedBy=graphical-session.target 13 | -------------------------------------------------------------------------------- /man/1/meson.build: -------------------------------------------------------------------------------- 1 | install_man('gpaste-client.1') -------------------------------------------------------------------------------- /man/meson.build: -------------------------------------------------------------------------------- 1 | subdir('1') -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('bash-completion', type: 'boolean', value: true, description: 'install bash completion files') 2 | option('dbus-services-dir', type: 'string', value: '', description: 'path to the dbus services dir') 3 | option('introspection', type: 'boolean', value: true, description: 'build GIR data') 4 | option('control-center-keybindings-dir', type: 'string', value: '', description: 'path to where gnome-control-center stores its keybindings') 5 | option('gnome-shell', type: 'boolean', value: true, description: 'install the gnome-shell extension') 6 | option('systemd', type: 'boolean', value: true, description: 'install the systemd unit') 7 | option('systemd-user-unit-dir', type: 'string', value: '', description: 'path to where systemd stores its user units') 8 | option('vapi', type: 'boolean', value: true, description: 'build vala bindings') 9 | option('x-keybinder', type: 'boolean', value: true, description: 'build the x keybinder') 10 | option('zsh-completion', type: 'boolean', value: true, description: 'install zsh completion files') 11 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | ar 2 | cs 3 | de 4 | es 5 | fa 6 | fr 7 | it 8 | ja 9 | nb_NO 10 | nl_NL 11 | pl 12 | pt_BR 13 | ru 14 | sl 15 | sv 16 | tr 17 | zh_CN 18 | zh_Hant 19 | gl 20 | vi 21 | oc 22 | ka 23 | ko 24 | da 25 | uk 26 | tok 27 | is 28 | fi 29 | ta 30 | gpaste-gpaste-fi 31 | -------------------------------------------------------------------------------- /po/Makevars: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = GPaste 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments 12 | 13 | # This is the copyright holder that gets inserted into the header of the 14 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 15 | # package. (Note that the msgstr strings, extracted from the package's 16 | # sources, belong to the copyright holder of the package.) Translators are 17 | # expected to transfer the copyright for their translations to this person 18 | # or entity, or to disclaim their copyright. The empty string stands for 19 | # the public domain; in this case the translators are expected to disclaim 20 | # their copyright. 21 | COPYRIGHT_HOLDER = Marc-Antoine Perennou 22 | 23 | # This tells whether or not to prepend "GNU " prefix to the package 24 | # name that gets inserted into the header of the $(DOMAIN).pot file. 25 | # Possible values are "yes", "no", or empty. If it is empty, try to 26 | # detect it automatically by scanning the files in $(top_srcdir) for 27 | # "GNU packagename" string. 28 | PACKAGE_GNU = 29 | 30 | # This is the email address or URL to which the translators shall report 31 | # bugs in the untranslated strings: 32 | # - Strings which are not entire sentences, see the maintainer guidelines 33 | # in the GNU gettext documentation, section 'Preparing Strings'. 34 | # - Strings which use unclear terms or require additional context to be 35 | # understood. 36 | # - Strings which make invalid assumptions about notation of date, time or 37 | # money. 38 | # - Pluralisation problems. 39 | # - Incorrect English spelling. 40 | # - Incorrect formatting. 41 | # It can be your email address, or a mailing list address where translators 42 | # can write to without being subscribed, or the URL of a web page through 43 | # which the translators can contact you. 44 | MSGID_BUGS_ADDRESS = Marc-Antoine@Perennou.com 45 | 46 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 47 | # message catalogs shall be used. It is usually empty. 48 | EXTRA_LOCALE_CATEGORIES = 49 | 50 | # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' 51 | # context. Possible values are "yes" and "no". Set this to yes if the 52 | # package uses functions taking also a message context, like pgettext(), or 53 | # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. 54 | USE_MSGCTXT = no 55 | 56 | # These options get passed to msgmerge. 57 | # Useful options are in particular: 58 | # --previous to keep previous msgids of translated messages, 59 | # --quiet to reduce the verbosity. 60 | MSGMERGE_OPTIONS = 61 | 62 | # These options get passed to msginit. 63 | # If you want to disable line wrapping when writing PO files, add 64 | # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and 65 | # MSGINIT_OPTIONS. 66 | MSGINIT_OPTIONS = 67 | 68 | # This tells whether or not to regenerate a PO file when $(DOMAIN).pot 69 | # has changed. Possible values are "yes" and "no". Set this to no if 70 | # the POT file is checked in the repository and the version control 71 | # program ignores timestamps. 72 | PO_DEPENDS_ON_POT = yes 73 | 74 | # This tells whether or not to forcibly update $(DOMAIN).pot and 75 | # regenerate PO files on "make dist". Possible values are "yes" and 76 | # "no". Set this to no if the POT file and PO files are maintained 77 | # externally. 78 | DIST_DEPENDS_ON_UPDATE_PO = yes 79 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- 1 | data/appstream/org.gnome.GPaste.Ui.appdata.xml 2 | data/control-center/42-gpaste.control-center.xml 3 | data/desktop/org.gnome.GPaste.Preferences.desktop 4 | data/desktop/org.gnome.GPaste.Preferences.desktop.in 5 | data/desktop/org.gnome.GPaste.Ui.desktop 6 | data/desktop/org.gnome.GPaste.Ui.desktop.in 7 | data/gsettings/org.gnome.GPaste.gschema.xml 8 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext( 2 | 'GPaste', 3 | preset: 'glib', 4 | ) -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | run_ninja() { 6 | ninja -C build "${@}" 7 | } 8 | 9 | main() { 10 | local version="${1}" 11 | appstreamcli validate data/appstream/*.xml.in || exit 1 12 | run_ninja 13 | run_ninja GPaste-pot 14 | run_ninja GPaste-update-po 15 | git commit -asm "Release GPaste ${version}" 16 | run_ninja dist 17 | git tag -sm "Release GPaste ${version}" v${version} 18 | } 19 | 20 | main "${@}" 21 | -------------------------------------------------------------------------------- /src/client/meson.build: -------------------------------------------------------------------------------- 1 | gpaste_client_sources = [ 2 | 'gpaste-client.c', 3 | ] 4 | 5 | executable( 6 | 'gpaste-client', 7 | sources: gpaste_client_sources, 8 | install: true, 9 | dependencies: [ glib_dep, gtk3_dep, libgpaste_internal_dep ], 10 | install_dir: get_option('bindir'), 11 | ) 12 | -------------------------------------------------------------------------------- /src/daemon/meson.build: -------------------------------------------------------------------------------- 1 | gpaste_daemon_sources = [ 2 | 'gpaste-daemon.c', 3 | 'tmp/gpaste-bus-object.c', 4 | 'tmp/gpaste-bus.c', 5 | 'tmp/gpaste-clipboard.c', 6 | 'tmp/gpaste-clipboards-manager.c', 7 | 'tmp/gpaste-daemon.c', 8 | 'tmp/gpaste-file-backend.c', 9 | 'tmp/gpaste-history.c', 10 | 'tmp/gpaste-image-item.c', 11 | 'tmp/gpaste-item.c', 12 | 'tmp/gpaste-keybinder.c', 13 | 'tmp/gpaste-keybinding.c', 14 | 'tmp/gpaste-make-password-keybinding.c', 15 | 'tmp/gpaste-password-item.c', 16 | 'tmp/gpaste-pop-keybinding.c', 17 | 'tmp/gpaste-search-provider.c', 18 | 'tmp/gpaste-show-history-keybinding.c', 19 | 'tmp/gpaste-special-atom.c', 20 | 'tmp/gpaste-storage-backend.c', 21 | 'tmp/gpaste-sync-clipboard-to-primary-keybinding.c', 22 | 'tmp/gpaste-sync-primary-to-clipboard-keybinding.c', 23 | 'tmp/gpaste-text-item.c', 24 | 'tmp/gpaste-ui-keybinding.c', 25 | 'tmp/gpaste-upload-keybinding.c', 26 | 'tmp/gpaste-uris-item.c', 27 | ] 28 | 29 | gpaste_daemon_headers = [ 30 | 'tmp/gpaste-bus-object.h', 31 | 'tmp/gpaste-bus.h', 32 | 'tmp/gpaste-clipboard.h', 33 | 'tmp/gpaste-clipboards-manager.h', 34 | 'tmp/gpaste-daemon.h', 35 | 'tmp/gpaste-file-backend.h', 36 | 'tmp/gpaste-history.h', 37 | 'tmp/gpaste-image-item.h', 38 | 'tmp/gpaste-item.h', 39 | 'tmp/gpaste-keybinder.h', 40 | 'tmp/gpaste-keybinding.h', 41 | 'tmp/gpaste-make-password-keybinding.h', 42 | 'tmp/gpaste-password-item.h', 43 | 'tmp/gpaste-pop-keybinding.h', 44 | 'tmp/gpaste-search-provider.h', 45 | 'tmp/gpaste-show-history-keybinding.h', 46 | 'tmp/gpaste-special-atom.h', 47 | 'tmp/gpaste-storage-backend.h', 48 | 'tmp/gpaste-sync-clipboard-to-primary-keybinding.h', 49 | 'tmp/gpaste-sync-primary-to-clipboard-keybinding.h', 50 | 'tmp/gpaste-text-item.h', 51 | 'tmp/gpaste-ui-keybinding.h', 52 | 'tmp/gpaste-upload-keybinding.h', 53 | 'tmp/gpaste-uris-item.h', 54 | ] 55 | 56 | gpaste_daemon_headers_dep = declare_dependency( 57 | include_directories: include_directories('tmp', '../libgpaste'), 58 | sources: gpaste_daemon_headers, 59 | ) 60 | 61 | executable( 62 | 'gpaste-daemon', 63 | sources: gpaste_daemon_sources, 64 | install: true, 65 | dependencies: [ gcr_dep, glib_dep, gtk3_dep, libgpaste_internal_dep, libgpaste_gtk3_internal_dep, gpaste_daemon_headers_dep ] + keybinder_deps, 66 | install_dir: join_paths(get_option('libexecdir'), 'gpaste'), 67 | ) 68 | -------------------------------------------------------------------------------- /src/daemon/next/gpaste-keybinder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | G_BEGIN_DECLS 12 | 13 | #define G_PASTE_TYPE_KEYBINDER (g_paste_keybinder_get_type ()) 14 | 15 | G_PASTE_FINAL_TYPE (Keybinder, keybinder, KEYBINDER, GObject) 16 | 17 | void g_paste_keybinder_add_keybinding (GPasteKeybinder *self, 18 | GPasteKeybinding *binding); 19 | void g_paste_keybinder_activate_all (GPasteKeybinder *self); 20 | void g_paste_keybinder_deactivate_all (GPasteKeybinder *self); 21 | 22 | GPasteKeybinder *g_paste_keybinder_new (GPasteSettings *settings, 23 | GPasteGnomeShellClient *shell_client); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /src/daemon/next/gpaste-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #include 12 | 13 | G_BEGIN_DECLS 14 | 15 | #define G_PASTE_TYPE_KEYBINDING (g_paste_keybinding_get_type ()) 16 | 17 | G_PASTE_DERIVABLE_TYPE (Keybinding, keybinding, KEYBINDING, GObject) 18 | 19 | struct _GPasteKeybindingClass 20 | { 21 | GObjectClass parent_class; 22 | }; 23 | 24 | typedef const gchar *(*GPasteKeybindingGetter) (const GPasteSettings *settings); 25 | typedef void (*GPasteKeybindingFunc) (GPasteKeybinding *self, 26 | gpointer data); 27 | 28 | const guint32 *g_paste_keybinding_get_keycodes (const GPasteKeybinding *self); 29 | GdkModifierType g_paste_keybinding_get_modifiers (const GPasteKeybinding *self); 30 | const gchar *g_paste_keybinding_get_dconf_key (const GPasteKeybinding *self); 31 | const gchar *g_paste_keybinding_get_accelerator (const GPasteKeybinding *self, 32 | const GPasteSettings *settings); 33 | 34 | void g_paste_keybinding_activate (GPasteKeybinding *self, 35 | GPasteSettings *settings); 36 | void g_paste_keybinding_deactivate (GPasteKeybinding *self); 37 | gboolean g_paste_keybinding_is_active (GPasteKeybinding *self); 38 | void g_paste_keybinding_perform (GPasteKeybinding *self); 39 | void g_paste_keybinding_notify (GPasteKeybinding *self, 40 | GdkModifierType modifiers, 41 | guint64 keycode); 42 | 43 | GPasteKeybinding *g_paste_keybinding_new (GType type, 44 | const gchar *dconf_key, 45 | GPasteKeybindingGetter getter, 46 | GPasteKeybindingFunc callback, 47 | gpointer user_data); 48 | 49 | G_END_DECLS 50 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-bus-object.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include "gpaste-bus-object.h" 8 | 9 | G_PASTE_DEFINE_ABSTRACT_TYPE (BusObject, bus_object, G_TYPE_OBJECT) 10 | 11 | /** 12 | * g_paste_bus_object_register_on_connection: 13 | * @self: a #GPasteBusObject 14 | * @connection: a #GDBusConnection 15 | * @error: a #GError 16 | * 17 | * Register the #GPasteBusObject on the connection 18 | * 19 | * Returns: Whether the action succeeded or not 20 | */ 21 | G_PASTE_VISIBLE gboolean 22 | g_paste_bus_object_register_on_connection (GPasteBusObject *self, 23 | GDBusConnection *connection, 24 | GError **error) 25 | { 26 | g_return_val_if_fail (_G_PASTE_IS_BUS_OBJECT (self), FALSE); 27 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), FALSE); 28 | g_return_val_if_fail (!error || !(*error), FALSE); 29 | 30 | return G_PASTE_BUS_OBJECT_GET_CLASS (self)->register_on_connection (self, connection, error); 31 | } 32 | 33 | static void 34 | g_paste_bus_object_class_init (GPasteBusObjectClass *klass) 35 | { 36 | klass->register_on_connection = NULL; 37 | } 38 | 39 | static void 40 | g_paste_bus_object_init (GPasteBusObject *self G_GNUC_UNUSED) 41 | { 42 | } 43 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-bus-object.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_BUS_OBJECT_H__ 12 | #define __G_PASTE_BUS_OBJECT_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_BUS_OBJECT (g_paste_bus_object_get_type ()) 19 | 20 | G_PASTE_DERIVABLE_TYPE (BusObject, bus_object, BUS_OBJECT, GObject) 21 | 22 | struct _GPasteBusObjectClass 23 | { 24 | GObjectClass parent_class; 25 | 26 | /*< pure virtual >*/ 27 | gboolean (*register_on_connection) (GPasteBusObject *self, 28 | GDBusConnection *connection, 29 | GError **error); 30 | }; 31 | 32 | gboolean g_paste_bus_object_register_on_connection (GPasteBusObject *self, 33 | GDBusConnection *connection, 34 | GError **error); 35 | 36 | G_END_DECLS 37 | 38 | #endif /*__G_PASTE_BUS_OBJECT_H__*/ 39 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-bus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_BUS_H__ 12 | #define __G_PASTE_BUS_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_BUS (g_paste_bus_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (Bus, bus, BUS, GObject) 21 | 22 | typedef void (*GPasteBusAcquiredCallback) (GPasteBus *bus, 23 | gpointer user_data); 24 | 25 | void g_paste_bus_own_name (GPasteBus *self); 26 | 27 | GDBusConnection *g_paste_bus_get_connection (const GPasteBus *self); 28 | 29 | GPasteBus *g_paste_bus_new (GPasteBusAcquiredCallback on_bus_acquired, 30 | gpointer user_data); 31 | 32 | G_END_DECLS 33 | 34 | #endif /*__G_PASTE_BUS_H__*/ 35 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | G_BEGIN_DECLS 12 | 13 | #define G_PASTE_TYPE_CLIPBOARD (g_paste_clipboard_get_type ()) 14 | 15 | G_PASTE_FINAL_TYPE (Clipboard, clipboard, CLIPBOARD, GObject) 16 | 17 | typedef void (*GPasteClipboardTextCallback) (GPasteClipboard *self, 18 | const gchar *text, 19 | gpointer user_data); 20 | 21 | typedef void (*GPasteClipboardImageCallback) (GPasteClipboard *self, 22 | GdkPixbuf *image, 23 | gpointer user_data); 24 | 25 | void g_paste_clipboard_bootstrap (GPasteClipboard *self, 26 | GPasteHistory *history); 27 | gboolean g_paste_clipboard_is_clipboard (const GPasteClipboard *self); 28 | GtkClipboard *g_paste_clipboard_get_real (const GPasteClipboard *self); 29 | const gchar *g_paste_clipboard_get_text (const GPasteClipboard *self); 30 | void g_paste_clipboard_set_text (GPasteClipboard *self, 31 | GPasteClipboardTextCallback callback, 32 | gpointer user_data); 33 | void g_paste_clipboard_select_text (GPasteClipboard *self, 34 | const gchar *text); 35 | void g_paste_clipboard_sync_text (const GPasteClipboard *self, 36 | GPasteClipboard *other); 37 | void g_paste_clipboard_clear (GPasteClipboard *self); 38 | void g_paste_clipboard_store (GPasteClipboard *self); 39 | const gchar *g_paste_clipboard_get_image_checksum (const GPasteClipboard *self); 40 | void g_paste_clipboard_set_image (GPasteClipboard *self, 41 | GPasteClipboardImageCallback callback, 42 | gpointer user_data); 43 | gboolean g_paste_clipboard_select_item (GPasteClipboard *self, 44 | GPasteItem *item); 45 | void g_paste_clipboard_ensure_not_empty (GPasteClipboard *self, 46 | GPasteHistory *history); 47 | 48 | GPasteClipboard *g_paste_clipboard_new_clipboard (GPasteSettings *settings); 49 | GPasteClipboard *g_paste_clipboard_new_primary (GPasteSettings *settings); 50 | 51 | G_END_DECLS 52 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-clipboards-manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_CLIPBOARDS_MANAGER_H__ 12 | #define __G_PASTE_CLIPBOARDS_MANAGER_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_CLIPBOARDS_MANAGER (g_paste_clipboards_manager_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (ClipboardsManager, clipboards_manager, CLIPBOARDS_MANAGER, GObject) 21 | 22 | void g_paste_clipboards_manager_add_clipboard (GPasteClipboardsManager *self, 23 | GPasteClipboard *clipboard); 24 | void g_paste_clipboards_manager_sync_from_to (GPasteClipboardsManager *self, 25 | gboolean from_clipboard); 26 | void g_paste_clipboards_manager_activate (GPasteClipboardsManager *self); 27 | gboolean g_paste_clipboards_manager_select (GPasteClipboardsManager *self, 28 | GPasteItem *item); 29 | void g_paste_clipboards_manager_store (GPasteClipboardsManager *self); 30 | 31 | GPasteClipboardsManager *g_paste_clipboards_manager_new (GPasteHistory *history, 32 | GPasteSettings *settings); 33 | 34 | G_END_DECLS 35 | 36 | #endif /*__G_PASTE_CLIPBOARDS_MANAGER_H__*/ 37 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-daemon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_DAEMON_H__ 12 | #define __G_PASTE_DAEMON_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_DAEMON (g_paste_daemon_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (Daemon, daemon, DAEMON, GPasteBusObject) 21 | 22 | void g_paste_daemon_show_history (GPasteDaemon *self, 23 | GError **error); 24 | gboolean g_paste_daemon_upload (GPasteDaemon *self, 25 | const gchar *uuid); 26 | 27 | GPasteDaemon *g_paste_daemon_new (void); 28 | 29 | G_END_DECLS 30 | 31 | #endif /*__G_PASTE_DAEMON_H__*/ 32 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-file-backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_FILE_BACKEND_H__ 12 | #define __G_PASTE_FILE_BACKEND_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_FILE_BACKEND (g_paste_file_backend_get_type ()) 19 | 20 | G_PASTE_DERIVABLE_TYPE (FileBackend, file_backend, FILE_BACKEND, GPasteStorageBackend) 21 | 22 | struct _GPasteFileBackendClass 23 | { 24 | GPasteStorageBackendClass parent_class; 25 | 26 | /*< protected >*/ 27 | GOutputStream *(*get_output_stream) (const GPasteFileBackend *self, 28 | GFile *output_file); 29 | }; 30 | 31 | G_END_DECLS 32 | 33 | #endif /*__G_PASTE_FILE_BACKEND_H__*/ 34 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-image-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_IMAGE_ITEM_H__ 12 | #define __G_PASTE_IMAGE_ITEM_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_IMAGE_ITEM (g_paste_image_item_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (ImageItem, image_item, IMAGE_ITEM, GPasteItem) 23 | 24 | const gchar *g_paste_image_item_get_checksum (const GPasteImageItem *self); 25 | const GDateTime *g_paste_image_item_get_date (const GPasteImageItem *self); 26 | GdkPixbuf *g_paste_image_item_get_image (const GPasteImageItem *self); 27 | 28 | gboolean g_paste_image_item_is_growing (const GPasteImageItem *self, 29 | const GPasteImageItem *other); 30 | 31 | GPasteItem *g_paste_image_item_new (GdkPixbuf *img); 32 | GPasteItem *g_paste_image_item_new_from_file (const gchar *path, 33 | GDateTime *date); 34 | 35 | G_END_DECLS 36 | 37 | #endif /*__G_PASTE_IMAGE_ITEM_H__*/ 38 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_ITEM_H__ 12 | #define __G_PASTE_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | typedef enum { 19 | G_PASTE_ITEM_STATE_IDLE, 20 | G_PASTE_ITEM_STATE_ACTIVE 21 | } GPasteItemState; 22 | 23 | typedef struct { 24 | GPasteSpecialAtom mime; 25 | gchar *data; 26 | } GPasteSpecialValue; 27 | 28 | #define G_PASTE_TYPE_ITEM (g_paste_item_get_type ()) 29 | 30 | G_PASTE_DERIVABLE_TYPE (Item, item, ITEM, GObject) 31 | 32 | struct _GPasteItemClass 33 | { 34 | GObjectClass parent_class; 35 | 36 | /*< virtual >*/ 37 | const gchar * (*get_value) (const GPasteItem *self); 38 | gboolean (*equals) (const GPasteItem *self, 39 | const GPasteItem *other); 40 | void (*set_state) (GPasteItem *self, 41 | GPasteItemState state); 42 | gboolean (*secure) (const GPasteItem *self); 43 | 44 | /*< pure virtual >*/ 45 | const gchar *(*get_kind) (const GPasteItem *self); 46 | }; 47 | 48 | const gchar *g_paste_item_get_uuid (const GPasteItem *self); 49 | const gchar *g_paste_item_get_value (const GPasteItem *self); 50 | const gchar *g_paste_item_get_real_value (const GPasteItem *self); 51 | const GSList *g_paste_item_get_special_values (const GPasteItem *self); 52 | const gchar *g_paste_item_get_special_value (const GPasteItem *self, 53 | GPasteSpecialAtom atom); 54 | const gchar *g_paste_item_get_display_string (const GPasteItem *self); 55 | gboolean g_paste_item_equals (const GPasteItem *self, 56 | const GPasteItem *other); 57 | const gchar *g_paste_item_get_kind (const GPasteItem *self); 58 | guint64 g_paste_item_get_size (const GPasteItem *self); 59 | 60 | void g_paste_item_set_state (GPasteItem *self, 61 | GPasteItemState state); 62 | void g_paste_item_set_uuid (GPasteItem *self, 63 | const gchar *uuid); 64 | 65 | void g_paste_item_set_display_string (GPasteItem *self, 66 | const gchar *display_string); 67 | void g_paste_item_add_special_value (GPasteItem *self, 68 | const GPasteSpecialValue *special_value); 69 | 70 | void g_paste_item_set_size (GPasteItem *self, 71 | guint64 size); 72 | void g_paste_item_add_size (GPasteItem *self, 73 | guint64 size); 74 | void g_paste_item_remove_size (GPasteItem *self, 75 | guint64 size); 76 | 77 | GPasteItem *g_paste_item_new (GType type, 78 | const gchar *value); 79 | G_END_DECLS 80 | 81 | #endif /*__G_PASTE_ITEM_H__*/ 82 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-keybinder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_KEYBINDER_H__ 12 | #define __G_PASTE_KEYBINDER_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_KEYBINDER (g_paste_keybinder_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (Keybinder, keybinder, KEYBINDER, GObject) 23 | 24 | void g_paste_keybinder_add_keybinding (GPasteKeybinder *self, 25 | GPasteKeybinding *binding); 26 | void g_paste_keybinder_activate_all (GPasteKeybinder *self); 27 | void g_paste_keybinder_deactivate_all (GPasteKeybinder *self); 28 | 29 | GPasteKeybinder *g_paste_keybinder_new (GPasteSettings *settings, 30 | GPasteGnomeShellClient *shell_client); 31 | 32 | G_END_DECLS 33 | 34 | #endif /*__G_PASTE_KEYBINDER_H__*/ 35 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_KEYBINDING_H__ 12 | #define __G_PASTE_KEYBINDING_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_KEYBINDING (g_paste_keybinding_get_type ()) 21 | 22 | G_PASTE_DERIVABLE_TYPE (Keybinding, keybinding, KEYBINDING, GObject) 23 | 24 | struct _GPasteKeybindingClass 25 | { 26 | GObjectClass parent_class; 27 | }; 28 | 29 | typedef const gchar *(*GPasteKeybindingGetter) (const GPasteSettings *settings); 30 | typedef void (*GPasteKeybindingFunc) (GPasteKeybinding *self, 31 | gpointer data); 32 | 33 | const guint32 *g_paste_keybinding_get_keycodes (const GPasteKeybinding *self); 34 | GdkModifierType g_paste_keybinding_get_modifiers (const GPasteKeybinding *self); 35 | const gchar *g_paste_keybinding_get_dconf_key (const GPasteKeybinding *self); 36 | const gchar *g_paste_keybinding_get_accelerator (const GPasteKeybinding *self, 37 | const GPasteSettings *settings); 38 | 39 | void g_paste_keybinding_activate (GPasteKeybinding *self, 40 | GPasteSettings *settings); 41 | void g_paste_keybinding_deactivate (GPasteKeybinding *self); 42 | gboolean g_paste_keybinding_is_active (GPasteKeybinding *self); 43 | void g_paste_keybinding_perform (GPasteKeybinding *self); 44 | void g_paste_keybinding_notify (GPasteKeybinding *self, 45 | GdkModifierType modifiers, 46 | guint64 keycode); 47 | 48 | GPasteKeybinding *g_paste_keybinding_new (GType type, 49 | const gchar *dconf_key, 50 | GPasteKeybindingGetter getter, 51 | GPasteKeybindingFunc callback, 52 | gpointer user_data); 53 | 54 | G_END_DECLS 55 | 56 | #endif /*__G_PASTE_KEYBINDING_H__*/ 57 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-make-password-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteMakePasswordKeybinding 12 | { 13 | GPasteKeybinding parent_instance; 14 | }; 15 | 16 | G_PASTE_DEFINE_TYPE (MakePasswordKeybinding, make_password_keybinding, G_PASTE_TYPE_KEYBINDING) 17 | 18 | static void 19 | g_paste_make_password_keybinding_class_init (GPasteMakePasswordKeybindingClass *klass G_GNUC_UNUSED) 20 | { 21 | } 22 | 23 | static void 24 | g_paste_make_password_keybinding_init (GPasteMakePasswordKeybinding *self G_GNUC_UNUSED) 25 | { 26 | } 27 | 28 | static void 29 | g_paste_make_password_keybinding_make_password (GPasteKeybinding *self G_GNUC_UNUSED, 30 | gpointer data) 31 | { 32 | GPasteHistory *history = data; 33 | const GPasteItem *first = g_paste_history_get (history, 0); 34 | 35 | if (!first) 36 | return; 37 | 38 | g_paste_history_set_password (history, g_paste_item_get_uuid (first), NULL); 39 | } 40 | 41 | /** 42 | * g_paste_make_password_keybinding_new: 43 | * @history: a #GPasteHistory instance 44 | * 45 | * Create a new instance of #GPasteMakePasswordKeybinding 46 | * 47 | * Returns: a newly allocated #GPasteMakePasswordKeybinding 48 | * free it with g_object_unref 49 | */ 50 | G_PASTE_VISIBLE GPasteKeybinding * 51 | g_paste_make_password_keybinding_new (GPasteHistory *history) 52 | { 53 | return g_paste_keybinding_new (G_PASTE_TYPE_MAKE_PASSWORD_KEYBINDING, 54 | G_PASTE_MAKE_PASSWORD_SETTING, 55 | g_paste_settings_get_make_password, 56 | g_paste_make_password_keybinding_make_password, 57 | history); 58 | } 59 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-make-password-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_MAKE_PASSWORD_KEYBINDING_H__ 12 | #define __G_PASTE_MAKE_PASSWORD_KEYBINDING_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_MAKE_PASSWORD_KEYBINDING (g_paste_make_password_keybinding_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (MakePasswordKeybinding, make_password_keybinding, MAKE_PASSWORD_KEYBINDING, GPasteKeybinding) 22 | 23 | GPasteKeybinding *g_paste_make_password_keybinding_new (GPasteHistory *history); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_MAKE_PASSWORD_KEYBINDING_H__*/ 28 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-password-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_PASSWORD_ITEM_H__ 12 | #define __G_PASTE_PASSWORD_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_PASSWORD_ITEM (g_paste_password_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (PasswordItem, password_item, PASSWORD_ITEM, GPasteTextItem) 21 | 22 | const gchar *g_paste_password_item_get_name (const GPastePasswordItem *self); 23 | 24 | void g_paste_password_item_set_name (GPastePasswordItem *self, 25 | const char *name); 26 | 27 | GPasteItem *g_paste_password_item_new (const gchar *name, 28 | const gchar *password); 29 | 30 | G_END_DECLS 31 | 32 | #endif /*__G_PASTE_PASSWORD_ITEM_H__*/ 33 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-pop-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPastePopKeybinding 12 | { 13 | GPasteKeybinding parent_instance; 14 | }; 15 | 16 | typedef struct 17 | { 18 | GPasteHistory *history; 19 | } GPastePopKeybindingPrivate; 20 | 21 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (PopKeybinding, pop_keybinding, G_PASTE_TYPE_KEYBINDING) 22 | 23 | static void 24 | g_paste_pop_keybinding_dispose (GObject *object) 25 | { 26 | GPastePopKeybindingPrivate *priv = g_paste_pop_keybinding_get_instance_private (G_PASTE_POP_KEYBINDING (object)); 27 | 28 | g_clear_object (&priv->history); 29 | 30 | G_OBJECT_CLASS (g_paste_pop_keybinding_parent_class)->dispose (object); 31 | } 32 | 33 | static void 34 | g_paste_pop_keybinding_class_init (GPastePopKeybindingClass *klass) 35 | { 36 | G_OBJECT_CLASS (klass)->dispose = g_paste_pop_keybinding_dispose; 37 | } 38 | 39 | static void 40 | g_paste_pop_keybinding_init (GPastePopKeybinding *self G_GNUC_UNUSED) 41 | { 42 | } 43 | 44 | static void 45 | pop (GPasteKeybinding *self, 46 | gpointer data G_GNUC_UNUSED) 47 | { 48 | const GPastePopKeybindingPrivate *priv = _g_paste_pop_keybinding_get_instance_private (G_PASTE_POP_KEYBINDING (self)); 49 | 50 | g_paste_history_remove (priv->history, 0); 51 | } 52 | 53 | /** 54 | * g_paste_pop_keybinding_new: 55 | * @history: a #GPasteHistory instance 56 | * 57 | * Create a new instance of #GPastePopKeybinding 58 | * 59 | * Returns: a newly allocated #GPastePopKeybinding 60 | * free it with g_object_unref 61 | */ 62 | G_PASTE_VISIBLE GPasteKeybinding * 63 | g_paste_pop_keybinding_new (GPasteHistory *history) 64 | { 65 | g_return_val_if_fail (_G_PASTE_IS_HISTORY (history), NULL); 66 | 67 | GPasteKeybinding *self = g_paste_keybinding_new (G_PASTE_TYPE_POP_KEYBINDING, 68 | G_PASTE_POP_SETTING, 69 | g_paste_settings_get_pop, 70 | pop, 71 | NULL); 72 | GPastePopKeybindingPrivate *priv = g_paste_pop_keybinding_get_instance_private (G_PASTE_POP_KEYBINDING (self)); 73 | 74 | priv->history = g_object_ref (history); 75 | 76 | return self; 77 | } 78 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-pop-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_POP_KEYBINDING_H__ 12 | #define __G_PASTE_POP_KEYBINDING_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_POP_KEYBINDING (g_paste_pop_keybinding_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (PopKeybinding, pop_keybinding, POP_KEYBINDING, GPasteKeybinding) 22 | 23 | GPasteKeybinding *g_paste_pop_keybinding_new (GPasteHistory *history); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_POP_KEYBINDING_H__*/ 28 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-search-provider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_SEARCH_PROVIDER_H__ 12 | #define __G_PASTE_SEARCH_PROVIDER_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_SEARCH_PROVIDER (g_paste_search_provider_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (SearchProvider, search_provider, SEARCH_PROVIDER, GPasteBusObject) 21 | 22 | GPasteBusObject *g_paste_search_provider_new (void); 23 | 24 | G_END_DECLS 25 | 26 | #endif /*__G_PASTE_SEARCH_PROVIDER_H__*/ 27 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-show-history-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteShowHistoryKeybinding 12 | { 13 | GPasteKeybinding parent_instance; 14 | }; 15 | 16 | G_PASTE_DEFINE_TYPE (ShowHistoryKeybinding, show_history_keybinding, G_PASTE_TYPE_KEYBINDING) 17 | 18 | static void 19 | g_paste_show_history_keybinding_class_init (GPasteShowHistoryKeybindingClass *klass G_GNUC_UNUSED) 20 | { 21 | } 22 | 23 | static void 24 | g_paste_show_history_keybinding_init (GPasteShowHistoryKeybinding *self G_GNUC_UNUSED) 25 | { 26 | } 27 | 28 | static void 29 | g_paste_show_history_keybinding_show_history (GPasteKeybinding *self G_GNUC_UNUSED, 30 | gpointer data) 31 | { 32 | GPasteDaemon *gpaste_daemon = data; 33 | 34 | g_paste_daemon_show_history (gpaste_daemon, 35 | NULL); /* error */ 36 | } 37 | 38 | /** 39 | * g_paste_show_history_keybinding_new: 40 | * @gpaste_daemon: a #GPasteDaemon instance 41 | * 42 | * Create a new instance of #GPasteShowHistoryKeybinding 43 | * 44 | * Returns: a newly allocated #GPasteShowHistoryKeybinding 45 | * free it with g_object_unref 46 | */ 47 | G_PASTE_VISIBLE GPasteKeybinding * 48 | g_paste_show_history_keybinding_new (GPasteDaemon *gpaste_daemon) 49 | { 50 | return g_paste_keybinding_new (G_PASTE_TYPE_SHOW_HISTORY_KEYBINDING, 51 | G_PASTE_SHOW_HISTORY_SETTING, 52 | g_paste_settings_get_show_history, 53 | g_paste_show_history_keybinding_show_history, 54 | gpaste_daemon); 55 | } 56 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-show-history-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_SHOW_HISTORY_KEYBINDING_H__ 12 | #define __G_PASTE_SHOW_HISTORY_KEYBINDING_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_SHOW_HISTORY_KEYBINDING (g_paste_show_history_keybinding_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (ShowHistoryKeybinding, show_history_keybinding, SHOW_HISTORY_KEYBINDING, GPasteKeybinding) 22 | 23 | GPasteKeybinding *g_paste_show_history_keybinding_new (GPasteDaemon *gpaste_daemon); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_SHOW_HISTORY_KEYBINDING_H__*/ 28 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-special-atom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | static GdkAtom special_atoms[G_PASTE_SPECIAL_ATOM_LAST] = { 0 }; 10 | 11 | static void 12 | g_paste_special_atom_init(void) 13 | { 14 | static gboolean inited = FALSE; 15 | 16 | if (!inited) 17 | { 18 | g_debug("atoms init"); 19 | special_atoms[G_PASTE_SPECIAL_ATOM_GNOME_COPIED_FILES] = gdk_atom_intern_static_string ("x-special/gnome-copied-files"); 20 | special_atoms[G_PASTE_SPECIAL_ATOM_TEXT_HTML] = gdk_atom_intern_static_string ("text/html"); 21 | special_atoms[G_PASTE_SPECIAL_ATOM_TEXT_XML] = gdk_atom_intern_static_string ("text/xml"); 22 | inited = TRUE; 23 | } 24 | } 25 | 26 | G_PASTE_VISIBLE GType 27 | g_paste_special_atom_get_type (void) 28 | { 29 | static GType etype = 0; 30 | if (!etype) 31 | { 32 | g_paste_special_atom_init (); 33 | static const GEnumValue values[] = { 34 | { G_PASTE_SPECIAL_ATOM_GNOME_COPIED_FILES, "G_PASTE_SPECIAL_ATOM_GNOME_COPIED_FILES", "gnome-copied-files" }, 35 | { G_PASTE_SPECIAL_ATOM_TEXT_HTML, "G_PASTE_SPECIAL_ATOM_TEXT_HTML", "text-html" }, 36 | { G_PASTE_SPECIAL_ATOM_TEXT_XML, "G_PASTE_SPECIAL_ATOM_TEXT_XML", "text-xml" }, 37 | { G_PASTE_SPECIAL_ATOM_INVALID, NULL, NULL }, 38 | }; 39 | etype = g_enum_register_static (g_intern_static_string ("GPasteSpecialAtom"), values); 40 | g_type_class_ref (etype); 41 | } 42 | return etype; 43 | } 44 | 45 | /** 46 | * g_paste_special_atom_get 47 | * @atom: the atom we want to get 48 | * 49 | * Find special atoms handled by GPaste 50 | * 51 | * Returns: (transfer none): the atom corresponding to @atom 52 | */ 53 | G_PASTE_VISIBLE GdkAtom 54 | g_paste_special_atom_get (GPasteSpecialAtom atom) 55 | { 56 | g_paste_special_atom_init (); 57 | return special_atoms[atom]; 58 | } 59 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-special-atom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #include 12 | 13 | #include 14 | 15 | #ifndef __G_PASTE_SPECIAL_ATOM_H__ 16 | #define __G_PASTE_SPECIAL_ATOM_H__ 17 | 18 | G_BEGIN_DECLS 19 | 20 | typedef enum 21 | { 22 | G_PASTE_SPECIAL_ATOM_FIRST, 23 | 24 | G_PASTE_SPECIAL_ATOM_GNOME_COPIED_FILES = G_PASTE_SPECIAL_ATOM_FIRST, 25 | G_PASTE_SPECIAL_ATOM_TEXT_HTML, 26 | G_PASTE_SPECIAL_ATOM_TEXT_XML, 27 | 28 | G_PASTE_SPECIAL_ATOM_LAST, 29 | G_PASTE_SPECIAL_ATOM_INVALID = -1 30 | } GPasteSpecialAtom; 31 | 32 | #define G_PASTE_TYPE_SPECIAL_ATOM (g_paste_special_atom_get_type ()) 33 | GType g_paste_special_atom_get_type (void); 34 | 35 | GdkAtom g_paste_special_atom_get (GPasteSpecialAtom atom); 36 | 37 | G_END_DECLS 38 | 39 | #endif /*__G_PASTE_SPECIAL_ATOM_H__*/ 40 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-storage-backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_STORAGE_BACKEND_H__ 12 | #define __G_PASTE_STORAGE_BACKEND_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | typedef enum { 19 | G_PASTE_STORAGE_FILE, 20 | G_PASTE_STORAGE_DEFAULT = G_PASTE_STORAGE_FILE 21 | } GPasteStorage; 22 | 23 | #define G_PASTE_TYPE_STORAGE_BACKEND (g_paste_storage_backend_get_type ()) 24 | 25 | G_PASTE_DERIVABLE_TYPE (StorageBackend, storage_backend, STORAGE_BACKEND, GObject) 26 | 27 | struct _GPasteStorageBackendClass 28 | { 29 | GObjectClass parent_class; 30 | 31 | /*< pure virtual >*/ 32 | void (*read_history_file) (const GPasteStorageBackend *self, 33 | const gchar *history_file_path, 34 | GList **history, 35 | gsize *size); 36 | void (*write_history_file) (const GPasteStorageBackend *self, 37 | const gchar *history_file_path, 38 | const GList *history); 39 | 40 | /*< protected >*/ 41 | const gchar *(*get_extension) (const GPasteStorageBackend *self); 42 | const GPasteSettings *(*get_settings) (const GPasteStorageBackend *self); 43 | }; 44 | 45 | void g_paste_storage_backend_read_history (const GPasteStorageBackend *self, 46 | const gchar *name, 47 | GList **history, 48 | gsize *size); 49 | void g_paste_storage_backend_write_history (const GPasteStorageBackend *self, 50 | const gchar *name, 51 | const GList *history); 52 | 53 | GPasteStorageBackend *g_paste_storage_backend_new (GPasteStorage storage_kind, 54 | GPasteSettings *settings); 55 | 56 | G_END_DECLS 57 | 58 | #endif /*__G_PASTE_STORAGE_BACKEND_H__*/ 59 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-sync-clipboard-to-primary-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteSyncClipboardToPrimaryKeybinding 12 | { 13 | GPasteKeybinding parent_instance; 14 | }; 15 | 16 | G_PASTE_DEFINE_TYPE (SyncClipboardToPrimaryKeybinding, sync_clipboard_to_primary_keybinding, G_PASTE_TYPE_KEYBINDING) 17 | 18 | static void 19 | g_paste_sync_clipboard_to_primary_keybinding_class_init (GPasteSyncClipboardToPrimaryKeybindingClass *klass G_GNUC_UNUSED) 20 | { 21 | } 22 | 23 | static void 24 | g_paste_sync_clipboard_to_primary_keybinding_init (GPasteSyncClipboardToPrimaryKeybinding *self G_GNUC_UNUSED) 25 | { 26 | } 27 | 28 | static void 29 | g_paste_sync_clipboard_to_primary_keybinding_sync (GPasteKeybinding *self G_GNUC_UNUSED, 30 | gpointer data) 31 | { 32 | GPasteClipboardsManager *gcm = data; 33 | 34 | g_paste_clipboards_manager_sync_from_to (gcm, TRUE); 35 | } 36 | 37 | /** 38 | * g_paste_sync_clipboard_to_primary_keybinding_new: 39 | * @gcm: a #GPasteClipboardManager instance 40 | * 41 | * Create a new instance of #GPasteSyncClipboardToPrimaryKeybinding 42 | * 43 | * Returns: a newly allocated #GPasteSyncClipboardToPrimaryKeybinding 44 | * free it with g_object_unref 45 | */ 46 | G_PASTE_VISIBLE GPasteKeybinding * 47 | g_paste_sync_clipboard_to_primary_keybinding_new (GPasteClipboardsManager *gcm) 48 | { 49 | return g_paste_keybinding_new (G_PASTE_TYPE_SYNC_CLIPBOARD_TO_PRIMARY_KEYBINDING, 50 | G_PASTE_SYNC_CLIPBOARD_TO_PRIMARY_SETTING, 51 | g_paste_settings_get_sync_clipboard_to_primary, 52 | g_paste_sync_clipboard_to_primary_keybinding_sync, 53 | gcm); 54 | } 55 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-sync-clipboard-to-primary-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_SYNC_CLIPBOARD_TO_PRIMARY_KEYBINDING_H__ 12 | #define __G_PASTE_SYNC_CLIPBOARD_TO_PRIMARY_KEYBINDING_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_SYNC_CLIPBOARD_TO_PRIMARY_KEYBINDING (g_paste_sync_clipboard_to_primary_keybinding_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (SyncClipboardToPrimaryKeybinding, sync_clipboard_to_primary_keybinding, SYNC_CLIPBOARD_TO_PRIMARY_KEYBINDING, GPasteKeybinding) 22 | 23 | GPasteKeybinding *g_paste_sync_clipboard_to_primary_keybinding_new (GPasteClipboardsManager *gcm); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_SYNC_CLIPBOARD_TO_PRIMARY_KEYBINDING_H__*/ 28 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-sync-primary-to-clipboard-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteSyncPrimaryToClipboardKeybinding 12 | { 13 | GPasteKeybinding parent_instance; 14 | }; 15 | 16 | G_PASTE_DEFINE_TYPE (SyncPrimaryToClipboardKeybinding, sync_primary_to_clipboard_keybinding, G_PASTE_TYPE_KEYBINDING) 17 | 18 | static void 19 | g_paste_sync_primary_to_clipboard_keybinding_class_init (GPasteSyncPrimaryToClipboardKeybindingClass *klass G_GNUC_UNUSED) 20 | { 21 | } 22 | 23 | static void 24 | g_paste_sync_primary_to_clipboard_keybinding_init (GPasteSyncPrimaryToClipboardKeybinding *self G_GNUC_UNUSED) 25 | { 26 | } 27 | 28 | static void 29 | g_paste_sync_primary_to_clipboard_keybinding_sync (GPasteKeybinding *self G_GNUC_UNUSED, 30 | gpointer data) 31 | { 32 | GPasteClipboardsManager *gcm = data; 33 | 34 | g_paste_clipboards_manager_sync_from_to (gcm, FALSE); 35 | } 36 | 37 | /** 38 | * g_paste_sync_primary_to_clipboard_keybinding_new: 39 | * @gcm: a #GPasteClipboardManager instance 40 | * 41 | * Create a new instance of #GPasteSyncPrimaryToClipboardKeybinding 42 | * 43 | * Returns: a newly allocated #GPasteSyncPrimaryToClipboardKeybinding 44 | * free it with g_object_unref 45 | */ 46 | G_PASTE_VISIBLE GPasteKeybinding * 47 | g_paste_sync_primary_to_clipboard_keybinding_new (GPasteClipboardsManager *gcm) 48 | { 49 | return g_paste_keybinding_new (G_PASTE_TYPE_SYNC_PRIMARY_TO_CLIPBOARD_KEYBINDING, 50 | G_PASTE_SYNC_PRIMARY_TO_CLIPBOARD_SETTING, 51 | g_paste_settings_get_sync_primary_to_clipboard, 52 | g_paste_sync_primary_to_clipboard_keybinding_sync, 53 | gcm); 54 | } 55 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-sync-primary-to-clipboard-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_SYNC_PRIMARY_TO_CLIPBOARD_KEYBINDING_H__ 12 | #define __G_PASTE_SYNC_PRIMARY_TO_CLIPBOARD_KEYBINDING_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_SYNC_PRIMARY_TO_CLIPBOARD_KEYBINDING (g_paste_sync_primary_to_clipboard_keybinding_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (SyncPrimaryToClipboardKeybinding, sync_primary_to_clipboard_keybinding, SYNC_PRIMARY_TO_CLIPBOARD_KEYBINDING, GPasteKeybinding) 22 | 23 | GPasteKeybinding *g_paste_sync_primary_to_clipboard_keybinding_new (GPasteClipboardsManager *gcm); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_SYNC_PRIMARY_TO_CLIPBOARD_KEYBINDING_H__*/ 28 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-text-item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | G_PASTE_DEFINE_TYPE (TextItem, text_item, G_PASTE_TYPE_ITEM) 10 | 11 | static gboolean 12 | g_paste_text_item_equals (const GPasteItem *self, 13 | const GPasteItem *other) 14 | { 15 | return (_G_PASTE_IS_TEXT_ITEM (other) && 16 | G_PASTE_ITEM_CLASS (g_paste_text_item_parent_class)->equals (self, other)); 17 | } 18 | 19 | static const gchar * 20 | g_paste_text_item_get_kind (const GPasteItem *self G_GNUC_UNUSED) 21 | { 22 | return "Text"; 23 | } 24 | 25 | static void 26 | g_paste_text_item_class_init (GPasteTextItemClass *klass) 27 | { 28 | GPasteItemClass *item_class = G_PASTE_ITEM_CLASS (klass); 29 | 30 | item_class->equals = g_paste_text_item_equals; 31 | item_class->get_kind = g_paste_text_item_get_kind; 32 | } 33 | 34 | static void 35 | g_paste_text_item_init (GPasteTextItem *self G_GNUC_UNUSED) 36 | { 37 | } 38 | 39 | /** 40 | * g_paste_text_item_new: 41 | * @text: the content of the desired #GPasteTextItem 42 | * 43 | * Create a new instance of #GPasteTextItem 44 | * 45 | * Returns: a newly allocated #GPasteTextItem 46 | * free it with g_object_unref 47 | */ 48 | G_PASTE_VISIBLE GPasteItem * 49 | g_paste_text_item_new (const gchar *text) 50 | { 51 | g_return_val_if_fail (text, NULL); 52 | g_return_val_if_fail (g_utf8_validate (text, -1, NULL), NULL); 53 | 54 | return g_paste_item_new (G_PASTE_TYPE_TEXT_ITEM, text); 55 | } 56 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-text-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_TEXT_ITEM_H__ 12 | #define __G_PASTE_TEXT_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_TEXT_ITEM (g_paste_text_item_get_type ()) 19 | 20 | G_PASTE_DERIVABLE_TYPE (TextItem, text_item, TEXT_ITEM, GPasteItem) 21 | 22 | struct _GPasteTextItemClass 23 | { 24 | GPasteItemClass parent_class; 25 | }; 26 | 27 | GPasteItem *g_paste_text_item_new (const gchar *text); 28 | 29 | G_END_DECLS 30 | 31 | #endif /*__G_PASTE_TEXT_ITEM_H__*/ 32 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-ui-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | struct _GPasteUiKeybinding 13 | { 14 | GPasteKeybinding parent_instance; 15 | }; 16 | 17 | G_PASTE_DEFINE_TYPE (UiKeybinding, ui_keybinding, G_PASTE_TYPE_KEYBINDING) 18 | 19 | static void 20 | g_paste_ui_keybinding_class_init (GPasteUiKeybindingClass *klass G_GNUC_UNUSED) 21 | { 22 | } 23 | 24 | static void 25 | g_paste_ui_keybinding_init (GPasteUiKeybinding *self G_GNUC_UNUSED) 26 | { 27 | } 28 | 29 | static void 30 | launch_ui (GPasteKeybinding *self G_GNUC_UNUSED, 31 | gpointer data G_GNUC_UNUSED) 32 | { 33 | g_paste_util_spawn ("Ui"); 34 | } 35 | 36 | /** 37 | * g_paste_ui_keybinding_new: 38 | * 39 | * Create a new instance of #GPasteUiKeybinding 40 | * 41 | * Returns: a newly allocated #GPasteUiKeybinding 42 | * free it with g_object_unref 43 | */ 44 | G_PASTE_VISIBLE GPasteKeybinding * 45 | g_paste_ui_keybinding_new (void) 46 | { 47 | return g_paste_keybinding_new (G_PASTE_TYPE_UI_KEYBINDING, 48 | G_PASTE_LAUNCH_UI_SETTING, 49 | g_paste_settings_get_launch_ui, 50 | launch_ui, 51 | NULL); 52 | } 53 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-ui-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_KEYBINDING_H__ 12 | #define __G_PASTE_UI_KEYBINDING_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_KEYBINDING (g_paste_ui_keybinding_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiKeybinding, ui_keybinding, UI_KEYBINDING, GPasteKeybinding) 21 | 22 | GPasteKeybinding *g_paste_ui_keybinding_new (void); 23 | 24 | G_END_DECLS 25 | 26 | #endif /*__G_PASTE_UI_KEYBINDING_H__*/ 27 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-upload-keybinding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteUploadKeybinding 12 | { 13 | GPasteKeybinding parent_instance; 14 | }; 15 | 16 | typedef struct 17 | { 18 | GPasteDaemon *daemon; 19 | } GPasteUploadKeybindingPrivate; 20 | 21 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (UploadKeybinding, upload_keybinding, G_PASTE_TYPE_KEYBINDING) 22 | 23 | static void 24 | g_paste_upload_keybinding_dispose (GObject *object) 25 | { 26 | GPasteUploadKeybindingPrivate *priv = g_paste_upload_keybinding_get_instance_private (G_PASTE_UPLOAD_KEYBINDING (object)); 27 | 28 | g_clear_object (&priv->daemon); 29 | 30 | G_OBJECT_CLASS (g_paste_upload_keybinding_parent_class)->dispose (object); 31 | } 32 | 33 | static void 34 | g_paste_upload_keybinding_class_init (GPasteUploadKeybindingClass *klass) 35 | { 36 | G_OBJECT_CLASS (klass)->dispose = g_paste_upload_keybinding_dispose; 37 | } 38 | 39 | static void 40 | g_paste_upload_keybinding_init (GPasteUploadKeybinding *self G_GNUC_UNUSED) 41 | { 42 | } 43 | 44 | static void 45 | upload (GPasteKeybinding *self, 46 | gpointer data G_GNUC_UNUSED) 47 | { 48 | const GPasteUploadKeybindingPrivate *priv = _g_paste_upload_keybinding_get_instance_private (G_PASTE_UPLOAD_KEYBINDING (self)); 49 | 50 | g_paste_daemon_upload (priv->daemon, NULL); 51 | } 52 | 53 | /** 54 | * g_paste_upload_keybinding_new: 55 | * @daemon: a #GPasteDaemon instance 56 | * 57 | * Create a new instance of #GPasteUploadKeybinding 58 | * 59 | * Returns: a newly allocated #GPasteUploadKeybinding 60 | * free it with g_object_unref 61 | */ 62 | G_PASTE_VISIBLE GPasteKeybinding * 63 | g_paste_upload_keybinding_new (GPasteDaemon *daemon) 64 | { 65 | g_return_val_if_fail (_G_PASTE_IS_DAEMON (daemon), NULL); 66 | 67 | GPasteKeybinding *self = g_paste_keybinding_new (G_PASTE_TYPE_UPLOAD_KEYBINDING, 68 | G_PASTE_UPLOAD_SETTING, 69 | g_paste_settings_get_upload, 70 | upload, 71 | NULL); 72 | GPasteUploadKeybindingPrivate *priv = g_paste_upload_keybinding_get_instance_private (G_PASTE_UPLOAD_KEYBINDING (self)); 73 | 74 | priv->daemon = g_object_ref (daemon); 75 | 76 | return self; 77 | } 78 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-upload-keybinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UPLOAD_KEYBINDING_H__ 12 | #define __G_PASTE_UPLOAD_KEYBINDING_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_UPLOAD_KEYBINDING (g_paste_upload_keybinding_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (UploadKeybinding, upload_keybinding, UPLOAD_KEYBINDING, GPasteKeybinding) 22 | 23 | GPasteKeybinding *g_paste_upload_keybinding_new (GPasteDaemon *daemon); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_UPLOAD_KEYBINDING_H__*/ 28 | -------------------------------------------------------------------------------- /src/daemon/tmp/gpaste-uris-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_URIS_ITEM_H__ 12 | #define __G_PASTE_URIS_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_URIS_ITEM (g_paste_uris_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UrisItem, uris_item, URIS_ITEM, GPasteTextItem) 21 | 22 | const gchar * const *g_paste_uris_item_get_uris (const GPasteUrisItem *self); 23 | 24 | GPasteItem *g_paste_uris_item_new (const gchar *uris); 25 | 26 | G_END_DECLS 27 | 28 | #endif /*__G_PASTE_URIS_ITEM_H__*/ 29 | -------------------------------------------------------------------------------- /src/gnome-shell/aboutItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; 8 | 9 | import GObject from 'gi://GObject'; 10 | 11 | import { GPasteActionButton } from './actionButton.js'; 12 | 13 | export const GPasteAboutItem = GObject.registerClass( 14 | class GPasteAboutItem extends GPasteActionButton { 15 | _init(client, menu) { 16 | super._init('dialog-information-symbolic', _("About"), function() { 17 | menu.itemActivated(); 18 | client.about(null); 19 | }); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /src/gnome-shell/actionButton.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import Clutter from 'gi://Clutter'; 8 | import GObject from 'gi://GObject'; 9 | import St from 'gi://St'; 10 | 11 | import { GPasteActionButtonActor } from './actionButtonActor.js'; 12 | 13 | export const GPasteActionButton = GObject.registerClass( 14 | class GPasteActionButton extends St.Button { 15 | _init(iconName, label, action) { 16 | super._init({ 17 | x_expand: true, 18 | x_align: Clutter.ActorAlign.CENTER, 19 | reactive: true, 20 | can_focus: true, 21 | track_hover: true, 22 | style_class: 'button', 23 | child: new GPasteActionButtonActor(iconName, label) 24 | }); 25 | 26 | this.connect('clicked', action); 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /src/gnome-shell/actionButtonActor.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; 8 | 9 | import GObject from 'gi://GObject'; 10 | import St from 'gi://St'; 11 | 12 | export const GPasteActionButtonActor = GObject.registerClass( 13 | class GPasteActionButtonActor extends St.BoxLayout { 14 | _init(iconName, label) { 15 | super._init({ style: 'spacing: 10px;' }); 16 | 17 | this.add_child(new St.Icon({ 18 | icon_name: iconName, 19 | style_class: 'popup-menu-icon' 20 | })); 21 | 22 | this.add_child(new St.Bin({ 23 | child: new St.Label({ text: label }), 24 | })); 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /src/gnome-shell/actions.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { Ornament, PopupBaseMenuItem } from 'resource:///org/gnome/shell/ui/popupMenu.js'; 8 | 9 | import GObject from 'gi://GObject'; 10 | 11 | import { GPasteAboutItem } from './aboutItem.js'; 12 | import { GPastePadding } from './padding.js'; 13 | import { GPasteUiItem } from './uiItem.js'; 14 | 15 | export const GPasteActions = GObject.registerClass( 16 | class GPasteActions extends PopupBaseMenuItem { 17 | _init(client, menu, emptyHistoryItem) { 18 | super._init({ 19 | reactive: false, 20 | can_focus: false 21 | }); 22 | 23 | this.setOrnament(Ornament.NONE); 24 | // Add padding at the beginning and end so that our contents is centered 25 | this.add_child(new GPastePadding()); 26 | this.add_child(new GPasteUiItem(menu)); 27 | this.add_child(emptyHistoryItem); 28 | this.add_child(new GPasteAboutItem(client, menu)); 29 | this.add_child(new GPastePadding()); 30 | } 31 | }); 32 | -------------------------------------------------------------------------------- /src/gnome-shell/checkerBypass.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | * 6 | * Based on js/misc/util.js from gnome-shell 7 | */ 8 | 9 | import * as Main from 'resource:///org/gnome/shell/ui/main.js'; 10 | 11 | import GLib from 'gi://GLib'; 12 | import Gio from 'gi://Gio'; 13 | 14 | // Sadly, there is no other way of making global keybindings work on wayland until we get a portal for this. 15 | // I really wish we could avoid this, and the fact that we do this defeats the whole purpose of the added security from 16 | // gnome-shell which is... really sad. 17 | export default function checkerBypass() { 18 | if (!Main.shellDBusService) { 19 | // we got loaded too early, the dbus service isn't ready so we cannot hook ourselves in, try back later 20 | GLib.idle_add(GLib.PRIORITY_DEFAULT, checkerBypass); 21 | return; 22 | } 23 | let checker = Main.shellDBusService._senderChecker; 24 | if (!checker._gpasteEnabled) { 25 | checker._gpasteEnabled = true; 26 | checker._watchList.push(Gio.DBus.watch_name(Gio.BusType.SESSION, 27 | 'org.gnome.GPaste', 28 | Gio.BusNameWatcherFlags.NONE, 29 | (conn_, name_, owner) => checker._allowlistMap.set('org.gnome.GPaste', owner), 30 | () => checker._allowlistMap.delete('org.gnome.GPaste'))); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /src/gnome-shell/deleteButton.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import Clutter from 'gi://Clutter'; 8 | import GObject from 'gi://GObject'; 9 | import St from 'gi://St'; 10 | 11 | export const GPasteDeleteButton = GObject.registerClass( 12 | class GPasteDeleteButton extends St.Button { 13 | _init(client, uuid) { 14 | super._init(); 15 | 16 | this.child = new St.Icon({ 17 | icon_name: 'edit-delete-symbolic', 18 | style_class: 'popup-menu-icon' 19 | }); 20 | 21 | this._client = client; 22 | this.setUuid(uuid); 23 | 24 | this.connect('clicked', this._onClick.bind(this)); 25 | } 26 | 27 | setUuid(uuid) { 28 | this._uuid = uuid; 29 | } 30 | 31 | _onClick() { 32 | this._client.delete(this._uuid, null); 33 | return Clutter.EVENT_STOP; 34 | } 35 | }); 36 | -------------------------------------------------------------------------------- /src/gnome-shell/deleteItemPart.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import GObject from 'gi://GObject'; 8 | import St from 'gi://St'; 9 | 10 | import { GPasteDeleteButton } from './deleteButton.js'; 11 | 12 | export const GPasteDeleteItemPart = GObject.registerClass( 13 | class GPasteDeleteItemPart extends St.Bin { 14 | _init(client, uuid) { 15 | super._init(); 16 | this._deleteButton = new GPasteDeleteButton(client, uuid); 17 | this.child = this._deleteButton; 18 | } 19 | 20 | setUuid(uuid) { 21 | this._deleteButton.setUuid(uuid); 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /src/gnome-shell/dependencies.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import 'gi://Gio?version=2.0'; 8 | import 'gi://GLib?version=2.0'; 9 | import 'gi://GObject?version=2.0'; 10 | import 'gi://GPaste?version=2'; 11 | import 'gi://Pango?version=1.0'; 12 | 13 | import * as Config from 'resource:///org/gnome/shell/misc/config.js'; 14 | 15 | import gi from 'gi'; 16 | 17 | gi.require('Clutter', Config.LIBMUTTER_API_VERSION); 18 | gi.require('St', Config.LIBMUTTER_API_VERSION); 19 | -------------------------------------------------------------------------------- /src/gnome-shell/dummyHistoryItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; 8 | import { PopupMenuItem } from 'resource:///org/gnome/shell/ui/popupMenu.js'; 9 | 10 | import GObject from 'gi://GObject'; 11 | 12 | export const GPasteDummyHistoryItem = GObject.registerClass( 13 | class GPasteDummyHistoryItem extends PopupMenuItem { 14 | _init() { 15 | super._init(_("(Couldn't connect to GPaste daemon)")); 16 | this.setSensitive(false); 17 | } 18 | 19 | showEmpty() { 20 | this.label.text = _("(Empty)"); 21 | this.show(); 22 | } 23 | 24 | showNoResult() { 25 | this.label.text = _("(No result)"); 26 | this.show(); 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /src/gnome-shell/emptyHistoryItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; 8 | 9 | import GObject from 'gi://GObject'; 10 | import GPaste from 'gi://GPaste'; 11 | import St from 'gi://St'; 12 | 13 | import { GPasteActionButton } from './actionButton.js'; 14 | 15 | export const GPasteEmptyHistoryItem = GObject.registerClass( 16 | class GPasteEmptyHistoryItem extends GPasteActionButton { 17 | _init(client, settings, menu) { 18 | super._init('edit-clear-all-symbolic', _("Empty history"), function() { 19 | menu.itemActivated(); 20 | client.get_history_name((client, result) => { 21 | const name = client.get_history_name_finish(result); 22 | 23 | GPaste.util_empty_with_confirmation (client, settings, name); 24 | }); 25 | }); 26 | } 27 | }); 28 | -------------------------------------------------------------------------------- /src/gnome-shell/extension.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import * as Main from 'resource:///org/gnome/shell/ui/main.js'; 8 | import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; 9 | 10 | import checkerBypass from './checkerBypass.js'; 11 | import { GPasteIndicator } from './indicator.js'; 12 | 13 | export default class GPasteExtension extends Extension { 14 | enable() { 15 | checkerBypass(); 16 | Main.panel.addToStatusArea('gpaste', new GPasteIndicator()); 17 | } 18 | 19 | disable() { 20 | Main.panel.statusArea.gpaste.shutdown(); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/gnome-shell/meson.build: -------------------------------------------------------------------------------- 1 | shell_extension_files = [ 2 | 'aboutItem.js', 3 | 'actionButton.js', 4 | 'actionButtonActor.js', 5 | 'actions.js', 6 | 'checkerBypass.js', 7 | 'deleteButton.js', 8 | 'deleteItemPart.js', 9 | 'dependencies.js', 10 | 'dummyHistoryItem.js', 11 | 'emptyHistoryItem.js', 12 | 'extension.js', 13 | 'indicator.js', 14 | 'item.js', 15 | 'padding.js', 16 | 'pageItem.js', 17 | 'pageSwitcher.js', 18 | 'prefs.js', 19 | 'searchItem.js', 20 | 'stateSwitch.js', 21 | 'statusIcon.js', 22 | 'uiItem.js', 23 | ] 24 | 25 | configured_shell_ext_metadata = configure_file( 26 | input: 'metadata.json.in', 27 | configuration: conf, 28 | output: 'metadata.json', 29 | ) 30 | 31 | install_data( 32 | shell_extension_files, 33 | configured_shell_ext_metadata, 34 | install_dir: join_paths(get_option('datadir'), 'gnome-shell/extensions/GPaste@gnome-shell-extensions.gnome.org'), 35 | ) 36 | -------------------------------------------------------------------------------- /src/gnome-shell/metadata.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "shell-version": [ "45", "46", "47", "48" ], 3 | "session-modes": [ "user" ], 4 | "uuid": "GPaste@gnome-shell-extensions.gnome.org", 5 | "name": "GPaste", 6 | "version": "@version@", 7 | "description": "Clipboard management system", 8 | "url": "http://github.com/Keruspe/GPaste", 9 | "gettext-domain": "@gettext_domain@" 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/gnome-shell/padding.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import GObject from 'gi://GObject'; 8 | import St from 'gi://St'; 9 | 10 | export const GPastePadding = GObject.registerClass( 11 | class GPastePadding extends St.Label { 12 | _init() { 13 | super._init({ text: '', x_expand: true }); 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /src/gnome-shell/pageItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import GObject from 'gi://GObject'; 8 | import St from 'gi://St'; 9 | 10 | export const GPastePageItem = GObject.registerClass({ 11 | Signals: { 12 | 'switch': { param_types: [GObject.TYPE_UINT64] }, 13 | }, 14 | }, class GPastePageItem extends St.Button { 15 | _init(page) { 16 | super._init({ 17 | label: '' + page, 18 | reactive: true, 19 | can_focus: false, 20 | track_hover: true, 21 | style_class: 'calendar-day-base calendar-day' 22 | }); 23 | 24 | this._page = page; 25 | 26 | this.connect('clicked', () => { 27 | this.emit('switch', this._page); 28 | }); 29 | } 30 | 31 | setActive(active) { 32 | if (active) { 33 | this.add_style_pseudo_class('selected'); 34 | } else { 35 | this.remove_style_pseudo_class('selected'); 36 | } 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /src/gnome-shell/prefs.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; 8 | 9 | import GPasteGtk from 'gi://GPasteGtk?version=4'; 10 | 11 | export default class GPastePreferences extends ExtensionPreferences { 12 | getPreferencesWidget() { 13 | return new GPasteGtk.PreferencesWidget(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/gnome-shell/searchItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { PopupBaseMenuItem } from 'resource:///org/gnome/shell/ui/popupMenu.js'; 8 | 9 | import GObject from 'gi://GObject'; 10 | import St from 'gi://St'; 11 | 12 | export const GPasteSearchItem = GObject.registerClass({ 13 | Signals: { 14 | 'text-changed': { param_types: [] }, 15 | }, 16 | }, class GPasteSearchItem extends PopupBaseMenuItem { 17 | _init() { 18 | super._init({ 19 | activate: false, 20 | reactive: true, 21 | hover: false, 22 | can_focus: false 23 | }); 24 | 25 | this._entry = new St.Entry({ 26 | name: 'GPasteSearchEntry', 27 | style_class:'search-entry', 28 | track_hover: true, 29 | reactive: true, 30 | can_focus: true 31 | }); 32 | this.add_child(this._entry); 33 | 34 | this._entry.set_primary_icon(new St.Icon({ 35 | style_class:'search-entry-icon', 36 | icon_name:'edit-find-symbolic' 37 | })); 38 | this._entry.clutter_text.connect('text-changed', this._onTextChanged.bind(this)); 39 | 40 | this._clearIcon = new St.Icon({ 41 | style_class: 'search-entry-icon', 42 | icon_name: 'edit-clear-symbolic' 43 | }); 44 | this._iconClickedId = 0; 45 | } 46 | 47 | get text() { 48 | return this._entry.get_text(); 49 | } 50 | 51 | resetSize(size) { 52 | this._entry.style = 'width: ' + size + 'em'; 53 | } 54 | 55 | reset() { 56 | this._entry.text = ''; 57 | let text = this._entry.clutter_text; 58 | text.set_cursor_visible(true); 59 | text.set_selection(0, 0); 60 | } 61 | 62 | grabFocus() { 63 | this._entry.grab_key_focus(); 64 | } 65 | 66 | _onTextChanged(se, prop) { 67 | const dummy = (this.text.length == 0); 68 | this._entry.set_secondary_icon((dummy) ? null : this._clearIcon); 69 | if (!dummy && this._iconClickedId == 0) { 70 | this._iconClickedId = this._entry.connect('secondary-icon-clicked', this.reset.bind(this)); 71 | } 72 | this.emit('text-changed'); 73 | } 74 | }); 75 | -------------------------------------------------------------------------------- /src/gnome-shell/stateSwitch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; 8 | import { PopupSwitchMenuItem } from 'resource:///org/gnome/shell/ui/popupMenu.js'; 9 | 10 | import GObject from 'gi://GObject'; 11 | 12 | export const GPasteStateSwitch = GObject.registerClass( 13 | class GPasteStateSwitch extends PopupSwitchMenuItem { 14 | _init(client) { 15 | super._init(_("Track changes"), client.is_active()); 16 | 17 | this._client = client; 18 | 19 | this.connect('toggled', this._onToggle.bind(this)); 20 | } 21 | 22 | toggle(state) { 23 | if (state !== this.state) 24 | super.toggle(state); 25 | } 26 | 27 | _onToggle(state) { 28 | this._client.track(this.state, null); 29 | } 30 | }); 31 | -------------------------------------------------------------------------------- /src/gnome-shell/statusIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import GObject from 'gi://GObject'; 8 | import St from 'gi://St'; 9 | 10 | export const GPasteStatusIcon = GObject.registerClass( 11 | class GPasteStatusIcon extends St.BoxLayout { 12 | _init() { 13 | super._init({ style_class: 'panel-status-menu-box' }); 14 | 15 | this.add_child(new St.Icon({ 16 | icon_name: 'edit-paste-symbolic', 17 | style_class: 'system-status-icon' 18 | })); 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /src/gnome-shell/uiItem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2023, Marc-Antoine Perennou 5 | */ 6 | 7 | import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; 8 | 9 | import GObject from 'gi://GObject'; 10 | import GPaste from 'gi://GPaste'; 11 | 12 | import { GPasteActionButton } from './actionButton.js'; 13 | 14 | export const GPasteUiItem = GObject.registerClass( 15 | class GPasteUiItem extends GPasteActionButton { 16 | _init(menu) { 17 | super._init('go-home-symbolic', _("Graphical tool"), function() { 18 | menu.itemActivated(); 19 | GPaste.util_spawn('Ui'); 20 | }); 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #pragma once 8 | 9 | #define __G_PASTE_GTK3_H_INSIDE__ 10 | 11 | /* Misc. macros */ 12 | #include 13 | #include 14 | 15 | /* GPasteGtkSettingUi */ 16 | #include 17 | #include 18 | #include 19 | 20 | #undef __G_PASTE_GTK3_H_INSIDE__ 21 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk3/gpaste-gtk-settings-ui-panel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK3_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_SETTINGS_UI_PANEL (g_paste_gtk_settings_ui_panel_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (SettingsUiPanel, settings_ui_panel, SETTINGS_UI_PANEL, GtkGrid) 20 | 21 | typedef void (*GPasteGtkBooleanCallback) (gboolean data, 22 | gpointer user_data); 23 | typedef void (*GPasteGtkRangeCallback) (gdouble data, 24 | gpointer user_data); 25 | typedef void (*GPasteGtkTextCallback) (const gchar *data, 26 | gpointer user_data); 27 | typedef void (*GPasteGtkResetCallback) (gpointer user_data); 28 | 29 | GtkSwitch *g_paste_gtk_settings_ui_panel_add_boolean_setting (GPasteGtkSettingsUiPanel *self, 30 | const gchar *label, 31 | gboolean value, 32 | GPasteGtkBooleanCallback on_value_changed, 33 | GPasteGtkResetCallback on_reset, 34 | gpointer user_data); 35 | void g_paste_gtk_settings_ui_panel_add_separator (GPasteGtkSettingsUiPanel *self); 36 | GtkSpinButton *g_paste_gtk_settings_ui_panel_add_range_setting (GPasteGtkSettingsUiPanel *self, 37 | const gchar *label, 38 | gdouble value, 39 | gdouble min, 40 | gdouble max, 41 | gdouble step, 42 | GPasteGtkRangeCallback on_value_changed, 43 | GPasteGtkResetCallback on_reset, 44 | gpointer user_data); 45 | GtkEntry *g_paste_gtk_settings_ui_panel_add_text_setting (GPasteGtkSettingsUiPanel *self, 46 | const gchar *label, 47 | const gchar *value, 48 | GPasteGtkTextCallback on_value_changed, 49 | GPasteGtkResetCallback on_reset, 50 | gpointer user_data); 51 | 52 | GPasteGtkSettingsUiPanel *g_paste_gtk_settings_ui_panel_new (void); 53 | 54 | G_END_DECLS 55 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk3/gpaste-gtk-settings-ui-stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK3_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_SETTINGS_UI_STACK (g_paste_gtk_settings_ui_stack_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (SettingsUiStack, settings_ui_stack, SETTINGS_UI_STACK, GtkStack) 20 | 21 | void g_paste_gtk_settings_ui_stack_add_panel (GPasteGtkSettingsUiStack *self, 22 | const gchar *name, 23 | const gchar *label, 24 | GPasteGtkSettingsUiPanel *panel); 25 | void g_paste_gtk_settings_ui_stack_fill (GPasteGtkSettingsUiStack *self); 26 | 27 | GPasteGtkSettingsUiStack *g_paste_gtk_settings_ui_stack_new (void); 28 | 29 | G_END_DECLS 30 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk3/gpaste-gtk-settings-ui-widget.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteGtkSettingsUiWidget 10 | { 11 | GtkGrid parent_instance; 12 | }; 13 | 14 | typedef struct 15 | { 16 | GPasteGtkSettingsUiStack *stack; 17 | } GPasteGtkSettingsUiWidgetPrivate; 18 | 19 | G_PASTE_GTK_DEFINE_TYPE_WITH_PRIVATE (SettingsUiWidget, settings_ui_widget, GTK_TYPE_GRID) 20 | 21 | /** 22 | * g_paste_gtk_settings_ui_widget_get_stack: 23 | * @self: a #GPasteGtkSettingsUiWidget instance 24 | * 25 | * Get the inner GtkStack from the Widget 26 | * 27 | * Returns: (transfer none): the #GtkStack 28 | */ 29 | G_PASTE_VISIBLE GPasteGtkSettingsUiStack * 30 | g_paste_gtk_settings_ui_widget_get_stack (GPasteGtkSettingsUiWidget *self) 31 | { 32 | g_return_val_if_fail (G_PASTE_IS_GTK_SETTINGS_UI_WIDGET (self), NULL); 33 | 34 | GPasteGtkSettingsUiWidgetPrivate *priv = g_paste_gtk_settings_ui_widget_get_instance_private (self); 35 | 36 | return priv->stack; 37 | } 38 | 39 | static void 40 | g_paste_gtk_settings_ui_widget_class_init (GPasteGtkSettingsUiWidgetClass *klass G_GNUC_UNUSED) 41 | { 42 | } 43 | 44 | static void 45 | g_paste_gtk_settings_ui_widget_init (GPasteGtkSettingsUiWidget *self) 46 | { 47 | GPasteGtkSettingsUiWidgetPrivate *priv = g_paste_gtk_settings_ui_widget_get_instance_private (self); 48 | GtkGrid *grid = GTK_GRID (self); 49 | guint64 current_line = 0; 50 | 51 | GPasteGtkSettingsUiStack *stack = priv->stack = g_paste_gtk_settings_ui_stack_new (); 52 | 53 | if (!stack) 54 | return; 55 | 56 | g_paste_gtk_settings_ui_stack_fill (stack); 57 | 58 | gtk_grid_attach (grid, gtk_widget_new (GTK_TYPE_STACK_SWITCHER, 59 | "stack", GTK_STACK (stack), 60 | "halign", GTK_ALIGN_CENTER, 61 | NULL), 0, current_line++, 1, 1); 62 | gtk_grid_attach (grid, GTK_WIDGET (stack), 0, current_line++, 1, 1); 63 | } 64 | 65 | /** 66 | * g_paste_gtk_settings_ui_widget_new: 67 | * 68 | * Create a new instance of #GPasteGtkSettingsUiWidget 69 | * 70 | * Returns: (nullable): a newly allocated #GPasteGtkSettingsUiWidget 71 | * free it with g_object_unref 72 | */ 73 | G_PASTE_VISIBLE GtkWidget * 74 | g_paste_gtk_settings_ui_widget_new (void) 75 | { 76 | GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_GTK_SETTINGS_UI_WIDGET, NULL); 77 | GPasteGtkSettingsUiWidgetPrivate *priv = g_paste_gtk_settings_ui_widget_get_instance_private (G_PASTE_GTK_SETTINGS_UI_WIDGET (self)); 78 | 79 | if (!priv->stack) 80 | { 81 | g_object_unref (self); 82 | return NULL; 83 | } 84 | 85 | return self; 86 | } 87 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk3/gpaste-gtk-settings-ui-widget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK3_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_SETTINGS_UI_WIDGET (g_paste_gtk_settings_ui_widget_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (SettingsUiWidget, settings_ui_widget, SETTINGS_UI_WIDGET, GtkGrid) 20 | 21 | GPasteGtkSettingsUiStack *g_paste_gtk_settings_ui_widget_get_stack (GPasteGtkSettingsUiWidget *self); 22 | 23 | GtkWidget *g_paste_gtk_settings_ui_widget_new (void); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk3/gpaste-gtk-util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK3_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | gboolean g_paste_gtk_util_confirm_dialog (GtkWindow *parent, 21 | const gchar *action, 22 | const gchar *msg); 23 | 24 | gchar *g_paste_gtk_util_compute_checksum (GdkPixbuf *image); 25 | 26 | void g_paste_gtk_util_empty_history (GtkWindow *parent_window, 27 | GPasteClient *client, 28 | GPasteSettings *settings, 29 | const gchar *history); 30 | 31 | void g_paste_gtk_util_show_win (GApplication *application); 32 | 33 | G_END_DECLS 34 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #pragma once 8 | 9 | #define __G_PASTE_GTK4_H_INSIDE__ 10 | 11 | /* Misc. macros */ 12 | #include 13 | #include 14 | 15 | /* GPasteGtkPreferences */ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #undef __G_PASTE_GTK4_H_INSIDE__ 26 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_GTK_FINAL_TYPE(TypeName, type_name, TYPE_NAME, ParentTypeName) \ 20 | G_PASTE_VISIBLE G_DECLARE_FINAL_TYPE (GPasteGtk##TypeName, g_paste_gtk_##type_name, G_PASTE, GTK_##TYPE_NAME, ParentTypeName) 21 | 22 | #define G_PASTE_GTK_DERIVABLE_TYPE(TypeName, type_name, TYPE_NAME, ParentTypeName) \ 23 | G_PASTE_VISIBLE G_DECLARE_DERIVABLE_TYPE (GPasteGtk##TypeName, g_paste_gtk_##type_name, G_PASTE, GTK_##TYPE_NAME, ParentTypeName) 24 | 25 | #define G_PASTE_GTK_DEFINE_TYPE(TypeName, type_name, ParentTypeName) \ 26 | G_DEFINE_TYPE (GPasteGtk##TypeName, g_paste_gtk_##type_name, ParentTypeName) 27 | 28 | #define G_PASTE_GTK_DEFINE_TYPE_WITH_PRIVATE(TypeName, type_name, ParentTypeName) \ 29 | G_DEFINE_TYPE_WITH_PRIVATE (GPasteGtk##TypeName, g_paste_gtk_##type_name, ParentTypeName) 30 | 31 | #define G_PASTE_GTK_INIT_APPLICATION(name) \ 32 | G_PASTE_INIT_GETTEXT (); \ 33 | AdwApplication *adw = adw_application_new ("org.gnome.GPaste." name, G_APPLICATION_FLAGS_NONE); \ 34 | GtkApplication *app = GTK_APPLICATION (adw); \ 35 | GApplication *gapp = G_APPLICATION (app); \ 36 | g_autoptr (GError) error = NULL; \ 37 | G_APPLICATION_GET_CLASS (gapp)->activate = g_paste_gtk_util_show_window; \ 38 | g_application_register (gapp, NULL, &error); \ 39 | if (error) \ 40 | { \ 41 | fprintf (stderr, "%s: %s\n", _("Failed to register the gtk application"), error->message); \ 42 | return EXIT_FAILURE; \ 43 | } \ 44 | if (g_application_get_is_remote (gapp)) \ 45 | { \ 46 | g_application_activate (gapp); \ 47 | return g_application_run (gapp, argc, argv); \ 48 | } 49 | 50 | G_END_DECLS 51 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-behaviour-page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_BEHAVIOUR_PAGE (g_paste_gtk_preferences_behaviour_page_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesBehaviourPage, preferences_behaviour_page, PREFERENCES_BEHAVIOUR_PAGE, GPasteGtkPreferencesPage) 20 | 21 | GtkWidget *g_paste_gtk_preferences_behaviour_page_new (GPasteGtkPreferencesManager *manager); 22 | 23 | G_END_DECLS 24 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-dialog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | struct _GPasteGtkPreferencesDialog 13 | { 14 | AdwPreferencesDialog parent_instance; 15 | }; 16 | 17 | typedef struct 18 | { 19 | GApplication *gapp; 20 | } GPasteGtkPreferencesDialogPrivate; 21 | 22 | G_PASTE_GTK_DEFINE_TYPE_WITH_PRIVATE (PreferencesDialog, preferences_dialog, ADW_TYPE_PREFERENCES_DIALOG) 23 | 24 | static void 25 | g_paste_gtk_preferences_dialog_finalize (GObject *object) 26 | { 27 | GPasteGtkPreferencesDialogPrivate *priv = g_paste_gtk_preferences_dialog_get_instance_private (G_PASTE_GTK_PREFERENCES_DIALOG (object)); 28 | 29 | if (priv->gapp) 30 | g_application_release (priv->gapp); 31 | } 32 | 33 | static void 34 | g_paste_gtk_preferences_dialog_class_init (GPasteGtkPreferencesDialogClass *klass) 35 | { 36 | G_OBJECT_CLASS (klass)->finalize = g_paste_gtk_preferences_dialog_finalize; 37 | } 38 | 39 | static void 40 | g_paste_gtk_preferences_dialog_init (GPasteGtkPreferencesDialog *self) 41 | { 42 | AdwPreferencesDialog *win = ADW_PREFERENCES_DIALOG (self); 43 | g_autoptr (GPasteGtkPreferencesManager) manager = g_paste_gtk_preferences_manager_new (); 44 | 45 | adw_preferences_dialog_add (win, ADW_PREFERENCES_PAGE (g_paste_gtk_preferences_behaviour_page_new (manager))); 46 | adw_preferences_dialog_add (win, ADW_PREFERENCES_PAGE (g_paste_gtk_preferences_history_settings_page_new (manager))); 47 | adw_preferences_dialog_add (win, ADW_PREFERENCES_PAGE (g_paste_gtk_preferences_shortcuts_page_new (manager))); 48 | } 49 | 50 | /** 51 | * g_paste_gtk_preferences_dialog_new: 52 | * @gapp: a #GApplication instance 53 | * 54 | * Create a new instance of #GPasteGtkPreferencesDialog 55 | * 56 | * Returns: (nullable): a newly allocated #GPasteGtkPreferencesDialog 57 | * free it with g_object_unref 58 | */ 59 | G_PASTE_VISIBLE AdwDialog * 60 | g_paste_gtk_preferences_dialog_new (GApplication *gapp) 61 | { 62 | GPasteGtkPreferencesDialog *self = g_object_new (G_PASTE_TYPE_GTK_PREFERENCES_DIALOG, NULL); 63 | GPasteGtkPreferencesDialogPrivate *priv = g_paste_gtk_preferences_dialog_get_instance_private (self); 64 | 65 | if (gapp) 66 | g_application_hold (gapp); 67 | priv->gapp = gapp; 68 | 69 | return ADW_DIALOG (self); 70 | } 71 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_DIALOG (g_paste_gtk_preferences_dialog_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesDialog, preferences_dialog, PREFERENCES_DIALOG, AdwPreferencesDialog) 20 | 21 | AdwDialog *g_paste_gtk_preferences_dialog_new (GApplication *gapp); 22 | 23 | G_END_DECLS 24 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-group.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_GROUP (g_paste_gtk_preferences_group_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesGroup, preferences_group, PREFERENCES_GROUP, AdwPreferencesGroup) 20 | 21 | typedef void (*GPasteGtkBooleanCallback) (GPasteSettings *settings, 22 | gboolean data); 23 | typedef void (*GPasteGtkRangeCallback) (GPasteSettings *settings, 24 | guint64 data); 25 | typedef void (*GPasteGtkTextCallback) (GPasteSettings *settings, 26 | const gchar *data); 27 | typedef void (*GPasteGtkResetCallback) (GPasteSettings *settings); 28 | 29 | GtkSwitch *g_paste_gtk_preferences_group_add_boolean_setting (GPasteGtkPreferencesGroup *self, 30 | const gchar *label, 31 | gboolean value, 32 | GPasteGtkBooleanCallback on_value_changed, 33 | GPasteGtkResetCallback on_reset, 34 | GPasteSettings *settings); 35 | GtkSpinButton *g_paste_gtk_preferences_group_add_range_setting (GPasteGtkPreferencesGroup *self, 36 | const gchar *label, 37 | gdouble value, 38 | gdouble min, 39 | gdouble max, 40 | gdouble step, 41 | GPasteGtkRangeCallback on_value_changed, 42 | GPasteGtkResetCallback on_reset, 43 | GPasteSettings *settings); 44 | GtkEntryBuffer *g_paste_gtk_preferences_group_add_text_setting (GPasteGtkPreferencesGroup *self, 45 | const gchar *label, 46 | const gchar *value, 47 | GPasteGtkTextCallback on_value_changed, 48 | GPasteGtkResetCallback on_reset, 49 | GPasteSettings *settings); 50 | 51 | GPasteGtkPreferencesGroup *g_paste_gtk_preferences_group_new (const gchar *title); 52 | 53 | G_END_DECLS 54 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-history-settings-page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_HISTORY_SETTINGS_PAGE (g_paste_gtk_preferences_history_settings_page_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesHistorySettingsPage, preferences_history_settings_page, PREFERENCES_HISTORY_SETTINGS_PAGE, GPasteGtkPreferencesPage) 20 | 21 | GtkWidget *g_paste_gtk_preferences_history_settings_page_new (GPasteGtkPreferencesManager *manager); 22 | 23 | G_END_DECLS 24 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_MANAGER (g_paste_gtk_preferences_manager_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesManager, preferences_manager, PREFERENCES_MANAGER, GObject) 20 | 21 | GPasteSettings *g_paste_gtk_preferences_manager_get_settings (GPasteGtkPreferencesManager *self); 22 | 23 | void g_paste_gtk_preferences_manager_register (GPasteGtkPreferencesManager *self, 24 | GPasteGtkPreferencesPage *page); 25 | 26 | void g_paste_gtk_preferences_manager_deregister (GPasteGtkPreferencesManager *self, 27 | GPasteGtkPreferencesPage *page); 28 | 29 | GPasteGtkPreferencesManager *g_paste_gtk_preferences_manager_new (void); 30 | 31 | G_END_DECLS 32 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-page.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | G_PASTE_GTK_DEFINE_TYPE (PreferencesPage, preferences_page, ADW_TYPE_PREFERENCES_PAGE) 10 | 11 | /** 12 | * g_paste_gtk_preferences_page_setting_changed: 13 | * @self: a #GPasteGtkPreferencesPage instance 14 | * @settings: a #GPasteSettings instance 15 | * @key: the settings key that just changed 16 | * 17 | * Apply changes related to the update of one setting 18 | */ 19 | G_PASTE_VISIBLE void 20 | g_paste_gtk_preferences_page_setting_changed (GPasteGtkPreferencesPage *self, 21 | GPasteSettings *settings, 22 | const gchar *key) 23 | { 24 | g_return_if_fail (G_PASTE_IS_GTK_PREFERENCES_PAGE (self)); 25 | g_return_if_fail (G_PASTE_IS_SETTINGS (settings)); 26 | g_return_if_fail (key); 27 | 28 | GPasteGtkPreferencesPageClass *klass = G_PASTE_GTK_PREFERENCES_PAGE_GET_CLASS (self); 29 | 30 | if (klass->setting_changed) 31 | klass->setting_changed (self, settings, key); 32 | } 33 | 34 | static void 35 | g_paste_gtk_preferences_page_class_init (GPasteGtkPreferencesPageClass *klass G_GNUC_UNUSED) 36 | { 37 | } 38 | 39 | static void 40 | g_paste_gtk_preferences_page_init (GPasteGtkPreferencesPage *self G_GNUC_UNUSED) 41 | { 42 | } 43 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_PAGE (g_paste_gtk_preferences_page_get_type ()) 18 | 19 | G_PASTE_GTK_DERIVABLE_TYPE (PreferencesPage, preferences_page, PREFERENCES_PAGE, AdwPreferencesPage) 20 | 21 | struct _GPasteGtkPreferencesPageClass 22 | { 23 | AdwPreferencesPageClass parent_class; 24 | 25 | /*< pure virtual >*/ 26 | void (*setting_changed) (GPasteGtkPreferencesPage *self, 27 | GPasteSettings *settings, 28 | const gchar *key); 29 | }; 30 | 31 | void g_paste_gtk_preferences_page_setting_changed (GPasteGtkPreferencesPage *self, 32 | GPasteSettings *settings, 33 | const gchar *key); 34 | 35 | G_END_DECLS 36 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-shortcuts-page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_SHORTCUTS_PAGE (g_paste_gtk_preferences_shortcuts_page_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesShortcutsPage, preferences_shortcuts_page, PREFERENCES_SHORTCUTS_PAGE, GPasteGtkPreferencesPage) 20 | 21 | GtkWidget *g_paste_gtk_preferences_shortcuts_page_new (GPasteGtkPreferencesManager *manager); 22 | 23 | G_END_DECLS 24 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-widget.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | struct _GPasteGtkPreferencesWidget 13 | { 14 | AdwBin parent_instance; 15 | }; 16 | 17 | G_PASTE_GTK_DEFINE_TYPE (PreferencesWidget, preferences_widget, ADW_TYPE_BIN) 18 | 19 | static void 20 | g_paste_gtk_preferences_widget_class_init (GPasteGtkPreferencesWidgetClass *klass G_GNUC_UNUSED) 21 | { 22 | } 23 | 24 | static void 25 | add_page (AdwViewStack *s, 26 | GtkWidget *page) 27 | { 28 | AdwPreferencesPage *p = ADW_PREFERENCES_PAGE (page); 29 | AdwViewStackPage *asp = adw_view_stack_add_titled (s, page, adw_preferences_page_get_name (p), adw_preferences_page_get_title (p)); 30 | 31 | adw_view_stack_page_set_icon_name (asp, adw_preferences_page_get_icon_name (p)); 32 | } 33 | 34 | static void 35 | g_paste_gtk_preferences_widget_init (GPasteGtkPreferencesWidget *self) 36 | { 37 | AdwBin *bin = ADW_BIN (self); 38 | GtkWidget *box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); 39 | GtkBox *b = GTK_BOX (box); 40 | g_autoptr (GPasteGtkPreferencesManager) manager = g_paste_gtk_preferences_manager_new (); 41 | GtkWidget *stack = adw_view_stack_new (); 42 | AdwViewStack *s = ADW_VIEW_STACK (stack); 43 | GtkWidget *switcher = GTK_WIDGET (g_object_new (ADW_TYPE_VIEW_SWITCHER, "stack", stack, "policy", ADW_VIEW_SWITCHER_POLICY_WIDE, NULL)); 44 | 45 | add_page (s, g_paste_gtk_preferences_behaviour_page_new (manager)); 46 | add_page (s, g_paste_gtk_preferences_history_settings_page_new (manager)); 47 | add_page (s, g_paste_gtk_preferences_shortcuts_page_new (manager)); 48 | 49 | gtk_box_append (b, switcher); 50 | gtk_box_append (b, stack); 51 | 52 | adw_bin_set_child (bin, box); 53 | } 54 | 55 | /** 56 | * g_paste_gtk_preferences_widget_new: 57 | * 58 | * Create a new instance of #GPasteGtkPreferencesWidget 59 | * 60 | * Returns: (nullable): a newly allocated #GPasteGtkPreferencesWidget 61 | * free it with g_object_unref 62 | */ 63 | G_PASTE_VISIBLE GtkWidget * 64 | g_paste_gtk_preferences_widget_new (void) 65 | { 66 | return GTK_WIDGET (g_object_new (G_PASTE_TYPE_GTK_PREFERENCES_WIDGET, NULL)); 67 | } 68 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-preferences-widget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_GTK_PREFERENCES_WIDGET (g_paste_gtk_preferences_widget_get_type ()) 18 | 19 | G_PASTE_GTK_FINAL_TYPE (PreferencesWidget, preferences_widget, PREFERENCES_WIDGET, AdwBin) 20 | 21 | GtkWidget *g_paste_gtk_preferences_widget_new (void); 22 | 23 | G_END_DECLS 24 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste-gtk4/gpaste-gtk-util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_GTK4_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | typedef void (*GPasteGtkConfirmDialogCallback) (gboolean confirmed, 20 | gpointer user_data); 21 | 22 | void g_paste_gtk_util_confirm_dialog (GtkWindow *parent, 23 | const gchar *action, 24 | const gchar *msg, 25 | GPasteGtkConfirmDialogCallback on_confirmation, 26 | gpointer user_data); 27 | 28 | gchar *g_paste_gtk_util_compute_checksum (GdkTexture *texture); 29 | 30 | void g_paste_gtk_util_empty_history (GtkWindow *parent_window, 31 | GPasteClient *client, 32 | GPasteSettings *settings, 33 | const gchar *history); 34 | 35 | void g_paste_gtk_util_show_window (GApplication *application); 36 | 37 | G_END_DECLS 38 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #pragma once 8 | 9 | #define __G_PASTE_H_INSIDE__ 10 | 11 | /* Misc. macros */ 12 | #include 13 | 14 | /* GDBus utils */ 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | /* GPasteSettings */ 21 | #include 22 | #include 23 | 24 | /* GPasteClient */ 25 | #include 26 | #include 27 | 28 | /* GPasteUtil */ 29 | #include 30 | 31 | /* GPasteGnomeShellClient */ 32 | #include 33 | 34 | /* GPasteScreensaverClient */ 35 | #include 36 | 37 | #undef __G_PASTE_H_INSIDE__ 38 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-client-item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteClientItem 10 | { 11 | GObject parent_instance; 12 | }; 13 | 14 | typedef struct 15 | { 16 | gchar *uuid; 17 | gchar *value; 18 | } GPasteClientItemPrivate; 19 | 20 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (ClientItem, client_item, G_TYPE_OBJECT) 21 | 22 | /** 23 | * g_paste_client_item_get_uuid: 24 | * @self: a #GPasteClientItem instance 25 | * 26 | * Returns the uuid of the item 27 | */ 28 | G_PASTE_VISIBLE const gchar * 29 | g_paste_client_item_get_uuid (const GPasteClientItem *self) 30 | { 31 | g_return_val_if_fail (_G_PASTE_IS_CLIENT_ITEM (self), NULL); 32 | 33 | const GPasteClientItemPrivate *priv = _g_paste_client_item_get_instance_private (self); 34 | 35 | return priv->uuid;; 36 | } 37 | 38 | /** 39 | * g_paste_client_item_get_value: 40 | * @self: a #GPasteClientItem instance 41 | * 42 | * Returns the value of the item 43 | */ 44 | G_PASTE_VISIBLE const gchar * 45 | g_paste_client_item_get_value (const GPasteClientItem *self) 46 | { 47 | g_return_val_if_fail (_G_PASTE_IS_CLIENT_ITEM (self), NULL); 48 | 49 | const GPasteClientItemPrivate *priv = _g_paste_client_item_get_instance_private (self); 50 | 51 | return priv->value; 52 | } 53 | 54 | static void 55 | g_paste_client_item_finalize (GObject *object) 56 | { 57 | GPasteClientItemPrivate *priv = g_paste_client_item_get_instance_private (G_PASTE_CLIENT_ITEM (object)); 58 | 59 | g_free (priv->uuid); 60 | g_free (priv->value); 61 | } 62 | 63 | static void 64 | g_paste_client_item_class_init (GPasteClientItemClass *klass) 65 | { 66 | G_OBJECT_CLASS (klass)->finalize = g_paste_client_item_finalize; 67 | } 68 | 69 | static void 70 | g_paste_client_item_init (GPasteClientItem *self G_GNUC_UNUSED) 71 | { 72 | } 73 | 74 | /** 75 | * g_paste_client_item_new: 76 | * @uuid: the uuid of the item 77 | * @value: the value of the item 78 | * 79 | * Create a new instance of #GPasteClientItem 80 | * 81 | * Returns: (transfer full): a newly allocated #GPasteClientItem 82 | * free it with g_object_unref 83 | */ 84 | G_PASTE_VISIBLE GPasteClientItem * 85 | g_paste_client_item_new (const gchar *uuid, 86 | const gchar *value) 87 | { 88 | g_return_val_if_fail (g_uuid_string_is_valid (uuid), NULL); 89 | g_return_val_if_fail (g_utf8_validate (value, -1, NULL), NULL); 90 | 91 | GPasteClientItem *self = g_object_new (G_PASTE_TYPE_CLIENT_ITEM, NULL); 92 | GPasteClientItemPrivate *priv = g_paste_client_item_get_instance_private (self); 93 | 94 | priv->uuid = g_strdup (uuid); 95 | priv->value = g_strdup (value); 96 | 97 | return self; 98 | } 99 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-client-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_TYPE_CLIENT_ITEM (g_paste_client_item_get_type ()) 18 | 19 | G_PASTE_FINAL_TYPE (ClientItem, client_item, CLIENT_ITEM, GObject) 20 | 21 | const gchar *g_paste_client_item_get_uuid (const GPasteClientItem *self); 22 | const gchar *g_paste_client_item_get_value (const GPasteClientItem *self); 23 | 24 | GPasteClientItem *g_paste_client_item_new (const gchar *uuid, 25 | const gchar *value); 26 | 27 | G_END_DECLS 28 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-gsettings-keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_SETTINGS_NAME "org.gnome.GPaste" 18 | #define G_PASTE_SETTINGS_PATH "/org/gnome/GPaste/" 19 | #define G_PASTE_SHELL_SETTINGS_NAME "org.gnome.shell" 20 | 21 | #define G_PASTE_CLOSE_ON_SELECT_SETTING "close-on-select" 22 | #define G_PASTE_ELEMENT_SIZE_SETTING "element-size" 23 | #define G_PASTE_EMPTY_HISTORY_CONFIRMATION_SETTING "empty-history-confirmation" 24 | #define G_PASTE_GROWING_LINES_SETTING "growing-lines" 25 | #define G_PASTE_HISTORY_NAME_SETTING "history-name" 26 | #define G_PASTE_IMAGES_SUPPORT_SETTING "images-support" 27 | #define G_PASTE_LAUNCH_UI_SETTING "launch-ui" 28 | #define G_PASTE_MAKE_PASSWORD_SETTING "make-password" 29 | #define G_PASTE_MAX_DISPLAYED_HISTORY_SIZE_SETTING "max-displayed-history-size" 30 | #define G_PASTE_MAX_HISTORY_SIZE_SETTING "max-history-size" 31 | #define G_PASTE_MAX_MEMORY_USAGE_SETTING "max-memory-usage" 32 | #define G_PASTE_MAX_TEXT_ITEM_SIZE_SETTING "max-text-item-size" 33 | #define G_PASTE_MIN_TEXT_ITEM_SIZE_SETTING "min-text-item-size" 34 | #define G_PASTE_OPEN_CENTERED_SETTING "open-centered" 35 | #define G_PASTE_POP_SETTING "pop" 36 | #define G_PASTE_PRIMARY_TO_HISTORY_SETTING "primary-to-history" 37 | #define G_PASTE_RICH_TEXT_SUPPORT_SETTING "rich-text-support" 38 | #define G_PASTE_SAVE_HISTORY_SETTING "save-history" 39 | #define G_PASTE_SHOW_HISTORY_SETTING "show-history" 40 | #define G_PASTE_SYNC_CLIPBOARD_TO_PRIMARY_SETTING "sync-clipboard-to-primary" 41 | #define G_PASTE_SYNC_PRIMARY_TO_CLIPBOARD_SETTING "sync-primary-to-clipboard" 42 | #define G_PASTE_SYNCHRONIZE_CLIPBOARDS_SETTING "synchronize-clipboards" 43 | #define G_PASTE_TRACK_CHANGES_SETTING "track-changes" 44 | #define G_PASTE_TRACK_EXTENSION_STATE_SETTING "track-extension-state" 45 | #define G_PASTE_TRIM_ITEMS_SETTING "trim-items" 46 | #define G_PASTE_UPLOAD_SETTING "upload" 47 | 48 | #define G_PASTE_EXTENSION_ENABLED_SETTING "extension-enabled" 49 | #define G_PASTE_SHELL_ENABLED_EXTENSIONS_SETTING "enabled-extensions" 50 | 51 | G_END_DECLS 52 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-item-enums.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | G_PASTE_VISIBLE GType 11 | g_paste_item_kind_get_type (void) 12 | { 13 | static GType etype = 0; 14 | if (!etype) 15 | { 16 | static const GEnumValue values[] = { 17 | { G_PASTE_ITEM_KIND_TEXT, "G_PASTE_ITEM_KIND_TEXT", "Text" }, 18 | { G_PASTE_ITEM_KIND_URIS, "G_PASTE_ITEM_KIND_URIS", "Uris" }, 19 | { G_PASTE_ITEM_KIND_IMAGE, "G_PASTE_ITEM_KIND_IMAGE", "Image" }, 20 | { G_PASTE_ITEM_KIND_PASSWORD, "G_PASTE_ITEM_KIND_PASSWORD", "Password" }, 21 | { G_PASTE_ITEM_KIND_INVALID, NULL, NULL } 22 | }; 23 | etype = g_enum_register_static (g_intern_static_string ("GPasteItemKind"), values); 24 | g_type_class_ref (etype); 25 | } 26 | return etype; 27 | } 28 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-item-enums.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | typedef enum { 18 | G_PASTE_ITEM_KIND_TEXT = 1, 19 | G_PASTE_ITEM_KIND_URIS, 20 | G_PASTE_ITEM_KIND_IMAGE, 21 | G_PASTE_ITEM_KIND_PASSWORD, 22 | G_PASTE_ITEM_KIND_INVALID = 0 23 | } GPasteItemKind; 24 | 25 | #define G_PASTE_TYPE_ITEM_KIND (g_paste_item_kind_get_type ()) 26 | GType g_paste_item_kind_get_type (void); 27 | 28 | G_END_DECLS 29 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-screensaver-client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define G_PASTE_SCREENSAVER_BUS_NAME "org.gnome.ScreenSaver" 18 | 19 | #define G_PASTE_TYPE_SCREENSAVER_CLIENT (g_paste_screensaver_client_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (ScreensaverClient, screensaver_client, SCREENSAVER_CLIENT, GDBusProxy) 22 | 23 | GPasteScreensaverClient *g_paste_screensaver_client_new_sync (GError **error); 24 | void g_paste_screensaver_client_new (GAsyncReadyCallback callback, 25 | gpointer user_data); 26 | GPasteScreensaverClient *g_paste_screensaver_client_new_finish (GAsyncResult *result, 27 | GError **error); 28 | 29 | G_END_DECLS 30 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-update-enums.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | G_PASTE_VISIBLE GType 11 | g_paste_update_action_get_type (void) 12 | { 13 | static GType etype = 0; 14 | if (!etype) 15 | { 16 | static const GEnumValue values[] = { 17 | { G_PASTE_UPDATE_ACTION_REPLACE, "G_PASTE_UPDATE_ACTION_REPLACE", "REPLACE" }, 18 | { G_PASTE_UPDATE_ACTION_REMOVE, "G_PASTE_UPDATE_ACTION_REMOVE", "REMOVE" }, 19 | { G_PASTE_UPDATE_ACTION_INVALID, NULL, NULL } 20 | }; 21 | etype = g_enum_register_static (g_intern_static_string ("GPasteUpdateAction"), values); 22 | g_type_class_ref (etype); 23 | } 24 | return etype; 25 | } 26 | 27 | G_PASTE_VISIBLE GType 28 | g_paste_update_target_get_type (void) 29 | { 30 | static GType etype = 0; 31 | if (!etype) 32 | { 33 | static const GEnumValue values[] = { 34 | { G_PASTE_UPDATE_TARGET_ALL, "G_PASTE_UPDATE_TARGET_ALL", "ALL" }, 35 | { G_PASTE_UPDATE_TARGET_POSITION, "G_PASTE_UPDATE_TARGET_POSITION", "POSITION" }, 36 | { G_PASTE_UPDATE_TARGET_INVALID, NULL, NULL } 37 | }; 38 | etype = g_enum_register_static (g_intern_static_string ("GPasteUpdateTarget"), values); 39 | g_type_class_ref (etype); 40 | } 41 | return etype; 42 | } 43 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-update-enums.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | typedef enum { 18 | G_PASTE_UPDATE_ACTION_REPLACE = 1, 19 | G_PASTE_UPDATE_ACTION_REMOVE, 20 | G_PASTE_UPDATE_ACTION_INVALID = 0 21 | } GPasteUpdateAction; 22 | 23 | #define G_PASTE_TYPE_UPDATE_ACTION (g_paste_update_action_get_type ()) 24 | GType g_paste_update_action_get_type (void); 25 | 26 | typedef enum { 27 | G_PASTE_UPDATE_TARGET_ALL = 1, 28 | G_PASTE_UPDATE_TARGET_POSITION, 29 | G_PASTE_UPDATE_TARGET_INVALID = 0 30 | } GPasteUpdateTarget; 31 | 32 | #define G_PASTE_TYPE_UPDATE_TARGET (g_paste_update_target_get_type ()) 33 | GType g_paste_update_target_get_type (void); 34 | 35 | G_END_DECLS 36 | -------------------------------------------------------------------------------- /src/libgpaste/gpaste/gpaste-util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | void g_paste_util_spawn (const gchar *app); 19 | gboolean g_paste_util_spawn_sync (const gchar *app, 20 | GError **error); 21 | void g_paste_util_activate_ui (const gchar *action, 22 | GVariant *arg); 23 | gboolean g_paste_util_activate_ui_sync (const gchar *action, 24 | GVariant *arg, 25 | GError **error); 26 | void g_paste_util_empty_with_confirmation (GPasteClient *client, 27 | const GPasteSettings *settings, 28 | const gchar *history); 29 | gboolean g_paste_util_empty_with_confirmation_sync (GPasteClient *client, 30 | const GPasteSettings *settings, 31 | const gchar *history, 32 | GError **error); 33 | gchar *g_paste_util_replace (const gchar *text, 34 | const gchar *pattern, 35 | const gchar *substitution); 36 | 37 | gboolean g_paste_util_has_gnome_shell (void); 38 | 39 | guint32 *g_paste_util_get_dbus_au_result (GVariant *variant, 40 | guint64 *len); 41 | 42 | GPasteClientItem *g_paste_util_get_dbus_item_result (GVariant *variant); 43 | GList *g_paste_util_get_dbus_items_result (GVariant *variant); 44 | 45 | void g_paste_util_write_pid_file (const gchar *component); 46 | GPid g_paste_util_read_pid_file (const gchar *component); 47 | 48 | gchar *g_paste_util_xml_decode (const gchar *text); 49 | gchar *g_paste_util_xml_encode (const gchar *text); 50 | 51 | gchar *g_paste_util_get_history_dir_path (void); 52 | GFile *g_paste_util_get_history_dir (void); 53 | gchar *g_paste_util_get_history_file_path (const gchar *name, 54 | const gchar *extension); 55 | GFile *g_paste_util_get_history_file (const gchar *name, 56 | const gchar *extension); 57 | 58 | gboolean g_paste_util_ensure_history_dir_exists (const GPasteSettings *settings); 59 | 60 | G_END_DECLS 61 | -------------------------------------------------------------------------------- /src/libgpaste/libgpaste-gtk3.sym: -------------------------------------------------------------------------------- 1 | LIBGPASTE_GTK3_42 { 2 | global: 3 | g_paste_gtk_util_confirm_dialog; 4 | g_paste_gtk_util_compute_checksum; 5 | g_paste_gtk_util_empty_history; 6 | g_paste_gtk_util_show_win; 7 | 8 | g_paste_gtk_settings_ui_panel_add_boolean_setting; 9 | g_paste_gtk_settings_ui_panel_add_range_setting; 10 | g_paste_gtk_settings_ui_panel_add_separator; 11 | g_paste_gtk_settings_ui_panel_add_text_setting; 12 | g_paste_gtk_settings_ui_panel_get_type; 13 | g_paste_gtk_settings_ui_panel_new; 14 | 15 | g_paste_gtk_settings_ui_stack_add_panel; 16 | g_paste_gtk_settings_ui_stack_fill; 17 | g_paste_gtk_settings_ui_stack_get_type; 18 | g_paste_gtk_settings_ui_stack_new; 19 | 20 | g_paste_gtk_settings_ui_widget_get_stack; 21 | g_paste_gtk_settings_ui_widget_get_type; 22 | g_paste_gtk_settings_ui_widget_new; 23 | local: 24 | *; 25 | }; 26 | -------------------------------------------------------------------------------- /src/libgpaste/libgpaste-gtk4.sym: -------------------------------------------------------------------------------- 1 | LIBGPASTE_GTK4_42 { 2 | global: 3 | g_paste_gtk_util_confirm_dialog; 4 | g_paste_gtk_util_compute_checksum; 5 | g_paste_gtk_util_empty_history; 6 | g_paste_gtk_util_show_window; 7 | 8 | g_paste_gtk_preferences_behaviour_page_get_type; 9 | g_paste_gtk_preferences_behaviour_page_new; 10 | 11 | g_paste_gtk_preferences_group_add_boolean_setting; 12 | g_paste_gtk_preferences_group_add_range_setting; 13 | g_paste_gtk_preferences_group_add_text_setting; 14 | g_paste_gtk_preferences_group_get_type; 15 | g_paste_gtk_preferences_group_new; 16 | 17 | g_paste_gtk_preferences_history_settings_page_get_type; 18 | g_paste_gtk_preferences_history_settings_page_new; 19 | 20 | g_paste_gtk_preferences_manager_get_settings; 21 | g_paste_gtk_preferences_manager_get_type; 22 | g_paste_gtk_preferences_manager_deregister; 23 | g_paste_gtk_preferences_manager_new; 24 | g_paste_gtk_preferences_manager_register; 25 | 26 | g_paste_gtk_preferences_page_get_type; 27 | g_paste_gtk_preferences_page_setting_changed; 28 | 29 | g_paste_gtk_preferences_shortcuts_page_get_type; 30 | g_paste_gtk_preferences_shortcuts_page_new; 31 | 32 | g_paste_gtk_preferences_widget_get_type; 33 | g_paste_gtk_preferences_widget_new; 34 | 35 | g_paste_gtk_preferences_dialog_get_type; 36 | g_paste_gtk_preferences_dialog_new; 37 | local: 38 | *; 39 | }; 40 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | subdir('libgpaste') 2 | subdir('client') 3 | subdir('daemon') 4 | subdir('preferences') 5 | subdir('ui') 6 | 7 | if get_option('gnome-shell') 8 | subdir('gnome-shell') 9 | endif 10 | -------------------------------------------------------------------------------- /src/preferences/gpaste-preferences.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2022, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | static void 11 | quit_activated (GSimpleAction *action G_GNUC_UNUSED, 12 | GVariant *parameter G_GNUC_UNUSED, 13 | gpointer user_data) 14 | { 15 | g_application_quit (G_APPLICATION (user_data)); 16 | } 17 | 18 | gint 19 | main (gint argc, gchar *argv[]) 20 | { 21 | G_PASTE_GTK_INIT_APPLICATION ("Preferences"); 22 | 23 | GActionEntry app_entries[] = { 24 | { "quit", quit_activated, NULL, NULL, NULL, { 0 } }, 25 | }; 26 | 27 | g_action_map_add_action_entries (G_ACTION_MAP (app), app_entries, G_N_ELEMENTS (app_entries), app); 28 | 29 | AdwDialog *dialog = g_paste_gtk_preferences_dialog_new (gapp); 30 | 31 | adw_dialog_present (dialog, NULL); 32 | 33 | return g_application_run (gapp, argc, argv); 34 | } 35 | -------------------------------------------------------------------------------- /src/preferences/meson.build: -------------------------------------------------------------------------------- 1 | gpaste_preferences_sources = [ 2 | 'gpaste-preferences.c', 3 | ] 4 | 5 | executable( 6 | 'gpaste-preferences', 7 | sources: gpaste_preferences_sources, 8 | install: true, 9 | dependencies: [ glib_dep, gtk4_dep, libadwaita_dep, libgpaste_internal_dep, libgpaste_gtk4_internal_dep ], 10 | install_dir: join_paths(get_option('libexecdir'), 'gpaste'), 11 | ) 12 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-about.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | struct _GPasteUiAbout 11 | { 12 | GtkButton parent_instance; 13 | }; 14 | 15 | typedef struct 16 | { 17 | GActionGroup *action_group; 18 | } GPasteUiAboutPrivate; 19 | 20 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (UiAbout, ui_about, GTK_TYPE_BUTTON) 21 | 22 | static void 23 | g_paste_ui_about_clicked (GtkButton *button) 24 | { 25 | const GPasteUiAboutPrivate *priv = _g_paste_ui_about_get_instance_private (G_PASTE_UI_ABOUT (button)); 26 | 27 | g_action_group_activate_action (priv->action_group, "about", NULL); 28 | } 29 | 30 | static void 31 | g_paste_ui_about_class_init (GPasteUiAboutClass *klass) 32 | { 33 | GTK_BUTTON_CLASS (klass)->clicked = g_paste_ui_about_clicked; 34 | } 35 | 36 | static void 37 | g_paste_ui_about_init (GPasteUiAbout *self) 38 | { 39 | GtkWidget *widget = GTK_WIDGET (self); 40 | 41 | gtk_widget_set_tooltip_text (widget, _("About")); 42 | gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); 43 | gtk_container_add (GTK_CONTAINER (self), gtk_image_new_from_icon_name ("dialog-information-symbolic", GTK_ICON_SIZE_BUTTON)); 44 | } 45 | 46 | /** 47 | * g_paste_ui_about_new: 48 | * @app: The #GtkApplication 49 | * 50 | * Create a new instance of #GPasteUiAbout 51 | * 52 | * Returns: a newly allocated #GPasteUiAbout 53 | * free it with g_object_unref 54 | */ 55 | G_PASTE_VISIBLE GtkWidget * 56 | g_paste_ui_about_new (GtkApplication *app) 57 | { 58 | g_return_val_if_fail (GTK_IS_APPLICATION (app), NULL); 59 | 60 | GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_UI_ABOUT, NULL); 61 | GPasteUiAboutPrivate *priv = g_paste_ui_about_get_instance_private (G_PASTE_UI_ABOUT (self)); 62 | 63 | priv->action_group = G_ACTION_GROUP (app); 64 | 65 | return self; 66 | } 67 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-about.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_ABOUT_H__ 12 | #define __G_PASTE_UI_ABOUT_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_ABOUT (g_paste_ui_about_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiAbout, ui_about, UI_ABOUT, GtkButton) 23 | 24 | GtkWidget *g_paste_ui_about_new (GtkApplication *app); 25 | 26 | G_END_DECLS 27 | 28 | #endif /*__G_PASTE_UI_ABOUT_H__*/ 29 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-backup-history.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_BACKUP_HISTORY_H__ 12 | #define __G_PASTE_UI_BACKUP_HISTORY_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_BACKUP_HISTORY (g_paste_ui_backup_history_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiBackupHistory, ui_backup_history, UI_BACKUP_HISTORY, GPasteUiHistoryAction) 21 | 22 | GtkWidget *g_paste_ui_backup_history_new (GPasteClient *client, 23 | GPasteSettings *settings, 24 | GtkWidget *actions, 25 | GtkWindow *rootwin); 26 | 27 | G_END_DECLS 28 | 29 | #endif /*__G_PASTE_UI_BACKUP_HISTORY_H__*/ 30 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-delete-history.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | struct _GPasteUiDeleteHistory 13 | { 14 | GPasteUiHistoryAction parent_instance; 15 | }; 16 | 17 | G_PASTE_DEFINE_TYPE (UiDeleteHistory, ui_delete_history, G_PASTE_TYPE_UI_HISTORY_ACTION) 18 | 19 | static gboolean 20 | g_paste_ui_delete_history_activate (GPasteUiHistoryAction *self G_GNUC_UNUSED, 21 | GPasteClient *client, 22 | GPasteSettings *settings G_GNUC_UNUSED, 23 | GtkWindow *rootwin, 24 | const gchar *history) 25 | { 26 | if (g_paste_gtk_util_confirm_dialog (rootwin, _("Delete"), _("Are you sure you want to delete this history?"))) 27 | g_paste_client_delete_history (client, history, NULL, NULL); 28 | 29 | return TRUE; 30 | } 31 | 32 | static void 33 | g_paste_ui_delete_history_class_init (GPasteUiDeleteHistoryClass *klass) 34 | { 35 | G_PASTE_UI_HISTORY_ACTION_CLASS (klass)->activate = g_paste_ui_delete_history_activate; 36 | } 37 | 38 | static void 39 | g_paste_ui_delete_history_init (GPasteUiDeleteHistory *self G_GNUC_UNUSED) 40 | { 41 | } 42 | 43 | /** 44 | * g_paste_ui_delete_history_new: 45 | * @client: a #GPasteClient 46 | * @settings: a #GPasteSettings 47 | * @actions: the #GPasteUiHistoryActions 48 | * @rootwin: the root #GtkWindow 49 | * 50 | * Create a new instance of #GPasteUiDeleteHistory 51 | * 52 | * Returns: a newly allocated #GPasteUiDeleteHistory 53 | * free it with g_object_unref 54 | */ 55 | G_PASTE_VISIBLE GtkWidget * 56 | g_paste_ui_delete_history_new (GPasteClient *client, 57 | GPasteSettings *settings, 58 | GtkWidget *actions, 59 | GtkWindow *rootwin) 60 | { 61 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 62 | g_return_val_if_fail (_G_PASTE_IS_SETTINGS (settings), NULL); 63 | g_return_val_if_fail (_G_PASTE_IS_UI_HISTORY_ACTIONS (actions), NULL); 64 | g_return_val_if_fail (GTK_IS_WINDOW (rootwin), NULL); 65 | 66 | return g_paste_ui_history_action_new (G_PASTE_TYPE_UI_DELETE_HISTORY, client, settings, actions, rootwin, _("Delete")); 67 | } 68 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-delete-history.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_DELETE_HISTORY_H__ 12 | #define __G_PASTE_UI_DELETE_HISTORY_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_DELETE_HISTORY (g_paste_ui_delete_history_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiDeleteHistory, ui_delete_history, UI_DELETE_HISTORY, GPasteUiHistoryAction) 21 | 22 | GtkWidget *g_paste_ui_delete_history_new (GPasteClient *client, 23 | GPasteSettings *settings, 24 | GtkWidget *actions, 25 | GtkWindow *rootwin); 26 | 27 | G_END_DECLS 28 | 29 | #endif /*__G_PASTE_UI_DELETE_HISTORY_H__*/ 30 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-delete-item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteUiDeleteItem 10 | { 11 | GPasteUiItemAction parent_instance; 12 | }; 13 | 14 | G_PASTE_DEFINE_TYPE (UiDeleteItem, ui_delete_item, G_PASTE_TYPE_UI_ITEM_ACTION) 15 | 16 | static void 17 | g_paste_ui_delete_item_activate (GPasteUiItemAction *self G_GNUC_UNUSED, 18 | GPasteClient *client, 19 | const gchar *uuid) 20 | { 21 | g_paste_client_delete (client, uuid, NULL, NULL); 22 | } 23 | 24 | static void 25 | g_paste_ui_delete_item_class_init (GPasteUiDeleteItemClass *klass) 26 | { 27 | G_PASTE_UI_ITEM_ACTION_CLASS (klass)->activate = g_paste_ui_delete_item_activate; 28 | } 29 | 30 | static void 31 | g_paste_ui_delete_item_init (GPasteUiDeleteItem *self G_GNUC_UNUSED) 32 | { 33 | } 34 | 35 | /** 36 | * g_paste_ui_delete_item_new: 37 | * @client: a #GPasteClient 38 | * 39 | * Create a new instance of #GPasteUiDeleteItem 40 | * 41 | * Returns: a newly allocated #GPasteUiDeleteItem 42 | * free it with g_object_unref 43 | */ 44 | G_PASTE_VISIBLE GtkWidget * 45 | g_paste_ui_delete_item_new (GPasteClient *client) 46 | { 47 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 48 | 49 | return g_paste_ui_item_action_new (G_PASTE_TYPE_UI_DELETE_ITEM, client, "edit-delete-symbolic", _("Delete")); 50 | } 51 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-delete-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_DELETE_ITEM_H__ 12 | #define __G_PASTE_UI_DELETE_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_DELETE_ITEM (g_paste_ui_delete_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiDeleteItem, ui_delete_item, UI_DELETE_ITEM, GPasteUiItemAction) 21 | 22 | GtkWidget *g_paste_ui_delete_item_new (GPasteClient *client); 23 | 24 | G_END_DECLS 25 | 26 | #endif /*__G_PASTE_UI_DELETE_ITEM_H__*/ 27 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-edit-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_EDIT_ITEM_H__ 12 | #define __G_PASTE_UI_EDIT_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_EDIT_ITEM (g_paste_ui_edit_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiEditItem, ui_edit_item, UI_EDIT_ITEM, GPasteUiItemAction) 21 | 22 | GtkWidget *g_paste_ui_edit_item_new (GPasteClient *client, 23 | GtkWindow *rootwin); 24 | 25 | G_END_DECLS 26 | 27 | #endif /*__G_PASTE_UI_EDIT_ITEM_H__*/ 28 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-empty-history.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | struct _GPasteUiEmptyHistory 13 | { 14 | GPasteUiHistoryAction parent_instance; 15 | }; 16 | 17 | G_PASTE_DEFINE_TYPE (UiEmptyHistory, ui_empty_history, G_PASTE_TYPE_UI_HISTORY_ACTION) 18 | 19 | static gboolean 20 | g_paste_ui_empty_history_activate (GPasteUiHistoryAction *self G_GNUC_UNUSED, 21 | GPasteClient *client, 22 | GPasteSettings *settings, 23 | GtkWindow *rootwin, 24 | const gchar *history) 25 | { 26 | g_paste_gtk_util_empty_history (rootwin, client, settings, history); 27 | 28 | return TRUE; 29 | } 30 | 31 | static void 32 | g_paste_ui_empty_history_class_init (GPasteUiEmptyHistoryClass *klass) 33 | { 34 | G_PASTE_UI_HISTORY_ACTION_CLASS (klass)->activate = g_paste_ui_empty_history_activate; 35 | } 36 | 37 | static void 38 | g_paste_ui_empty_history_init (GPasteUiEmptyHistory *self G_GNUC_UNUSED) 39 | { 40 | } 41 | 42 | /** 43 | * g_paste_ui_empty_history_new: 44 | * @client: a #GPasteClient instance 45 | * @settings: a #GPasteSettings instance 46 | * @actions: the #GPasteUiHistoryActions 47 | * @rootwin: the main #GtkWindow 48 | * 49 | * Create a new instance of #GPasteUiEmptyHistory 50 | * 51 | * Returns: a newly allocated #GPasteUiEmptyHistory 52 | * free it with g_object_unref 53 | */ 54 | G_PASTE_VISIBLE GtkWidget * 55 | g_paste_ui_empty_history_new (GPasteClient *client, 56 | GPasteSettings *settings, 57 | GtkWidget *actions, 58 | GtkWindow *rootwin) 59 | { 60 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 61 | g_return_val_if_fail (_G_PASTE_IS_SETTINGS (settings), NULL); 62 | g_return_val_if_fail (_G_PASTE_IS_UI_HISTORY_ACTIONS (actions), NULL); 63 | g_return_val_if_fail (GTK_IS_WINDOW (rootwin), NULL); 64 | 65 | /* Translators: this is the translation for emptying the history */ 66 | return g_paste_ui_history_action_new (G_PASTE_TYPE_UI_EMPTY_HISTORY, client, settings, actions, rootwin, _("Empty")); 67 | } 68 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-empty-history.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_EMPTY_HISTORY_H__ 12 | #define __G_PASTE_UI_EMPTY_HISTORY_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_EMPTY_HISTORY (g_paste_ui_empty_history_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiEmptyHistory, ui_empty_history, UI_EMPTY_HISTORY, GPasteUiHistoryAction) 21 | 22 | GtkWidget *g_paste_ui_empty_history_new (GPasteClient *client, 23 | GPasteSettings *settings, 24 | GtkWidget *actions, 25 | GtkWindow *rootwin); 26 | 27 | G_END_DECLS 28 | 29 | #endif /*__G_PASTE_UI_EMPTY_HISTORY_H__*/ 30 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-empty-item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteUiEmptyItem 10 | { 11 | GPasteUiItemSkeleton parent_instance; 12 | }; 13 | 14 | G_PASTE_DEFINE_TYPE (UiEmptyItem, ui_empty_item, G_PASTE_TYPE_UI_ITEM_SKELETON) 15 | 16 | static void 17 | g_paste_ui_empty_item_show_text (GPasteUiEmptyItem *self, 18 | const gchar *text) 19 | { 20 | g_paste_ui_item_skeleton_set_text (G_PASTE_UI_ITEM_SKELETON (self), text); 21 | gtk_widget_show (GTK_WIDGET (self)); 22 | } 23 | 24 | /** 25 | * g_paste_ui_empty_show_no_result: 26 | * @self: a #GPasteUiEmptyItem instance 27 | * 28 | * Show a no result message 29 | */ 30 | G_PASTE_VISIBLE void 31 | g_paste_ui_empty_item_show_no_result (GPasteUiEmptyItem *self) 32 | { 33 | g_return_if_fail (G_PASTE_IS_UI_EMPTY_ITEM (self)); 34 | 35 | g_paste_ui_empty_item_show_text (self, _("(No result)")); 36 | } 37 | 38 | /** 39 | * g_paste_ui_empty_show_empty: 40 | * @self: a #GPasteUiEmptyItem instance 41 | * 42 | * Show an empty message 43 | */ 44 | G_PASTE_VISIBLE void 45 | g_paste_ui_empty_item_show_empty (GPasteUiEmptyItem *self) 46 | { 47 | g_return_if_fail (G_PASTE_IS_UI_EMPTY_ITEM (self)); 48 | 49 | g_paste_ui_empty_item_show_text (self, _("(Empty)")); 50 | } 51 | 52 | static void 53 | g_paste_ui_empty_item_class_init (GPasteUiEmptyItemClass *klass G_GNUC_UNUSED) 54 | { 55 | } 56 | 57 | static void 58 | g_paste_ui_empty_item_init (GPasteUiEmptyItem *self) 59 | { 60 | g_paste_ui_item_skeleton_set_text (G_PASTE_UI_ITEM_SKELETON (self), _("(Couldn't connect to GPaste daemon)")); 61 | } 62 | 63 | /** 64 | * g_paste_ui_empty_item_new: 65 | * @client: a #GPasteClient instance 66 | * @settings: a #GPasteSettings instance 67 | * @rootwin: the root #GtkWindow 68 | * 69 | * Create a new instance of #GPasteUiEmptyItem 70 | * 71 | * Returns: a newly allocated #GPasteUiEmptyItem 72 | * free it with g_object_unref 73 | */ 74 | G_PASTE_VISIBLE GtkWidget * 75 | g_paste_ui_empty_item_new (GPasteClient *client, 76 | GPasteSettings *settings, 77 | GtkWindow *rootwin) 78 | { 79 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 80 | g_return_val_if_fail (_G_PASTE_IS_SETTINGS (settings), NULL); 81 | g_return_val_if_fail (GTK_IS_WINDOW (rootwin), NULL); 82 | 83 | GtkWidget *self = g_paste_ui_item_skeleton_new (G_PASTE_TYPE_UI_EMPTY_ITEM, client, settings, rootwin); 84 | 85 | g_paste_ui_item_skeleton_set_activatable (G_PASTE_UI_ITEM_SKELETON (self), FALSE); 86 | 87 | return self; 88 | } 89 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-empty-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_EMPTY_ITEM_H__ 12 | #define __G_PASTE_UI_EMPTY_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_EMPTY_ITEM (g_paste_ui_empty_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiEmptyItem, ui_empty_item, UI_EMPTY_ITEM, GPasteUiItemSkeleton) 21 | 22 | void g_paste_ui_empty_item_show_no_result (GPasteUiEmptyItem *self); 23 | void g_paste_ui_empty_item_show_empty (GPasteUiEmptyItem *self); 24 | 25 | GtkWidget *g_paste_ui_empty_item_new (GPasteClient *client, 26 | GPasteSettings *settings, 27 | GtkWindow *rootwin); 28 | 29 | G_END_DECLS 30 | 31 | #endif /*__G_PASTE_UI_EMPTY_ITEM_H__*/ 32 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-header.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | struct _GPasteUiHeader 16 | { 17 | GtkHeaderBar parent_instance; 18 | }; 19 | 20 | typedef struct 21 | { 22 | GtkButton *settings; 23 | GtkButton *search; 24 | } GPasteUiHeaderPrivate; 25 | 26 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (UiHeader, ui_header, GTK_TYPE_HEADER_BAR) 27 | 28 | /** 29 | * g_paste_ui_header_show_prefs: 30 | * @self: the #GPasteUiHeader 31 | * 32 | * Show the prefs pane 33 | */ 34 | G_PASTE_VISIBLE void 35 | g_paste_ui_header_show_prefs (const GPasteUiHeader *self) 36 | { 37 | g_return_if_fail (_G_PASTE_IS_UI_HEADER (self)); 38 | 39 | const GPasteUiHeaderPrivate *priv = _g_paste_ui_header_get_instance_private (self); 40 | 41 | gtk_button_clicked (priv->settings); 42 | } 43 | 44 | /** 45 | * g_paste_ui_header_get_search_button: 46 | * @self: the #GPasteUiHeader 47 | * 48 | * Get the search button 49 | * 50 | * Returns: (transfer none): the #GPasteUISearch instance 51 | */ 52 | G_PASTE_VISIBLE GtkButton * 53 | g_paste_ui_header_get_search_button (const GPasteUiHeader *self) 54 | { 55 | g_return_val_if_fail (_G_PASTE_IS_UI_HEADER (self), NULL); 56 | 57 | const GPasteUiHeaderPrivate *priv = _g_paste_ui_header_get_instance_private (self); 58 | 59 | return priv->search; 60 | } 61 | 62 | static void 63 | g_paste_ui_header_class_init (GPasteUiHeaderClass *klass G_GNUC_UNUSED) 64 | { 65 | } 66 | 67 | static void 68 | g_paste_ui_header_init (GPasteUiHeader *self) 69 | { 70 | GPasteUiHeaderPrivate *priv = g_paste_ui_header_get_instance_private (self); 71 | GtkHeaderBar *header_bar = GTK_HEADER_BAR (self); 72 | GtkWidget *settings = g_paste_ui_settings_new (); 73 | GtkWidget *search = g_paste_ui_search_new (); 74 | 75 | priv->settings = GTK_BUTTON (settings); 76 | priv->search = GTK_BUTTON (search); 77 | 78 | gtk_header_bar_set_title(header_bar, PACKAGE_STRING); 79 | gtk_header_bar_set_show_close_button (header_bar, TRUE); 80 | gtk_header_bar_pack_end (header_bar, settings); 81 | gtk_header_bar_pack_end (header_bar, search); 82 | } 83 | 84 | /** 85 | * g_paste_ui_header_new: 86 | * @topwin: the main #GtkWindow 87 | * @client: a #GPasteClient instance 88 | * 89 | * Create a new instance of #GPasteUiHeader 90 | * 91 | * Returns: a newly allocated #GPasteUiHeader 92 | * free it with g_object_unref 93 | */ 94 | G_PASTE_VISIBLE GtkWidget * 95 | g_paste_ui_header_new (GtkWindow *topwin, 96 | GPasteClient *client) 97 | { 98 | g_return_val_if_fail (GTK_IS_WINDOW (topwin), NULL); 99 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 100 | 101 | GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_UI_HEADER, NULL); 102 | GtkHeaderBar *bar = GTK_HEADER_BAR (self); 103 | 104 | gtk_header_bar_pack_start (bar, g_paste_ui_switch_new (topwin, client)); 105 | gtk_header_bar_pack_start (bar, g_paste_ui_reexec_new (topwin, client)); 106 | 107 | gtk_header_bar_pack_end (bar, g_paste_ui_about_new (gtk_window_get_application (topwin))); 108 | gtk_header_bar_pack_end (bar, g_paste_ui_new_item_new (topwin, client)); 109 | 110 | return self; 111 | } 112 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_HEADER_H__ 12 | #define __G_PASTE_UI_HEADER_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_HEADER (g_paste_ui_header_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiHeader, ui_header, UI_HEADER, GtkHeaderBar) 23 | 24 | void g_paste_ui_header_show_prefs (const GPasteUiHeader *self); 25 | 26 | GtkButton *g_paste_ui_header_get_search_button (const GPasteUiHeader *self); 27 | 28 | GtkWidget *g_paste_ui_header_new (GtkWindow *topwin, 29 | GPasteClient *client); 30 | 31 | G_END_DECLS 32 | 33 | #endif /*__G_PASTE_UI_HEADER_H__*/ 34 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-history-action.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_HISTORY_ACTION_H__ 12 | #define __G_PASTE_UI_HISTORY_ACTION_H__ 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define G_PASTE_TYPE_UI_HISTORY_ACTION (g_paste_ui_history_action_get_type ()) 22 | 23 | G_PASTE_DERIVABLE_TYPE (UiHistoryAction, ui_history_action, UI_HISTORY_ACTION, GtkButton) 24 | 25 | struct _GPasteUiHistoryActionClass 26 | { 27 | GtkButtonClass parent_class; 28 | 29 | /*< pure virtual >*/ 30 | gboolean (*activate) (GPasteUiHistoryAction *self, 31 | GPasteClient *client, 32 | GPasteSettings *settings, 33 | GtkWindow *rootwin, 34 | const gchar *history); 35 | }; 36 | 37 | void g_paste_ui_history_action_set_history (GPasteUiHistoryAction *self, 38 | const gchar *history); 39 | 40 | GtkWidget *g_paste_ui_history_action_new (GType type, 41 | GPasteClient *client, 42 | GPasteSettings *settings, 43 | GtkWidget *actions, 44 | GtkWindow *rootwin, 45 | const gchar *label); 46 | 47 | G_END_DECLS 48 | 49 | #endif /*__G_PASTE_UI_HISTORY_ACTION_H__*/ 50 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-history-actions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_HISTORY_ACTIONS_H__ 12 | #define __G_PASTE_UI_HISTORY_ACTIONS_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_HISTORY_ACTIONS (g_paste_ui_history_actions_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiHistoryActions, ui_history_actions, UI_HISTORY_ACTIONS, GtkPopover) 23 | 24 | void g_paste_ui_history_actions_set_relative_to (GPasteUiHistoryActions *self, 25 | GPasteUiPanelHistory *history); 26 | 27 | GtkWidget *g_paste_ui_history_actions_new (GPasteClient *client, 28 | GPasteSettings *settings, 29 | GtkWindow *rootwin); 30 | 31 | G_END_DECLS 32 | 33 | #endif /*__G_PASTE_UI_HISTORY_ACTIONS_H__*/ 34 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-history.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_HISTORY_H__ 12 | #define __G_PASTE_UI_HISTORY_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_HISTORY (g_paste_ui_history_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiHistory, ui_history, UI_HISTORY, GtkListBox) 21 | 22 | void g_paste_ui_history_search (GPasteUiHistory *self, 23 | const gchar *search); 24 | 25 | gboolean g_paste_ui_history_select_first (GPasteUiHistory *self); 26 | 27 | GtkWidget *g_paste_ui_history_new (GPasteClient *client, 28 | GPasteSettings *settings, 29 | GPasteUiPanel *panel, 30 | GtkWindow *rootwin); 31 | 32 | G_END_DECLS 33 | 34 | #endif /*__G_PASTE_UI_HISTORY_H__*/ 35 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-item-action.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | typedef struct 10 | { 11 | GPasteClient *client; 12 | 13 | gchar *uuid; 14 | } GPasteUiItemActionPrivate; 15 | 16 | G_PASTE_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (UiItemAction, ui_item_action, GTK_TYPE_BUTTON) 17 | 18 | /** 19 | * g_paste_ui_item_action_set_uuid: 20 | * @self: a #GPasteUiItemAction instance 21 | * @uuid: the uuid of the corresponding item 22 | * 23 | * Track a new uuid 24 | */ 25 | G_PASTE_VISIBLE void 26 | g_paste_ui_item_action_set_uuid (GPasteUiItemAction *self, 27 | const gchar *uuid) 28 | { 29 | g_return_if_fail (_G_PASTE_IS_UI_ITEM_ACTION (self)); 30 | 31 | GPasteUiItemActionPrivate *priv = g_paste_ui_item_action_get_instance_private (self); 32 | g_autofree gchar *old_uuid = priv->uuid; 33 | 34 | priv->uuid = g_strdup (uuid); 35 | } 36 | 37 | static gboolean 38 | g_paste_ui_item_action_button_press_event (GtkWidget *widget, 39 | GdkEventButton *event G_GNUC_UNUSED) 40 | { 41 | GPasteUiItemAction *self = G_PASTE_UI_ITEM_ACTION (widget); 42 | const GPasteUiItemActionPrivate *priv = _g_paste_ui_item_action_get_instance_private (self); 43 | GPasteUiItemActionClass *klass = G_PASTE_UI_ITEM_ACTION_GET_CLASS (self); 44 | 45 | if (klass->activate) 46 | klass->activate (self, priv->client, priv->uuid); 47 | 48 | return TRUE; 49 | } 50 | 51 | static void 52 | g_paste_ui_item_action_dispose (GObject *object) 53 | { 54 | GPasteUiItemActionPrivate *priv = g_paste_ui_item_action_get_instance_private (G_PASTE_UI_ITEM_ACTION (object)); 55 | 56 | g_clear_object (&priv->client); 57 | g_clear_pointer (&priv->uuid, g_free); 58 | 59 | G_OBJECT_CLASS (g_paste_ui_item_action_parent_class)->dispose (object); 60 | } 61 | 62 | static void 63 | g_paste_ui_item_action_class_init (GPasteUiItemActionClass *klass) 64 | { 65 | G_OBJECT_CLASS (klass)->dispose = g_paste_ui_item_action_dispose; 66 | GTK_WIDGET_CLASS (klass)->button_press_event = g_paste_ui_item_action_button_press_event; 67 | } 68 | 69 | static void 70 | g_paste_ui_item_action_init (GPasteUiItemAction *self G_GNUC_UNUSED) 71 | { 72 | } 73 | 74 | /** 75 | * g_paste_ui_item_action_new: 76 | * @type: the type of the subclass to instantiate 77 | * @client: a #GPasteClient 78 | * @icon_name: the name of the icon to use 79 | * @tooltip: the tooltip to display 80 | * 81 | * Create a new instance of #GPasteUiItemAction 82 | * 83 | * Returns: a newly allocated #GPasteUiItemAction 84 | * free it with g_object_unref 85 | */ 86 | G_PASTE_VISIBLE GtkWidget * 87 | g_paste_ui_item_action_new (GType type, 88 | GPasteClient *client, 89 | const gchar *icon_name, 90 | const gchar *tooltip) 91 | { 92 | g_return_val_if_fail (g_type_is_a (type, G_PASTE_TYPE_UI_ITEM_ACTION), NULL); 93 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 94 | 95 | GtkWidget *self = gtk_widget_new (type, NULL); 96 | GPasteUiItemActionPrivate *priv = g_paste_ui_item_action_get_instance_private (G_PASTE_UI_ITEM_ACTION (self)); 97 | GtkWidget *icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); 98 | 99 | priv->client = g_object_ref (client); 100 | 101 | gtk_widget_set_tooltip_text (self, tooltip); 102 | gtk_widget_set_margin_start (icon, 5); 103 | gtk_widget_set_margin_end (icon, 5); 104 | 105 | gtk_container_add (GTK_CONTAINER (self), icon); 106 | 107 | return self; 108 | } 109 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-item-action.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_ITEM_ACTION_H__ 12 | #define __G_PASTE_UI_ITEM_ACTION_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_ITEM_ACTION (g_paste_ui_item_action_get_type ()) 21 | 22 | G_PASTE_DERIVABLE_TYPE (UiItemAction, ui_item_action, UI_ITEM_ACTION, GtkButton) 23 | 24 | struct _GPasteUiItemActionClass 25 | { 26 | GtkButtonClass parent_class; 27 | 28 | /*< pure virtual >*/ 29 | void (*activate) (GPasteUiItemAction *self, 30 | GPasteClient *client, 31 | const gchar *uuid); 32 | }; 33 | 34 | void g_paste_ui_item_action_set_uuid (GPasteUiItemAction *self, 35 | const gchar *uuid); 36 | 37 | GtkWidget *g_paste_ui_item_action_new (GType type, 38 | GPasteClient *client, 39 | const gchar *icon_name, 40 | const gchar *tooltip); 41 | 42 | G_END_DECLS 43 | 44 | #endif /*__G_PASTE_UI_ITEM_ACTION_H__*/ 45 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-item-skeleton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_ITEM_SKELETON_H__ 12 | #define __G_PASTE_UI_ITEM_SKELETON_H__ 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define G_PASTE_TYPE_UI_ITEM_SKELETON (g_paste_ui_item_skeleton_get_type ()) 22 | 23 | G_PASTE_DERIVABLE_TYPE (UiItemSkeleton, ui_item_skeleton, UI_ITEM_SKELETON, GtkListBoxRow) 24 | 25 | struct _GPasteUiItemSkeletonClass 26 | { 27 | GtkListBoxRowClass parent_class; 28 | }; 29 | 30 | void g_paste_ui_item_skeleton_set_activatable (GPasteUiItemSkeleton *self, 31 | gboolean activatable); 32 | void g_paste_ui_item_skeleton_set_editable (GPasteUiItemSkeleton *self, 33 | gboolean editable); 34 | void g_paste_ui_item_skeleton_set_uploadable (GPasteUiItemSkeleton *self, 35 | gboolean uploadable); 36 | 37 | void g_paste_ui_item_skeleton_set_text (GPasteUiItemSkeleton *self, 38 | const gchar *text); 39 | void g_paste_ui_item_skeleton_set_markup (GPasteUiItemSkeleton *self, 40 | const gchar *markup); 41 | 42 | void g_paste_ui_item_skeleton_set_index_and_uuid (GPasteUiItemSkeleton *self, 43 | guint64 index, 44 | const gchar *uuid); 45 | 46 | GtkLabel *g_paste_ui_item_skeleton_get_label (GPasteUiItemSkeleton *self); 47 | 48 | GtkWidget *g_paste_ui_item_skeleton_new (GType type, 49 | GPasteClient *client, 50 | GPasteSettings *settings, 51 | GtkWindow *rootwin); 52 | 53 | G_END_DECLS 54 | 55 | #endif /*__G_PASTE_UI_ITEM_SKELETON_H__*/ 56 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_ITEM_H__ 12 | #define __G_PASTE_UI_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_ITEM (g_paste_ui_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiItem, ui_item, UI_ITEM, GPasteUiItemSkeleton) 21 | 22 | gboolean g_paste_ui_item_activate (GPasteUiItem *self); 23 | void g_paste_ui_item_refresh (GPasteUiItem *self); 24 | 25 | void g_paste_ui_item_set_index (GPasteUiItem *self, 26 | guint64 index); 27 | 28 | void g_paste_ui_item_set_uuid (GPasteUiItem *self, 29 | const gchar *uuid); 30 | 31 | GtkWidget *g_paste_ui_item_new (GPasteClient *client, 32 | GPasteSettings *settings, 33 | GtkWindow *rootwin, 34 | guint64 index); 35 | 36 | G_END_DECLS 37 | 38 | #endif /*__G_PASTE_UI_ITEM_H__*/ 39 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-new-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_NEW_ITEM_H__ 12 | #define __G_PASTE_UI_NEW_ITEM_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_NEW_ITEM (g_paste_ui_new_item_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiNewItem, ui_new_item, UI_NEW_ITEM, GtkButton) 23 | 24 | GtkWidget *g_paste_ui_new_item_new (GtkWindow *rootwin, 25 | GPasteClient *client); 26 | 27 | G_END_DECLS 28 | 29 | #endif /*__G_PASTE_UI_NEW_ITEM_H__*/ 30 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-panel-history.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_PANEL_HISTORY_H__ 12 | #define __G_PASTE_UI_PANEL_HISTORY_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_PANEL_HISTORY (g_paste_ui_panel_history_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiPanelHistory, ui_panel_history, UI_PANEL_HISTORY, GtkListBoxRow) 23 | 24 | void g_paste_ui_panel_history_activate (GPasteUiPanelHistory *self); 25 | void g_paste_ui_panel_history_set_length (GPasteUiPanelHistory *self, 26 | guint64 length); 27 | 28 | const gchar *g_paste_ui_panel_history_get_history (const GPasteUiPanelHistory *self); 29 | 30 | GtkWidget *g_paste_ui_panel_history_new (GPasteClient *client, 31 | const gchar *history); 32 | 33 | G_END_DECLS 34 | 35 | #endif /*__G_PASTE_UI_PANEL_HISTORY_H__*/ 36 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-panel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_PANEL_H__ 12 | #define __G_PASTE_UI_PANEL_H__ 13 | 14 | #include 15 | #include 16 | 17 | G_BEGIN_DECLS 18 | 19 | #define G_PASTE_TYPE_UI_PANEL (g_paste_ui_panel_get_type ()) 20 | 21 | G_PASTE_FINAL_TYPE (UiPanel, ui_panel, UI_PANEL, GtkBox) 22 | 23 | void g_paste_ui_panel_update_history_length (GPasteUiPanel *self, 24 | const gchar *history, 25 | guint64 length); 26 | 27 | GtkWidget *g_paste_ui_panel_new (GPasteClient *client, 28 | GPasteSettings *settings, 29 | GtkWindow *rootwin, 30 | GtkSearchEntry *search_entry); 31 | 32 | G_END_DECLS 33 | 34 | #endif /*__G_PASTE_UI_PANEL_H__*/ 35 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-reexec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteUiReexec 12 | { 13 | GtkButton parent_instance; 14 | }; 15 | 16 | typedef struct 17 | { 18 | GPasteClient *client; 19 | 20 | GtkWindow *topwin; 21 | } GPasteUiReexecPrivate; 22 | 23 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (UiReexec, ui_reexec, GTK_TYPE_BUTTON) 24 | 25 | static void 26 | g_paste_ui_reexec_clicked (GtkButton *button) 27 | { 28 | const GPasteUiReexecPrivate *priv = _g_paste_ui_reexec_get_instance_private (G_PASTE_UI_REEXEC (button)); 29 | 30 | if (g_paste_gtk_util_confirm_dialog (priv->topwin, _("Restart"), _("Do you really want to restart the daemon?"))) 31 | g_paste_client_reexecute (priv->client, NULL, NULL); 32 | } 33 | 34 | static void 35 | g_paste_ui_reexec_dispose (GObject *object) 36 | { 37 | GPasteUiReexecPrivate *priv = g_paste_ui_reexec_get_instance_private (G_PASTE_UI_REEXEC (object)); 38 | 39 | g_clear_object (&priv->client); 40 | 41 | G_OBJECT_CLASS (g_paste_ui_reexec_parent_class)->dispose (object); 42 | } 43 | 44 | static void 45 | g_paste_ui_reexec_class_init (GPasteUiReexecClass *klass) 46 | { 47 | G_OBJECT_CLASS (klass)->dispose = g_paste_ui_reexec_dispose; 48 | GTK_BUTTON_CLASS (klass)->clicked = g_paste_ui_reexec_clicked; 49 | } 50 | 51 | static void 52 | g_paste_ui_reexec_init (GPasteUiReexec *self) 53 | { 54 | GtkWidget *widget = GTK_WIDGET (self); 55 | 56 | gtk_widget_set_tooltip_text (widget, _("Restart the daemon")); 57 | gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); 58 | gtk_container_add (GTK_CONTAINER (self), gtk_image_new_from_icon_name ("view-refresh-symbolic", GTK_ICON_SIZE_BUTTON)); 59 | } 60 | 61 | /** 62 | * g_paste_ui_reexec_new: 63 | * @topwin: the main #GtkWindow 64 | * @client: a #GPasteClient instance 65 | * 66 | * Create a new instance of #GPasteUiReexec 67 | * 68 | * Returns: a newly allocated #GPasteUiReexec 69 | * free it with g_object_unref 70 | */ 71 | G_PASTE_VISIBLE GtkWidget * 72 | g_paste_ui_reexec_new (GtkWindow *topwin, 73 | GPasteClient *client) 74 | { 75 | g_return_val_if_fail (GTK_IS_WINDOW (topwin), NULL); 76 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 77 | 78 | GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_UI_REEXEC,NULL); 79 | GPasteUiReexecPrivate *priv = g_paste_ui_reexec_get_instance_private (G_PASTE_UI_REEXEC (self)); 80 | 81 | priv->topwin = topwin; 82 | priv->client = g_object_ref (client); 83 | 84 | return self; 85 | } 86 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-reexec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_REEXEC_H__ 12 | #define __G_PASTE_UI_REEXEC_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_REEXEC (g_paste_ui_reexec_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiReexec, ui_reexec, UI_REEXEC, GtkButton) 23 | 24 | GtkWidget *g_paste_ui_reexec_new (GtkWindow *topwin, 25 | GPasteClient *client); 26 | 27 | G_END_DECLS 28 | 29 | #endif /*__G_PASTE_UI_REEXEC_H__*/ 30 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-search-bar.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteUiSearchBar 10 | { 11 | GtkSearchBar parent_instance; 12 | }; 13 | 14 | typedef struct 15 | { 16 | GtkSearchEntry *entry; 17 | } GPasteUiSearchBarPrivate; 18 | 19 | G_PASTE_DEFINE_TYPE_WITH_PRIVATE (UiSearchBar, ui_search_bar, GTK_TYPE_SEARCH_BAR) 20 | 21 | /** 22 | * g_paste_ui_search_bar_get_entry: 23 | * 24 | * Get the #GtkSearchEntry 25 | * 26 | * Returns: (transfer none): the #GtkSearchEntry 27 | */ 28 | G_PASTE_VISIBLE GtkSearchEntry * 29 | g_paste_ui_search_bar_get_entry (const GPasteUiSearchBar *self) 30 | { 31 | g_return_val_if_fail (_G_PASTE_IS_UI_SEARCH_BAR (self), NULL); 32 | const GPasteUiSearchBarPrivate *priv = _g_paste_ui_search_bar_get_instance_private (self); 33 | 34 | return priv->entry; 35 | } 36 | 37 | static void 38 | g_paste_ui_search_bar_class_init (GPasteUiSearchBarClass *klass G_GNUC_UNUSED) 39 | { 40 | } 41 | 42 | static void 43 | g_paste_ui_search_bar_init (GPasteUiSearchBar *self) 44 | { 45 | GPasteUiSearchBarPrivate *priv = g_paste_ui_search_bar_get_instance_private (self); 46 | GtkWidget *entry = gtk_search_entry_new (); 47 | 48 | priv->entry = GTK_SEARCH_ENTRY (entry); 49 | 50 | gtk_container_add (GTK_CONTAINER (self), entry); 51 | } 52 | 53 | /** 54 | * g_paste_ui_search_bar_new: 55 | * 56 | * Create a new instance of #GPasteUiSearchBar 57 | * 58 | * Returns: a newly allocated #GPasteUiSearchBar 59 | * free it with g_object_unref 60 | */ 61 | G_PASTE_VISIBLE GtkWidget * 62 | g_paste_ui_search_bar_new (void) 63 | { 64 | return gtk_widget_new (G_PASTE_TYPE_UI_SEARCH_BAR, 65 | NULL); 66 | } 67 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-search-bar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_SEARCH_BAR_H__ 12 | #define __G_PASTE_UI_SEARCH_BAR_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_SEARCH_BAR (g_paste_ui_search_bar_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiSearchBar, ui_search_bar, UI_SEARCH_BAR, GtkSearchBar) 23 | 24 | GtkSearchEntry *g_paste_ui_search_bar_get_entry (const GPasteUiSearchBar *self); 25 | 26 | GtkWidget *g_paste_ui_search_bar_new (void); 27 | 28 | G_END_DECLS 29 | 30 | #endif /*__G_PASTE_UI_SEARCH_H__*/ 31 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-search.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteUiSearch 10 | { 11 | GtkToggleButton parent_instance; 12 | }; 13 | 14 | G_PASTE_DEFINE_TYPE (UiSearch, ui_search, GTK_TYPE_TOGGLE_BUTTON) 15 | 16 | static void 17 | g_paste_ui_search_class_init (GPasteUiSearchClass *klass G_GNUC_UNUSED) 18 | { 19 | } 20 | 21 | static void 22 | g_paste_ui_search_init (GPasteUiSearch *self) 23 | { 24 | GtkWidget *widget = GTK_WIDGET (self); 25 | 26 | gtk_widget_set_tooltip_text (widget, _("Search")); 27 | gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); 28 | gtk_container_add (GTK_CONTAINER (self), gtk_image_new_from_icon_name ("edit-find-symbolic", GTK_ICON_SIZE_BUTTON)); 29 | } 30 | 31 | /** 32 | * g_paste_ui_search_new: 33 | * 34 | * Create a new instance of #GPasteUiSearch 35 | * 36 | * Returns: a newly allocated #GPasteUiSearch 37 | * free it with g_object_unref 38 | */ 39 | G_PASTE_VISIBLE GtkWidget * 40 | g_paste_ui_search_new (void) 41 | { 42 | return gtk_widget_new (G_PASTE_TYPE_UI_SEARCH, NULL); 43 | } 44 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-search.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_SEARCH_H__ 12 | #define __G_PASTE_UI_SEARCH_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_SEARCH (g_paste_ui_search_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiSearch, ui_search, UI_SEARCH, GtkToggleButton) 23 | 24 | GtkWidget *g_paste_ui_search_new (void); 25 | 26 | G_END_DECLS 27 | 28 | #endif /*__G_PASTE_UI_SEARCH_H__*/ 29 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-settings.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | struct _GPasteUiSettings 12 | { 13 | GtkMenuButton parent_instance; 14 | }; 15 | 16 | G_PASTE_DEFINE_TYPE (UiSettings, ui_settings, GTK_TYPE_MENU_BUTTON) 17 | 18 | static void 19 | g_paste_ui_settings_class_init (GPasteUiSettingsClass *klass G_GNUC_UNUSED) 20 | { 21 | } 22 | 23 | static void 24 | g_paste_ui_settings_init (GPasteUiSettings *self) 25 | { 26 | GtkWidget *widget = GTK_WIDGET (self); 27 | GtkMenuButton *menu = GTK_MENU_BUTTON (self); 28 | GtkWidget *popover = gtk_popover_new (GTK_WIDGET (self)); 29 | GtkWidget *settings_widget = g_paste_gtk_settings_ui_widget_new (); 30 | 31 | gtk_widget_set_tooltip_text (widget, _("GPaste Settings")); 32 | gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); 33 | 34 | gtk_widget_set_margin_top (settings_widget, 10); 35 | 36 | gtk_menu_button_set_direction (menu, GTK_ARROW_NONE); 37 | gtk_menu_button_set_use_popover (menu, TRUE); 38 | gtk_menu_button_set_popover (menu, popover); 39 | 40 | gtk_container_add (GTK_CONTAINER (popover), settings_widget); 41 | gtk_widget_show_all (settings_widget); 42 | } 43 | 44 | /** 45 | * g_paste_ui_settings_new: 46 | * 47 | * Create a new instance of #GPasteUiSettings 48 | * 49 | * Returns: a newly allocated #GPasteUiSettings 50 | * free it with g_object_unref 51 | */ 52 | G_PASTE_VISIBLE GtkWidget * 53 | g_paste_ui_settings_new (void) 54 | { 55 | return gtk_widget_new (G_PASTE_TYPE_UI_SETTINGS, NULL); 56 | } 57 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_SETTINGS_H__ 12 | #define __G_PASTE_UI_SETTINGS_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_SETTINGS (g_paste_ui_settings_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiSettings, ui_settings, UI_SETTINGS, GtkMenuButton) 21 | 22 | GtkWidget *g_paste_ui_settings_new (void); 23 | 24 | G_END_DECLS 25 | 26 | #endif /*__G_PASTE_UI_SETTINGS_H__*/ 27 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-shortcuts-window.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteUiShortcutsWindow 10 | { 11 | GtkShortcutsWindow parent_instance; 12 | }; 13 | 14 | G_PASTE_DEFINE_TYPE (UiShortcutsWindow, ui_shortcuts_window, GTK_TYPE_SHORTCUTS_WINDOW) 15 | 16 | static void 17 | g_paste_ui_shortcuts_window_class_init (GPasteUiShortcutsWindowClass *klass G_GNUC_UNUSED) 18 | { 19 | } 20 | 21 | static void 22 | g_paste_ui_shortcuts_window_init (GPasteUiShortcutsWindow *self G_GNUC_UNUSED) 23 | { 24 | } 25 | 26 | static inline void 27 | add_shortcut (GtkContainer *group, 28 | const gchar *title, 29 | const gchar *accelerator) 30 | { 31 | gtk_container_add (group, gtk_widget_new (GTK_TYPE_SHORTCUTS_SHORTCUT, 32 | "visible", TRUE, 33 | "title", title, 34 | "accelerator", accelerator, 35 | NULL)); 36 | } 37 | 38 | /** 39 | * g_paste_ui_shortcuts_window_new: 40 | * @settings: a #GPasteSettings instance 41 | * 42 | * Create a new instance of #GPasteUiShortcutsWindow 43 | * 44 | * Returns: a newly allocated #GPasteUiShortcutsWindow 45 | * free it with g_object_unref 46 | */ 47 | G_PASTE_VISIBLE GtkWidget * 48 | g_paste_ui_shortcuts_window_new (const GPasteSettings *settings) 49 | { 50 | g_return_val_if_fail (_G_PASTE_IS_SETTINGS (settings), NULL); 51 | 52 | GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_UI_SHORTCUTS_WINDOW, 53 | "type", GTK_WINDOW_TOPLEVEL, 54 | "window-position", GTK_WIN_POS_CENTER_ALWAYS, 55 | "modal", TRUE, 56 | "resizable", FALSE, 57 | NULL); 58 | GtkWidget *section = gtk_widget_new (GTK_TYPE_SHORTCUTS_SECTION, 59 | "section-name", "shortcuts", 60 | "visible", TRUE, 61 | "max-height", 10, 62 | NULL); 63 | GtkWidget *general_group = gtk_widget_new (GTK_TYPE_SHORTCUTS_GROUP, 64 | "title", _("General"), 65 | "visible", TRUE, 66 | NULL); 67 | GtkContainer *ggroup = GTK_CONTAINER (general_group); 68 | 69 | gtk_container_add (GTK_CONTAINER (self), section); 70 | gtk_container_add (GTK_CONTAINER (section), general_group); 71 | 72 | add_shortcut (ggroup, _("Delete the active item from history"), g_paste_settings_get_pop (settings)); 73 | add_shortcut (ggroup, _("Launch the graphical tool"), g_paste_settings_get_launch_ui (settings)); 74 | add_shortcut (ggroup, _("Mark the active item as being a password"), g_paste_settings_get_make_password (settings)); 75 | add_shortcut (ggroup, _("Display the history"), g_paste_settings_get_show_history (settings)); 76 | add_shortcut (ggroup, _("Sync the clipboard to the primary selection"), g_paste_settings_get_sync_clipboard_to_primary (settings)); 77 | add_shortcut (ggroup, _("Sync the primary selection to the clipboard"), g_paste_settings_get_sync_primary_to_clipboard (settings)); 78 | add_shortcut (ggroup, _("Upload the active item to a pastebin service"), g_paste_settings_get_upload (settings)); 79 | 80 | return self; 81 | } 82 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-shortcuts-window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_SHORTCUTS_WINDOW_H__ 12 | #define __G_PASTE_UI_SHORTCUTS_WINDOW_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_SHORTCUTS_WINDOW (g_paste_ui_shortcuts_window_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiShortcutsWindow, ui_shortcuts_window, UI_SHORTCUTS_WINDOW, GtkShortcutsWindow) 23 | 24 | GtkWidget *g_paste_ui_shortcuts_window_new (const GPasteSettings *settings); 25 | 26 | G_END_DECLS 27 | 28 | #endif /*__G_PASTE_UI_SHORTCUTS_WINDOW_H__*/ 29 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-switch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_SWITCH_H__ 12 | #define __G_PASTE_UI_SWITCH_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_SWITCH (g_paste_ui_switch_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiSwitch, ui_switch, UI_SWITCH, GtkSwitch) 23 | 24 | GtkWidget *g_paste_ui_switch_new (GtkWindow *topwin, 25 | GPasteClient *client); 26 | 27 | G_END_DECLS 28 | 29 | #endif /*__G_PASTE_UI_SWITCH_H__*/ 30 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-upload-item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #include 8 | 9 | struct _GPasteUiUploadItem 10 | { 11 | GPasteUiItemAction parent_instance; 12 | }; 13 | 14 | G_PASTE_DEFINE_TYPE (UiUploadItem, ui_upload_item, G_PASTE_TYPE_UI_ITEM_ACTION) 15 | 16 | static void 17 | g_paste_ui_upload_item_activate (GPasteUiItemAction *self G_GNUC_UNUSED, 18 | GPasteClient *client, 19 | const gchar *uuid) 20 | { 21 | g_paste_client_upload (client, uuid, NULL, NULL); 22 | } 23 | 24 | static void 25 | g_paste_ui_upload_item_class_init (GPasteUiUploadItemClass *klass) 26 | { 27 | G_PASTE_UI_ITEM_ACTION_CLASS (klass)->activate = g_paste_ui_upload_item_activate; 28 | } 29 | 30 | static void 31 | g_paste_ui_upload_item_init (GPasteUiUploadItem *self G_GNUC_UNUSED) 32 | { 33 | } 34 | 35 | /** 36 | * g_paste_ui_upload_item_new: 37 | * @client: a #GPasteClient 38 | * 39 | * Create a new instance of #GPasteUiUploadItem 40 | * 41 | * Returns: a newly allocated #GPasteUiUploadItem 42 | * free it with g_object_unref 43 | */ 44 | G_PASTE_VISIBLE GtkWidget * 45 | g_paste_ui_upload_item_new (GPasteClient *client) 46 | { 47 | g_return_val_if_fail (_G_PASTE_IS_CLIENT (client), NULL); 48 | 49 | return g_paste_ui_item_action_new (G_PASTE_TYPE_UI_UPLOAD_ITEM, client, "document-send-symbolic", _("Upload")); 50 | } 51 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-upload-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_UPLOAD_ITEM_H__ 12 | #define __G_PASTE_UI_UPLOAD_ITEM_H__ 13 | 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define G_PASTE_TYPE_UI_UPLOAD_ITEM (g_paste_ui_upload_item_get_type ()) 19 | 20 | G_PASTE_FINAL_TYPE (UiUploadItem, ui_upload_item, UI_UPLOAD_ITEM, GPasteUiItemAction) 21 | 22 | GtkWidget *g_paste_ui_upload_item_new (GPasteClient *client); 23 | 24 | G_END_DECLS 25 | 26 | #endif /*__G_PASTE_UI_UPLOAD_ITEM_H__*/ 27 | -------------------------------------------------------------------------------- /src/ui/gpaste-ui-window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GPaste. 3 | * 4 | * Copyright (c) 2010-2018, Marc-Antoine Perennou 5 | */ 6 | 7 | #if !defined (__G_PASTE_H_INSIDE__) && !defined (G_PASTE_COMPILATION) 8 | #error "Only can be included directly." 9 | #endif 10 | 11 | #ifndef __G_PASTE_UI_WINDOW_H__ 12 | #define __G_PASTE_UI_WINDOW_H__ 13 | 14 | #include 15 | 16 | #include 17 | 18 | G_BEGIN_DECLS 19 | 20 | #define G_PASTE_TYPE_UI_WINDOW (g_paste_ui_window_get_type ()) 21 | 22 | G_PASTE_FINAL_TYPE (UiWindow, ui_window, UI_WINDOW, GtkApplicationWindow) 23 | 24 | void g_paste_ui_window_empty_history (GPasteUiWindow *self, 25 | const gchar *history); 26 | void g_paste_ui_window_search (GPasteUiWindow *self, 27 | const gchar *search); 28 | void g_paste_ui_window_show_prefs (GPasteUiWindow *self); 29 | 30 | GtkWidget *g_paste_ui_window_new (GtkApplication *app); 31 | 32 | G_END_DECLS 33 | 34 | #endif /*__G_PASTE_UI_WINDOW_H__*/ 35 | -------------------------------------------------------------------------------- /src/ui/meson.build: -------------------------------------------------------------------------------- 1 | gpaste_ui_sources = [ 2 | 'gpaste-ui-about.c', 3 | 'gpaste-ui-backup-history.c', 4 | 'gpaste-ui-delete-history.c', 5 | 'gpaste-ui-delete-item.c', 6 | 'gpaste-ui-edit-item.c', 7 | 'gpaste-ui-empty-history.c', 8 | 'gpaste-ui-empty-item.c', 9 | 'gpaste-ui-header.c', 10 | 'gpaste-ui-history-action.c', 11 | 'gpaste-ui-history-actions.c', 12 | 'gpaste-ui-history.c', 13 | 'gpaste-ui-item-action.c', 14 | 'gpaste-ui-item-skeleton.c', 15 | 'gpaste-ui-item.c', 16 | 'gpaste-ui-new-item.c', 17 | 'gpaste-ui-panel-history.c', 18 | 'gpaste-ui-panel.c', 19 | 'gpaste-ui-reexec.c', 20 | 'gpaste-ui-search-bar.c', 21 | 'gpaste-ui-search.c', 22 | 'gpaste-ui-settings.c', 23 | 'gpaste-ui-shortcuts-window.c', 24 | 'gpaste-ui-switch.c', 25 | 'gpaste-ui-upload-item.c', 26 | 'gpaste-ui-window.c', 27 | 'gpaste-ui.c', 28 | ] 29 | 30 | gpaste_ui_headers = [ 31 | 'gpaste-ui-about.h', 32 | 'gpaste-ui-backup-history.h', 33 | 'gpaste-ui-delete-history.h', 34 | 'gpaste-ui-delete-item.h', 35 | 'gpaste-ui-edit-item.h', 36 | 'gpaste-ui-empty-history.h', 37 | 'gpaste-ui-empty-item.h', 38 | 'gpaste-ui-header.h', 39 | 'gpaste-ui-history-action.h', 40 | 'gpaste-ui-history-actions.h', 41 | 'gpaste-ui-history.h', 42 | 'gpaste-ui-item-action.h', 43 | 'gpaste-ui-item-skeleton.h', 44 | 'gpaste-ui-item.h', 45 | 'gpaste-ui-new-item.h', 46 | 'gpaste-ui-panel-history.h', 47 | 'gpaste-ui-panel.h', 48 | 'gpaste-ui-reexec.h', 49 | 'gpaste-ui-search-bar.h', 50 | 'gpaste-ui-search.h', 51 | 'gpaste-ui-settings.h', 52 | 'gpaste-ui-shortcuts-window.h', 53 | 'gpaste-ui-switch.h', 54 | 'gpaste-ui-upload-item.h', 55 | 'gpaste-ui-window.h', 56 | ] 57 | 58 | gpaste_ui_headers_dep = declare_dependency( 59 | include_directories: include_directories('../libgpaste'), 60 | sources: gpaste_ui_headers, 61 | ) 62 | 63 | executable( 64 | 'gpaste-ui', 65 | sources: gpaste_ui_sources, 66 | install: true, 67 | dependencies: [ glib_dep, gtk3_dep, libgpaste_internal_dep, libgpaste_gtk3_internal_dep, gpaste_ui_headers_dep ], 68 | install_dir: join_paths(get_option('libexecdir'), 'gpaste'), 69 | ) 70 | -------------------------------------------------------------------------------- /tests/gnome-shell-client/meson.build: -------------------------------------------------------------------------------- 1 | # We're overlinking with libgpaste here, but we need one of it's includes 2 | # and since this isn't installed anyway it doesn't matter and is easier for us. 3 | gnome_shell_client_test_exe = executable( 4 | 'gpaste-gnome-shell-client-test', 5 | sources: 'test-gnome-shell-client.c', 6 | dependencies: [ glib_dep, gobject_dep, libgpaste_internal_dep ], 7 | ) 8 | 9 | test('test-gnome-shell-client', gnome_shell_client_test_exe) 10 | -------------------------------------------------------------------------------- /tests/meson.build: -------------------------------------------------------------------------------- 1 | subdir('gnome-shell-client') -------------------------------------------------------------------------------- /tools/check-includes.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | typeset -A includes 4 | 5 | get_file_name() { 6 | local file="${1}" 7 | 8 | if [[ "${file}" == *.h ]]; then 9 | echo "$(basename ${file})" 10 | else 11 | echo "${file}" 12 | fi 13 | } 14 | 15 | parse_includes() { 16 | local file name 17 | 18 | for file in **/*.[ch]; do 19 | name=$(get_file_name "${file}") 20 | 21 | includes[${name}]="$(grep '#include' "${file}" | awk '{print $NF}' | sed -e 's///' -e 's/"//g')" 22 | done 23 | } 24 | 25 | get_includes() { 26 | local file="${1}" 27 | local name 28 | 29 | name=$(get_file_name "${file}") 30 | 31 | echo ${includes[${name}]} 32 | } 33 | 34 | has_include() { 35 | local file="${1}" 36 | local include="${2}" 37 | local output="${3}" 38 | local i 39 | 40 | for i in $(get_includes "${file}"); do 41 | [[ "${i}" == "${include}" ]] && echo "${include}: ${output} => ${include}" && return 0 42 | has_include "${i}" "${include}" "${output} => ${i}" && return 0 43 | done 44 | 45 | return 1 46 | } 47 | 48 | check_include() { 49 | local file="${1}" 50 | local include="${2}" 51 | local i 52 | 53 | for i in $(get_includes "${file}"); do 54 | [[ "${include}" == "${i}" ]] && continue 55 | has_include "${i}" "${include}" "${file} => ${i}" 56 | done 57 | } 58 | 59 | check_includes() { 60 | local file i 61 | 62 | for file in **/*.[ch]; do 63 | [[ "${file}" == "src/libgpaste/gpaste.h" ]] && continue 64 | [[ "${file}" == "src/libgpaste/gpaste-gtk3.h" ]] && continue 65 | [[ "${file}" == "src/libgpaste/gpaste-gtk4.h" ]] && continue 66 | for i in $(get_includes "${file}"); do 67 | check_include "${file}" "${i}" 68 | done 69 | done 70 | } 71 | 72 | main() { 73 | pushd "$(dirname "${1}")/.." &>/dev/null 74 | parse_includes 75 | check_includes 76 | popd &>/dev/null 77 | } 78 | 79 | main "${0}" 80 | --------------------------------------------------------------------------------