mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 21:19:16 -06:00
Move multi-byte char functions to gnome-utils.
Refactor date accelerator functionality to gnome-utils. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5350 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d28f079f9a
commit
d060f4a155
@ -27,6 +27,8 @@
|
||||
#include <glade/glade.h>
|
||||
#include <gnome.h>
|
||||
|
||||
#include "basiccell.h" /* FIXME: remove when multi-byte functions
|
||||
are in app-utils, (or just glib) */
|
||||
#include "dialog-utils.h"
|
||||
#include "global-options.h"
|
||||
#include "gnc-commodity.h"
|
||||
@ -587,6 +589,140 @@ gnc_window_adjust_for_screen(GtkWindow * window)
|
||||
gtk_widget_queue_resize(GTK_WIDGET(window));
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_handle_date_accelerator (GdkEventKey *event,
|
||||
struct tm *tm,
|
||||
const char *date_str)
|
||||
{
|
||||
GDate gdate;
|
||||
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
g_return_val_if_fail (tm != NULL, FALSE);
|
||||
g_return_val_if_fail (date_str != NULL, FALSE);
|
||||
|
||||
if (event->type != GDK_KEY_PRESS)
|
||||
return FALSE;
|
||||
|
||||
g_date_set_dmy (&gdate,
|
||||
tm->tm_mday,
|
||||
tm->tm_mon + 1,
|
||||
tm->tm_year + 1900);
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_KP_Add:
|
||||
case GDK_plus:
|
||||
case GDK_equal:
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g_date_add_days (&gdate, 7);
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
g_date_add_months (&gdate, 1);
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
g_date_add_years (&gdate, 1);
|
||||
else
|
||||
g_date_add_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_minus:
|
||||
if ((strlen (date_str) != 0) && (dateSeparator () == '-'))
|
||||
{
|
||||
GdkWChar *wcs;
|
||||
int count;
|
||||
int len;
|
||||
int i;
|
||||
|
||||
len = gnc_mbstowcs (&wcs, date_str);
|
||||
if (len < 0)
|
||||
return FALSE;
|
||||
|
||||
/* rough check for existing date */
|
||||
for (i = count = 0; i < len; i++)
|
||||
{
|
||||
if (wcs[i] == '-')
|
||||
count++;
|
||||
}
|
||||
|
||||
g_free (wcs);
|
||||
|
||||
if (count < 2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* fall through */
|
||||
case GDK_KP_Subtract:
|
||||
case GDK_underscore:
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g_date_subtract_days (&gdate, 7);
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
g_date_subtract_months (&gdate, 1);
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
g_date_subtract_years (&gdate, 1);
|
||||
else
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_braceright:
|
||||
case GDK_bracketright:
|
||||
/* increment month */
|
||||
g_date_add_months (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_braceleft:
|
||||
case GDK_bracketleft:
|
||||
/* decrement month */
|
||||
g_date_subtract_months (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_M:
|
||||
case GDK_m:
|
||||
/* beginning of month */
|
||||
g_date_set_day (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_H:
|
||||
case GDK_h:
|
||||
/* end of month */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_add_months (&gdate, 1);
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_Y:
|
||||
case GDK_y:
|
||||
/* beginning of year */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_set_month (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_R:
|
||||
case GDK_r:
|
||||
/* end of year */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_set_month (&gdate, 1);
|
||||
g_date_add_years (&gdate, 1);
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_T:
|
||||
case GDK_t:
|
||||
{
|
||||
/* today */
|
||||
GTime gtime;
|
||||
|
||||
gtime = time (NULL);
|
||||
g_date_set_time (&gdate, gtime);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_date_to_struct_tm (&gdate, tm);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -883,3 +1019,85 @@ gnc_glade_lookup_widget (GtkWidget *widget, const char *name)
|
||||
|
||||
return glade_xml_get_widget (xml, name);
|
||||
}
|
||||
|
||||
gint
|
||||
gnc_mbstowcs (GdkWChar **dest_p, const char *src)
|
||||
{
|
||||
GdkWChar *dest;
|
||||
gint src_len;
|
||||
gint retval;
|
||||
|
||||
if (!src)
|
||||
return -1;
|
||||
|
||||
src_len = strlen (src);
|
||||
|
||||
dest = g_new0 (GdkWChar, src_len + 1);
|
||||
|
||||
retval = gdk_mbstowcs (dest, src, src_len);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
PERR ("bad multi-byte conversion");
|
||||
}
|
||||
|
||||
if (dest_p)
|
||||
*dest_p = dest;
|
||||
else
|
||||
g_free (dest);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
gnc_wcstombs (const GdkWChar *src)
|
||||
{
|
||||
char *retval;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
retval = gdk_wcstombs (src);
|
||||
if (!retval)
|
||||
{
|
||||
PERR ("bad multi-byte conversion");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
gint
|
||||
gnc_wcslen (const GdkWChar *src)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
|
||||
while (src[len])
|
||||
len++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
GdkWChar *
|
||||
gnc_wcsdup (const GdkWChar *src)
|
||||
{
|
||||
GdkWChar *dest;
|
||||
int len;
|
||||
int i;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
len = gnc_wcslen (src);
|
||||
|
||||
dest = g_new (GdkWChar, len + 1);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
dest[i] = src[i];
|
||||
|
||||
dest[len] = 0;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -75,6 +75,10 @@ int gnc_option_menu_get_active (GtkWidget * option_menu);
|
||||
|
||||
void gnc_window_adjust_for_screen (GtkWindow * window);
|
||||
|
||||
gboolean gnc_handle_date_accelerator (GdkEventKey *event,
|
||||
struct tm *tm,
|
||||
const char *date_str);
|
||||
|
||||
|
||||
/* This function sets or clears a check mark in a GtkCList row.
|
||||
* There are some restrictions on using this function. If you mix
|
||||
@ -92,4 +96,20 @@ void gnc_clist_columns_autosize (GtkCList *list);
|
||||
GladeXML * gnc_glade_xml_new (const char *filename, const char *root);
|
||||
GtkWidget * gnc_glade_lookup_widget (GtkWidget *widget, const char *name);
|
||||
|
||||
|
||||
/* Multibyte/wide char string helper functions. */
|
||||
|
||||
/* Allocate new wide char string in dest_p. Return number of
|
||||
* wide chars or < 0 if error. */
|
||||
gint gnc_mbstowcs (GdkWChar **dest_p, const char *src);
|
||||
|
||||
/* Return new multibyte string or NULL if failure. */
|
||||
char * gnc_wcstombs (const GdkWChar *src);
|
||||
|
||||
/* Len of wide char string in chars */
|
||||
gint gnc_wcslen (const GdkWChar *src);
|
||||
|
||||
/* Duplicate wide char string */
|
||||
GdkWChar * gnc_wcsdup (const GdkWChar *src);
|
||||
|
||||
#endif
|
||||
|
@ -41,9 +41,10 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "date.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-date-edit.h"
|
||||
#include "messages.h"
|
||||
#include "date.h"
|
||||
|
||||
|
||||
enum {
|
||||
@ -532,146 +533,13 @@ date_accel_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
GNCDateEdit *gde = data;
|
||||
char *string;
|
||||
struct tm tm;
|
||||
GDate gdate;
|
||||
|
||||
switch (event->keyval) {
|
||||
case GDK_plus:
|
||||
case GDK_KP_Add:
|
||||
case GDK_equal:
|
||||
case GDK_KP_Equal:
|
||||
case GDK_underscore:
|
||||
case GDK_minus:
|
||||
case GDK_KP_Subtract:
|
||||
case GDK_bracketright:
|
||||
case GDK_braceright:
|
||||
case GDK_bracketleft:
|
||||
case GDK_braceleft:
|
||||
case GDK_M:
|
||||
case GDK_m:
|
||||
case GDK_H:
|
||||
case GDK_h:
|
||||
case GDK_Y:
|
||||
case GDK_y:
|
||||
case GDK_R:
|
||||
case GDK_r:
|
||||
case GDK_T:
|
||||
case GDK_t:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
string = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
|
||||
tm = gnc_date_edit_get_date_internal (gde);
|
||||
|
||||
g_date_set_dmy (&gdate, tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_KP_Add:
|
||||
case GDK_plus:
|
||||
case GDK_equal:
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g_date_add_days (&gdate, 7);
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
g_date_add_months (&gdate, 1);
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
g_date_add_years (&gdate, 1);
|
||||
else
|
||||
g_date_add_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_minus:
|
||||
if ((strlen (string) != 0) && (dateSeparator () == '-'))
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
int count;
|
||||
|
||||
len = strlen (string);
|
||||
/* rough check for existing date */
|
||||
for (i = count = 0; i < len; i++)
|
||||
{
|
||||
if (string[i] == '-')
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count < 2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* fall through */
|
||||
case GDK_KP_Subtract:
|
||||
case GDK_underscore:
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g_date_subtract_days (&gdate, 7);
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
g_date_subtract_months (&gdate, 1);
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
g_date_subtract_years (&gdate, 1);
|
||||
else
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_braceright:
|
||||
case GDK_bracketright:
|
||||
/* increment month */
|
||||
g_date_add_months (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_braceleft:
|
||||
case GDK_bracketleft:
|
||||
/* decrement month */
|
||||
g_date_subtract_months (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_M:
|
||||
case GDK_m:
|
||||
/* beginning of month */
|
||||
g_date_set_day (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_H:
|
||||
case GDK_h:
|
||||
/* end of month */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_add_months (&gdate, 1);
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_Y:
|
||||
case GDK_y:
|
||||
/* beginning of year */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_set_month (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_R:
|
||||
case GDK_r:
|
||||
/* end of year */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_set_month (&gdate, 1);
|
||||
g_date_add_years (&gdate, 1);
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_T:
|
||||
case GDK_t:
|
||||
{
|
||||
/* today */
|
||||
GTime gtime;
|
||||
|
||||
gtime = time (NULL);
|
||||
g_date_set_time (&gdate, gtime);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_date_to_struct_tm (&gdate, &tm);
|
||||
if (!gnc_handle_date_accelerator (event, &tm, string))
|
||||
return FALSE;
|
||||
|
||||
if (mktime (&tm) == -1)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ INCLUDES = \
|
||||
-I${top_srcdir}/src/engine \
|
||||
-I${top_srcdir}/src/app-utils \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
-I${top_srcdir}/src/gnome-utils \
|
||||
-I${top_srcdir}/src/guile \
|
||||
${GLIB_CFLAGS} \
|
||||
${GNOME_INCLUDEDIR} \
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "QuickFill.h"
|
||||
#include "basiccell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-ui-util.h"
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-engine-util.h"
|
||||
|
||||
|
||||
@ -312,87 +313,3 @@ gnc_basic_cell_set_wcvalue_internal (BasicCell *cell, const GdkWChar *value)
|
||||
g_free (cell->value_w);
|
||||
cell->value_len = gnc_mbstowcs (&cell->value_w, cell->value);
|
||||
}
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
gint
|
||||
gnc_mbstowcs (GdkWChar **dest_p, const char *src)
|
||||
{
|
||||
GdkWChar *dest;
|
||||
gint src_len;
|
||||
gint retval;
|
||||
|
||||
if (!src)
|
||||
return -1;
|
||||
|
||||
src_len = strlen (src);
|
||||
|
||||
dest = g_new0 (GdkWChar, src_len + 1);
|
||||
|
||||
retval = gdk_mbstowcs (dest, src, src_len);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
PERR ("bad multi-byte conversion");
|
||||
}
|
||||
|
||||
if (dest_p)
|
||||
*dest_p = dest;
|
||||
else
|
||||
g_free (dest);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
gnc_wcstombs (const GdkWChar *src)
|
||||
{
|
||||
char *retval;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
retval = gdk_wcstombs (src);
|
||||
if (!retval)
|
||||
{
|
||||
PERR ("bad multi-byte conversion");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
gint
|
||||
gnc_wcslen (const GdkWChar *src)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
|
||||
while (src[len])
|
||||
len++;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
GdkWChar *
|
||||
gnc_wcsdup (const GdkWChar *src)
|
||||
{
|
||||
GdkWChar *dest;
|
||||
int len;
|
||||
int i;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
len = gnc_wcslen (src);
|
||||
|
||||
dest = g_new (GdkWChar, len + 1);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
dest[i] = src[i];
|
||||
|
||||
dest[len] = 0;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -271,10 +271,4 @@ void gnc_basic_cell_set_value_internal (BasicCell *bcell,
|
||||
void gnc_basic_cell_set_wcvalue_internal (BasicCell *bcell,
|
||||
const GdkWChar *value);
|
||||
|
||||
/* helper function, allocates new wide char string for conversion */
|
||||
gint gnc_mbstowcs (GdkWChar **dest_p, const char *src);
|
||||
char * gnc_wcstombs (const GdkWChar *src);
|
||||
gint gnc_wcslen (const GdkWChar *src);
|
||||
GdkWChar * gnc_wcsdup (const GdkWChar *src);
|
||||
|
||||
#endif /* BASIC_CELL_H */
|
||||
|
@ -36,6 +36,13 @@ gnc_module_init(int refcount) {
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME. We need this for the wide-character functions.
|
||||
* When fixing, get rid of gnome-utils includes, too. */
|
||||
if(!gnc_module_load("gnucash/gnome-utils", 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#endif
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-ui-util.h"
|
||||
#include "quickfillcell.h"
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "table-allgui.h"
|
||||
#include "cellblock.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-engine-util.h"
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ INCLUDES = \
|
||||
-I${top_srcdir}/src/guile \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
-I${top_srcdir}/src/app-utils \
|
||||
-I${top_srcdir}/src/gnome-utils \
|
||||
-I${top_srcdir}/src/register/ledger-core \
|
||||
-I${top_srcdir}/src/register/register-core \
|
||||
${GLIB_CFLAGS} \
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "datecell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-ui-util.h"
|
||||
#include "gnucash-date-picker.h"
|
||||
#include "gnucash-item-edit.h"
|
||||
@ -481,118 +482,9 @@ gnc_date_cell_direct_update (BasicCell *bcell,
|
||||
char buff[DATE_BUF];
|
||||
GDate gdate;
|
||||
|
||||
if (event->type != GDK_KEY_PRESS)
|
||||
if (!gnc_handle_date_accelerator (event, &(box->date), bcell->value))
|
||||
return FALSE;
|
||||
|
||||
g_date_set_dmy (&gdate,
|
||||
box->date.tm_mday,
|
||||
box->date.tm_mon + 1,
|
||||
box->date.tm_year + 1900);
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_KP_Add:
|
||||
case GDK_plus:
|
||||
case GDK_equal:
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g_date_add_days (&gdate, 7);
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
g_date_add_months (&gdate, 1);
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
g_date_add_years (&gdate, 1);
|
||||
else
|
||||
g_date_add_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_minus:
|
||||
if ((bcell->value_len != 0) && (dateSeparator () == '-'))
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
|
||||
/* rough check for existing date */
|
||||
for (i = count = 0; i < bcell->value_len; i++)
|
||||
{
|
||||
if (bcell->value_w[i] == '-')
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count < 2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* fall through */
|
||||
case GDK_KP_Subtract:
|
||||
case GDK_underscore:
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g_date_subtract_days (&gdate, 7);
|
||||
else if (event->state & GDK_MOD1_MASK)
|
||||
g_date_subtract_months (&gdate, 1);
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
g_date_subtract_years (&gdate, 1);
|
||||
else
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_braceright:
|
||||
case GDK_bracketright:
|
||||
/* increment month */
|
||||
g_date_add_months (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_braceleft:
|
||||
case GDK_bracketleft:
|
||||
/* decrement month */
|
||||
g_date_subtract_months (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_M:
|
||||
case GDK_m:
|
||||
/* beginning of month */
|
||||
g_date_set_day (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_H:
|
||||
case GDK_h:
|
||||
/* end of month */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_add_months (&gdate, 1);
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_Y:
|
||||
case GDK_y:
|
||||
/* beginning of year */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_set_month (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_R:
|
||||
case GDK_r:
|
||||
/* end of year */
|
||||
g_date_set_day (&gdate, 1);
|
||||
g_date_set_month (&gdate, 1);
|
||||
g_date_add_years (&gdate, 1);
|
||||
g_date_subtract_days (&gdate, 1);
|
||||
break;
|
||||
|
||||
case GDK_T:
|
||||
case GDK_t:
|
||||
{
|
||||
/* today */
|
||||
GTime gtime;
|
||||
|
||||
gtime = time (NULL);
|
||||
g_date_set_time (&gdate, gtime);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_date_to_struct_tm (&gdate, &(box->date));
|
||||
|
||||
printDate (buff,
|
||||
box->date.tm_mday,
|
||||
box->date.tm_mon + 1,
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "gnucash-sheet.h"
|
||||
|
||||
#include "dialog-utils.h"
|
||||
#include "gnucash-color.h"
|
||||
#include "gnucash-grid.h"
|
||||
#include "gnucash-cursor.h"
|
||||
|
Loading…
Reference in New Issue
Block a user