-Authors & Contributors:
+Code and stuff:
* Dmitry Medvinsky <dmedvinsky@gmail.com>
- * Kim Hempel <kim@hempel.nu>: issue reports, patches
- * Victor Feight <vrfeight3@gmail.com>: Arch Linux package
- * Joshua Saddler <nightmorph@gentoo.org>: Gentoo Linux package
- * Filip Pytloun <filip.pytloun@stickfish.com>: Fedora Linux package
- * maelnor: Gentoo Linux package
+ * Kim Hempel <kim@hempel.nu>
+
+Bugs and ideas:
+ * Sergei Sarbash <sarbash.s@gmail.com>
+ * Julien Valroff <julien@kirya.net>
+
+Packages:
+ - Arch Linux:
+ * Victor Feight <vrfeight3@gmail.com>
+ - Gentoo Linux:
+ * Joshua Saddler <nightmorph@gentoo.org>
+ * maelnor
+ - Fedora Linux
+ * Filip Pytloun <filip.pytloun@stickfish.com>
--- /dev/null
+Copyright (c) 2009, Dmitry Medvinsky
+
+Some rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * The names of the contributors may not be used to endorse or
+ promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+2011-08-24: v0.9:
+- Fix license text not included in distribution
+- Fix last `=` was treated as separator of key/value in config, not the first
++ Add ability to execute external viewer upon doubleclick on a date
+
2011-04-03: v0.8:
- Fix segmentation fault in the clock
+ Add keyboard bindings to go to the current date
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS \
+ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog NEWS depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
- [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
- $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
_PKG_TEXT
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for gsimplecal 0.8.
+# Generated by GNU Autoconf 2.68 for gsimplecal 0.9.
#
-# Report bugs to <http://github.com/dmedvinsky/gsimplecal/issues>.
+# Report bugs to <https://github.com/dmedvinsky/gsimplecal/issues>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org and
-$0: http://github.com/dmedvinsky/gsimplecal/issues about
+$0: https://github.com/dmedvinsky/gsimplecal/issues about
$0: your system, including any error possibly output before
$0: this message. Then install a modern shell, or manually
$0: run the script under such a shell if you do have one."
# Identity of this package.
PACKAGE_NAME='gsimplecal'
PACKAGE_TARNAME='gsimplecal'
-PACKAGE_VERSION='0.8'
-PACKAGE_STRING='gsimplecal 0.8'
-PACKAGE_BUGREPORT='http://github.com/dmedvinsky/gsimplecal/issues'
-PACKAGE_URL='http://github.com/dmedvinsky/gsimplecal'
+PACKAGE_VERSION='0.9'
+PACKAGE_STRING='gsimplecal 0.9'
+PACKAGE_BUGREPORT='https://github.com/dmedvinsky/gsimplecal/issues'
+PACKAGE_URL='https://github.com/dmedvinsky/gsimplecal'
ac_unique_file="src/gsimplecal.cpp"
# Factoring default headers for most tests.
# 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.
cat <<_ACEOF
-\`configure' configures gsimplecal 0.8 to adapt to many kinds of systems.
+\`configure' configures gsimplecal 0.9 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gsimplecal 0.8:";;
+ short | recursive ) echo "Configuration of gsimplecal 0.9:";;
esac
cat <<\_ACEOF
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to <http://github.com/dmedvinsky/gsimplecal/issues>.
-gsimplecal home page: <http://github.com/dmedvinsky/gsimplecal>.
+Report bugs to <https://github.com/dmedvinsky/gsimplecal/issues>.
+gsimplecal home page: <https://github.com/dmedvinsky/gsimplecal>.
_ACEOF
ac_status=$?
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gsimplecal configure 0.8
+gsimplecal configure 0.9
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ------------------------------------------------------------- ##
-## Report this to http://github.com/dmedvinsky/gsimplecal/issues ##
-## ------------------------------------------------------------- ##"
+( $as_echo "## -------------------------------------------------------------- ##
+## Report this to https://github.com/dmedvinsky/gsimplecal/issues ##
+## -------------------------------------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gsimplecal $as_me 0.8, which was
+It was created by gsimplecal $as_me 0.9, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='gsimplecal'
- VERSION='0.8'
+ VERSION='0.9'
cat >>confdefs.h <<_ACEOF
+
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_GTK2_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_GTK2_LIBS=`$PKG_CONFIG --libs "gtk+-2.0" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- GTK2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gtk+-2.0" 2>&1`
+ GTK2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0" 2>&1`
else
- GTK2_PKG_ERRORS=`$PKG_CONFIG --print-errors "gtk+-2.0" 2>&1`
+ GTK2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$GTK2_PKG_ERRORS" >&5
semget \
semctl \
ftok \
- readlink
+ readlink \
+ fork \
+ execl
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
done
-#
+# Flags
AM_CPPFLAGS="-Wall"
AM_LDFLAGS="-Wl,--as-needed"
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gsimplecal $as_me 0.8, which was
+This file was extended by gsimplecal $as_me 0.9, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Configuration commands:
$config_commands
-Report bugs to <http://github.com/dmedvinsky/gsimplecal/issues>.
-gsimplecal home page: <http://github.com/dmedvinsky/gsimplecal>."
+Report bugs to <https://github.com/dmedvinsky/gsimplecal/issues>.
+gsimplecal home page: <https://github.com/dmedvinsky/gsimplecal>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gsimplecal config.status 0.8
+gsimplecal config.status 0.9
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([gsimplecal],
- [0.8],
- [http://github.com/dmedvinsky/gsimplecal/issues],
+ [0.9],
+ [https://github.com/dmedvinsky/gsimplecal/issues],
[gsimplecal],
- [http://github.com/dmedvinsky/gsimplecal])
+ [https://github.com/dmedvinsky/gsimplecal])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
semget \
semctl \
ftok \
- readlink])
+ readlink \
+ fork \
+ execl])
-#
+# Flags
AM_CPPFLAGS="-Wall"
AM_LDFLAGS="-Wl,--as-needed"
AC_SUBST(AM_CFLAGS)
.br
mark_today = 1
.br
+external_viewer = sunbird --cool-arg --date="%Y-%m-%d"
+.br
clock_format = %a %d %b %H:%M
.br
mainwindow_decorated = 0
selection, i.e. when you click on the other day, today will remain marked
somehow, e.g. in bold print).
+.TP 5
+\fBexternal_viewer\fP: string, defaults to empty string.
+Command line to run when doubleclicking a date. This string is strftime'd
+(see \fIman strftime\fP for the possible substitutions)
+and passed to the shell. Thus you can use pipes, redirections, and whatever,
+I hope.
+.br
+Currently the shell is hardcoded to
+.nh
+/bin/sh
+.ny
+though. I hope that will do for all the users, but if you've got a trouble,
+please file a ticket (see \fIREPORTING BUGS\fP).
+
.TP 5
\fBclock_format\fP: string
Sets the clocks format. Look \fIman strftime\fP for the possible formats.
.PP
Please, report any issues to the gsimplecal issue tracker, available at:
.nh
-http://github.com/dmedvinsky/gsimplecal/issues
+https://github.com/dmedvinsky/gsimplecal/issues
.ny
+#include <string.h>
+#include <stdio.h>
+#include <sys/time.h>
+
#include <gtk/gtk.h>
#include "Calendar.hpp"
#include "Config.hpp"
+void fork_and_run(char* cmdline)
+{
+ if (strlen(cmdline)) {
+ if (fork() == 0) {
+ execl("/bin/sh", "/bin/sh", "-c", cmdline, NULL);
+ _exit(0);
+ }
+ }
+}
+
void monthChangedCb(GtkCalendar *calendar, gpointer cls)
{
if (cls) {
((Calendar*)cls)->markToday();
}
}
+void dayDoubleClickCb(GtkCalendar *calendar, gpointer cls)
+{
+ if (cls) {
+ ((Calendar*)cls)->runExternalViewer();
+ }
+}
Calendar::Calendar()
Config* config = Config::getInstance();
if (config->mark_today) {
- // Store today date to know be able to mark it after month changes.
+ // Store today date to be able to mark it after month changes.
gtk_calendar_get_date((GtkCalendar*)widget,
&today_year, &today_month, &today_day);
markToday();
gtk_signal_connect(GTK_OBJECT(widget), "month-changed",
GTK_SIGNAL_FUNC(monthChangedCb), (gpointer)this);
+ gtk_signal_connect(GTK_OBJECT(widget), "day-selected-double-click",
+ GTK_SIGNAL_FUNC(dayDoubleClickCb), (gpointer)this);
}
gtk_widget_show(widget);
gtk_calendar_select_month((GtkCalendar*)widget, today_month, today_year);
gtk_calendar_select_day((GtkCalendar*)widget, today_day);
}
+
+bool Calendar::runExternalViewer()
+{
+ Config* config = Config::getInstance();
+ size_t len = config->external_viewer.length();
+ if (len > 0) {
+ int year, month, day;
+ gtk_calendar_get_date((GtkCalendar*)widget,
+ (guint*)&year, (guint*)&month, (guint*)&day);
+ struct tm date;
+ date.tm_year = year - 1900;
+ date.tm_mon = month;
+ date.tm_mday = day;
+ date.tm_sec = date.tm_min = date.tm_hour = date.tm_wday
+ = date.tm_yday = date.tm_isdst = 0;
+
+ size_t buf_size = len + 64;
+ char* cmd = new char[buf_size];
+ strftime(cmd, buf_size, config->external_viewer.c_str(), &date);
+ fork_and_run(cmd);
+ delete[] cmd;
+ return true;
+ } else {
+ return false;
+ }
+}
void goToday();
bool markToday();
+ bool runExternalViewer();
protected:
void _change(int year_offset, int month_offset);
if (!line.length() || line[0] == '#') {
return;
}
- int pos;
- for (pos = line.length() - 1; pos >= 0; pos--) {
- if (line[pos] == '=') {
- break;
- }
- }
- if (pos == -1) {
+ size_t pos = line.find_first_of('=');
+ if (pos == string::npos) {
return;
}
string var = strip(line.substr(0, pos));
if (!fromString<bool>(mark_today, val)) {
mark_today = true;
}
+ } else if (var == "external_viewer") {
+ external_viewer = val;
}
}
string clock_format;
vector<ClockInfo*> clocks;
bool mark_today;
+ string external_viewer;
bool mainwindow_decorated;
bool mainwindow_keep_above;
signal(SIGTERM, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
+ signal(SIGCHLD, SIG_IGN);
gtk_init(&argc, &argv);
main_window = new MainWindow();