mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change source files dialog-dup-trans.* for space and tabs
This commit is contained in:
parent
4c2df4c2ad
commit
bbc6887b0f
@ -48,11 +48,11 @@ typedef struct
|
|||||||
GtkWidget * link_edit;
|
GtkWidget * link_edit;
|
||||||
|
|
||||||
GtkWidget *duplicate_title_label; // GtkLabel
|
GtkWidget *duplicate_title_label; // GtkLabel
|
||||||
GtkWidget *duplicate_table; // GtkTable
|
GtkWidget *duplicate_table; // GtkTable
|
||||||
GtkWidget *date_label; // GtkLabel
|
GtkWidget *date_label; // GtkLabel
|
||||||
GtkWidget *num_label; // GtkLabel
|
GtkWidget *num_label; // GtkLabel
|
||||||
GtkWidget *tnum_label; // GtkLabel
|
GtkWidget *tnum_label; // GtkLabel
|
||||||
GtkWidget *link_label; //GtkLabel
|
GtkWidget *link_label; // GtkLabel
|
||||||
} DupTransDialog;
|
} DupTransDialog;
|
||||||
|
|
||||||
/* Parses the string value and returns true if it is a
|
/* Parses the string value and returns true if it is a
|
||||||
@ -66,10 +66,10 @@ parse_num (const char *string, long int *num)
|
|||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!gnc_strisnum(string))
|
if (!gnc_strisnum (string))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
number = strtol(string, NULL, 10);
|
number = strtol (string, NULL, 10);
|
||||||
|
|
||||||
if ((number == LONG_MIN) || (number == LONG_MAX))
|
if ((number == LONG_MIN) || (number == LONG_MAX))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -147,7 +147,7 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
const gchar *tt = _("Use +- keys to increment/decrement number");
|
const gchar *tt = _("Use +- keys to increment/decrement number");
|
||||||
|
|
||||||
builder = gtk_builder_new();
|
builder = gtk_builder_new ();
|
||||||
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "num_adjustment");
|
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "num_adjustment");
|
||||||
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "tnum_adjustment");
|
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "tnum_adjustment");
|
||||||
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "duplicate_transaction_dialog");
|
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "duplicate_transaction_dialog");
|
||||||
@ -161,7 +161,7 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
|
|||||||
|
|
||||||
/* parent */
|
/* parent */
|
||||||
if (parent != NULL)
|
if (parent != NULL)
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
|
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
|
||||||
|
|
||||||
/* date widget */
|
/* date widget */
|
||||||
dt_dialog->date_label = GTK_WIDGET(gtk_builder_get_object (builder, "date_label"));
|
dt_dialog->date_label = GTK_WIDGET(gtk_builder_get_object (builder, "date_label"));
|
||||||
@ -171,13 +171,13 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
|
|||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
|
|
||||||
date_edit = gnc_date_edit_new (date, FALSE, FALSE);
|
date_edit = gnc_date_edit_new (date, FALSE, FALSE);
|
||||||
gnc_date_activates_default(GNC_DATE_EDIT(date_edit), TRUE);
|
gnc_date_activates_default (GNC_DATE_EDIT(date_edit), TRUE);
|
||||||
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
|
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
|
||||||
gtk_widget_show (date_edit);
|
gtk_widget_show (date_edit);
|
||||||
|
|
||||||
gnc_date_make_mnemonic_target (GNC_DATE_EDIT(date_edit), dt_dialog->date_label);
|
gnc_date_make_mnemonic_target (GNC_DATE_EDIT(date_edit), dt_dialog->date_label);
|
||||||
|
|
||||||
gtk_box_pack_end (GTK_BOX (hbox), date_edit, TRUE, TRUE, 0);
|
gtk_box_pack_end (GTK_BOX(hbox), date_edit, TRUE, TRUE, 0);
|
||||||
dt_dialog->date_edit = date_edit;
|
dt_dialog->date_edit = date_edit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -227,14 +227,14 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
|
|||||||
|
|
||||||
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dt_dialog);
|
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dt_dialog);
|
||||||
|
|
||||||
g_object_unref(G_OBJECT(builder));
|
g_object_unref (G_OBJECT(builder));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
||||||
const char* window_title, const char* title,
|
const char* window_title, const char* title,
|
||||||
gboolean show_date, time64 *date_p,
|
gboolean show_date, time64 *date_p, GDate *gdate_p,
|
||||||
GDate *gdate_p, const char *num, char **out_num,
|
const char *num, char **out_num,
|
||||||
const char *tnum, char **out_tnum,
|
const char *tnum, char **out_tnum,
|
||||||
const char *tlink, char **out_tlink)
|
const char *tlink, char **out_tlink)
|
||||||
{
|
{
|
||||||
@ -251,9 +251,9 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
|||||||
if (!show_date)
|
if (!show_date)
|
||||||
{
|
{
|
||||||
// The "date" field isn't being asked for, so we make the widgets invisible
|
// The "date" field isn't being asked for, so we make the widgets invisible
|
||||||
gtk_widget_set_visible(dt_dialog->date_label, FALSE);
|
gtk_widget_set_visible (dt_dialog->date_label, FALSE);
|
||||||
if (dt_dialog->date_edit)
|
if (dt_dialog->date_edit)
|
||||||
gtk_widget_set_visible(dt_dialog->date_edit, FALSE);
|
gtk_widget_set_visible (dt_dialog->date_edit, FALSE);
|
||||||
// If no "date" field, there must be a "num" field, so give it focus
|
// If no "date" field, there must be a "num" field, so give it focus
|
||||||
if (out_num)
|
if (out_num)
|
||||||
gtk_widget_grab_focus (dt_dialog->num_edit);
|
gtk_widget_grab_focus (dt_dialog->num_edit);
|
||||||
@ -262,70 +262,70 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
|||||||
{
|
{
|
||||||
GNCDateEdit *gde;
|
GNCDateEdit *gde;
|
||||||
|
|
||||||
gde = GNC_DATE_EDIT (dt_dialog->date_edit);
|
gde = GNC_DATE_EDIT(dt_dialog->date_edit);
|
||||||
entry = gde->date_entry;
|
entry = gde->date_entry;
|
||||||
gtk_widget_grab_focus (entry);
|
gtk_widget_grab_focus (entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_title)
|
if (window_title)
|
||||||
gtk_window_set_title (GTK_WINDOW (dt_dialog->dialog), window_title);
|
gtk_window_set_title (GTK_WINDOW(dt_dialog->dialog), window_title);
|
||||||
|
|
||||||
if (title)
|
if (title)
|
||||||
{
|
{
|
||||||
gchar *full_text = g_strdup_printf("<b>%s</b>", title);
|
gchar *full_text = g_strdup_printf ("<b>%s</b>", title);
|
||||||
gtk_label_set_markup(GTK_LABEL (dt_dialog->duplicate_title_label), full_text);
|
gtk_label_set_markup (GTK_LABEL(dt_dialog->duplicate_title_label), full_text);
|
||||||
g_free(full_text);
|
g_free (full_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!out_num)
|
if (!out_num)
|
||||||
{
|
{
|
||||||
// The "num" field isn't being asked for, so we make the widgets invisible
|
// The "num" field isn't being asked for, so we make the widgets invisible
|
||||||
gtk_widget_set_visible(dt_dialog->num_label, FALSE);
|
gtk_widget_set_visible (dt_dialog->num_label, FALSE);
|
||||||
gtk_widget_set_visible(dt_dialog->num_edit, FALSE);
|
gtk_widget_set_visible (dt_dialog->num_edit, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tnum)
|
if (!tnum)
|
||||||
{
|
{
|
||||||
// The "tnum" field isn't being asked for, so we make the widgets invisible
|
// The "tnum" field isn't being asked for, so we make the widgets invisible
|
||||||
gtk_widget_set_visible(dt_dialog->tnum_label, FALSE);
|
gtk_widget_set_visible (dt_dialog->tnum_label, FALSE);
|
||||||
gtk_widget_set_visible(dt_dialog->tnum_edit, FALSE);
|
gtk_widget_set_visible (dt_dialog->tnum_edit, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!show_date && !tnum)
|
if (!show_date && !tnum)
|
||||||
{
|
{
|
||||||
// The "date" and the "tnum" fields aren't being asked for, this is a split copy
|
// The "date" and the "tnum" fields aren't being asked for, this is a split copy
|
||||||
gtk_label_set_markup(GTK_LABEL (dt_dialog->num_label), _("Action/Number"));
|
gtk_label_set_markup (GTK_LABEL(dt_dialog->num_label), _("Action/Number"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tnum)
|
if (tnum)
|
||||||
{
|
{
|
||||||
gtk_entry_set_activates_default(GTK_ENTRY(dt_dialog->num_edit), FALSE);
|
gtk_entry_set_activates_default (GTK_ENTRY(dt_dialog->num_edit), FALSE);
|
||||||
gtk_entry_set_activates_default(GTK_ENTRY(dt_dialog->tnum_edit), TRUE);
|
gtk_entry_set_activates_default (GTK_ENTRY(dt_dialog->tnum_edit), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlink)
|
if (tlink)
|
||||||
{
|
{
|
||||||
gtk_widget_set_visible(dt_dialog->link_label, TRUE);
|
gtk_widget_set_visible (dt_dialog->link_label, TRUE);
|
||||||
gtk_widget_set_visible(dt_dialog->link_edit, TRUE);
|
gtk_widget_set_visible (dt_dialog->link_edit, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_set_visible(dt_dialog->link_label, FALSE);
|
gtk_widget_set_visible (dt_dialog->link_label, FALSE);
|
||||||
gtk_widget_set_visible(dt_dialog->link_edit, FALSE);
|
gtk_widget_set_visible (dt_dialog->link_edit, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = gtk_dialog_run (GTK_DIALOG (dt_dialog->dialog));
|
result = gtk_dialog_run (GTK_DIALOG(dt_dialog->dialog));
|
||||||
|
|
||||||
if (result == GTK_RESPONSE_OK)
|
if (result == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
if (date_p)
|
if (date_p)
|
||||||
*date_p = gnc_date_edit_get_date (GNC_DATE_EDIT (dt_dialog->date_edit));
|
*date_p = gnc_date_edit_get_date (GNC_DATE_EDIT(dt_dialog->date_edit));
|
||||||
if (gdate_p)
|
if (gdate_p)
|
||||||
gnc_date_edit_get_gdate (GNC_DATE_EDIT (dt_dialog->date_edit), gdate_p);
|
gnc_date_edit_get_gdate (GNC_DATE_EDIT(dt_dialog->date_edit), gdate_p);
|
||||||
if (out_num)
|
if (out_num)
|
||||||
*out_num = g_strdup (gtk_entry_get_text (GTK_ENTRY (dt_dialog->num_edit)));
|
*out_num = g_strdup (gtk_entry_get_text (GTK_ENTRY(dt_dialog->num_edit)));
|
||||||
if (tnum)
|
if (tnum)
|
||||||
*out_tnum = g_strdup (gtk_entry_get_text (GTK_ENTRY (dt_dialog->tnum_edit)));
|
*out_tnum = g_strdup (gtk_entry_get_text (GTK_ENTRY(dt_dialog->tnum_edit)));
|
||||||
if (tlink)
|
if (tlink)
|
||||||
{
|
{
|
||||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dt_dialog->link_edit)))
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dt_dialog->link_edit)))
|
||||||
@ -336,20 +336,23 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
|
|||||||
else
|
else
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
|
|
||||||
gtk_widget_destroy(GTK_WIDGET(dt_dialog->dialog));
|
gtk_widget_destroy (GTK_WIDGET(dt_dialog->dialog));
|
||||||
g_free (dt_dialog);
|
g_free (dt_dialog);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gnc_dup_trans_dialog (GtkWidget * parent, const char* title, gboolean show_date,
|
gnc_dup_trans_dialog (GtkWidget * parent, const char* title,
|
||||||
time64 *date_p, const char *num, char **out_num,
|
gboolean show_date, time64 *date_p,
|
||||||
|
const char *num, char **out_num,
|
||||||
const char *tnum, char **out_tnum,
|
const char *tnum, char **out_tnum,
|
||||||
const char *tlink, char **out_tlink)
|
const char *tlink, char **out_tlink)
|
||||||
{
|
{
|
||||||
return gnc_dup_trans_dialog_internal(parent, NULL, title, show_date, date_p, NULL,
|
return gnc_dup_trans_dialog_internal (parent, NULL, title,
|
||||||
num, out_num, tnum, out_tnum, tlink, out_tlink);
|
show_date, date_p, NULL,
|
||||||
|
num, out_num, tnum, out_tnum,
|
||||||
|
tlink, out_tlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -357,29 +360,35 @@ gnc_dup_trans_dialog_gdate (GtkWidget * parent, GDate *gdate_p,
|
|||||||
const char *num, char **out_num)
|
const char *num, char **out_num)
|
||||||
{
|
{
|
||||||
time64 tmp_time;
|
time64 tmp_time;
|
||||||
g_assert(gdate_p);
|
g_assert (gdate_p);
|
||||||
|
|
||||||
tmp_time = gdate_to_time64 (*gdate_p);
|
tmp_time = gdate_to_time64 (*gdate_p);
|
||||||
return gnc_dup_trans_dialog_internal(parent, NULL, NULL, TRUE, &tmp_time, gdate_p,
|
return gnc_dup_trans_dialog_internal (parent, NULL, NULL, TRUE,
|
||||||
num, out_num, NULL, NULL, NULL, NULL);
|
&tmp_time, gdate_p,
|
||||||
|
num, out_num, NULL, NULL,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gnc_dup_time64_dialog (GtkWidget * parent, const char *window_title,
|
gnc_dup_time64_dialog (GtkWidget * parent, const char *window_title,
|
||||||
const char* title, time64 *date)
|
const char* title, time64 *date)
|
||||||
{
|
{
|
||||||
return gnc_dup_trans_dialog_internal(parent, window_title, title, TRUE, date, NULL,
|
return gnc_dup_trans_dialog_internal (parent, window_title, title, TRUE,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
date, NULL,
|
||||||
|
NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gnc_dup_date_dialog (GtkWidget * parent, const char* title, GDate *gdate_p)
|
gnc_dup_date_dialog (GtkWidget * parent, const char* title, GDate *gdate_p)
|
||||||
{
|
{
|
||||||
time64 tmp_time;
|
time64 tmp_time;
|
||||||
g_assert(gdate_p);
|
g_assert (gdate_p);
|
||||||
|
|
||||||
tmp_time = gdate_to_time64(*gdate_p);
|
tmp_time = gdate_to_time64 (*gdate_p);
|
||||||
return gnc_dup_trans_dialog_internal(parent, NULL, title, TRUE, &tmp_time, gdate_p,
|
return gnc_dup_trans_dialog_internal (parent, NULL, title, TRUE,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
&tmp_time, gdate_p,
|
||||||
|
NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,9 @@
|
|||||||
* Return: TRUE if user closes dialog with 'OK' *
|
* Return: TRUE if user closes dialog with 'OK' *
|
||||||
\***********************************************************************/
|
\***********************************************************************/
|
||||||
gboolean
|
gboolean
|
||||||
gnc_dup_trans_dialog (GtkWidget * parent, const char* title, gboolean show_date,
|
gnc_dup_trans_dialog (GtkWidget * parent, const char* title,
|
||||||
time64 *date_p, const char *num, char **out_num,
|
gboolean show_date, time64 *date_p,
|
||||||
|
const char *num, char **out_num,
|
||||||
const char *tnum, char **out_tnum,
|
const char *tnum, char **out_tnum,
|
||||||
const char *tdoclink, char **out_tdoclink);
|
const char *tdoclink, char **out_tdoclink);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user