From 799b35b71486eb37a7435ac76134a2a7441cb8ee Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Mon, 23 Jun 2003 03:48:51 +0000 Subject: [PATCH] The widget should now correctly use the page size "id" when interacting through its API, but use the page size "name" (which may be localized) when interacting with the human user. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@264 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/src/wdgt-media-select.c | 21 +++++++++++++++++---- glabels2/src/wdgt-media-select.h | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c index fec3aa5c..ff7376b8 100644 --- a/glabels2/src/wdgt-media-select.c +++ b/glabels2/src/wdgt-media-select.c @@ -478,11 +478,19 @@ gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select, gchar * gl_wdgt_media_select_get_page_size (glWdgtMediaSelect *media_select) { + gchar *page_size_name, *page_size_id; + gl_debug (DEBUG_MEDIA_SELECT, ""); - return + page_size_name = gtk_editable_get_chars (GTK_EDITABLE (media_select->page_size_entry), 0, -1); + + page_size_id = gl_paper_lookup_id_from_name (page_size_name); + + g_free (page_size_name); + + return page_size_id; } /****************************************************************************/ @@ -490,12 +498,15 @@ gl_wdgt_media_select_get_page_size (glWdgtMediaSelect *media_select) /****************************************************************************/ void gl_wdgt_media_select_set_page_size (glWdgtMediaSelect *media_select, - gchar *page_size) + gchar *page_size_id) { - gint pos; + gint pos; + gchar *page_size_name; gl_debug (DEBUG_MEDIA_SELECT, "START"); + page_size_name = gl_paper_lookup_name_from_id (page_size_id); + g_signal_handlers_block_by_func (G_OBJECT(media_select->page_size_entry), G_CALLBACK(page_size_entry_changed_cb), media_select); @@ -507,7 +518,9 @@ gl_wdgt_media_select_set_page_size (glWdgtMediaSelect *media_select, pos = 0; gtk_editable_insert_text (GTK_EDITABLE (media_select->page_size_entry), - page_size, strlen (page_size), &pos); + page_size_name, strlen (page_size_name), &pos); + + g_free (page_size_name); gl_debug (DEBUG_MEDIA_SELECT, "END"); } diff --git a/glabels2/src/wdgt-media-select.h b/glabels2/src/wdgt-media-select.h index 122fede2..7505e4c8 100644 --- a/glabels2/src/wdgt-media-select.h +++ b/glabels2/src/wdgt-media-select.h @@ -74,7 +74,7 @@ void gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select, gchar *gl_wdgt_media_select_get_page_size (glWdgtMediaSelect *media_select); void gl_wdgt_media_select_set_page_size (glWdgtMediaSelect *media_select, - gchar *page_size); + gchar *page_size_id); G_END_DECLS -- 2.39.5