</child>
<child>
<object class="PsppireValueEntry" id="group2-entry">
+ <property name="has-entry">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</child>
<child>
<object class="PsppireValueEntry" id="group1-entry">
+ <property name="has-entry">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</child>
<child>
<object class="PsppireValueEntry" id="cut-point-entry">
+ <property name="has-entry">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
#define SEPARATOR_CNT (sizeof separators / sizeof *separators)
static void
-set_quote_list (GtkComboBoxEntry *cb)
+set_quote_list (GtkComboBox *cb)
{
GtkListStore *list = gtk_list_store_new (1, G_TYPE_STRING);
GtkTreeIter iter;
gtk_combo_box_set_model (GTK_COMBO_BOX (cb), GTK_TREE_MODEL (list));
g_object_unref (list);
- gtk_combo_box_entry_set_text_column (cb, 0);
+ gtk_combo_box_set_entry_text_column (cb, 0);
}
/* Initializes IA's separators substructure. */
p->quote_cb = get_widget_assert (builder, "quote-cb");
p->escape_cb = get_widget_assert (builder, "escape");
- set_quote_list (GTK_COMBO_BOX_ENTRY (p->quote_combo));
+ set_quote_list (GTK_COMBO_BOX (p->quote_combo));
p->fields_tree_view = PSPP_SHEET_VIEW (get_widget_assert (builder, "fields"));
g_signal_connect (p->quote_combo, "changed",
G_CALLBACK (on_quote_combo_change), ia);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s->quote_cb)))
{
- gchar *text = gtk_combo_box_get_active_text (
- GTK_COMBO_BOX (s->quote_combo));
+ const gchar *text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (s->quote_combo))));
ds_assign_cstr (&s->quotes, text);
- g_free (text);
}
else
ds_clear (&s->quotes);
/* Data sheet tab. */
GtkWidget *vbox; /* Top-level widget in tab. */
GtkWidget *cell_ref_label; /* GtkLabel that shows selected case and var. */
- GtkWidget *datum_entry; /* GtkComboBoxEntry for editing current cell. */
+ GtkWidget *datum_entry; /* PsppireValueEntry for editing current cell. */
GtkWidget *datasheet_vbox_widget; /* ->vbox child that holds data sheets. */
GtkWidget *data_sheets[4]; /* Normally one data sheet; four, if split. */
gboolean split; /* True if data sheets are split. */
G_DEFINE_TYPE (PsppireValueEntry,
psppire_value_entry,
- GTK_TYPE_COMBO_BOX_ENTRY);
+ GTK_TYPE_COMBO_BOX);
enum
{
}
}
+static void
+psppire_value_entry_text_changed (GtkEntryBuffer *buffer,
+ GParamSpec *pspec,
+ PsppireValueEntry *obj)
+{
+ obj->cur_value = NULL;
+}
+
+
+static void
+on_realize (GtkWidget *w)
+{
+ GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (w)));
+ GtkEntryBuffer *buffer = gtk_entry_get_buffer (entry);
+
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (w), COL_LABEL);
+
+ g_signal_connect (buffer, "notify::text",
+ G_CALLBACK (psppire_value_entry_text_changed), w);
+
+ GTK_WIDGET_CLASS (psppire_value_entry_parent_class)->realize (w);
+}
+
static void
psppire_value_entry_class_init (PsppireValueEntryClass *class)
{
- GObjectClass *gobject_class;
- gobject_class = G_OBJECT_CLASS (class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
gobject_class->finalize = psppire_value_entry_finalize;
gobject_class->set_property = psppire_value_entry_set_property;
gobject_class->get_property = psppire_value_entry_get_property;
+ widget_class->realize = on_realize;
g_object_class_install_property (
gobject_class, PROP_SHOW_VALUE_LABEL,
G_PARAM_READABLE | G_PARAM_WRITABLE));
}
-static void
-psppire_value_entry_text_changed (GtkEntryBuffer *buffer,
- GParamSpec *pspec,
- PsppireValueEntry *obj)
-{
- obj->cur_value = NULL;
-}
-
static void
psppire_value_entry_init (PsppireValueEntry *obj)
{
- GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (obj)));
- GtkEntryBuffer *buffer = gtk_entry_get_buffer (entry);
-
obj->show_value_label = true;
obj->val_labs = NULL;
obj->format = F_8_0;
obj->encoding = NULL;
obj->cur_value = NULL;
- gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (obj), COL_LABEL);
-
- g_signal_connect (buffer, "notify::text",
- G_CALLBACK (psppire_value_entry_text_changed), obj);
}
static void
GtkWidget *
psppire_value_entry_new (void)
{
- return GTK_WIDGET (g_object_new (PSPPIRE_TYPE_VALUE_ENTRY, NULL));
+ return GTK_WIDGET (g_object_new (PSPPIRE_TYPE_VALUE_ENTRY, "has-entry", TRUE, NULL));
}
static void
#include <gtk/gtk.h>
#include "data/format.h"
-/* PsppireValueEntry is a subclass of GtkComboBoxEntry that is specialized for
+/* PsppireValueEntry is a subclass of GtkComboBox that is specialized for
displaying and entering "union value"s. Its main advantage over a plain
GtkEntry is that, when value labels are supplied, it (optionally) displays
the value label instead of the value. It also allows the user to choose a
struct _PsppireValueEntry
{
- GtkComboBoxEntry parent;
+ GtkComboBox parent;
gboolean show_value_label;
struct _PsppireValueEntryClass
{
- GtkComboBoxEntryClass parent_class;
+ GtkComboBoxClass parent_class;
};
GType psppire_value_entry_get_type (void);
</child>
<child>
<object class="PsppireValueEntry" id="entry2">
+ <property name="has-entry">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="quote-combo">
+ <object class="GtkComboBox" id="quote-combo">
+ <property name="has-entry">True</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="has_frame">False</property>