X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-encoding-selector.c;h=a551ef054937a467941b1c998b2e7ae4d13099fd;hb=c2b19a85c1d156d72f1b853bffdcca2c2690e79c;hp=0352051c3a984f776e8483ea694921e2fda81aa3;hpb=656fc48419248831d507817106363d41055f5d37;p=pspp diff --git a/src/ui/gui/psppire-encoding-selector.c b/src/ui/gui/psppire-encoding-selector.c index 0352051c3a..a551ef0549 100644 --- a/src/ui/gui/psppire-encoding-selector.c +++ b/src/ui/gui/psppire-encoding-selector.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2011, 2012 Free Software Foundation, Inc. + Copyright (C) 2011, 2012, 2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,6 @@ #include "ui/gui/psppire-encoding-selector.h" -#include #include #include "libpspp/cast.h" @@ -173,7 +172,7 @@ psppire_encoding_selector_new (const char *default_encoding, renderer, set_sensitive, NULL, NULL); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("Character Encoding: ")), FALSE, FALSE, 0); @@ -183,13 +182,17 @@ psppire_encoding_selector_new (const char *default_encoding, return hbox; } +/* + Return a string describing the currently selected encoding. + The caller should free this string when no longer required. +*/ gchar * psppire_encoding_selector_get_encoding (GtkWidget *selector) { gchar *encoding = NULL; - GList *list, *pos; + GList *pos; + GList *list = gtk_container_get_children (GTK_CONTAINER (selector)); - list = gtk_container_get_children (GTK_CONTAINER (selector)); for (pos = list; pos; pos = pos->next) { GtkWidget *widget = pos->data; @@ -206,6 +209,14 @@ psppire_encoding_selector_get_encoding (GtkWidget *selector) break; } } + g_list_free (list); + + if (0 == strcmp (encoding, "Auto")) + { + g_free (encoding); + return NULL; + } + return encoding; }