Merge branch '1.4'

This commit is contained in:
Cristian Henzel 2011-05-21 20:19:18 +03:00
commit f825a9d128
19 changed files with 518 additions and 129 deletions

View File

@ -1,3 +1,33 @@
ClipIt-1.4.0-20110521001 - 21 May. 2011
+ Added: We are now using the shipped icon in the systray.
ClipIt-1.4.0-20110520002 - 20 May. 2011
+ Fixed: Remove duplicate truncate_history functionality.
+ Added: Added basic history item structure.
ClipIt-1.4.0-20110520001 - 20 May. 2011
+ Fixed: Deleted items are now properly removed from the history.
+ Fixed: Double clicking an item in the "Manage history" dialog now
properly selects it again.
+ Added: [Enter] (for selecting the item) and [Delete] (for removing
the item(s)) now works in the "Manage history" dialog.
ClipIt-1.4.0-20110518002 - 18 May. 2011
+ Added: Also added 1-0 shortcuts to the history menu.
ClipIt-1.4.0-20110518001 - 18 May. 2011
+ Fixed: Re-enabled indicator support.
+ Added: We are now installing a sepparate icon for clipit (not using it
yet, though).
+ Added: Search as you type in "Manage history" dialog.
+ Added: 1-0 shortcuts for fast selecting of menu items.
+ Added: Possiblity to select multiple items for deletion in the
"Manage history" dialog.
ClipIt-1.4.0-20110506001 - 06 May. 2011
+ Added: Added option to automatically paste an entry after selecting it.
+ Fixed: Re-enabled indicator since it should now work properly.
ClipIt-1.3.13-20110503001 - 03 May. 2011 ClipIt-1.3.13-20110503001 - 03 May. 2011
+ Fixed: Bug in the indicator code that makes ClipIt crash X under + Fixed: Bug in the indicator code that makes ClipIt crash X under
certain circumstances. certain circumstances.
@ -64,25 +94,26 @@ ClipIt-v1.3.3-23112010001 - 23 Nov. 2010
item properly. item properly.
ClipIt-v1.3.2-22112010001 - 22 Nov. 2010 ClipIt-v1.3.2-22112010001 - 22 Nov. 2010
+ Fixed: Fixed most of the markup and indentation (replaced double spaces + Fixed: Fixed most of the markup and indentation (replaced double
with tabs). spaces with tabs).
+ Fixed: Removed clipboard restoring from history, as this seems to cause + Fixed: Removed clipboard restoring from history, as this seems to
more problems than it solves. cause more problems than it solves.
ClipIt-v1.3.1-17112010001 - 17 Nov. 2010 ClipIt-v1.3.1-17112010001 - 17 Nov. 2010
+ Added: Added autostart support for LXDE. + Added: Added autostart support for LXDE.
+ Fixed: Fixed problem with "Edit" window not appearing. + Fixed: Fixed problem with "Edit" window not appearing.
ClipIt-v1.3.0-14112010001 - 14 Nov. 2010 ClipIt-v1.3.0-14112010001 - 14 Nov. 2010
+ Added: Added "Edit" and "Remove" buttons to the "Manage History" dialog. + Added: Added "Edit" and "Remove" buttons to the "Manage History"
dialog.
+ Fixed: Major speed improvements for big history entries while: + Fixed: Major speed improvements for big history entries while:
searching through the history; searching through the history;
populating the "Manage History" dialog; populating the "Manage History" dialog;
generating the popup menus; generating the popup menus;
All of these should now be more than 99% faster, at the expense All of these should now be more than 99% faster, at the expense
of an (at most) 1MB overhead. I think it's worth it, though. of an (at most) 1MB overhead. I think it's worth it, though.
+ Fixed: Fixed a drawing issue with the small history menu when activated + Fixed: Fixed a drawing issue with the small history menu when
by clicking on the systray icon. activated by clicking on the systray icon.
ClipIt-v1.2.6-12112010003 - 12 Nov. 2010 ClipIt-v1.2.6-12112010003 - 12 Nov. 2010
+ Fixed: Removed reference to pthread.h from configure.in. + Fixed: Removed reference to pthread.h from configure.in.
@ -91,8 +122,8 @@ ClipIt-v1.2.6-12112010003 - 12 Nov. 2010
ClipIt-v1.2.5-12112010002 - 12 Nov. 2010 ClipIt-v1.2.5-12112010002 - 12 Nov. 2010
+ Fixed: Now using autopoint instead of gettextize to avoid waiting for + Fixed: Now using autopoint instead of gettextize to avoid waiting for
user input. user input.
+ Fixed: Added AM_MAINTAINER_MODE, to get rid of the disable-maintainer-mode + Fixed: Added AM_MAINTAINER_MODE, to get rid of the
warning. disable-maintainer-mode warning.
+ Fixed: Fixed a small typo in main.c. + Fixed: Fixed a small typo in main.c.
+ Fixed: removed dependency of pthread.h (the pthread_exit function that + Fixed: removed dependency of pthread.h (the pthread_exit function that
we use is also included in glib.h). we use is also included in glib.h).
@ -135,9 +166,10 @@ ClipIt-v1.0.0-05112010001 - 05 Nov. 2010
+ Created "Small history" for quick access to last used items. + Created "Small history" for quick access to last used items.
+ Renamed the old history to "Full history". + Renamed the old history to "Full history".
+ "Full history" can now hold up to 1000 items. + "Full history" can now hold up to 1000 items.
+ Ability to put the button for the "Full history" in the systray + Ability to put the button for the "Full history" in the
menu. systray menu.
+ Created a Search function, which allows searching through history. + Created a Search function, which allows searching through
history.
+ Added Search hotkey. + Added Search hotkey.
+ Created Exceptions: + Created Exceptions:
you can enter C or Perl regex into the window and you can enter C or Perl regex into the window and

View File

@ -11,6 +11,7 @@ EXTRA_DIST = \
m4/ChangeLog \ m4/ChangeLog \
$(desktop_DATA) \ $(desktop_DATA) \
$(autostart_DATA) \ $(autostart_DATA) \
$(pixmaps_DATA) \
intltool-merge.in \ intltool-merge.in \
intltool-update.in \ intltool-update.in \
intltool-extract.in intltool-extract.in

View File

@ -259,6 +259,7 @@ EXTRA_DIST = \
m4/ChangeLog \ m4/ChangeLog \
$(desktop_DATA) \ $(desktop_DATA) \
$(autostart_DATA) \ $(autostart_DATA) \
$(pixmaps_DATA) \
intltool-merge.in \ intltool-merge.in \
intltool-update.in \ intltool-update.in \
intltool-extract.in intltool-extract.in

2
TODO
View File

@ -4,4 +4,4 @@
actually use that return value to display an error if there was one. actually use that return value to display an error if there was one.
+ Redo Preferences dialog. + Redo Preferences dialog.
+ Clean up the code and indent it properly. + Clean up the code and indent it properly.
+ Move all pop-up and menu functions from main.c to menus.c. + history structure has to be changed in: main.c, manage.c, history.c

20
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for clipit 1.3.13. # Generated by GNU Autoconf 2.67 for clipit 1.4.0.
# #
# Report bugs to <oss@rspwn.com>. # Report bugs to <oss@rspwn.com>.
# #
@ -552,8 +552,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='clipit' PACKAGE_NAME='clipit'
PACKAGE_TARNAME='clipit' PACKAGE_TARNAME='clipit'
PACKAGE_VERSION='1.3.13' PACKAGE_VERSION='1.4.0'
PACKAGE_STRING='clipit 1.3.13' PACKAGE_STRING='clipit 1.4.0'
PACKAGE_BUGREPORT='oss@rspwn.com' PACKAGE_BUGREPORT='oss@rspwn.com'
PACKAGE_URL='' PACKAGE_URL=''
@ -1328,7 +1328,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures clipit 1.3.13 to adapt to many kinds of systems. \`configure' configures clipit 1.4.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1398,7 +1398,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of clipit 1.3.13:";; short | recursive ) echo "Configuration of clipit 1.4.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1511,7 +1511,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
clipit configure 1.3.13 clipit configure 1.4.0
generated by GNU Autoconf 2.67 generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
@ -1880,7 +1880,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by clipit $as_me 1.3.13, which was It was created by clipit $as_me 1.4.0, which was
generated by GNU Autoconf 2.67. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@ $ $0 $@
@ -2696,7 +2696,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE=clipit PACKAGE=clipit
VERSION=1.3.13 VERSION=1.4.0
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -9764,7 +9764,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by clipit $as_me 1.3.13, which was This file was extended by clipit $as_me 1.4.0, which was
generated by GNU Autoconf 2.67. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -9830,7 +9830,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
clipit config.status 1.3.13 clipit config.status 1.4.0
configured by $0, generated by GNU Autoconf 2.67, configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -2,7 +2,7 @@
# Autoconf/automake. # Autoconf/automake.
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
AC_PREREQ([2.5]) AC_PREREQ([2.5])
AC_INIT([clipit], [1.3.13], [oss@rspwn.com]) AC_INIT([clipit], [1.4.0], [oss@rspwn.com])
AM_INIT_AUTOMAKE([AC_PACKAGE_TARNAME()], [AC_PACKAGE_VERSION()]) AM_INIT_AUTOMAKE([AC_PACKAGE_TARNAME()], [AC_PACKAGE_VERSION()])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@ -37,7 +37,7 @@ APPINDICATOR_REQUIRED_VERSION=0.2.4
AC_ARG_ENABLE([appindicator], AC_ARG_ENABLE([appindicator],
AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators]), AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators]),
[enable_appindicator=$enableval], [enable_appindicator=$enableval],
[enable_appindicator="no"]) [enable_appindicator="auto"])
if test x$enable_appindicator = xauto ; then if test x$enable_appindicator = xauto ; then

View File

@ -8,9 +8,13 @@ autostartdir = $(sysconfdir)/xdg/autostart
autostart_in_file = clipit-startup.desktop.in autostart_in_file = clipit-startup.desktop.in
autostart_DATA = $(autostart_in_file:.desktop.in=.desktop) autostart_DATA = $(autostart_in_file:.desktop.in=.desktop)
pixmapsdir = $(datarootdir)/pixmaps/clipit
pixmaps_DATA = trayicon.svg
EXTRA_DIST = \ EXTRA_DIST = \
$(desktop_in_file) \ $(desktop_in_file) \
$(autostart_in_file) $(autostart_in_file) \
$(pixmaps_DATA)
CLEANFILES = \ CLEANFILES = \
$(desktop_DATA) \ $(desktop_DATA) \

View File

@ -73,8 +73,8 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(autostartdir)" \ am__installdirs = "$(DESTDIR)$(autostartdir)" \
"$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pixmapsdir)"
DATA = $(autostart_DATA) $(desktop_DATA) DATA = $(autostart_DATA) $(desktop_DATA) $(pixmaps_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
ALL_LINGUAS = @ALL_LINGUAS@ ALL_LINGUAS = @ALL_LINGUAS@
@ -224,9 +224,12 @@ desktop_DATA = $(desktop_in_file:.desktop.in=.desktop)
autostartdir = $(sysconfdir)/xdg/autostart autostartdir = $(sysconfdir)/xdg/autostart
autostart_in_file = clipit-startup.desktop.in autostart_in_file = clipit-startup.desktop.in
autostart_DATA = $(autostart_in_file:.desktop.in=.desktop) autostart_DATA = $(autostart_in_file:.desktop.in=.desktop)
pixmapsdir = $(datarootdir)/pixmaps/clipit
pixmaps_DATA = trayicon.svg
EXTRA_DIST = \ EXTRA_DIST = \
$(desktop_in_file) \ $(desktop_in_file) \
$(autostart_in_file) $(autostart_in_file) \
$(pixmaps_DATA)
CLEANFILES = \ CLEANFILES = \
$(desktop_DATA) \ $(desktop_DATA) \
@ -309,6 +312,26 @@ uninstall-desktopDATA:
test -n "$$files" || exit 0; \ test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \ echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(desktopdir)" && rm -f $$files cd "$(DESTDIR)$(desktopdir)" && rm -f $$files
install-pixmapsDATA: $(pixmaps_DATA)
@$(NORMAL_INSTALL)
test -z "$(pixmapsdir)" || $(MKDIR_P) "$(DESTDIR)$(pixmapsdir)"
@list='$(pixmaps_DATA)'; test -n "$(pixmapsdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pixmapsdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pixmapsdir)" || exit $$?; \
done
uninstall-pixmapsDATA:
@$(NORMAL_UNINSTALL)
@list='$(pixmaps_DATA)'; test -n "$(pixmapsdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pixmapsdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pixmapsdir)" && rm -f $$files
tags: TAGS tags: TAGS
TAGS: TAGS:
@ -350,7 +373,7 @@ check-am: all-am
check: check-am check: check-am
all-am: Makefile $(DATA) all-am: Makefile $(DATA)
installdirs: installdirs:
for dir in "$(DESTDIR)$(autostartdir)" "$(DESTDIR)$(desktopdir)"; do \ for dir in "$(DESTDIR)$(autostartdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pixmapsdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done done
install: install-am install: install-am
@ -400,7 +423,8 @@ info: info-am
info-am: info-am:
install-data-am: install-autostartDATA install-desktopDATA install-data-am: install-autostartDATA install-desktopDATA \
install-pixmapsDATA
install-dvi: install-dvi-am install-dvi: install-dvi-am
@ -444,7 +468,8 @@ ps: ps-am
ps-am: ps-am:
uninstall-am: uninstall-autostartDATA uninstall-desktopDATA uninstall-am: uninstall-autostartDATA uninstall-desktopDATA \
uninstall-pixmapsDATA
.MAKE: install-am install-strip .MAKE: install-am install-strip
@ -454,11 +479,12 @@ uninstall-am: uninstall-autostartDATA uninstall-desktopDATA
install-data-am install-desktopDATA install-dvi install-dvi-am \ install-data-am install-desktopDATA install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \ install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \ install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \ install-pdf-am install-pixmapsDATA install-ps install-ps-am \
installcheck installcheck-am installdirs maintainer-clean \ install-strip installcheck installcheck-am installdirs \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ maintainer-clean maintainer-clean-generic mostlyclean \
pdf-am ps ps-am uninstall uninstall-am uninstall-autostartDATA \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-desktopDATA uninstall-autostartDATA uninstall-desktopDATA \
uninstall-pixmapsDATA
@INTLTOOL_DESKTOP_RULE@ @INTLTOOL_DESKTOP_RULE@

191
data/trayicon.svg Normal file
View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="48"
height="48"
id="svg2">
<defs
id="defs4">
<linearGradient
id="linearGradient3620">
<stop
id="stop3622"
style="stop-color:#9d7d53;stop-opacity:1"
offset="0" />
<stop
id="stop3624"
style="stop-color:#ad8757;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3846">
<stop
id="stop3848"
style="stop-color:#c1a581;stop-opacity:1"
offset="0" />
<stop
id="stop3850"
style="stop-color:#9b784b;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="24.467497"
y1="0.47814167"
x2="25.464664"
y2="70.020134"
id="linearGradient4545"
xlink:href="#linearGradient3846"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.54289087,0,0,0.48890703,-0.0291956,-18.233335)" />
<linearGradient
id="linearGradient3600">
<stop
id="stop3602"
style="stop-color:#f4f4f4;stop-opacity:1"
offset="0" />
<stop
id="stop3604"
style="stop-color:#dbdbdb;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3931">
<stop
id="stop3933"
style="stop-color:#747671;stop-opacity:1"
offset="0" />
<stop
id="stop3935"
style="stop-color:#cbcbcb;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="25.132275"
y1="6.7287393"
x2="25.132275"
y2="47.013336"
id="linearGradient3192"
xlink:href="#linearGradient3600"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.5428805,0,0,0.4889072,18.970867,-6.233341)" />
<linearGradient
x1="-64.247643"
y1="14.969027"
x2="-22.573992"
y2="-19.797691"
id="linearGradient3194"
xlink:href="#linearGradient3931"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.4383743,0,0,0.4575444,51.223522,-6.778219)" />
<linearGradient
id="linearGradient3269">
<stop
id="stop3271"
style="stop-color:#787878;stop-opacity:1"
offset="0" />
<stop
id="stop3273"
style="stop-color:#bebebe;stop-opacity:1"
offset="0.34446934" />
<stop
id="stop3275"
style="stop-color:#c8c8c8;stop-opacity:1"
offset="0.3731544" />
<stop
id="stop3277"
style="stop-color:#e6e6e6;stop-opacity:1"
offset="0.48990577" />
<stop
id="stop3279"
style="stop-color:#8c8c8c;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3257">
<stop
id="stop3261"
style="stop-color:#787878;stop-opacity:1"
offset="0" />
<stop
id="stop3263"
style="stop-color:#828282;stop-opacity:1"
offset="0.36563665" />
<stop
id="stop3265"
style="stop-color:#aaaaaa;stop-opacity:1"
offset="0.46209824" />
<stop
id="stop3922"
style="stop-color:#6a6a6a;stop-opacity:1"
offset="0.59657371" />
<stop
id="stop3920"
style="stop-color:#787878;stop-opacity:1"
offset="0.73104912" />
<stop
id="stop3267"
style="stop-color:#464646;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="321.40091"
y1="83.497276"
x2="321.57819"
y2="96.245491"
id="linearGradient2964"
xlink:href="#linearGradient3269"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.41034562,0,0,0.51289447,-114.89528,-62.82218)" />
<linearGradient
x1="22.451862"
y1="26.645382"
x2="22.451862"
y2="40.185558"
id="linearGradient2966"
xlink:href="#linearGradient3257"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.41182453,0,0,0.51282072,6.5443502,-34.097634)" />
<linearGradient
x1="9.3157892"
y1="16"
x2="9.7894735"
y2="-17.999569"
id="linearGradient3626"
xlink:href="#linearGradient3620"
gradientUnits="userSpaceOnUse" />
</defs>
<g
transform="translate(0,24)"
id="layer1">
<path
d="m 3.4995742,-17.499994 26.0008518,4.3e-4 0,32.99999 -26.0008518,0 0,-33.00042 z"
id="rect2594"
style="fill:url(#linearGradient4545);fill-opacity:1;stroke:url(#linearGradient3626);stroke-width:0.99914837;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline" />
<path
d="m 4.5,-16.5 24,0 0,31 -24,0 0,-31 z"
id="path3852"
style="opacity:0.15;fill:none;stroke:#ffffff;stroke-width:0.99914837;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline" />
<path
d="m 22.49957,-5.5 22.00043,4.3e-4 0,27.000001 -22.00043,0 0,-27.000431 z"
id="path3064"
style="fill:url(#linearGradient3192);fill-opacity:1;stroke:url(#linearGradient3194);stroke-width:0.99913895;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline" />
<path
d="m 25,-1.99957 1.359538,0 0,1.00000002 -1.359538,0 0,-1.00000002 z m 1.544729,0 1.282784,0 0,1.00000002 -1.282784,0 0,-1.00000002 z m 1.467975,0 1.129269,0 0,1.00000002 -1.129269,0 0,-1.00000002 z m 1.314458,0 0.496023,0 0,1.00000002 -0.496023,0 0,-1.00000002 z m 0.68122,0 1.110075,0 0,1.00000002 -1.110075,0 0,-1.00000002 z m 1.295272,0 2.875482,0 0,1.00000002 -2.875482,0 0,-1.00000002 z m 3.060674,0 2.184672,0 0,1.00000002 -2.184672,0 0,-1.00000002 z m -9.364328,6 1.315079,0 0,1 -1.315079,0 0,-1 z m 1.494213,0 1.240835,0 0,1 -1.240835,0 0,-1 z m 1.419971,0 1.092338,0 0,1 -1.092338,0 0,-1 z m 1.271472,0 0.479802,0 0,1 -0.479802,0 0,-1 z m 0.658943,0 1.073773,0 0,1 -1.073773,0 0,-1 z m 1.252914,0 2.781449,0 0,1 -2.781449,0 0,-1 z m 2.960584,0 2.113229,0 0,1 -2.113229,0 0,-1 z m 2.29237,0 0.646852,0 0,1 -0.646852,0 0,-1 z m 0.825993,0 1.277954,0 0,1 -1.277954,0 0,-1 z M 25,4.3102435e-4 l 2.038983,0 0,0.99999997565 -2.038983,0 0,-0.99999997565 z m 2.225084,0 0.980966,0 0,0.99999997565 -0.980966,0 0,-0.99999997565 z m 1.167067,0 0.461237,0 0,0.99999997565 -0.461237,0 0,-0.99999997565 z m 0.647339,0 0.888159,0 0,0.99999997565 -0.888159,0 0,-0.99999997565 z m 1.074254,0 0.888158,0 0,0.99999997565 -0.888158,0 0,-0.99999997565 z m 1.074258,0 1.426446,0 0,0.99999997565 -1.426446,0 0,-0.99999997565 z m 1.612542,0 1.871931,0 0,0.99999997565 -1.871931,0 0,-0.99999997565 z m 2.058032,0 1.25939,0 0,0.99999997565 -1.25939,0 0,-0.99999997565 z m 1.445492,0 0.294181,0 0,0.99999997565 -0.294181,0 0,-0.99999997565 z M 25,2.00043 l 2.33597,0 0,1 -2.33597,0 0,-1 z m 2.519087,0 2.503019,0 0,1 -2.503019,0 0,-1 z m 2.686137,0 0.99953,0 0,1 -0.99953,0 0,-1 z m 1.182648,0 2.354528,0 0,1 -2.354528,0 0,-1 z m 4.332824,0 0.628292,0 0,1 -0.628292,0 0,-1 z m -1.795178,0 1.61206,0 0,1 -1.61206,0 0,-1 z m 2.606587,0 0.36843,0 0,1 -0.36843,0 0,-1 z m 0.551548,0 0.99953,0 0,1 -0.99953,0 0,-1 z M 25,13.000431 l 2.335971,0 0,1 -2.335971,0 0,-1 z m 2.519087,0 2.503021,0 0,1 -2.503021,0 0,-1 z m 2.686139,0 0.99953,0 0,1 -0.99953,0 0,-1 z m 1.182648,0 2.354529,0 0,1 -2.354529,0 0,-1 z m 4.332825,0 0.628293,0 0,1 -0.628293,0 0,-1 z m -1.795178,0 1.612061,0 0,1 -1.612061,0 0,-1 z m 2.606588,0 0.368431,0 0,1 -0.368431,0 0,-1 z m 0.551548,0 0.999531,0 0,1 -0.999531,0 0,-1 z M 25,8.00043 l 1.68631,0 0,1 -1.68631,0 0,-1 z m 1.865451,0 2.800009,0 0,1 -2.800009,0 0,-1 z m 2.979151,0 1.352197,0 0,1 -1.352197,0 0,-1 z m 2.969866,0 1.073775,0 0,1 -1.073775,0 0,-1 z m 1.252915,0 1.723435,0 0,1 -1.723435,0 0,-1 z m 1.902569,0 2.800015,0 0,1 -2.800015,0 0,-1 z m -4.594014,0 1.259396,0 0,1 -1.259396,0 0,-1 z M 25,11.000431 l 2.11323,0 0,1 -2.11323,0 0,-1 z m 2.287728,0 0.665418,0 0,1 -0.665418,0 0,-1 z m 0.839914,0 1.519259,0 0,1 -1.519259,0 0,-1 z m 1.693755,0 1.036655,0 0,1 -1.036655,0 0,-1 z m 1.211152,0 1.036649,0 0,1 -1.036649,0 0,-1 z m 1.211151,0 1.500695,0 0,1 -1.500695,0 0,-1 z m 1.675185,0 0.312751,0 0,1 -0.312751,0 0,-1 z m 0.487248,0 1.946174,0 0,1 -1.946174,0 0,-1 z m 2.120671,0 1.036654,0 0,1 -1.036654,0 0,-1 z m -11.526804,4 0.851034,0 0,1 -0.851034,0 0,-1 z m 1.071276,0 3.096997,0 0,1 -3.096997,0 0,-1 z m 7.458746,0 -0.851034,0 0,1 0.851034,0 0,-1 z m -1.071276,0 -3.096997,0 0,1 3.096997,0 0,-1 z"
id="path2950"
style="opacity:0.7;fill:#666666;fill-opacity:1;stroke:none;display:inline" />
<path
d="m 14.500502,-21.508 c 0.046,1.844225 -0.184182,5.989238 -1.815947,6.055813 -0.239147,0.513498 -0.363701,1.747107 0.218221,1.952187 l 7.437468,0 c 0.47136,-0.186897 0.01956,-1.708469 0,-1.879447 -1.831768,-0.173895 -1.787106,-4.324162 -1.787106,-6.128553 l -4.052636,0 z"
id="path4675"
style="fill:url(#linearGradient2964);fill-opacity:1;stroke:url(#linearGradient2966);stroke-width:0.99827468;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0.50000001;display:inline;enable-background:new" />
<path
d="m 16.657514,4.3922276 a 0.32733107,0.1818506 0 1 1 -0.654662,0 0.32733107,0.1818506 0 1 1 0.654662,0 z"
transform="matrix(0.50261493,0,0,0.90470684,8.2922062,-23.473678)"
id="path3897"
style="fill:none;stroke:#ffffff;stroke-width:0.995;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@ -1,4 +1,6 @@
AM_CFLAGS = -I$(top_srcdir) -DCLIPITLOCALEDIR=\""$(clipitlocaledir)"\" AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -DCLIPITLOCALEDIR=\""$(clipitlocaledir)"\" \
-DCLIPITPIXMAPSDIR=\""$(datarootdir)"/pixmaps/clipit\"
INCLUDES = $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS) INCLUDES = $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS)
LDADD = $(GTK_LIBS) $(APPINDICATOR_LIBS) $(X11_LIBS) LDADD = $(GTK_LIBS) $(APPINDICATOR_LIBS) $(X11_LIBS)
AM_LDFLAGS = -Wl,--as-needed AM_LDFLAGS = -Wl,--as-needed
@ -8,11 +10,11 @@ bin_PROGRAMS = clipit
DISTCLEANFILES = *.bak *.log *~ .deps/*.P DISTCLEANFILES = *.bak *.log *~ .deps/*.P
clipit_SOURCES = main.c main.h \ clipit_SOURCES = main.c main.h \
utils.c utils.h \ utils.c utils.h \
clipit-i18n.h\ clipit-i18n.h\
daemon.c daemon.h \ daemon.c daemon.h \
history.c history.h \ history.c history.h \
keybinder.c keybinder.h \ keybinder.c keybinder.h \
preferences.c preferences.h \ preferences.c preferences.h \
manage.c manage.h \ manage.c manage.h \
eggaccelerators.c eggaccelerators.h eggaccelerators.c eggaccelerators.h

View File

@ -215,20 +215,23 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
AM_CFLAGS = -I$(top_srcdir) -DCLIPITLOCALEDIR=\""$(clipitlocaledir)"\" AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -DCLIPITLOCALEDIR=\""$(clipitlocaledir)"\" \
-DCLIPITPIXMAPSDIR=\""$(datarootdir)"/pixmaps/clipit\"
INCLUDES = $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS) INCLUDES = $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS)
LDADD = $(GTK_LIBS) $(APPINDICATOR_LIBS) $(X11_LIBS) LDADD = $(GTK_LIBS) $(APPINDICATOR_LIBS) $(X11_LIBS)
AM_LDFLAGS = -Wl,--as-needed AM_LDFLAGS = -Wl,--as-needed
DISTCLEANFILES = *.bak *.log *~ .deps/*.P DISTCLEANFILES = *.bak *.log *~ .deps/*.P
clipit_SOURCES = main.c main.h \ clipit_SOURCES = main.c main.h \
utils.c utils.h \ utils.c utils.h \
clipit-i18n.h\ clipit-i18n.h\
daemon.c daemon.h \ daemon.c daemon.h \
history.c history.h \ history.c history.h \
keybinder.c keybinder.h \ keybinder.c keybinder.h \
preferences.c preferences.h \ preferences.c preferences.h \
manage.c manage.h \ manage.c manage.h \
eggaccelerators.c eggaccelerators.h eggaccelerators.c eggaccelerators.h
all: all-am all: all-am

View File

@ -33,7 +33,7 @@
GSList *history; GSList *history;
/* Reads history from DATADIR/clipit/history */ /* Reads history from DATADIR/clipit/history */
void read_history () void read_history()
{ {
/* Build file path */ /* Build file path */
gchar *history_path = g_build_filename(g_get_user_data_dir(), gchar *history_path = g_build_filename(g_get_user_data_dir(),
@ -140,18 +140,7 @@ void check_and_append(gchar *item)
void append_item(gchar *item) void append_item(gchar *item)
{ {
history = g_slist_prepend(history, g_strdup(item)); history = g_slist_prepend(history, g_strdup(item));
/* Shorten history if necessary */ truncate_history();
GSList *last_possible_element = g_slist_nth(history,
prefs.history_limit - 1);
if (last_possible_element)
{
/* Free last posible element and subsequent elements */
g_slist_free(last_possible_element->next);
last_possible_element->next = NULL;
}
/* Save changes */
if (prefs.save_history)
save_history();
} }
/* Truncates history to history_limit items */ /* Truncates history to history_limit items */

View File

@ -32,21 +32,26 @@ G_BEGIN_DECLS
* 1 GB of RAM. If you don't want that, set this lower. */ * 1 GB of RAM. If you don't want that, set this lower. */
#define ENTRY_MAX_SIZE 1048576 #define ENTRY_MAX_SIZE 1048576
extern GSList* history; typedef struct {
gboolean is_static;
gpointer content;
} history_item;
extern GSList *history;
void read_history(); void read_history();
void save_history(); void save_history();
void check_and_append(gchar* item); void check_and_append(gchar *item);
void append_item(gchar* item); void append_item(gchar *item);
void truncate_history(); void truncate_history();
gpointer get_last_item(); gpointer get_last_item();
void delete_duplicate(gchar* item); void delete_duplicate(gchar *item);
G_END_DECLS G_END_DECLS

View File

@ -26,6 +26,7 @@
#include <glib.h> #include <glib.h>
#include <stdlib.h> #include <stdlib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <X11/keysym.h>
#ifdef HAVE_APPINDICATOR #ifdef HAVE_APPINDICATOR
#include <libappindicator/app-indicator.h> #include <libappindicator/app-indicator.h>
#endif #endif
@ -43,6 +44,7 @@ static gchar* clipboard_text;
static gchar* synchronized_text; static gchar* synchronized_text;
static GtkClipboard* primary; static GtkClipboard* primary;
static GtkClipboard* clipboard; static GtkClipboard* clipboard;
static char *trayicon_path;
#ifdef HAVE_APPINDICATOR #ifdef HAVE_APPINDICATOR
static AppIndicator *indicator; static AppIndicator *indicator;
static GtkWidget *indicator_menu = NULL; static GtkWidget *indicator_menu = NULL;
@ -55,13 +57,13 @@ static gboolean status_menu_lock = FALSE;
static gboolean actions_lock = FALSE; static gboolean actions_lock = FALSE;
/* Init preferences structure */ /* Init preferences structure */
prefs_t prefs = {DEF_USE_COPY, DEF_USE_PRIMARY, DEF_SYNCHRONIZE, prefs_t prefs = {DEF_USE_COPY, DEF_USE_PRIMARY, DEF_SYNCHRONIZE,
DEF_SHOW_INDEXES, DEF_SAVE_URIS, DEF_SAVE_HISTORY, DEF_AUTOMATIC_PASTE, DEF_SHOW_INDEXES, DEF_SAVE_URIS,
DEF_HISTORY_LIMIT, DEF_ITEMS_MENU, DEF_HYPERLINKS_ONLY, DEF_SAVE_HISTORY, DEF_HISTORY_LIMIT, DEF_ITEMS_MENU,
DEF_CONFIRM_CLEAR, DEF_SINGLE_LINE, DEF_REVERSE_HISTORY, DEF_HYPERLINKS_ONLY, DEF_CONFIRM_CLEAR, DEF_SINGLE_LINE,
DEF_ITEM_LENGTH, DEF_ELLIPSIZE, INIT_HISTORY_KEY, DEF_REVERSE_HISTORY, DEF_ITEM_LENGTH, DEF_ELLIPSIZE,
INIT_ACTIONS_KEY, INIT_MENU_KEY, INIT_SEARCH_KEY, INIT_HISTORY_KEY, INIT_ACTIONS_KEY, INIT_MENU_KEY,
DEF_NO_ICON}; INIT_SEARCH_KEY, DEF_NO_ICON};
/* Called every CHECK_INTERVAL seconds to check for new items */ /* Called every CHECK_INTERVAL seconds to check for new items */
static gboolean item_check(gpointer data) static gboolean item_check(gpointer data)
@ -194,6 +196,15 @@ static gboolean item_check(gpointer data)
return TRUE; return TRUE;
} }
static void set_icon_paths() {
gchar *pixmap_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), DATA_DIR, "pixmaps", NULL);
gchar *test_path = g_build_path(G_DIR_SEPARATOR_S, pixmap_dir, "trayicon.svg", NULL);
if (g_file_test(test_path, G_FILE_TEST_EXISTS))
trayicon_path = test_path;
else
trayicon_path = g_build_path(G_DIR_SEPARATOR_S, CLIPITPIXMAPSDIR, "trayicon.svg", NULL);
}
/* Thread function called for each action performed */ /* Thread function called for each action performed */
static void *execute_action(void *command) static void *execute_action(void *command)
{ {
@ -256,6 +267,17 @@ static void item_selected(GtkMenuItem *menu_item, gpointer user_data)
GSList* element = g_slist_nth(history, GPOINTER_TO_INT(user_data)); GSList* element = g_slist_nth(history, GPOINTER_TO_INT(user_data));
gtk_clipboard_set_text(clipboard, (gchar*)element->data, -1); gtk_clipboard_set_text(clipboard, (gchar*)element->data, -1);
gtk_clipboard_set_text(primary, (gchar*)element->data, -1); gtk_clipboard_set_text(primary, (gchar*)element->data, -1);
/* Paste the clipboard contents automatically if enabled */
if (prefs.automatic_paste) {
gchar* cmd = g_strconcat("/bin/sh -c 'xdotool key ctrl+v'", NULL);
GPid pid;
gchar **argv;
g_shell_parse_argv(cmd, NULL, &argv, NULL);
g_free(cmd);
g_spawn_async(NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL);
g_child_watch_add(pid, (GChildWatchFunc)action_exit, NULL);
g_strfreev(argv);
}
} }
/* Clears all local data (specific to main.c) */ /* Clears all local data (specific to main.c) */
@ -465,6 +487,53 @@ static gboolean show_actions_menu(gpointer data)
return FALSE; return FALSE;
} }
static gboolean menu_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
switch (event->keyval) {
case XK_0:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(9));
gtk_widget_destroy(widget);
break;
case XK_1:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(0));
gtk_widget_destroy(widget);
break;
case XK_2:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(1));
gtk_widget_destroy(widget);
break;
case XK_3:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(2));
gtk_widget_destroy(widget);
break;
case XK_4:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(3));
gtk_widget_destroy(widget);
break;
case XK_5:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(4));
gtk_widget_destroy(widget);
break;
case XK_6:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(5));
gtk_widget_destroy(widget);
break;
case XK_7:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(6));
gtk_widget_destroy(widget);
break;
case XK_8:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(7));
gtk_widget_destroy(widget);
break;
case XK_9:
item_selected((GtkMenuItem*)widget, GINT_TO_POINTER(8));
gtk_widget_destroy(widget);
break;
}
return FALSE;
}
/* Generates the small history menu */ /* Generates the small history menu */
static gboolean show_history_menu(gpointer data) static gboolean show_history_menu(gpointer data)
{ {
@ -474,6 +543,7 @@ static gboolean show_history_menu(gpointer data)
/* Create the menu */ /* Create the menu */
menu = gtk_menu_new(); menu = gtk_menu_new();
g_signal_connect((GObject*)menu, "selection-done", (GCallback)gtk_widget_destroy, NULL); g_signal_connect((GObject*)menu, "selection-done", (GCallback)gtk_widget_destroy, NULL);
g_signal_connect((GObject*)menu, "key-press-event", (GCallback)menu_key_pressed, NULL);
/* Items */ /* Items */
if ((history != NULL) && (history->data != NULL)) if ((history != NULL) && (history->data != NULL))
{ {
@ -693,6 +763,7 @@ static gboolean show_clipit_menu()
/* Create the menu */ /* Create the menu */
statusicon_menu = gtk_menu_new(); statusicon_menu = gtk_menu_new();
g_signal_connect((GObject*)statusicon_menu, "selection-done", (GCallback)gtk_widget_destroy, NULL); g_signal_connect((GObject*)statusicon_menu, "selection-done", (GCallback)gtk_widget_destroy, NULL);
g_signal_connect((GObject*)statusicon_menu, "key-press-event", (GCallback)menu_key_pressed, NULL);
/* Items */ /* Items */
if ((history != NULL) && (history->data != NULL)) if ((history != NULL) && (history->data != NULL))
@ -876,10 +947,11 @@ static void clipit_init()
/* Create status icon */ /* Create status icon */
if (!prefs.no_icon) if (!prefs.no_icon)
{ {
set_icon_paths();
#ifdef HAVE_APPINDICATOR #ifdef HAVE_APPINDICATOR
create_app_indicator(1); create_app_indicator(1);
#else #else
status_icon = gtk_status_icon_new_from_stock(GTK_STOCK_PASTE); status_icon = gtk_status_icon_new_from_file(trayicon_path);
gtk_status_icon_set_tooltip((GtkStatusIcon*)status_icon, _("Clipboard Manager")); gtk_status_icon_set_tooltip((GtkStatusIcon*)status_icon, _("Clipboard Manager"));
g_signal_connect((GObject*)status_icon, "button_press_event", (GCallback)status_icon_clicked, NULL); g_signal_connect((GObject*)status_icon, "button_press_event", (GCallback)status_icon_clicked, NULL);
#endif #endif

View File

@ -30,11 +30,11 @@ G_BEGIN_DECLS
#define POPUP_DELAY 30 #define POPUP_DELAY 30
#define CHECK_INTERVAL 500 #define CHECK_INTERVAL 500
typedef struct typedef struct {
{
gboolean use_copy; /* Use copy */ gboolean use_copy; /* Use copy */
gboolean use_primary; /* Use primary */ gboolean use_primary; /* Use primary */
gboolean synchronize; /* Synchronize copy and primary */ gboolean synchronize; /* Synchronize copy and primary */
gboolean automatic_paste; /* Automatically paste entry after selecting it */
gboolean show_indexes; /* Show index numbers in history menu */ gboolean show_indexes; /* Show index numbers in history menu */
gboolean save_uris; /* Save URIs in history */ gboolean save_uris; /* Save URIs in history */
@ -58,8 +58,7 @@ typedef struct
gchar* search_key; /* ClipIt search hotkey */ gchar* search_key; /* ClipIt search hotkey */
gboolean no_icon; /* No icon */ gboolean no_icon; /* No icon */
} } prefs_t;
prefs_t;
extern prefs_t prefs; extern prefs_t prefs;

View File

@ -22,6 +22,7 @@
#include <glib.h> #include <glib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <string.h> #include <string.h>
#include <X11/keysym.h>
#include "main.h" #include "main.h"
#include "utils.h" #include "utils.h"
#include "history.h" #include "history.h"
@ -107,13 +108,18 @@ static void edit_selected()
{ {
GtkTreeIter sel_iter; GtkTreeIter sel_iter;
GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search); GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search);
/* This helps prevent multiple instances and checks if there's anything selected */ /* This checks if there's anything selected */
if (gtk_tree_selection_get_selected(search_selection, NULL, &sel_iter)) gint selected_count = gtk_tree_selection_count_selected_rows(search_selection);
{ if (selected_count > 0) {
/* Create clipboard buffer and set its text */ /* Create clipboard buffer and set its text */
gint selected_item_nr; gint selected_item_nr;
gtk_tree_model_get((GtkTreeModel*)search_list, &sel_iter, 0, &selected_item_nr, -1); GList *selected_rows = gtk_tree_selection_get_selected_rows(search_selection, NULL);
GList *row_loop = g_list_first(selected_rows);
selected_item_nr = atoi((gchar*)gtk_tree_path_to_string(row_loop->data));
g_list_foreach(selected_rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free(selected_rows);
GSList* element = g_slist_nth(history, selected_item_nr); GSList* element = g_slist_nth(history, selected_item_nr);
GSList* elementafter = element->next;
GString* s_selected_item = g_string_new((gchar*)element->data); GString* s_selected_item = g_string_new((gchar*)element->data);
GtkTextBuffer* clipboard_buffer = gtk_text_buffer_new(NULL); GtkTextBuffer* clipboard_buffer = gtk_text_buffer_new(NULL);
gtk_text_buffer_set_text(clipboard_buffer, s_selected_item->str, -1); gtk_text_buffer_set_text(clipboard_buffer, s_selected_item->str, -1);
@ -151,13 +157,13 @@ static void edit_selected()
/* Delete any duplicate */ /* Delete any duplicate */
delete_duplicate(gtk_text_buffer_get_text(clipboard_buffer, &start, &end, TRUE)); delete_duplicate(gtk_text_buffer_get_text(clipboard_buffer, &start, &end, TRUE));
/* Insert new element before the old one */
history = g_slist_insert_before(history, element->next,
g_strdup(gtk_text_buffer_get_text(clipboard_buffer, &start, &end, TRUE)));
/* Remove old entry */ /* Remove old entry */
history = g_slist_remove(history, element->data); history = g_slist_remove(history, element->data);
/* Insert new element where the old one was */
history = g_slist_insert_before(history, elementafter,
g_strdup(gtk_text_buffer_get_text(clipboard_buffer, &start, &end, TRUE)));
if(selected_item_nr == 0) if(selected_item_nr == 0)
{ {
GtkClipboard* clipboard; GtkClipboard* clipboard;
@ -173,21 +179,34 @@ static void edit_selected()
} }
} }
static void add_iter(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *piter, gpointer userdata)
{
GArray *sel = (GArray*)userdata;
GtkTreeIter iter = *piter;
g_array_append_val(sel, iter);
}
/* Called when Remove is selected from Manage dialog */ /* Called when Remove is selected from Manage dialog */
static void remove_selected() static void remove_selected()
{ {
GtkTreeIter sel_iter;
GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search); GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search);
/* This checks if there's anything selected */ gint selected_count = gtk_tree_selection_count_selected_rows(search_selection);
if (gtk_tree_selection_get_selected(search_selection, NULL, &sel_iter)) if (selected_count > 0) {
{ GtkListStore *store;
/* Get item to delete */ GArray *sel;
gint selected_item_nr; gint i;
gtk_tree_model_get((GtkTreeModel*)search_list, &sel_iter, 0, &selected_item_nr, -1); store = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView*)treeview_search));
GSList* element = g_slist_nth(history, selected_item_nr); sel = g_array_new(FALSE, FALSE, sizeof(GtkTreeIter));
/* Remove entry */ gtk_tree_selection_selected_foreach(search_selection, add_iter, sel);
history = g_slist_remove(history, element->data); gtk_tree_selection_unselect_all(search_selection);
search_history(); for (i = 0; i < sel->len; i++) {
gint remove_item;
GtkTreeIter *iter = &g_array_index(sel, GtkTreeIter, i);
gtk_tree_model_get((GtkTreeModel*)search_list, iter, 0, &remove_item, -1);
history = g_slist_remove(history, g_slist_nth_data(history, remove_item));
gtk_list_store_remove(store, iter);
}
g_array_free(sel, TRUE);
} }
} }
@ -232,13 +251,16 @@ static void remove_all_selected(gpointer user_data)
static void search_doubleclick() static void search_doubleclick()
{ {
GtkTreeIter sel_iter;
GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search); GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search);
/* Check if selected */ /* Check if selected */
if (gtk_tree_selection_get_selected(search_selection, NULL, &sel_iter)) gint selected_count = gtk_tree_selection_count_selected_rows(search_selection);
{ if (selected_count == 1) {
gint selected_item_nr; gint selected_item_nr;
gtk_tree_model_get((GtkTreeModel*)search_list, &sel_iter, 0, &selected_item_nr, -1); GList *selected_rows = gtk_tree_selection_get_selected_rows(search_selection, NULL);
GList *row_loop = g_list_first(selected_rows);
selected_item_nr = atoi((gchar*)gtk_tree_path_to_string(row_loop->data));
g_list_foreach(selected_rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free(selected_rows);
GSList *element = g_slist_nth(history, selected_item_nr); GSList *element = g_slist_nth(history, selected_item_nr);
GtkClipboard* prim = gtk_clipboard_get(GDK_SELECTION_PRIMARY); GtkClipboard* prim = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@ -247,7 +269,7 @@ static void search_doubleclick()
} }
} }
static gint search_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *search_window) static gboolean search_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *search_window)
{ {
if(event->type==GDK_2BUTTON_PRESS || event->type==GDK_3BUTTON_PRESS) if(event->type==GDK_2BUTTON_PRESS || event->type==GDK_3BUTTON_PRESS)
{ {
@ -257,14 +279,38 @@ static gint search_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *se
return FALSE; return FALSE;
} }
static gint search_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer user_data) static gboolean search_key_released(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{ {
/* Check if [Return] key was pressed */ search_history();
if ((event->keyval == 0xff0d) || (event->keyval == 0xff8d))
search_history();
return FALSE; return FALSE;
} }
static gboolean treeview_key_pressed(GtkWidget *widget, GdkEventKey *event, GtkWidget *search_window)
{
switch (event->keyval) {
case XK_Escape:
case XK_Home:
case XK_Up:
case XK_Down:
case XK_Page_Up:
case XK_Page_Down:
case XK_End:
case XK_Shift_L:
case XK_Shift_R:
case XK_Control_L:
case XK_Control_R:
return FALSE;
case XK_Return:
search_doubleclick();
gtk_widget_destroy(search_window);
break;
case XK_Delete:
remove_selected();
break;
}
return TRUE;
}
void search_window_response(GtkDialog *dialog, gint response_id, gpointer user_data) void search_window_response(GtkDialog *dialog, gint response_id, gpointer user_data)
{ {
if(response_id < 0) if(response_id < 0)
@ -301,7 +347,7 @@ gboolean show_search()
gtk_box_pack_start((GtkBox*)vbox_search, hbox, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox_search, hbox, FALSE, FALSE, 0);
search_entry = gtk_entry_new(); search_entry = gtk_entry_new();
gtk_box_pack_end((GtkBox*)hbox, search_entry, TRUE, TRUE, 0); gtk_box_pack_end((GtkBox*)hbox, search_entry, TRUE, TRUE, 0);
g_signal_connect((GObject*)search_entry, "key-press-event", (GCallback)search_key_pressed, NULL); g_signal_connect((GObject*)search_entry, "key-release-event", (GCallback)search_key_released, NULL);
/* Build the exclude treeview */ /* Build the exclude treeview */
GtkWidget* scrolled_window_search = gtk_scrolled_window_new( GtkWidget* scrolled_window_search = gtk_scrolled_window_new(
@ -336,8 +382,9 @@ gboolean show_search()
g_signal_connect((GObject*)close_button, "clicked", (GCallback)search_history, NULL); g_signal_connect((GObject*)close_button, "clicked", (GCallback)search_history, NULL);
GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search); GtkTreeSelection* search_selection = gtk_tree_view_get_selection((GtkTreeView*)treeview_search);
gtk_tree_selection_set_mode(search_selection, GTK_SELECTION_BROWSE); gtk_tree_selection_set_mode(search_selection, GTK_SELECTION_MULTIPLE);
g_signal_connect((GObject*)treeview_search, "button_press_event", (GCallback)search_click, search_dialog); g_signal_connect((GObject*)treeview_search, "button_press_event", (GCallback)search_click, search_dialog);
g_signal_connect((GObject*)treeview_search, "key-press-event", (GCallback)treeview_key_pressed, search_dialog);
g_signal_connect((GtkDialog*)search_dialog, "response", (GCallback)search_window_response, search_dialog); g_signal_connect((GtkDialog*)search_dialog, "response", (GCallback)search_window_response, search_dialog);
gtk_widget_show_all(vbox_search); gtk_widget_show_all(vbox_search);

View File

@ -32,6 +32,7 @@
GtkWidget *copy_check, GtkWidget *copy_check,
*primary_check, *primary_check,
*synchronize_check, *synchronize_check,
*paste_check,
*show_indexes_check, *show_indexes_check,
*save_uris_check, *save_uris_check,
*history_spin, *history_spin,
@ -74,6 +75,7 @@ static void apply_preferences()
prefs.use_copy = gtk_toggle_button_get_active((GtkToggleButton*)copy_check); prefs.use_copy = gtk_toggle_button_get_active((GtkToggleButton*)copy_check);
prefs.use_primary = gtk_toggle_button_get_active((GtkToggleButton*)primary_check); prefs.use_primary = gtk_toggle_button_get_active((GtkToggleButton*)primary_check);
prefs.synchronize = gtk_toggle_button_get_active((GtkToggleButton*)synchronize_check); prefs.synchronize = gtk_toggle_button_get_active((GtkToggleButton*)synchronize_check);
prefs.automatic_paste = gtk_toggle_button_get_active((GtkToggleButton*)paste_check);
prefs.show_indexes = gtk_toggle_button_get_active((GtkToggleButton*)show_indexes_check); prefs.show_indexes = gtk_toggle_button_get_active((GtkToggleButton*)show_indexes_check);
prefs.save_uris = gtk_toggle_button_get_active((GtkToggleButton*)save_uris_check); prefs.save_uris = gtk_toggle_button_get_active((GtkToggleButton*)save_uris_check);
prefs.save_history = gtk_toggle_button_get_active((GtkToggleButton*)save_check); prefs.save_history = gtk_toggle_button_get_active((GtkToggleButton*)save_check);
@ -108,6 +110,7 @@ static void save_preferences()
g_key_file_set_boolean(rc_key, "rc", "use_copy", prefs.use_copy); g_key_file_set_boolean(rc_key, "rc", "use_copy", prefs.use_copy);
g_key_file_set_boolean(rc_key, "rc", "use_primary", prefs.use_primary); g_key_file_set_boolean(rc_key, "rc", "use_primary", prefs.use_primary);
g_key_file_set_boolean(rc_key, "rc", "synchronize", prefs.synchronize); g_key_file_set_boolean(rc_key, "rc", "synchronize", prefs.synchronize);
g_key_file_set_boolean(rc_key, "rc", "automatic_paste", prefs.automatic_paste);
g_key_file_set_boolean(rc_key, "rc", "show_indexes", prefs.show_indexes); g_key_file_set_boolean(rc_key, "rc", "show_indexes", prefs.show_indexes);
g_key_file_set_boolean(rc_key, "rc", "save_uris", prefs.save_uris); g_key_file_set_boolean(rc_key, "rc", "save_uris", prefs.save_uris);
g_key_file_set_boolean(rc_key, "rc", "save_history", prefs.save_history); g_key_file_set_boolean(rc_key, "rc", "save_history", prefs.save_history);
@ -211,6 +214,7 @@ void read_preferences()
prefs.use_copy = g_key_file_get_boolean(rc_key, "rc", "use_copy", NULL); prefs.use_copy = g_key_file_get_boolean(rc_key, "rc", "use_copy", NULL);
prefs.use_primary = g_key_file_get_boolean(rc_key, "rc", "use_primary", NULL); prefs.use_primary = g_key_file_get_boolean(rc_key, "rc", "use_primary", NULL);
prefs.synchronize = g_key_file_get_boolean(rc_key, "rc", "synchronize", NULL); prefs.synchronize = g_key_file_get_boolean(rc_key, "rc", "synchronize", NULL);
prefs.automatic_paste = g_key_file_get_boolean(rc_key, "rc", "automatic_paste", NULL);
prefs.show_indexes = g_key_file_get_boolean(rc_key, "rc", "show_indexes", NULL); prefs.show_indexes = g_key_file_get_boolean(rc_key, "rc", "show_indexes", NULL);
prefs.save_uris = g_key_file_get_boolean(rc_key, "rc", "save_uris", NULL); prefs.save_uris = g_key_file_get_boolean(rc_key, "rc", "save_uris", NULL);
prefs.save_history = g_key_file_get_boolean(rc_key, "rc", "save_history", NULL); prefs.save_history = g_key_file_get_boolean(rc_key, "rc", "save_history", NULL);
@ -651,6 +655,9 @@ void show_preferences(gint tab)
gtk_box_pack_start((GtkBox*)vbox, primary_check, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox, primary_check, FALSE, FALSE, 0);
synchronize_check = gtk_check_button_new_with_mnemonic(_("S_ynchronize clipboards")); synchronize_check = gtk_check_button_new_with_mnemonic(_("S_ynchronize clipboards"));
gtk_box_pack_start((GtkBox*)vbox, synchronize_check, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox, synchronize_check, FALSE, FALSE, 0);
paste_check = gtk_check_button_new_with_mnemonic(_("_Automatically paste selected item"));
g_signal_connect((GObject*)paste_check, "toggled", (GCallback)check_toggled, NULL);
gtk_box_pack_start((GtkBox*)vbox, paste_check, FALSE, FALSE, 0);
gtk_box_pack_start((GtkBox*)vbox_settings, frame, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox_settings, frame, FALSE, FALSE, 0);
/* Build the miscellaneous frame */ /* Build the miscellaneous frame */
@ -957,6 +964,7 @@ void show_preferences(gint tab)
gtk_toggle_button_set_active((GtkToggleButton*)copy_check, prefs.use_copy); gtk_toggle_button_set_active((GtkToggleButton*)copy_check, prefs.use_copy);
gtk_toggle_button_set_active((GtkToggleButton*)primary_check, prefs.use_primary); gtk_toggle_button_set_active((GtkToggleButton*)primary_check, prefs.use_primary);
gtk_toggle_button_set_active((GtkToggleButton*)synchronize_check, prefs.synchronize); gtk_toggle_button_set_active((GtkToggleButton*)synchronize_check, prefs.synchronize);
gtk_toggle_button_set_active((GtkToggleButton*)paste_check, prefs.automatic_paste);
gtk_toggle_button_set_active((GtkToggleButton*)show_indexes_check, prefs.show_indexes); gtk_toggle_button_set_active((GtkToggleButton*)show_indexes_check, prefs.show_indexes);
gtk_toggle_button_set_active((GtkToggleButton*)save_uris_check, prefs.save_uris); gtk_toggle_button_set_active((GtkToggleButton*)save_uris_check, prefs.save_uris);
gtk_toggle_button_set_active((GtkToggleButton*)save_check, prefs.save_history); gtk_toggle_button_set_active((GtkToggleButton*)save_check, prefs.save_history);

View File

@ -32,6 +32,7 @@ G_BEGIN_DECLS
#define DEF_USE_COPY TRUE #define DEF_USE_COPY TRUE
#define DEF_USE_PRIMARY FALSE #define DEF_USE_PRIMARY FALSE
#define DEF_SYNCHRONIZE FALSE #define DEF_SYNCHRONIZE FALSE
#define DEF_AUTOMATIC_PASTE FALSE
#define DEF_SHOW_INDEXES FALSE #define DEF_SHOW_INDEXES FALSE
#define DEF_SAVE_URIS TRUE #define DEF_SAVE_URIS TRUE
#define DEF_SAVE_HISTORY TRUE #define DEF_SAVE_HISTORY TRUE

View File

@ -28,11 +28,11 @@
#include "clipit-i18n.h" #include "clipit-i18n.h"
/* Creates program related directories if needed */ /* Creates program related directories if needed */
void void check_dirs()
check_dirs()
{ {
gchar *data_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), DATA_DIR, NULL); gchar *data_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), DATA_DIR, NULL);
gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), CONFIG_DIR, NULL); gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), CONFIG_DIR, NULL);
gchar *pixmap_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), DATA_DIR, "pixmaps", NULL);
/* Check if data directory exists */ /* Check if data directory exists */
if (!g_file_test(data_dir, G_FILE_TEST_EXISTS)) if (!g_file_test(data_dir, G_FILE_TEST_EXISTS))
{ {
@ -47,9 +47,17 @@ check_dirs()
if (g_mkdir_with_parents(config_dir, 0755) != 0) if (g_mkdir_with_parents(config_dir, 0755) != 0)
g_warning(_("Couldn't create directory: %s\n"), config_dir); g_warning(_("Couldn't create directory: %s\n"), config_dir);
} }
/* Check if pixmap directory exists */
if (!g_file_test(pixmap_dir, G_FILE_TEST_EXISTS))
{
/* Try to make pixmap directory */
if (g_mkdir_with_parents(pixmap_dir, 0755) != 0)
g_warning(_("Couldn't create directory: %s\n"), pixmap_dir);
}
/* Cleanup */ /* Cleanup */
g_free(data_dir); g_free(data_dir);
g_free(config_dir); g_free(config_dir);
g_free(pixmap_dir);
} }
/* Returns TRUE if text is a hyperlink */ /* Returns TRUE if text is a hyperlink */