mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
gtk_text_buffer_get_text() returns an allocated string.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gnucash-gnome2-dev@9604 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "gdk/gdkfont.h"
|
||||
#include "guile-mappings.h"
|
||||
#include "gnc-date-format.h"
|
||||
#include "misc-gnome-utils.h"
|
||||
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@@ -2032,10 +2033,7 @@ gnc_option_set_ui_value_text (GNCOption *option, gboolean use_default,
|
||||
if (SCM_STRINGP(value))
|
||||
{
|
||||
char *string = gh_scm2newstr(value, NULL);
|
||||
gint pos = 0;
|
||||
gtk_editable_delete_text(GTK_EDITABLE(widget), 0, -1);
|
||||
gtk_editable_insert_text(GTK_EDITABLE(widget),
|
||||
string, strlen (string), &pos);
|
||||
xxxgtk_textview_set_text (GTK_TEXT_VIEW(widget), string);
|
||||
free(string);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2430,7 +2428,7 @@ gnc_option_get_ui_value_text (GNCOption *option, GtkWidget *widget)
|
||||
char * string;
|
||||
SCM result;
|
||||
|
||||
string = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
|
||||
string = xxxgtk_textview_get_text (GTK_TEXT_VIEW(widget));
|
||||
result = scm_makfrom0str(string);
|
||||
g_free(string);
|
||||
return result;
|
||||
|
||||
@@ -32,7 +32,7 @@ xxxgtk_textview_set_text (GtkTextView *text, const char *str)
|
||||
|
||||
}
|
||||
|
||||
const char *
|
||||
char *
|
||||
xxxgtk_textview_get_text (GtkTextView *text)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
|
||||
/* Some gtk-like utilities */
|
||||
void xxxgtk_textview_set_text (GtkTextView *text, const char *str);
|
||||
const char * xxxgtk_textview_get_text (GtkTextView *text);
|
||||
char * xxxgtk_textview_get_text (GtkTextView *text);
|
||||
|
||||
#endif /* __GTT_UTIL_H__ */
|
||||
|
||||
@@ -409,7 +409,8 @@ ap_close_period (GnomeDruidPage *druidpage,
|
||||
{
|
||||
AcctPeriodInfo *info = user_data;
|
||||
QofBook *closed_book = NULL, *current_book;
|
||||
const char *btitle, *bnotes;
|
||||
const char *btitle;
|
||||
char *bnotes;
|
||||
Timespec closing_date;
|
||||
KvpFrame *book_frame;
|
||||
gboolean really_do_close_books = FALSE;
|
||||
@@ -454,6 +455,7 @@ ap_close_period (GnomeDruidPage *druidpage,
|
||||
gnc_engine_resume_events ();
|
||||
gnc_gui_refresh_all (); /* resume above should have been enough ??? */
|
||||
}
|
||||
g_free(bnotes);
|
||||
|
||||
/* Report the status back to the user. */
|
||||
info->close_status = 0; /* XXX fixme success or failure? */
|
||||
|
||||
@@ -270,6 +270,7 @@ lv_unselect_row_cb (GtkCList *clist,
|
||||
GNCLotViewer *lv = user_data;
|
||||
GNCLot *lot = lv->selected_lot;
|
||||
const char * str;
|
||||
char * notes;
|
||||
|
||||
/* Get the title, plunk it into ctree */
|
||||
str = gtk_entry_get_text (lv->title_entry);
|
||||
@@ -281,8 +282,9 @@ lv_unselect_row_cb (GtkCList *clist,
|
||||
kvp_frame_set_str (kvp, "/title", str);
|
||||
|
||||
/* Get the notes, save the notes */
|
||||
str = xxxgtk_textview_get_text (lv->lot_notes);
|
||||
kvp_frame_set_str (kvp, "/notes", str);
|
||||
notes = xxxgtk_textview_get_text (lv->lot_notes);
|
||||
kvp_frame_set_str (kvp, "/notes", notes);
|
||||
g_free(notes);
|
||||
}
|
||||
|
||||
lv_unset_lot (lv);
|
||||
@@ -504,6 +506,7 @@ lv_close_handler (gpointer user_data)
|
||||
if (lot)
|
||||
{
|
||||
const char * str;
|
||||
char *notes;
|
||||
KvpFrame *kvp = gnc_lot_get_slots (lot);
|
||||
|
||||
/* Get the title, save the title */
|
||||
@@ -511,8 +514,9 @@ lv_close_handler (gpointer user_data)
|
||||
kvp_frame_set_str (kvp, "/title", str);
|
||||
|
||||
/* Get the notes, save the notes */
|
||||
str = xxxgtk_textview_get_text (lv->lot_notes);
|
||||
kvp_frame_set_str (kvp, "/notes", str);
|
||||
notes = xxxgtk_textview_get_text (lv->lot_notes);
|
||||
kvp_frame_set_str (kvp, "/notes", notes);
|
||||
g_free(notes);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (lv->window);
|
||||
|
||||
Reference in New Issue
Block a user