Commit 9e0c471b authored by Matthias Clasen's avatar Matthias Clasen
Browse files

entry, spin button: Drop redundant API

Avoid duplicating GtkEditable APIs. Port existing users.
parent dc282991
Pipeline #63997 passed with stages
in 15 minutes and 42 seconds
......@@ -80,7 +80,7 @@ on_entry_changed (GtkWidget *widget, gpointer data)
page_number = gtk_assistant_get_current_page (assistant);
current_page = gtk_assistant_get_nth_page (assistant, page_number);
text = gtk_entry_get_text (GTK_ENTRY (widget));
text = gtk_editable_get_text (GTK_EDITABLE (widget));
if (text && *text)
gtk_assistant_set_page_complete (assistant, current_page, TRUE);
......
......@@ -28,7 +28,7 @@ copy_button_clicked (GtkWidget *button,
clipboard = gtk_widget_get_clipboard (entry);
/* Set clipboard text */
gdk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)));
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
}
void
......@@ -50,7 +50,7 @@ paste_received (GObject *source_object,
if (text)
{
/* Set the entry text */
gtk_entry_set_text (GTK_ENTRY (entry), text);
gtk_editable_set_text (GTK_EDITABLE (entry), text);
g_free (text);
}
else
......
......@@ -256,7 +256,7 @@ mask_entry_set_background (MaskEntry *entry)
{
if (entry->mask)
{
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
if (!g_regex_match_simple (entry->mask, gtk_editable_get_text (GTK_EDITABLE (entry)), 0, 0))
{
PangoAttrList *attrs;
......
......@@ -69,7 +69,7 @@ interactive_dialog_clicked (GtkButton *button,
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
local_entry1 = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (entry1)));
gtk_editable_set_text (GTK_EDITABLE (local_entry1), gtk_editable_get_text (GTK_EDITABLE (entry1)));
gtk_grid_attach (GTK_GRID (table), local_entry1, 1, 0, 1, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry1);
......@@ -77,7 +77,7 @@ interactive_dialog_clicked (GtkButton *button,
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
local_entry2 = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2)));
gtk_editable_set_text (GTK_EDITABLE (local_entry2), gtk_editable_get_text (GTK_EDITABLE (entry2)));
gtk_grid_attach (GTK_GRID (table), local_entry2, 1, 1, 1, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2);
......@@ -85,8 +85,8 @@ interactive_dialog_clicked (GtkButton *button,
if (response == GTK_RESPONSE_OK)
{
gtk_entry_set_text (GTK_ENTRY (entry1), gtk_entry_get_text (GTK_ENTRY (local_entry1)));
gtk_entry_set_text (GTK_ENTRY (entry2), gtk_entry_get_text (GTK_ENTRY (local_entry2)));
gtk_editable_set_text (GTK_EDITABLE (entry1), gtk_editable_get_text (GTK_EDITABLE (local_entry1)));
gtk_editable_set_text (GTK_EDITABLE (entry2), gtk_editable_get_text (GTK_EDITABLE (local_entry2)));
}
gtk_widget_destroy (dialog);
......
......@@ -199,7 +199,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
gtk_container_child_get (GTK_CONTAINER (fixed), entry, "x", &x, "y", &y, NULL);
label = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "label"));
gtk_label_set_text (GTK_LABEL (label), gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_widget_destroy (entry);
}
......@@ -218,7 +218,7 @@ edit_cb (GtkWidget *child)
g_object_set_data (G_OBJECT (entry), "label", child);
gtk_entry_set_text (GTK_ENTRY (entry), gtk_label_get_text (GTK_LABEL (child)));
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
gtk_widget_grab_focus (entry);
......
......@@ -305,7 +305,7 @@ update_display (void)
char *font_desc;
char *features;
text = gtk_entry_get_text (GTK_ENTRY (entry));
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (gtk_label_get_selection_bounds (GTK_LABEL (label), &ins, &bound))
{
......@@ -728,7 +728,7 @@ adjustment_changed (GtkAdjustment *adjustment,
char *str;
str = g_strdup_printf ("%g", gtk_adjustment_get_value (adjustment));
gtk_entry_set_text (GTK_ENTRY (entry), str);
gtk_editable_set_text (GTK_EDITABLE (entry), str);
g_free (str);
update_display ();
......@@ -741,7 +741,7 @@ entry_activated (GtkEntry *entry,
gdouble value;
gchar *err = NULL;
value = g_strtod (gtk_entry_get_text (entry), &err);
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
if (err != NULL)
gtk_adjustment_set_value (adjustment, value);
}
......@@ -821,7 +821,7 @@ add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
gtk_grid_attach (GTK_GRID (variations_grid), axis_scale, 1, i, 1, 1);
axis_entry = gtk_entry_new ();
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
gtk_entry_set_width_chars (GTK_ENTRY (axis_entry), 4);
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_grid_attach (GTK_GRID (variations_grid), axis_entry, 2, i, 1, 1);
axis = g_new (Axis, 1);
......@@ -1639,7 +1639,7 @@ static char *text;
static void
switch_to_entry (void)
{
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
gtk_widget_grab_focus (entry);
}
......@@ -1677,7 +1677,7 @@ entry_key_press (GtkEventController *controller,
{
if (keyval == GDK_KEY_Escape)
{
gtk_entry_set_text (GTK_ENTRY (entry), text);
gtk_editable_set_text (GTK_EDITABLE (entry), text);
stop_edit ();
return GDK_EVENT_STOP;
}
......
......@@ -12,7 +12,7 @@
static void
do_number (GtkButton *button, GtkEntry *entry)
{
gtk_entry_set_text (entry, gtk_button_get_label (button));
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_button_get_label (button));
}
GtkWidget *
......
......@@ -85,7 +85,7 @@ stop_search (GtkButton *button,
static void
clear_entry (GtkEntry *entry)
{
gtk_entry_set_text (entry, "");
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static void
......
......@@ -19,7 +19,7 @@ hex_spin_input (GtkSpinButton *spin_button,
gchar *err;
gdouble res;
buf = gtk_spin_button_get_text (spin_button);
buf = gtk_editable_get_text (GTK_EDITABLE (spin_button));
res = strtol (buf, &err, 16);
*new_val = res;
if (*err)
......@@ -41,8 +41,8 @@ hex_spin_output (GtkSpinButton *spin_button)
buf = g_strdup ("0x00");
else
buf = g_strdup_printf ("0x%.2X", (gint) val);
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
g_free (buf);
return TRUE;
......@@ -60,7 +60,7 @@ time_spin_input (GtkSpinButton *spin_button,
gchar *endh;
gchar *endm;
text = gtk_spin_button_get_text (spin_button);
text = gtk_editable_get_text (GTK_EDITABLE (spin_button));
str = g_strsplit (text, ":", 2);
if (g_strv_length (str) == 2)
......@@ -99,8 +99,8 @@ time_spin_output (GtkSpinButton *spin_button)
hours = gtk_adjustment_get_value (adjustment) / 60.0;
minutes = (hours - floor (hours)) * 60.0;
buf = g_strdup_printf ("%02.0f:%02.0f", floor (hours), floor (minutes + 0.5));
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
g_free (buf);
return TRUE;
......@@ -132,7 +132,7 @@ month_spin_input (GtkSpinButton *spin_button,
for (i = 1; i <= 12; i++)
{
tmp1 = g_ascii_strup (month[i - 1], -1);
tmp2 = g_ascii_strup (gtk_spin_button_get_text (spin_button), -1);
tmp2 = g_ascii_strup (gtk_editable_get_text (GTK_EDITABLE (spin_button)), -1);
if (strstr (tmp1, tmp2) == tmp1)
found = TRUE;
g_free (tmp1);
......@@ -162,8 +162,8 @@ month_spin_output (GtkSpinButton *spin_button)
for (i = 1; i <= 12; i++)
if (fabs (value - (double)i) < 1e-5)
{
if (strcmp (month[i-1], gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, month[i-1]);
if (strcmp (month[i-1], gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), month[i-1]);
}
return TRUE;
......
......@@ -68,7 +68,7 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
{
const gchar *text;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
......@@ -322,7 +322,7 @@ icon_visible_func (GtkTreeModel *model,
gboolean visible;
search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (win->search));
search_text = gtk_entry_get_text (GTK_ENTRY (win->searchentry));
search_text = gtk_editable_get_text (GTK_EDITABLE (win->searchentry));
if (win->symbolic)
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;
......
......@@ -1406,7 +1406,7 @@ open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button
{
const gchar *text;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
gtk_widget_set_sensitive (button, strlen (text) > 0);
}
......
......@@ -827,7 +827,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
......
......@@ -918,8 +918,6 @@ gtk_entry_new
gtk_entry_new_with_buffer
gtk_entry_get_buffer
gtk_entry_set_buffer
gtk_entry_set_text
gtk_entry_get_text
gtk_entry_get_text_length
gtk_entry_set_visibility
gtk_entry_get_visibility
......@@ -932,10 +930,6 @@ gtk_entry_set_activates_default
gtk_entry_get_activates_default
gtk_entry_set_has_frame
gtk_entry_get_has_frame
gtk_entry_set_width_chars
gtk_entry_get_width_chars
gtk_entry_set_max_width_chars
gtk_entry_get_max_width_chars
gtk_entry_set_alignment
gtk_entry_get_alignment
gtk_entry_set_placeholder_text
......@@ -2706,12 +2700,6 @@ gtk_spin_button_get_snap_to_ticks
gtk_spin_button_get_update_policy
gtk_spin_button_get_value
gtk_spin_button_get_wrap
gtk_spin_button_set_text
gtk_spin_button_get_text
gtk_spin_button_set_max_width_chars
gtk_spin_button_get_max_width_chars
gtk_spin_button_set_width_chars
gtk_spin_button_get_width_chars
GTK_INPUT_ERROR
<SUBSECTION Standard>
GTK_SPIN_BUTTON
......
......@@ -608,7 +608,7 @@
</section>
<section>
<title>Adapt to changes in the API of GtkEntry and GtkSearchEntry</title>
<title>Adapt to changes in the API of GtkEntry, GtkSearchEntry adn GtkSpinButton</title>
<para>
The GtkEditable has been made more useful, and the core functionality of
GtkEntry has been broken out as a GtkText widget. GtkEntry, GtkSearchEntry,
......@@ -620,7 +620,8 @@
<para>
Use GtkEditable API for editable functionality, and widget-specific APIs for
things that go beyond the common interface. For password entries, use
GtkPasswordEntry.
GtkPasswordEntry. As an example, gtk_spin_button_set_max_width_chars()
has been removed in favor of gtk_editable_set_max_width_chars().
</para>
</section>
......
......@@ -226,7 +226,7 @@ create_entry (void)
widget = gtk_entry_new ();
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_entry_set_text (GTK_ENTRY (widget), "Entry");
gtk_editable_set_text (GTK_EDITABLE (widget), "Entry");
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
return new_widget_info ("entry", widget, SMALL);
......@@ -320,7 +320,7 @@ create_combo_box_entry (void)
g_object_unref (model);
child = gtk_bin_get_child (GTK_BIN (widget));
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
......@@ -399,7 +399,7 @@ create_search_bar (void)
widget = gtk_search_bar_new ();
entry = gtk_search_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "Search Bar");
gtk_editable_set_text (GTK_EDITABLE (entry), "Search Bar");
gtk_container_add (GTK_CONTAINER (widget), entry);
gtk_widget_show (entry);
......
......@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
......@@ -58,7 +58,7 @@ find_word (GtkButton *button,
const gchar *word;
word = gtk_button_get_label (button);
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void
......
......@@ -25,7 +25,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
......
......@@ -29,7 +29,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
......@@ -56,7 +56,7 @@ find_word (GtkButton *button,
const gchar *word;
word = gtk_button_get_label (button);
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void
......
......@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
......@@ -58,7 +58,7 @@ find_word (GtkButton *button,
const gchar *word;
word = gtk_button_get_label (button);
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void
......
......@@ -364,7 +364,7 @@ combo_changed (GtkComboBox *combo,
str = g_strjoinv (",", accels);
g_strfreev (accels);
gtk_entry_set_text (entry, str);
gtk_editable_set_text (GTK_EDITABLE (entry), str);
}
static void
......@@ -389,7 +389,7 @@ response (GtkDialog *dialog,
if (!action)
return;
str = gtk_entry_get_text (entry);
str = gtk_editable_get_text (GTK_EDITABLE (entry));
accels = g_strsplit (str, ",", 0);
gtk_application_set_accels_for_action (gtk_window_get_application (user_data), action, (const gchar **) accels);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment