Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • apps/xfce4-screenshooter
  • andreldm/xfce4-screenshooter
  • bobby285271/xfce4-screenshooter
  • samuelsmash/xfce4-screenshooter
  • triallax/xfce4-screenshooter
  • mbarriolinares/xfce4-screenshooter
  • Monsterovich/xfce4-screenshooter
7 results
Show changes
Commits on Source (890)
Showing
with 2825 additions and 1677 deletions
# Autotools files generated into srcdir # Autotools files generated into srcdir
/ABOUT-NLS
/INSTALL /INSTALL
*.tar.bz2 *.tar.bz2
*.tar.gz *.tar.gz
...@@ -9,14 +10,23 @@ Makefile.in ...@@ -9,14 +10,23 @@ Makefile.in
/compile /compile
/config.* /config.*
/configure /configure
/configure~
/depcomp /depcomp
/install-sh /install-sh
/intltool-*.in /install-sh~
/ltmain.sh /ltmain.sh
/missing /missing
/po/Makefile.in.in /po/Makefile.in.in
/configure.ac /po/Makevars.template
/po/Rules-quot
/po/boldquot.sed
/po/en@boldquot.header
/po/en@quot.header
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sin
/m4/ /m4/
/mkinstalldirs
# Autotools files generated into builddir (for in-tree builds) # Autotools files generated into builddir (for in-tree builds)
Makefile Makefile
...@@ -30,16 +40,22 @@ Makefile ...@@ -30,16 +40,22 @@ Makefile
/libtool /libtool
/panel-plugin/.dirstamp /panel-plugin/.dirstamp
/panel-plugin/screenshooter.desktop /panel-plugin/screenshooter.desktop
/po/.intltool-merge-cache*
/po/POTFILES /po/POTFILES
/po/*.gmo /po/*.gmo
/po/stamp-it /po/remove-potcdate.sed
/po/stamp-po
/po/xfce4-screenshooter.pot
/src/.dirstamp /src/.dirstamp
*.o *.o
/src/xfce4-screenshooter /src/xfce4-screenshooter
/src/xfce4-screenshooter.desktop* /src/xfce4-screenshooter.desktop
/stamp-h1 /stamp-h1
src/xfce4-screenshooter.appdata.xml src/xfce4-screenshooter.appdata.xml
/protocols/.dirstamp
# UI header files generated using xdt-csource # UI header files generated using xdt-csource
lib/*_ui.h lib/*_ui.h
# Code generated using wayland-scanner
/protocols/*.c
/protocols/*.h
[submodule "protocols/wlr-protocols"]
path = protocols/wlr-protocols
url = https://gitlab.freedesktop.org/wlroots/wlr-protocols.git
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The licenses for most software are designed to take away your The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public freedom to share and change it. By contrast, the GNU General Public
...@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This ...@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to the GNU Lesser General Public License instead.) You can apply it to
your programs, too. your programs, too.
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
...@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all. ...@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 0. This License applies to any program or other work which contains
...@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: ...@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
...@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent ...@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
...@@ -225,7 +225,7 @@ impose that choice. ...@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
...@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals ...@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally. of promoting the sharing and reuse of software generally.
NO WARRANTY NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
...@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER ...@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it possible use to the public, the best way to achieve this is to make it
...@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. ...@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License along
along with this program; if not, write to the Free Software with this program; if not, write to the Free Software Foundation, Inc.,
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this If the program is interactive, make it output a short notice like this
when it starts in an interactive mode: when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.
...@@ -336,6 +335,5 @@ necessary. Here is a sample; alter the names: ...@@ -336,6 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. Public License instead of this License.
...@@ -5,6 +5,11 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} ...@@ -5,6 +5,11 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = po SUBDIRS = po
BUILT_SOURCES =
EXTRA_DIST =
DISTCLEANFILES =
noinst_LTLIBRARIES =
bin_PROGRAMS = src/xfce4-screenshooter bin_PROGRAMS = src/xfce4-screenshooter
distclean-local: distclean-local:
...@@ -19,22 +24,70 @@ dist-bz2: dist ...@@ -19,22 +24,70 @@ dist-bz2: dist
distcheck-bz2: distcheck distcheck-bz2: distcheck
zcat $(PACKAGE)-$(VERSION).tar.gz | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 zcat $(PACKAGE)-$(VERSION).tar.gz | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
# Wayland protocols
if ENABLE_WAYLAND
noinst_LTLIBRARIES += \
protocols/libprotocols.la
protocols_libprotocols_built_sources = \
protocols/wlr-screencopy-unstable-v1.c \
protocols/wlr-screencopy-unstable-v1-client.h
nodist_protocols_libprotocols_la_SOURCES = \
protocols/wlr-screencopy-unstable-v1.c
protocols_libprotocols_la_CFLAGS = \
$(WAYLAND_CLIENT_CFLAGS) \
$(PLATFORM_CFLAGS)
protocols_libprotocols_la_LDFLAGS = \
-no-undefined \
$(PLATFORM_LDFLAGS)
protocols_libprotocols_la_LIBADD = \
$(WAYLAND_CLIENT_LIBS)
protocols/%.c: $(WLR_PROTOCOLS_PKGDATADIR)/unstable/%.xml
$(AM_V_GEN) wayland-scanner private-code $< $@
protocols/%-client.h: $(WLR_PROTOCOLS_PKGDATADIR)/unstable/%.xml
$(AM_V_GEN) wayland-scanner client-header $< $@
BUILT_SOURCES += \
$(protocols_libprotocols_built_sources)
DISTCLEANFILES += \
$(protocols_libprotocols_built_sources)
endif
EXTRA_DIST += \
protocols/wlr-protocols/unstable/wlr-screencopy-unstable-v1.xml
# Convienence library for the application and the panel plugin # Convienence library for the application and the panel plugin
noinst_LTLIBRARIES = lib/libscreenshooter.la noinst_LTLIBRARIES += lib/libscreenshooter.la
lib_libscreenshooter_la_SOURCES = \ lib_libscreenshooter_la_SOURCES = \
$(lib_libscreenshooter_built_sources) \ $(lib_libscreenshooter_built_sources) \
lib/libscreenshooter.h \ lib/libscreenshooter.h \
lib/screenshooter-actions.c lib/screenshooter-actions.h \ lib/screenshooter-actions.c lib/screenshooter-actions.h \
lib/screenshooter-capture.c lib/screenshooter-capture.h \ lib/screenshooter-capture.c lib/screenshooter-capture.h \
lib/screenshooter-custom-actions.c lib/screenshooter-custom-actions.h \
lib/screenshooter-format.c lib/screenshooter-format.h \
lib/screenshooter-dialogs.c lib/screenshooter-dialogs.h \ lib/screenshooter-dialogs.c lib/screenshooter-dialogs.h \
lib/screenshooter-global.h \ lib/screenshooter-global.h \
lib/screenshooter-job.c lib/screenshooter-job.h \ lib/screenshooter-utils.c lib/screenshooter-utils.h
lib/screenshooter-job-callbacks.c lib/screenshooter-job-callbacks.h \
lib/screenshooter-simple-job.c lib/screenshooter-simple-job.h \ if ENABLE_X11
lib/screenshooter-utils.c lib/screenshooter-utils.h \ lib_libscreenshooter_la_SOURCES += \
lib/screenshooter-imgur.c lib/screenshooter-imgur.h \ lib/screenshooter-capture-x11.c lib/screenshooter-capture-x11.h \
lib/screenshooter-imgur-dialog.c lib/screenshooter-imgur-dialog.h lib/screenshooter-utils-x11.c lib/screenshooter-utils-x11.h
endif
if ENABLE_WAYLAND
lib_libscreenshooter_la_SOURCES += \
lib/screenshooter-capture-wayland.c lib/screenshooter-capture-wayland.h
endif
lib_libscreenshooter_la_CFLAGS = \ lib_libscreenshooter_la_CFLAGS = \
-I$(top_srcdir) \ -I$(top_srcdir) \
...@@ -46,10 +99,10 @@ lib_libscreenshooter_la_CFLAGS = \ ...@@ -46,10 +99,10 @@ lib_libscreenshooter_la_CFLAGS = \
@GLIB_CFLAGS@ \ @GLIB_CFLAGS@ \
@LIBXFCE4UTIL_CFLAGS@ \ @LIBXFCE4UTIL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \ @LIBXFCE4UI_CFLAGS@ \
@LIBXML_CFLAGS@ \
@SOUP_CFLAGS@ \
@LIBX11_CFLAGS@ \ @LIBX11_CFLAGS@ \
@WAYLAND_CLIENT_CFLAGS@ \
@XFIXES_CFLAGS@ \ @XFIXES_CFLAGS@ \
@XFCONF_CFLAGS@ \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" -DPACKAGE_LOCALE_DIR=\"$(localedir)\"
lib_libscreenshooter_la_LIBADD = \ lib_libscreenshooter_la_LIBADD = \
...@@ -61,19 +114,22 @@ lib_libscreenshooter_la_LIBADD = \ ...@@ -61,19 +114,22 @@ lib_libscreenshooter_la_LIBADD = \
@LIBXFCE4UTIL_LIBS@ \ @LIBXFCE4UTIL_LIBS@ \
@LIBXFCE4UI_LIBS@ \ @LIBXFCE4UI_LIBS@ \
@GLIB_LIBS@ \ @GLIB_LIBS@ \
@SOUP_LIBS@ \
@LIBXML_LIBS@ \
@LIBXEXT_LIBS@ \ @LIBXEXT_LIBS@ \
@LIBX11_LIBS@ \ @LIBX11_LIBS@ \
@LIBX11_LDFLAGS@ \ @WAYLAND_CLIENT_LIBS@ \
@XFCONF_LIBS@ \
@XFIXES_LIBS@ @XFIXES_LIBS@
if ENABLE_WAYLAND
lib_libscreenshooter_la_LIBADD += \
$(top_builddir)/protocols/libprotocols.la
endif
lib_libscreenshooter_built_sources = \ lib_libscreenshooter_built_sources = \
lib/screenshooter-marshal.c lib/screenshooter-marshal.h \ lib/screenshooter-marshal.c lib/screenshooter-marshal.h
lib/screenshooter-imgur-dialog_ui.h
#Autogenerated sources for the library #Autogenerated sources for the library
BUILT_SOURCES = $(lib_libscreenshooter_built_sources) BUILT_SOURCES += $(lib_libscreenshooter_built_sources)
lib/screenshooter-marshal.h: lib/stamp-screenshooter-marshal.h lib/screenshooter-marshal.h: lib/stamp-screenshooter-marshal.h
@true @true
...@@ -91,9 +147,6 @@ lib/screenshooter-marshal.c: lib/screenshooter-marshal.list Makefile ...@@ -91,9 +147,6 @@ lib/screenshooter-marshal.c: lib/screenshooter-marshal.list Makefile
&& glib-genmarshal --prefix=_screenshooter_marshal --body $(top_srcdir)/lib/screenshooter-marshal.list >>$@ \ && glib-genmarshal --prefix=_screenshooter_marshal --body $(top_srcdir)/lib/screenshooter-marshal.list >>$@ \
) )
lib/screenshooter-imgur-dialog_ui.h: lib/screenshooter-imgur-dialog.ui
$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=screenshooter_imgur_dialog_ui $< >$@
# Main application # Main application
src_xfce4_screenshooter_CFLAGS = \ src_xfce4_screenshooter_CFLAGS = \
-I$(top_srcdir)/lib/ \ -I$(top_srcdir)/lib/ \
...@@ -106,8 +159,6 @@ src_xfce4_screenshooter_CFLAGS = \ ...@@ -106,8 +159,6 @@ src_xfce4_screenshooter_CFLAGS = \
@LIBXFCE4UTIL_CFLAGS@ \ @LIBXFCE4UTIL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \ @LIBXFCE4UI_CFLAGS@ \
@GTHREAD_CFLAGS@ \ @GTHREAD_CFLAGS@ \
@SOUP_CFLAGS@ \
@LIBXML_CFLAGS@ \
@LIBX11_CFLAGS@ \ @LIBX11_CFLAGS@ \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" -DPACKAGE_LOCALE_DIR=\"$(localedir)\"
...@@ -118,10 +169,7 @@ src_xfce4_screenshooter_LDFLAGS = \ ...@@ -118,10 +169,7 @@ src_xfce4_screenshooter_LDFLAGS = \
@GDKX11_LIBS@ \ @GDKX11_LIBS@ \
@GLIB_LIBS@ \ @GLIB_LIBS@ \
@GTHREAD_LIBS@ \ @GTHREAD_LIBS@ \
@SOUP_LIBS@ \
@LIBXML_LIBS@ \
@LIBX11_LIBS@ \ @LIBX11_LIBS@ \
@LIBX11_LDFLAGS@ \
@LIBXFCE4UTIL_LIBS@ \ @LIBXFCE4UTIL_LIBS@ \
@LIBXFCE4UI_LIBS@ @LIBXFCE4UI_LIBS@
...@@ -129,6 +177,12 @@ src_xfce4_screenshooter_LDADD = lib/libscreenshooter.la ...@@ -129,6 +177,12 @@ src_xfce4_screenshooter_LDADD = lib/libscreenshooter.la
src_xfce4_screenshooter_SOURCES = src/main.c src_xfce4_screenshooter_SOURCES = src/main.c
if ENABLE_WAYLAND
src_xfce4_screenshooter_CFLAGS += \
-I$(top_srcdir)/protocols/ \
-I$(top_builddir)/protocols
endif
# Manual file for the application # Manual file for the application
if HAVE_HELP2MAN if HAVE_HELP2MAN
xfce4-screenshooter.1: src/xfce4-screenshooter xfce4-screenshooter.1: src/xfce4-screenshooter
...@@ -137,17 +191,11 @@ endif ...@@ -137,17 +191,11 @@ endif
# Desktop file for the application # Desktop file for the application
app_desktopdir = $(datadir)/applications app_desktopdir = $(datadir)/applications
app_desktop_in_in_files = src/xfce4-screenshooter.desktop.in.in app_desktop_in_files = src/xfce4-screenshooter.desktop.in
app_desktop_in_files = $(app_desktop_in_in_files:.desktop.in.in=.desktop.in)
app_desktop_DATA = $(app_desktop_in_files:.desktop.in=.desktop) app_desktop_DATA = $(app_desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
src/xfce4-screenshooter.desktop.in: src/xfce4-screenshooter.desktop.in.in src/xfce4-screenshooter.desktop: src/xfce4-screenshooter.desktop.in
$(AM_V_GEN) ( \ $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
$(MKDIR_P) $(dir $@); \
sed -e "s^@PLUGIN_PATH@^$(libexecdir)/applications^" \
$< > $@ \
)
# Panel plugin # Panel plugin
plugindir = $(libdir)/xfce4/panel/plugins plugindir = $(libdir)/xfce4/panel/plugins
...@@ -162,9 +210,7 @@ panel_plugin_libscreenshooterplugin_la_CFLAGS = \ ...@@ -162,9 +210,7 @@ panel_plugin_libscreenshooterplugin_la_CFLAGS = \
@LIBXFCE4PANEL_CFLAGS@ \ @LIBXFCE4PANEL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \ @LIBXFCE4UI_CFLAGS@ \
@GTHREAD_CFLAGS@ \ @GTHREAD_CFLAGS@ \
@LIBXML_CFLAGS@ \ @LIBX11_CFLAGS@
@LIBX11_CFLAGS@ \
@SOUP_CFLAGS@
panel_plugin_libscreenshooterplugin_la_LDFLAGS = \ panel_plugin_libscreenshooterplugin_la_LDFLAGS = \
-avoid-version \ -avoid-version \
...@@ -177,10 +223,7 @@ panel_plugin_libscreenshooterplugin_la_LIBADD = \ ...@@ -177,10 +223,7 @@ panel_plugin_libscreenshooterplugin_la_LIBADD = \
@EXO_LIBS@ \ @EXO_LIBS@ \
@LIBXFCE4PANEL_LIBS@ \ @LIBXFCE4PANEL_LIBS@ \
@GTHREAD_LIBS@ \ @GTHREAD_LIBS@ \
@SOUP_LIBS@ \
@LIBXML_LIBS@ \
@LIBX11_LIBS@ \ @LIBX11_LIBS@ \
@LIBX11_LDFLAGS@ \
@LIBXFCE4UI_LIBS@ \ @LIBXFCE4UI_LIBS@ \
lib/libscreenshooter.la lib/libscreenshooter.la
...@@ -191,14 +234,17 @@ panel_plugin_libscreenshooterplugin_la_SOURCES = \ ...@@ -191,14 +234,17 @@ panel_plugin_libscreenshooterplugin_la_SOURCES = \
panel_desktopdir = $(datadir)/xfce4/panel/plugins panel_desktopdir = $(datadir)/xfce4/panel/plugins
panel_desktop_in_files = panel-plugin/screenshooter.desktop.in panel_desktop_in_files = panel-plugin/screenshooter.desktop.in
panel_desktop_DATA = $(panel_desktop_in_files:.desktop.in=.desktop) panel_desktop_DATA = $(panel_desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
panel-plugin/screenshooter.desktop: panel-plugin/screenshooter.desktop.in
$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
# appdata file for the application # appdata file for the application
@INTLTOOL_XML_RULE@
appdatadir = $(datadir)/metainfo appdatadir = $(datadir)/metainfo
appdata_DATA = $(appdata_in_files:.xml.in=.xml) appdata_DATA = $(appdata_in_files:.xml.in=.xml)
appdata_in_files = src/xfce4-screenshooter.appdata.xml.in appdata_in_files = src/xfce4-screenshooter.appdata.xml.in
src/xfce4-screenshooter.appdata.xml: src/xfce4-screenshooter.appdata.xml.in
$(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
# App icons # App icons
...@@ -240,7 +286,6 @@ install-data-hook: ...@@ -240,7 +286,6 @@ install-data-hook:
echo "***"; \ echo "***"; \
fi fi
.PHONY: ChangeLog .PHONY: ChangeLog
ChangeLog: Makefile ChangeLog: Makefile
...@@ -251,14 +296,18 @@ ChangeLog: Makefile ...@@ -251,14 +296,18 @@ ChangeLog: Makefile
dist-hook: ChangeLog dist-hook: ChangeLog
# Extra dist and distclean rules # Extra dist and distclean rules
EXTRA_DIST = \ EXTRA_DIST += \
README.md \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
lib/screenshooter-marshal.list \ lib/screenshooter-marshal.list \
lib/screenshooter-imgur-dialog.ui \ meson.build \
$(app_desktop_in_in_files) \ meson_options.txt \
icons/meson.build \
lib/meson.build \
panel-plugin/meson.build \
po/meson.build \
protocols/meson.build \
src/meson.build \
xfce-revision.h.in \
$(app_desktop_in_files) \
$(panel_desktop_in_files) \ $(panel_desktop_in_files) \
$(16icons_DATA) \ $(16icons_DATA) \
$(24icons_DATA) \ $(24icons_DATA) \
...@@ -268,14 +317,11 @@ EXTRA_DIST = \ ...@@ -268,14 +317,11 @@ EXTRA_DIST = \
$(scalicons_DATA) \ $(scalicons_DATA) \
$(appdata_in_files) $(appdata_in_files)
DISTCLEANFILES = \ DISTCLEANFILES += \
intltool-extract \
intltool-merge \
intltool-update \
stamp-screenshooter-marshal.h \ stamp-screenshooter-marshal.h \
$(lib_libscreenshooter_built_sources) \ $(lib_libscreenshooter_built_sources) \
lib/stamp-screenshooter-marshal.h \ lib/stamp-screenshooter-marshal.h \
$(app_desktop_DATA) $(app_desktop_in_files) \ $(app_desktop_DATA) \
$(panel_desktop_DATA) \ $(panel_desktop_DATA) \
$(appdata_DATA) \ $(appdata_DATA) \
xfce4-screenshooter.1 xfce4-screenshooter.1
......
1.11.1 (2024-07-30)
======
- Drop unnecessary libxml dependency
- Translation Updates:
Czech, Serbian
1.11.0 (2024-07-25)
======
- Drop built-in support for imgur
- Drop jobs-related code
- Drop libsoup dependency
- Use XDG_DATA_HOME in imgur-upload.sh
- Make sure screenshot is copied to clipboard before closing (!56)
- Add more tests
- build: clang: Silence -Wcast-align
- Translation Updates:
Albanian, Basque, Belarusian, Bulgarian, Catalan, Chinese (China),
Chinese (Taiwan), Croatian, Czech, Danish, Dutch, English (United
Kingdom), Estonian, Finnish, French, Galician, German, Greek, Hebrew,
Hungarian, Indonesian, Italian, Japanese, Korean, Lithuanian, Malay,
Norwegian Bokmål, Occitan (post 1500), Persian (Iran), Polish,
Portuguese, Portuguese (Brazil), Russian, Serbian, Slovak, Slovenian,
Spanish, Swedish, Thai, Turkish, Ukrainian
1.10.6 (2024-05-28)
======
- build: Switch from intltool to gettext
- Preliminary Wayland support
- Translation Updates:
Albanian, Arabic, Armenian (Armenia), Basque, Belarusian, Bulgarian,
Catalan, Chinese (China), Chinese (Taiwan), Croatian, Czech, Danish,
Dutch, Eastern Armenian, English (Australia), English (United
Kingdom), Estonian, Finnish, French, Galician, Georgian, German,
Greek, Hebrew, Hungarian, Icelandic, Indonesian, Interlingue,
Italian, Japanese, Korean, Lithuanian, Malay, Norwegian Bokmål,
Occitan (post 1500), Persian (Iran), Polish, Portuguese, Portuguese
(Brazil), Russian, Serbian, Slovak, Slovenian, Spanish, Swedish,
Thai, Turkish, Ukrainian
1.10.5 (2024-02-04)
======
- Add imgur support as custom action (!51)
- Translation Updates:
Albanian, Basque, Bulgarian, Catalan, Chinese (China), Chinese
(Taiwan), Danish, Dutch, English (United Kingdom), Estonian, French,
German, Greek, Hebrew, Italian, Japanese, Lithuanian, Norwegian
Bokmål, Occitan (post 1500), Polish, Portuguese, Portuguese
(Brazil), Russian, Serbian, Slovenian, Spanish, Swedish, Turkish,
Ukrainian
1.10.4 (2023-05-14)
======
- Fix warning about checking file permissions
- Refactor supported image formats handling (!49)
- Add support to AVIF (#109)
- Add support to JPEG XL (#108)
- Check if the pixbuf-loader supports writing
- Restrict file permission if not saved in a user-owned directory (#2)
- Save preferences when plugin finalizes screenshot (#96)
- Fix screenshot finalize behavior for plugin
- Translation Updates:
Albanian, Arabic, Armenian (Armenia), Basque, Belarusian, Bulgarian,
Catalan, Chinese (China), Chinese (Taiwan), Croatian, Czech, Danish,
Dutch, Eastern Armenian, English (Australia), English (United
Kingdom), Estonian, Finnish, French, Galician, Georgian, German,
Greek, Hebrew, Hungarian, Icelandic, Indonesian, Interlingue,
Italian, Japanese, Kazakh, Korean, Lithuanian, Malay, Norwegian
Bokmål, Occitan (post 1500), Persian (Iran), Polish, Portuguese,
Portuguese (Brazil), Russian, Serbian, Slovak, Slovenian, Spanish,
Swedish, Thai, Turkish, Ukrainian
1.10.3 (2023-01-12)
======
- Lower minimal Xfce dependecies back to 4.16
- Remove fallback code
1.10.2 (2023-01-02)
======
- Fix capture of CSD windows
- Fix active window and region capture modes
- Consider scale factor while capturing screenshots with cairo (#95)
- Support libsoup2 and 3 simultaneously (#97)
- save dialog: show preview of selected file (#94)
- Save preferences of panel plugin (#96)
- Translation Updates:
Albanian, Arabic, Armenian (Armenia), Basque, Belarusian, Bulgarian,
Catalan, Chinese (China), Chinese (Taiwan), Croatian, Czech, Danish,
Dutch, Eastern Armenian, English (Australia), Estonian, Finnish,
French, Galician, Georgian, German, Greek, Hebrew, Hungarian,
Icelandic, Indonesian, Interlingue, Italian, Japanese, Korean,
Lithuanian, Malay, Norwegian Bokmål, Occitan (post 1500), Persian
(Iran), Polish, Portuguese, Portuguese (Brazil), Russian, Serbian,
Slovak, Slovenian, Spanish, Swedish, Thai, Turkish, Ukrainian
1.10.1 (2022-12-21)
======
- Fixes capture of screenshots after first time (#89)
- libsoup: Migrate to 3.0 (#88)
- Fix typo in NEWS file
- Translation Updates:
Albanian, Arabic, Armenian (Armenia), Basque, Belarusian, Bulgarian,
Catalan, Chinese (China), Chinese (Taiwan), Croatian, Czech, Danish,
Dutch, Eastern Armenian, English (Australia), Estonian, Finnish,
French, Galician, Georgian, German, Greek, Hebrew, Hungarian,
Icelandic, Indonesian, Interlingue, Italian, Japanese, Korean,
Lithuanian, Malay, Norwegian Bokmål, Occitan (post 1500), Persian
(Iran), Polish, Portuguese, Portuguese (Brazil), Russian, Serbian,
Slovak, Slovenian, Spanish, Swedish, Thai, Turkish, Ukrainian
1.10.0 (2022-11-15)
======
- Introduce custom actions (!37)
- Bump dependencies
- Replace deprecated functions
- Added writability check to screenshot_dir (#84)
- Include "config.h" before GLib include files
- Revert icon name translation
- Drop subtitles
- Add version check for libxi (#79)
- Translation Updates:
Albanian, Arabic, Armenian (Armenia), Basque, Belarusian, Bulgarian,
Catalan, Chinese (China), Chinese (Taiwan), Croatian, Czech, Danish,
Dutch, Eastern Armenian, English (Australia), English (United
Kingdom), Estonian, Finnish, French, Galician, Georgian, German,
Greek, Hebrew, Hungarian, Icelandic, Indonesian, Interlingue,
Italian, Japanese, Kazakh, Korean, Lithuanian, Malay, Norwegian
Bokmål, Occitan (post 1500), Persian (Iran), Polish, Portuguese,
Portuguese (Brazil), Russian, Serbian, Slovak, Slovenian, Spanish,
Swedish, Thai, Turkish, Ukrainian
1.9.11 (2022-08-08)
======
- Add support to WebP (#76)
- Fix window capture in HiDPI mode (#73)
- Fix intltool lock file problem during make distcheck
- Add option to Show in File Manager when saving (#47)
- Do not quit after dismissing dialog if invoked from plugin (#71)
- Update COPYING (Issue #70)
- Translation Updates:
Albanian, Basque, Belarusian, Bulgarian, Catalan, Chinese (China),
Chinese (Taiwan), Czech, Danish, Dutch, Estonian, Finnish, French,
Galician, German, Greek, Hebrew, Indonesian, Italian, Japanese,
Korean, Lithuanian, Malay, Norwegian Bokmål, Persian (Iran), Polish,
Portuguese, Portuguese (Brazil), Russian, Serbian, Slovak, Slovenian,
Spanish, Swedish, Thai, Turkish, Ukrainian
1.9.10 (2022-03-06) 1.9.10 (2022-03-06)
====== ======
- Use symbolic icons - Use symbolic icons
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
Xfce4-screenshooter allows you to capture the entire screen, the active Xfce4-screenshooter allows you to capture the entire screen, the active
window or a selected region. You can set the delay that elapses window or a selected region. You can set the delay that elapses
before the screenshot is taken and the action that will be done with before the screenshot is taken and the action that will be done with
the screenshot: save it to a /PNG file, copy it to the clipboard, open the screenshot: save it to a file, copy it to the clipboard, open
it using another application, or host it on imgur.com, it using another application or use your creativity with custom actions
a free online image hosting service. scripts.
---- ----
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
# #
# Written for Xfce by Benedikt Meurer <benny@xfce.org>. # Written for Xfce by Benedikt Meurer <benny@xfce.org>.
export XDT_AUTOGEN_REQUIRED_VERSION="4.14.0"
(type xdt-autogen) >/dev/null 2>&1 || { (type xdt-autogen) >/dev/null 2>&1 || {
cat >&2 <<EOF cat >&2 <<EOF
autogen.sh: You don't seem to have the Xfce development tools installed on autogen.sh: You don't seem to have the Xfce development tools installed on
...@@ -17,4 +15,4 @@ EOF ...@@ -17,4 +15,4 @@ EOF
exit 1 exit 1
} }
xdt-autogen $@ XDT_AUTOGEN_REQUIRED_VERSION="4.17.0" xdt-autogen $@
...@@ -3,15 +3,11 @@ dnl ...@@ -3,15 +3,11 @@ dnl
dnl xfce4-screenshooter dnl xfce4-screenshooter
dnl dnl
m4_define([xfce4_screenshooter_version_major], [1]) XDT_VERSION_INIT([1.11.1], [git])
m4_define([xfce4_screenshooter_version_minor], [9])
m4_define([xfce4_screenshooter_version_micro], [10]) AC_INIT([xfce4-screenshooter], [xdt_version], [https://gitlab.xfce.org/apps/xfce4-screenshooter], [xfce4-screenshooter])
m4_define([xfce4_screenshooter_version_nano], []) dnl leave this empty to have no nano version AC_PREREQ([2.69])
m4_define([xfce4_screenshooter_version_build], [@REVISION@]) AC_REVISION([xdt_version_build])
m4_define([xfce4_screenshooter_version_tag], [])
m4_define([xfce4_screenshooter_version], [xfce4_screenshooter_version_major().xfce4_screenshooter_version_minor().xfce4_screenshooter_version_micro()ifelse(xfce4_screenshooter_version_nano(), [], [], [.xfce4_screenshooter_version_nano()])ifelse(xfce4_screenshooter_version_tag(), [git], [xfce4_screenshooter_version_tag()-xfce4_screenshooter_version_build()], [xfce4_screenshooter_version_tag()])])
AC_INIT([xfce4-screenshooter], [xfce4_screenshooter_version], [https://gitlab.xfce.org/apps/xfce4-screenshooter], [xfce4-screenshooter])
AC_CONFIG_MACRO_DIRS([m4]) AC_CONFIG_MACRO_DIRS([m4])
dnl *************************** dnl ***************************
dnl *** Initialize automake *** dnl *** Initialize automake ***
...@@ -28,7 +24,6 @@ AC_PROG_CC() ...@@ -28,7 +24,6 @@ AC_PROG_CC()
AC_PROG_CC_C_O() AC_PROG_CC_C_O()
AC_PROG_LD() AC_PROG_LD()
AC_PROG_INSTALL() AC_PROG_INSTALL()
IT_PROG_INTLTOOL([0.35.0])
AM_PROG_CC_C_O() AM_PROG_CC_C_O()
dnl ************************** dnl **************************
...@@ -45,26 +40,70 @@ AC_HEADER_STDC ...@@ -45,26 +40,70 @@ AC_HEADER_STDC
dnl *********************************** dnl ***********************************
dnl *** Check for required packages *** dnl *** Check for required packages ***
dnl *********************************** dnl ***********************************
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.14.0]) XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.18.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.14.0]) XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.18.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.14.0]) XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.18.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.42.0]) XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.42.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.22.0]) XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.24.0])
XDT_CHECK_PACKAGE([GDK], [gdk-3.0], [3.22.0]) XDT_CHECK_PACKAGE([GDK], [gdk-3.0], [3.24.0])
XDT_CHECK_PACKAGE([GDKX11], [gdk-x11-3.0], [3.22.0]) XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.66.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.42.0])
XDT_CHECK_PACKAGE([SOUP], [libsoup-2.4], [2.26.0])
XDT_CHECK_PACKAGE([LIBXML], [libxml-2.0], [2.4.0])
XDT_CHECK_PACKAGE([EXO], [exo-2], [0.12.0]) XDT_CHECK_PACKAGE([EXO], [exo-2], [0.12.0])
XDT_CHECK_PACKAGE([LIBXEXT], [xext], [1.0.0])
XDT_CHECK_PACKAGE([PANGO], [pango], [1.44.0]) XDT_CHECK_PACKAGE([PANGO], [pango], [1.44.0])
XDT_CHECK_OPTIONAL_PACKAGE([XFIXES], [xfixes], [4.0.0], [xfixes], [XFIXES extension support]) XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.18.0])
XDT_CHECK_LIBX11()
dnl ***********************************
dnl *** Check for optional packages ***
dnl ***********************************
XDT_CHECK_OPTIONAL_FEATURE([X11],
[x11],
[
XDT_FEATURE_DEPENDENCY([LIBX11], [x11], [1.6.7])
XDT_FEATURE_DEPENDENCY([GDKX11], [gdk-x11-3.0], [3.24.0])
XDT_FEATURE_DEPENDENCY([XINPUT2], [xi], [1.7.8])
XDT_FEATURE_DEPENDENCY([LIBXEXT], [xext], [1.0.0])
XDT_FEATURE_DEPENDENCY([XFIXES], [xfixes], [4.0.0])
],
[the X11 windowing system])
XDT_CHECK_OPTIONAL_FEATURE([WAYLAND],
[wayland],
[
XDT_FEATURE_DEPENDENCY([GDK_WAYLAND], [gdk-wayland-3.0], [3.24.0])
XDT_FEATURE_DEPENDENCY([WAYLAND_SCANNER], [wayland-scanner], [1.15.0])
XDT_FEATURE_DEPENDENCY([WAYLAND_CLIENT], [wayland-client], [1.15.0])
],
[the Wayland windowing system])
if test x"$ENABLE_X11" != x"yes" -a x"$ENABLE_WAYLAND" != x"yes"; then
AC_MSG_ERROR([Either both X11 and Wayland support was disabled, or required dependencies are missing. One of the two must be enabled.])
fi
if test x"$ENABLE_X11" != x"yes"; then
dnl Do not check for optional X11 packages if X11 is disabled
enable_libxtst=no
fi
XDT_CHECK_OPTIONAL_PACKAGE([LIBXTST], [xtst], [libxtst_min_version], [libxtst], [Libxtst support])
if test x"$ENABLE_WAYLAND" = x"yes"; then
WLR_PROTOCOLS_PKGDATADIR=`$PKG_CONFIG --variable=pkgdatadir wlr-protocols 2>/dev/null || true`
if test x"$WLR_PROTOCOLS_PKGDATADIR" = x""; then
WLR_PROTOCOLS_PKGDATADIR="$ac_abs_confdir/protocols/wlr-protocols"
if test "$(echo "$WLR_PROTOCOLS_PKGDATADIR/"*)" = "$WLR_PROTOCOLS_PKGDATADIR/*"; then
AC_MSG_ERROR([$WLR_PROTOCOLS_PKGDATADIR seems empty, did you clone the wlr-protocols submodule?])
fi
fi
AC_MSG_CHECKING([for wlr-protocols])
AC_MSG_RESULT([$WLR_PROTOCOLS_PKGDATADIR])
AC_SUBST([WLR_PROTOCOLS_PKGDATADIR])
fi
dnl ****************************** dnl ******************************
dnl *** Check for i18n support *** dnl *** Check for i18n support ***
dnl ****************************** dnl ******************************
XDT_I18N([@LINGUAS@]) GETTEXT_PACKAGE="$PACKAGE"
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain])
AC_SUBST([GETTEXT_PACKAGE])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])
dnl ************************** dnl **************************
dnl *** Check for help2man *** dnl *** Check for help2man ***
...@@ -77,7 +116,7 @@ AM_CONDITIONAL([HAVE_HELP2MAN], false) ...@@ -77,7 +116,7 @@ AM_CONDITIONAL([HAVE_HELP2MAN], false)
fi fi
dnl Check for debugging support dnl Check for debugging support
XDT_FEATURE_DEBUG() XDT_FEATURE_DEBUG([xdt_debug_default])
AC_OUTPUT([ AC_OUTPUT([
Makefile Makefile
...@@ -94,5 +133,7 @@ echo "" ...@@ -94,5 +133,7 @@ echo ""
echo " * XFIXES support: $XFIXES_FOUND" echo " * XFIXES support: $XFIXES_FOUND"
echo " * Debugging support: $enable_debug" echo " * Debugging support: $enable_debug"
echo " * X11 Support: ${ENABLE_X11:-no}"
echo " * Wayland Support: ${ENABLE_WAYLAND:-no}"
echo "" echo ""
sizes = [16, 24, 32, 48, 128]
foreach size : sizes
install_data(
'@0@x@0@'.format(size) / 'org.xfce.screenshooter.png',
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / '@0@x@0@'.format(size) / 'apps',
)
endforeach
install_data(
'scalable' / 'org.xfce.screenshooter.svg',
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps',
)
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "screenshooter-utils.h" #include "screenshooter-utils.h"
#include "screenshooter-actions.h" #include "screenshooter-actions.h"
#include "screenshooter-capture.h" #include "screenshooter-capture.h"
#include "screenshooter-format.h"
#include "screenshooter-global.h" #include "screenshooter-global.h"
#endif #endif
libscreenshooter_sources = [
'libscreenshooter.h',
'screenshooter-actions.c',
'screenshooter-actions.h',
'screenshooter-capture.c',
'screenshooter-capture.h',
'screenshooter-custom-actions.c',
'screenshooter-custom-actions.h',
'screenshooter-format.c',
'screenshooter-format.h',
'screenshooter-dialogs.c',
'screenshooter-dialogs.h',
'screenshooter-global.h',
'screenshooter-utils.c',
'screenshooter-utils.h',
]
libscreenshooter_sources += gnome.genmarshal(
'screenshooter-marshal',
sources: 'screenshooter-marshal.list',
prefix: '_screenshooter_marshal',
internal: true,
install_header: false,
)
if enable_x11
libscreenshooter_sources += [
'screenshooter-capture-x11.c',
'screenshooter-capture-x11.h',
'screenshooter-utils-x11.c',
'screenshooter-utils-x11.h',
]
endif
if enable_wayland
libscreenshooter_sources += wayland_protocols_generated_sources
libscreenshooter_sources += [
'screenshooter-capture-wayland.c',
'screenshooter-capture-wayland.h',
]
endif
libscreenshooter = static_library(
'libscreenshooter',
libscreenshooter_sources,
include_directories: [
include_directories('..'),
],
dependencies: [
glib,
gtk,
exo,
libxfce4ui,
libxfce4util,
xfconf,
x11_deps,
wayland_deps,
xfixes,
],
install: false,
)
...@@ -18,11 +18,14 @@ ...@@ -18,11 +18,14 @@
* */ * */
#include "screenshooter-actions.h" #include "screenshooter-actions.h"
#include "screenshooter-custom-actions.h"
#include "screenshooter-utils.h" #include "screenshooter-utils.h"
#include "screenshooter-capture.h" #include "screenshooter-capture.h"
#include "screenshooter-global.h" #include "screenshooter-global.h"
#include "screenshooter-dialogs.h" #include "screenshooter-dialogs.h"
#include "screenshooter-imgur.h" #include "screenshooter-format.h"
static void static void
cb_help_response (GtkWidget *dialog, gint response, gpointer unused) cb_help_response (GtkWidget *dialog, gint response, gpointer unused)
...@@ -60,10 +63,8 @@ action_idle (gpointer user_data) ...@@ -60,10 +63,8 @@ action_idle (gpointer user_data)
response == GTK_RESPONSE_DELETE_EVENT || response == GTK_RESPONSE_DELETE_EVENT ||
response == GTK_RESPONSE_CLOSE) response == GTK_RESPONSE_CLOSE)
{ {
if (!sd->plugin)
gtk_main_quit ();
g_object_unref (sd->screenshot); g_object_unref (sd->screenshot);
sd->finalize_callback (FALSE, sd->finalize_callback_data);
return FALSE; return FALSE;
} }
...@@ -119,13 +120,16 @@ action_idle (gpointer user_data) ...@@ -119,13 +120,16 @@ action_idle (gpointer user_data)
return TRUE; return TRUE;
} }
} }
if (sd->show_in_folder)
screenshooter_show_file_in_folder (save_location);
} }
else else
{ {
GFile *temp_dir = g_file_new_for_path (g_get_tmp_dir ()); GFile *temp_dir = g_file_new_for_path (g_get_tmp_dir ());
gchar *temp_dir_uri = g_file_get_uri (temp_dir); gchar *temp_dir_uri = g_file_get_uri (temp_dir);
gchar *filename = screenshooter_get_filename_for_uri (temp_dir_uri, gchar *filename = screenshooter_get_filename_for_uri (temp_dir_uri,
sd->title, sd->title,
sd->last_extension, sd->last_extension,
sd->timestamp); sd->timestamp);
save_location = screenshooter_save_screenshot (sd->screenshot, save_location = screenshooter_save_screenshot (sd->screenshot,
...@@ -134,6 +138,7 @@ action_idle (gpointer user_data) ...@@ -134,6 +138,7 @@ action_idle (gpointer user_data)
sd->last_extension, sd->last_extension,
FALSE, FALSE,
FALSE); FALSE);
g_object_unref (temp_dir); g_object_unref (temp_dir);
g_free (temp_dir_uri); g_free (temp_dir_uri);
g_free (filename); g_free (filename);
...@@ -144,17 +149,9 @@ action_idle (gpointer user_data) ...@@ -144,17 +149,9 @@ action_idle (gpointer user_data)
{ {
screenshooter_open_screenshot (save_location, sd->app, sd->app_info); screenshooter_open_screenshot (save_location, sd->app, sd->app_info);
} }
else if (sd->action & UPLOAD_IMGUR) else if (sd->action & CUSTOM_ACTION)
{ {
gboolean upload_successful = screenshooter_upload_to_imgur (save_location, sd->title); screenshooter_custom_action_execute (save_location, sd->custom_action_name, sd->custom_action_command);
/* If upload failed, regardless of whether it was chosen by GUI or CLI, and
* the action was not selected via CLI, show the actions dialog again.*/
if (!upload_successful && !sd->action_specified)
{
g_free (save_location);
return TRUE;
}
} }
} }
} }
...@@ -164,12 +161,14 @@ action_idle (gpointer user_data) ...@@ -164,12 +161,14 @@ action_idle (gpointer user_data)
{ {
gchar *extension = NULL; gchar *extension = NULL;
if (G_LIKELY (g_str_has_suffix (save_location, ".png"))) for (ImageFormat *format = screenshooter_get_image_formats (); format->type != NULL; format++)
extension = g_strdup ("png"); {
else if (G_UNLIKELY (g_str_has_suffix (save_location, ".jpg") || g_str_has_suffix (save_location, ".jpeg"))) if (format->supported && screenshooter_image_format_match_extension (format, save_location))
extension = g_strdup ("jpg"); {
else if (G_UNLIKELY (g_str_has_suffix (save_location, ".bmp"))) extension = g_strdup (format->extensions[0]);
extension = g_strdup ("bmp"); break;
}
}
if (extension) if (extension)
{ {
...@@ -180,8 +179,7 @@ action_idle (gpointer user_data) ...@@ -180,8 +179,7 @@ action_idle (gpointer user_data)
g_free (save_location); g_free (save_location);
} }
if (!sd->plugin) sd->finalize_callback (TRUE, sd->finalize_callback_data);
gtk_main_quit ();
g_object_unref (sd->screenshot); g_object_unref (sd->screenshot);
...@@ -198,13 +196,12 @@ take_screenshot_idle (gpointer user_data) ...@@ -198,13 +196,12 @@ take_screenshot_idle (gpointer user_data)
sd->screenshot = screenshooter_capture_screenshot (sd->region, sd->screenshot = screenshooter_capture_screenshot (sd->region,
sd->delay, sd->delay,
sd->show_mouse, sd->show_mouse,
sd->show_border, sd->show_border);
sd->plugin);
if (sd->screenshot != NULL) if (sd->screenshot != NULL)
g_idle_add (action_idle, sd); g_idle_add (action_idle, sd);
else if (!sd->plugin) else
gtk_main_quit (); sd->finalize_callback (FALSE, sd->finalize_callback_data);
return FALSE; return FALSE;
} }
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include "screenshooter-global.h" #include "screenshooter-global.h"
void screenshooter_take_screenshot (ScreenshotData *sd,
gboolean immediate);
void screenshooter_take_screenshot (ScreenshotData *sd,
gboolean immediate);
#endif #endif
/* $Id$
*
* Copyright © 2024 André Miranda <andreldm@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "screenshooter-capture-wayland.h"
#include <sys/mman.h>
#include <gdk/gdkwayland.h>
#include <protocols/wlr-screencopy-unstable-v1-client.h>
#include <libxfce4util/libxfce4util.h>
#include "screenshooter-global.h"
#include "screenshooter-utils.h"
/* Internals */
typedef struct {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shm *shm;
struct zwlr_screencopy_manager_v1 *screencopy_manager;
}
ClientData;
typedef struct {
ClientData *client_data;
GdkMonitor *monitor;
struct zwlr_screencopy_frame_v1 *frame;
struct wl_buffer *buffer;
struct wl_shm_pool *pool;
unsigned char *shm_data;
int width;
int height;
int stride;
int size;
uint32_t format;
gboolean capture_done;
gboolean capture_failed;
}
OutputData;
static void handle_global (void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version);
static void handle_global_remove (void *data, struct wl_registry *reg, uint32_t name);
static void handle_frame_ready (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec);
static void handle_frame_failed (void *data, struct zwlr_screencopy_frame_v1 *frame);
static void handle_frame_flags (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t flags);
static void handle_frame_buffer (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t fmt, uint32_t w, uint32_t h, uint32_t str);
static void screenshooter_free_client_data (ClientData *client_data);
static void screenshooter_free_output_data (gpointer data);
static gboolean screenshooter_initialize_client_data (ClientData *client_data);
static GdkPixbuf *screenshooter_compose_screenshot (GList *outputs);
void
screenshooter_free_client_data (ClientData *client_data)
{
if (client_data->compositor != NULL)
wl_compositor_destroy (client_data->compositor);
if (client_data->shm != NULL)
wl_shm_destroy (client_data->shm);
if (client_data->screencopy_manager != NULL)
zwlr_screencopy_manager_v1_destroy (client_data->screencopy_manager);
wl_registry_destroy (client_data->registry);
/* do not destroy client_data->display because it is owned by gdk */
}
void
screenshooter_free_output_data (gpointer data)
{
OutputData *output = data;
if (output->shm_data != NULL)
munmap (output->shm_data, output->size);
if (output->buffer != NULL)
wl_buffer_destroy (output->buffer);
if (output->frame != NULL)
zwlr_screencopy_frame_v1_destroy (output->frame);
g_free (output);
}
/* global registry functions */
static void
handle_global (void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t version)
{
ClientData *client_data = data;
if (g_strcmp0 (interface, wl_compositor_interface.name) == 0)
client_data->compositor = wl_registry_bind (wl_registry, name, &wl_compositor_interface, 1);
else if (g_strcmp0 (interface, wl_shm_interface.name) == 0)
client_data->shm = wl_registry_bind (wl_registry, name, &wl_shm_interface, 1);
else if (g_strcmp0 (interface, zwlr_screencopy_manager_v1_interface.name) == 0)
client_data->screencopy_manager = wl_registry_bind (wl_registry, name, &zwlr_screencopy_manager_v1_interface, 1);
}
static void
handle_global_remove (void *data, struct wl_registry *reg, uint32_t name)
{
/* do nothing */
}
const struct wl_registry_listener registry_listener = {
.global = handle_global,
.global_remove = handle_global_remove
};
/* screencopy frame functions */
static void
handle_frame_ready (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec)
{
OutputData *output = data;
TRACE ("buffer copy ready");
output->capture_done = TRUE;
}
static void
handle_frame_failed (void *data, struct zwlr_screencopy_frame_v1 *frame)
{
OutputData *output = data;
screenshooter_error (_("Failed to capture screencopy frame"));
output->capture_failed = TRUE;
}
static void
handle_frame_flags (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t flags)
{
TRACE ("buffer flags received");
}
static void
handle_frame_buffer (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t format, uint32_t width, uint32_t height, uint32_t stride)
{
int fd;
char template[] = "/tmp/screenshooter-buffer-XXXXXX";
OutputData *output = data;
output->format = format;
output->width = width;
output->height = height;
output->stride = stride;
output->size = stride * height;
fd = mkstemp (template);
if (fd == -1)
{
screenshooter_error (_("Failed to create file descriptor"));
g_abort ();
}
ftruncate (fd, output->size);
unlink (template);
output->shm_data = mmap (NULL, output->size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (output->shm_data == MAP_FAILED)
{
screenshooter_error (_("Failed to map memory"));
close (fd);
g_abort ();
}
output->pool = wl_shm_create_pool (output->client_data->shm, fd, output->size);
output->buffer = wl_shm_pool_create_buffer (output->pool, 0, width, height, stride, format);
close (fd);
wl_shm_pool_destroy (output->pool);
zwlr_screencopy_frame_v1_copy (frame, output->buffer);
/* wait for flags and ready events */
}
const struct zwlr_screencopy_frame_v1_listener frame_listener = {
.ready = handle_frame_ready,
.failed = handle_frame_failed,
.flags = handle_frame_flags,
.buffer = handle_frame_buffer
};
/* Wayland client initialization */
gboolean
screenshooter_initialize_client_data (ClientData *client_data)
{
client_data->display = gdk_wayland_display_get_wl_display (gdk_display_get_default ());
client_data->registry = wl_display_get_registry (client_data->display);
wl_registry_add_listener (client_data->registry, &registry_listener, client_data);
wl_display_roundtrip (client_data->display);
if (client_data->compositor == NULL)
{
screenshooter_error (_("Required Wayland interfaces are missing"));
return FALSE;
}
if (client_data->shm == NULL)
{
screenshooter_error (_("Compositor is missing wl_shm"));
return FALSE;
}
if (client_data->screencopy_manager == NULL)
{
screenshooter_error (_("Compositor does not support wlr-screencopy-unstable-v1"));
return FALSE;
}
return TRUE;
}
/* Pixbuf manipulation functions */
static GdkPixbuf
*screenshooter_convert_buffer_to_pixbuf (OutputData *output)
{
guint8 *data = output->shm_data;
uint32_t format = output->format;
gboolean has_alpha = TRUE;
if (format == WL_SHM_FORMAT_ARGB8888 || format == WL_SHM_FORMAT_XRGB8888)
{
for (int y = 0; y < output->height; y++)
{
for (int x = 0; x < output->width; x++)
{
gint offset = y * output->stride + x * 4;
guint32 *px = (guint32 *)(gpointer)(data + offset);
guint8 blue = *px & 0xFF;
guint8 green = (*px >> 8) & 0xFF;
guint8 red = (*px >> 16) & 0xFF;
guint8 alpha = (*px >> 24) & 0xFF;
data[offset + 0] = red;
data[offset + 1] = green;
data[offset + 2] = blue;
data[offset + 3] = alpha;
}
}
}
else if (format == WL_SHM_FORMAT_ABGR8888 || format == WL_SHM_FORMAT_XBGR8888)
{
for (int y = 0; y < output->height; y++)
{
for (int x = 0; x < output->width; x++)
{
gint offset = y * output->stride + x * 4;
guint32 *px = (guint32 *)(gpointer)(data + offset);
guint8 red = *px & 0xFF;
guint8 green = (*px >> 8) & 0xFF;
guint8 blue = (*px >> 16) & 0xFF;
guint8 alpha = (*px >> 24) & 0xFF;
data[offset + 0] = red;
data[offset + 1] = green;
data[offset + 2] = blue;
data[offset + 3] = alpha;
}
}
}
else if (format == WL_SHM_FORMAT_BGR888)
{
has_alpha = FALSE;
for (int y = 0; y < output->height; y++)
{
for (int x = 0; x < output->width; x++)
{
gint offset = y * output->stride + x * 3;
guint8 *px = (guint8 *)(gpointer)(data + offset);
guint8 blue = px[2];
guint8 green = px[1];
guint8 red = px[0];
data[offset + 0] = red;
data[offset + 1] = green;
data[offset + 2] = blue;
}
}
}
else
{
screenshooter_error (_("Unsupported pixel format: 0x%x"), format);
return NULL;
}
return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, has_alpha, 8, output->width, output->height, output->stride, NULL, NULL);
}
GdkPixbuf
*screenshooter_compose_screenshot (GList *outputs)
{
GdkRectangle geometry;
GdkPixbuf *dest = NULL;
int max_width = 0, max_height = 0;
/* find the maximum dimensions */
for (GList *iter = outputs; iter != NULL; iter = iter->next)
{
OutputData *output = (OutputData *) iter->data;
gdk_monitor_get_geometry (output->monitor, &geometry);
max_width = MAX (max_width, geometry.x + geometry.width);
max_height = MAX (max_height, geometry.y + geometry.height);
}
/* create a new destination pixbuf */
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, max_width, max_height);
if (dest == NULL)
{
g_warning ("Failed to create destination pixbuf.");
return NULL;
}
/* fill with transparency */
gdk_pixbuf_fill (dest, 0x00000000);
/* composite each screenshot onto the destination pixbuf */
for (GList *iter = outputs; iter != NULL; iter = iter->next)
{
OutputData *output = (OutputData *) iter->data;
GdkPixbuf *pixbuf = screenshooter_convert_buffer_to_pixbuf (output);
gdk_monitor_get_geometry (output->monitor, &geometry);
gdk_pixbuf_composite (pixbuf, dest,
geometry.x, geometry.y,
geometry.width, geometry.height,
geometry.x, geometry.y,
1.0, 1.0,
GDK_INTERP_BILINEAR,
255);
g_object_unref (pixbuf);
}
return dest;
}
/* Public */
GdkPixbuf
*screenshooter_capture_screenshot_wayland (gint region,
gint delay,
gboolean show_mouse,
gboolean show_border)
{
int n_monitors;
gboolean failure = FALSE;
GList *outputs = NULL;
ClientData client_data = {};
GdkPixbuf *screenshot = NULL;
if (region != FULLSCREEN)
{
screenshooter_error (_("The selected mode is not supported in Wayland"));
return NULL;
}
/* only fullscreen is supported for now */
TRACE ("Get the screenshot of the entire screen");
/* initializate the wayland client */
if (!screenshooter_initialize_client_data (&client_data))
{
screenshooter_free_client_data (&client_data);
return NULL;
}
/* collect outputs (monitors) */
n_monitors = gdk_display_get_n_monitors (gdk_display_get_default ());
for (int i = 0; i < n_monitors; i++)
{
GdkMonitor *monitor = gdk_display_get_monitor (gdk_display_get_default (), i);
struct wl_output *wl_output = gdk_wayland_monitor_get_wl_output (monitor);
if (wl_output == NULL)
{
g_warning ("No output available for monitor %d", i);
continue;
}
OutputData *output = g_new0 (OutputData, 1);
outputs = g_list_append (outputs, output);
output->monitor = monitor;
output->client_data = &client_data;
output->frame = zwlr_screencopy_manager_v1_capture_output (client_data.screencopy_manager, show_mouse, wl_output);
zwlr_screencopy_frame_v1_add_listener (output->frame, &frame_listener, output);
}
/* wait for the capture of all outputs */
while (TRUE)
{
gboolean done = TRUE;
for (GList *elem = outputs; elem; elem = elem->next)
{
OutputData *output = elem->data;
if (!output->capture_done && !output->capture_failed)
done = FALSE;
if (output->capture_failed)
failure = TRUE;
}
if (done)
break;
wl_display_dispatch (client_data.display);
}
/* check the result */
if (failure)
screenshooter_error (_("Failed to capture"));
else
screenshot = screenshooter_compose_screenshot (outputs);
screenshooter_free_client_data (&client_data);
g_list_free_full (outputs, screenshooter_free_output_data);
return screenshot;
}
/* $Id$
*
* Copyright © 2024 André Miranda <andreldm@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __HAVE_CAPTURE_WAYLAND_H__
#define __HAVE_CAPTURE_WAYLAND_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gdk/gdk.h>
GdkPixbuf
*screenshooter_capture_screenshot_wayland (gint region,
gint delay,
gboolean show_mouse,
gboolean show_border);
#endif
This diff is collapsed.
/* $Id$ /* $Id$
* *
* Copyright © 2009 Sebastian Waisbrot <seppo0010@gmail.com> * Copyright © 2008-2009 Jérôme Guelfucci <jeromeg@xfce.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -15,22 +15,23 @@ ...@@ -15,22 +15,23 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* */ */
#ifndef __HAVE_IMGUR_H__ #ifndef __HAVE_CAPTURE_X11_H__
#define __HAVE_IMGUR_H__ #define __HAVE_CAPTURE_X11_H__
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <glib.h> #include <gdk/gdk.h>
#include <glib/gstdio.h>
#include "screenshooter-utils.h"
#include "screenshooter-simple-job.h"
gboolean screenshooter_upload_to_imgur (const gchar *image_path,
const gchar *title); GdkPixbuf
*screenshooter_capture_screenshot_x11 (gint region,
gint delay,
gboolean show_mouse,
gboolean show_border);
#endif #endif
This diff is collapsed.
/* $Id$ /* $Id$
* *
* Copyright © 2008-2009 Jérôme Guelfucci <jeromeg@xfce.org> * Copyright © 2024 André Miranda <andreldm@xfce.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -24,19 +24,7 @@ ...@@ -24,19 +24,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include "screenshooter-global.h" #include <gdk/gdk.h>
#ifdef HAVE_XFIXES
#include <X11/extensions/Xfixes.h>
#endif
#include <X11/extensions/shape.h>
#include <X11/extensions/XInput2.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <glib.h>
#include <unistd.h>
#include <libxfce4util/libxfce4util.h>
...@@ -44,7 +32,6 @@ GdkPixbuf ...@@ -44,7 +32,6 @@ GdkPixbuf
*screenshooter_capture_screenshot (gint region, *screenshooter_capture_screenshot (gint region,
gint delay, gint delay,
gboolean show_mouse, gboolean show_mouse,
gboolean show_border, gboolean show_border);
gboolean plugin);
#endif #endif
/* $Id$
*
* Copyright © 2022 Yogesh Kaushik <masterlukeskywalker02@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* */
#include "screenshooter-custom-actions.h"
#include <xfconf/xfconf.h>
#include <libxfce4ui/libxfce4ui.h>
static gchar**
screenshooter_parse_envp (gchar **cmd)
{
gchar **vars;
gchar **envp;
gint offset = 0;
vars = g_strsplit (*cmd, " ", -1);
envp = g_get_environ ();
for (gint n = 0; vars[n] != NULL; ++n)
{
gchar *var, *val;
gchar *index = g_strrstr (vars[n], "=");
if (index == NULL)
break;
offset += strlen (vars[n]);
var = g_strndup (vars[n], index - vars[n]);
val = g_strdup (index + 1);
envp = g_environ_setenv (envp, var, val, TRUE);
g_free (var);
g_free (val);
}
if (offset > 0)
{
gchar *temp = g_strdup (*cmd + offset + 1);
g_free (*cmd);
*cmd = temp;
}
g_strfreev (vars);
return envp;
}
void
screenshooter_custom_action_save (GtkTreeModel *list_store)
{
GtkTreeIter iter;
gboolean valid;
gint32 max_id;
gint32 id = 0;
XfconfChannel *channel;
GError *error = NULL;
if (!xfconf_init (&error))
{
g_critical ("Failed to initialized xfconf");
g_error_free (error);
return;
}
channel = xfconf_channel_get ("xfce4-screenshooter");
max_id = xfconf_channel_get_int (channel, "/actions/actions", 0);
valid = gtk_tree_model_get_iter_first (list_store, &iter);
while (valid)
{
gchar *name;
gchar *command;
gchar *name_address;
gchar *command_address;
gtk_tree_model_get (list_store, &iter,
CUSTOM_ACTION_NAME, &name,
CUSTOM_ACTION_COMMAND, &command,
-1);
name_address = g_strdup_printf ("/actions/action-%d/name", id);
command_address = g_strdup_printf ("/actions/action-%d/command", id);
xfconf_channel_set_string (channel, name_address, name);
xfconf_channel_set_string (channel, command_address, command);
id++;
valid = gtk_tree_model_iter_next (list_store, &iter);
g_free (name);
g_free (command);
g_free (name_address);
g_free (command_address);
}
for (gint32 i = id; i < max_id; i++)
{
gchar *property;
property = g_strdup_printf ("/actions/action-%d", i);
xfconf_channel_reset_property (channel, property, TRUE);
g_free (property);
}
xfconf_channel_set_int (channel, "/actions/actions", id);
xfconf_shutdown ();
}
void
screenshooter_custom_action_load (GtkListStore *list_store)
{
gint32 max_id;
gint32 id;
XfconfChannel *channel;
GtkTreeIter iter;
GError *error = NULL;
gboolean imgur_found = FALSE;
if (!xfconf_init (&error))
{
g_critical ("Failed to initialized xfconf");
g_error_free (error);
return;
}
channel = xfconf_channel_get ("xfce4-screenshooter");
max_id = xfconf_channel_get_int (channel, "/actions/actions", 0);
for (id = 0; id < max_id; id++)
{
gchar *name;
gchar *command;
gchar *name_address;
gchar *command_address;
name_address = g_strdup_printf ("/actions/action-%d/name", id);
command_address = g_strdup_printf ("/actions/action-%d/command", id);
name = xfconf_channel_get_string (channel, name_address, "");
command = xfconf_channel_get_string (channel, command_address, "");
/* Do not load action if that's the removed imgur upload script */
if (g_strrstr (command, "imgur-upload.sh") != NULL)
{
imgur_found = TRUE;
}
else
{
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (GTK_LIST_STORE (list_store), &iter, CUSTOM_ACTION_NAME, name, CUSTOM_ACTION_COMMAND, command, -1);
}
g_free (name);
g_free (command);
g_free (name_address);
g_free (command_address);
}
/* TODO remove after a few releases */
xfconf_channel_reset_property (channel, "/imgur-custom-action-added", FALSE);
if (imgur_found)
screenshooter_custom_action_save (GTK_TREE_MODEL (list_store));
xfconf_shutdown ();
}
void
screenshooter_custom_action_execute (gchar *save_location,
gchar *name,
gchar *command)
{
gchar **split;
gchar **argv;
gchar **envp;
gchar *formatted_command;
gchar *expanded_command;
gchar *save_location_quoted;
GError *error = NULL;
if (g_strcmp0 (name, "none") == 0 ||
g_strcmp0 (command, "none") == 0 ||
g_strcmp0 (name, "") == 0 ||
g_strcmp0 (command, "") == 0)
{
xfce_dialog_show_warning (NULL, _("Unable to execute the custom action"), _("Invalid custom action selected"));
return;
}
/* Replace %f placeholder */
split = g_strsplit (command, "\%f", -1);
save_location_quoted = g_shell_quote (save_location);
formatted_command = g_strjoinv (save_location_quoted, split);
g_free (save_location_quoted);
g_strfreev (split);
expanded_command = xfce_expand_variables (formatted_command, NULL);
envp = screenshooter_parse_envp (&expanded_command);
if (G_LIKELY (g_shell_parse_argv (expanded_command, NULL, &argv, &error)))
if (!g_spawn_async (NULL, argv, envp, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to run the custom action %s"), name);
g_error_free (error);
}
g_free (formatted_command);
g_free (expanded_command);
g_strfreev (argv);
g_strfreev (envp);
}