|
From: Crossfire C. r. messages.
<cro...@li...> - 2020-11-21 21:58:56
|
Revision: 21556
http://sourceforge.net/p/crossfire/code/21556
Author: silvernexus
Date: 2020-11-21 21:58:53 +0000 (Sat, 21 Nov 2020)
Log Message:
-----------
Fix config dialog faceset selection.
Fixes bug 877
Modified Paths:
--------------
client/trunk/ChangeLog
client/trunk/gtk-v2/src/config.c
Modified: client/trunk/ChangeLog
===================================================================
--- client/trunk/ChangeLog 2020-11-21 17:22:56 UTC (rev 21555)
+++ client/trunk/ChangeLog 2020-11-21 21:58:53 UTC (rev 21556)
@@ -4,6 +4,7 @@
**Fixed**
Add '--script=...' command-line option to pre-launch scripts.
Config window displayed last faceset as active regardless of desired faceset.
+Config dialog now allows to set the faceset for the client next run. It was broken and did nothing previously.
Prevent compiler errors on GCC 10 by disallowing multiple inclusions of src/gtk-v2/main.h.
Do not attempt to redraw map widget when disconnected.
Removed vestigal 0/0 next to food, xp, grace, sp, and hp bars.
Modified: client/trunk/gtk-v2/src/config.c
===================================================================
--- client/trunk/gtk-v2/src/config.c 2020-11-21 17:22:56 UTC (rev 21555)
+++ client/trunk/gtk-v2/src/config.c 2020-11-21 21:58:53 UTC (rev 21556)
@@ -647,13 +647,30 @@
want_config[CONFIG_SMOOTH] = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(config_button_smoothing));
- gchar *buf;
-
- buf = gtk_combo_box_text_get_active_text(config_combobox_faceset);
- if (buf) {
- free(face_info.want_faceset);
- face_info.want_faceset = g_strdup(buf);
- g_free(buf);
+ gchar *buf = 0;
+ GtkTreeIter iter;
+ /**
+ * Since the combo box does not have the "has-entry" property set to TRUE, we cannot use
+ * gtk_combo_box_text_get_active_text to get the currently selected option.
+ * Since we really have no good reason to turn that on and open up the box for
+ * arbitrary faceset strings, we can treat it more like a regular combo box.
+ * We need to use an iterator retrieval and gtk_tree_model_get to fetch the text,
+ * which is significantly more of a pain in the posterior.
+ *
+ * Daniel Hawkins -- 2020-11-21
+ */
+ if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(config_combobox_faceset), &iter)) {
+ // We have an active selection in our iterator. Now we get the string from the tree model.
+ GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(config_combobox_faceset));
+ gtk_tree_model_get(model, &iter, 0, &buf, -1);
+ if (buf) {
+ free(face_info.want_faceset);
+ face_info.want_faceset = g_strdup(buf);
+ g_free(buf);
+ }
+ else {
+ LOG(LOG_ERROR, "read_config_dialog", "Failed to get face set string from GTK Widget.");
+ }
}
want_config[CONFIG_DISPLAYMODE] =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|