mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Include banner in --json output.
This commit is contained in:
@@ -753,6 +753,8 @@ proc CreateCalWindow { dayNames } {
|
|||||||
button .b.quit -text {Quit} -command {Quit} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
button .b.quit -text {Quit} -command {Quit} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||||
balloon_add_help .b.quit "Quit TkRemind"
|
balloon_add_help .b.quit "Quit TkRemind"
|
||||||
label .b.status -text "" -width 25 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
label .b.status -text "" -width 25 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||||
|
bind .b.status <ButtonPress-1> [list ShowTodaysReminders 1]
|
||||||
|
balloon_add_help .b.status "Show Today's Reminders"
|
||||||
label .b.nqueued -text "" -width 20 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
label .b.nqueued -text "" -width 20 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||||
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.queue .b.quit -side left -fill both -padx 1
|
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.queue .b.quit -side left -fill both -padx 1
|
||||||
pack .b.status -side left -fill both -expand 1 -padx 1
|
pack .b.status -side left -fill both -expand 1 -padx 1
|
||||||
@@ -3014,7 +3016,7 @@ proc DaemonReadable { file } {
|
|||||||
catch { unset Ignore }
|
catch { unset Ignore }
|
||||||
Initialize
|
Initialize
|
||||||
FillCalWindow
|
FillCalWindow
|
||||||
ShowTodaysReminders
|
ShowTodaysReminders 0
|
||||||
}
|
}
|
||||||
"reread" {
|
"reread" {
|
||||||
if {[dict exists $obj command]} {
|
if {[dict exists $obj command]} {
|
||||||
@@ -3212,7 +3214,7 @@ proc main {} {
|
|||||||
}
|
}
|
||||||
FindConfigFile
|
FindConfigFile
|
||||||
LoadOptions
|
LoadOptions
|
||||||
ShowTodaysReminders
|
ShowTodaysReminders 0
|
||||||
ScanForTags $AppendFile
|
ScanForTags $AppendFile
|
||||||
CreateCalWindow $DayNames
|
CreateCalWindow $DayNames
|
||||||
FillCalWindow
|
FillCalWindow
|
||||||
@@ -4243,18 +4245,18 @@ proc DisplayTimeContinuously {} {
|
|||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# %PROCEDURE: ShowTodaysReminders
|
# %PROCEDURE: ShowTodaysReminders
|
||||||
# %ARGUMENTS:
|
# %ARGUMENTS:
|
||||||
# None
|
# force -- if true, show today's reminders even if option is disabled.
|
||||||
# %RETURNS:
|
# %RETURNS:
|
||||||
# Nothing
|
# Nothing
|
||||||
# %DESCRIPTION:
|
# %DESCRIPTION:
|
||||||
# Shows all of today's non-timed reminders in a window
|
# Shows all of today's non-timed reminders in a window
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
proc ShowTodaysReminders {} {
|
proc ShowTodaysReminders { force } {
|
||||||
global Option
|
global Option
|
||||||
global Remind
|
global Remind
|
||||||
global ReminderFile
|
global ReminderFile
|
||||||
global TwentyFourHourMode
|
global TwentyFourHourMode
|
||||||
if {!$Option(ShowTodaysReminders)} {
|
if {!$force && !$Option(ShowTodaysReminders)} {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
33
src/dorem.c
33
src/dorem.c
@@ -32,6 +32,18 @@ static int ParseUntil (ParsePtr s, Trigger *t, int type);
|
|||||||
static int ShouldTriggerBasedOnWarn (Trigger const *t, int dse, int *err);
|
static int ShouldTriggerBasedOnWarn (Trigger const *t, int dse, int *err);
|
||||||
static int ComputeTrigDuration(TimeTrig const *t);
|
static int ComputeTrigDuration(TimeTrig const *t);
|
||||||
|
|
||||||
|
static void remove_trailing_newlines(DynamicBuffer *buf)
|
||||||
|
{
|
||||||
|
char *s = (char *) DBufValue(buf) + DBufLen(buf) - 1;
|
||||||
|
while (s >= DBufValue(buf)) {
|
||||||
|
if (*s == '\n') {
|
||||||
|
*s = 0;
|
||||||
|
s--;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
static int todo_filtered(Trigger const *t)
|
static int todo_filtered(Trigger const *t)
|
||||||
{
|
{
|
||||||
if (t->is_todo && TodoFilter == ONLY_EVENTS) return 1;
|
if (t->is_todo && TodoFilter == ONLY_EVENTS) return 1;
|
||||||
@@ -409,7 +421,6 @@ int DoRem(ParsePtr p)
|
|||||||
if (JSONMode) {
|
if (JSONMode) {
|
||||||
DynamicBuffer body;
|
DynamicBuffer body;
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
char *s;
|
|
||||||
int if_depth = get_if_pointer() - get_base_if_pointer();
|
int if_depth = get_if_pointer() - get_base_if_pointer();
|
||||||
DBufInit(&body);
|
DBufInit(&body);
|
||||||
int red=-1, green=-1, blue=-1;
|
int red=-1, green=-1, blue=-1;
|
||||||
@@ -419,15 +430,8 @@ int DoRem(ParsePtr p)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
/* Remove trailing newlines from body */
|
/* Remove trailing newlines from body */
|
||||||
s = (char *) DBufValue(&body) + DBufLen(&body) - 1;
|
remove_trailing_newlines(&body);
|
||||||
while (s >= DBufValue(&body)) {
|
|
||||||
if (*s == '\n') {
|
|
||||||
*s = 0;
|
|
||||||
s--;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!*DBufValue(&body)) {
|
if (!*DBufValue(&body)) {
|
||||||
FreeTrig(&trig);
|
FreeTrig(&trig);
|
||||||
return r;
|
return r;
|
||||||
@@ -1363,6 +1367,15 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig const *tim, int dse, int is
|
|||||||
DBufLen(&buf)) {
|
DBufLen(&buf)) {
|
||||||
if (!JSONMode) {
|
if (!JSONMode) {
|
||||||
printf("%s\n", DBufValue(&buf));
|
printf("%s\n", DBufValue(&buf));
|
||||||
|
} else {
|
||||||
|
if (JSONLinesEmitted) {
|
||||||
|
printf("},\n");
|
||||||
|
}
|
||||||
|
JSONLinesEmitted++;
|
||||||
|
printf("{\"banner\":\"");
|
||||||
|
remove_trailing_newlines(&buf);
|
||||||
|
PrintJSONString(DBufValue(&buf));
|
||||||
|
printf("\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user