Code and stuff:
* Dmitry Medvinsky <dmedvinsky@gmail.com>
* Kim Hempel <kim@hempel.nu>
+ * Paul Vint <pjvint@gmail.com>
+ * Ryan Quinlan <ryan.van.quinlan@gmail.com>
Bugs and ideas:
* Sergei Sarbash <sarbash.s@gmail.com>
-Copyright (c) 2009, Dmitry Medvinsky
+Copyright (c) 2009-2012, Dmitry Medvinsky
Some rights reserved.
+2012-02-18: v1.4:
++ Add option to close gsimplecal when it loses focus
+
+2012-01-23: v1.3:
++ Add options for mainwindow position fine-tuning
+
+2011-12-06: v1.2:
++ Add `--version` and `--help` flags
+
2011-09-19: v1.1:
+ Add new option: mainwindow_resizable
AC_PREREQ([2.65])
AC_INIT([gsimplecal],
- [1.2],
+ [1.4],
[https://github.com/dmedvinsky/gsimplecal/issues],
[gsimplecal],
[https://github.com/dmedvinsky/gsimplecal])
-.TH GSIMPLECAL 1 "2011-12-06"
+.TH GSIMPLECAL 1 "2012-02-18"
.SH NAME
gsimplecal \- lightweight calendar applet
.br
show_week_numbers = 0
.br
+close_on_unfocus = 0
+.br
external_viewer = sunbird -showdate "%Y-%m-%d"
.br
clock_format = %a %d %b %H:%M
.br
mainwindow_position = none
.br
+mainwindow_xoffset = 0
+.br
+mainwindow_yoffset = 0
+.br
clock_label = UTC
.br
clock_tz = :UTC
\fBshow_week_numbers\fP: 1 or 0, defaults to 0.
Sets whether week numbers are shown in the calendar.
+.TP 5
+\fBclose_on_unfocus\fP: 1 or 0, defaults to 0.
+Sets whether the calendar will close if the window loses focus. Note that if
+mainwindow_skip_taskbar is set to 1 then the calendar window may not be given
+focus upon creation
+
.TP 5
\fBexternal_viewer\fP: string, defaults to empty string.
Command line to run when doubleclicking a date. This string is strftime'd
can configure your window manager to place gsimplecal in some predefined
position).
+.TP 5
+\fBmainwindow_xoffset\fP and \fBmainwindow_yoffset\fP: integer, default to 0.
+Allow for main window position fine tuning. Throw an integer at these, and
+it'll move the window by that number of pixels.
+
.TP 5
\fBclock_label\fP and \fBclock_tz\fP: string
These two options should go in pairs and \fBmust\fP be in the order given.
mainwindow_sticky = false;
mainwindow_skip_taskbar = true;
mainwindow_position = GTK_WIN_POS_MOUSE;
+ mainwindow_xoffset = 0;
+ mainwindow_yoffset = 0;
mark_today = true;
show_week_numbers = false;
+ close_on_unfocus = false;
}
bool Config::getFile()
} else {
mainwindow_position = GTK_WIN_POS_NONE;
}
+ } else if (var == "mainwindow_xoffset") {
+ stringstream convert(val);
+ if (!(convert >> mainwindow_xoffset)) {
+ mainwindow_xoffset = 0;
+ }
+ } else if (var == "mainwindow_yoffset") {
+ stringstream convert(val);
+ if (!(convert >> mainwindow_yoffset)) {
+ mainwindow_yoffset = 0;
+ }
} else if (var == "mainwindow_resizable") {
if (!fromString<bool>(mainwindow_resizable, val)) {
mainwindow_resizable = true;
if (!fromString<bool>(show_week_numbers, val)) {
show_week_numbers = false;
}
+ } else if (var == "close_on_unfocus") {
+ if (!fromString<bool>(close_on_unfocus, val)) {
+ close_on_unfocus = false;
+ }
}
}
bool mark_today;
string external_viewer;
bool show_week_numbers;
+ bool close_on_unfocus;
bool mainwindow_decorated;
bool mainwindow_keep_above;
bool mainwindow_skip_taskbar;
bool mainwindow_resizable;
GtkWindowPosition mainwindow_position;
+ int mainwindow_xoffset;
+ int mainwindow_yoffset;
private:
static Config* _instance;
MainWindow::MainWindow()
{
Config* config = Config::getInstance();
-
+ gint xpos, ypos;
widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(widget), "gsimplecal");
gtk_window_set_decorated(GTK_WINDOW(widget), config->mainwindow_decorated);
gtk_window_set_position(GTK_WINDOW(widget), config->mainwindow_position);
+ gtk_window_get_position(GTK_WINDOW(widget), &xpos, &ypos);
+ gtk_window_move(GTK_WINDOW(widget), config->mainwindow_xoffset + xpos, config->mainwindow_yoffset + ypos);
gtk_window_set_resizable(GTK_WINDOW(widget), config->mainwindow_resizable);
gtk_window_set_keep_above(GTK_WINDOW(widget),
config->mainwindow_keep_above);
if (config->show_timezones) {
g_timeout_add(30000, (GSourceFunc)time_handler, NULL);
}
+ if (config->close_on_unfocus) {
+ g_signal_connect(G_OBJECT(main_window->getWindow()), "focus-out-event",
+ GTK_SIGNAL_FUNC(gtk_widget_destroy),
+ GTK_OBJECT(main_window->getWindow()));
+ }
gtk_main();