diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-02-28 14:31:36 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-02-28 16:34:00 -0500 |
commit | 9e0c471b03c9c19e6f664ecacd17f2776f2004c6 (patch) | |
tree | 5f86c7276f4d76aaa6c0748f3d3a0db18346b5c7 /tests | |
parent | dc282991c6611a77f0f1049750c3fd7b6d085bb3 (diff) | |
download | gtk+-9e0c471b03c9c19e6f664ecacd17f2776f2004c6.tar.gz |
entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testbaseline.c | 2 | ||||
-rw-r--r-- | tests/testcolorchooser2.c | 4 | ||||
-rw-r--r-- | tests/testentrycompletion.c | 2 | ||||
-rw-r--r-- | tests/testentryicons.c | 4 | ||||
-rw-r--r-- | tests/testgtk.c | 44 | ||||
-rw-r--r-- | tests/testlogout.c | 2 | ||||
-rw-r--r-- | tests/testnotebookdnd.c | 4 | ||||
-rw-r--r-- | tests/testrevealer.c | 12 | ||||
-rw-r--r-- | tests/testtitlebar.c | 4 | ||||
-rw-r--r-- | tests/testtreelistmodel.c | 2 | ||||
-rw-r--r-- | tests/treestoretest.c | 8 |
11 files changed, 44 insertions, 44 deletions
diff --git a/tests/testbaseline.c b/tests/testbaseline.c index 806914399d..2ab609582f 100644 --- a/tests/testbaseline.c +++ b/tests/testbaseline.c @@ -120,7 +120,7 @@ main (int argc, for (i = 0; i < 3; i++) { entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "│XYyj,Ö..."); + gtk_editable_set_text (GTK_EDITABLE (entry), "│XYyj,Ö..."); set_font_size (entry, i); diff --git a/tests/testcolorchooser2.c b/tests/testcolorchooser2.c index a0c4f113ba..15d8a90248 100644 --- a/tests/testcolorchooser2.c +++ b/tests/testcolorchooser2.c @@ -9,7 +9,7 @@ text_activated (GtkEntry *entry, gpointer data) GdkRGBA rgba; const char *text; - text = gtk_entry_get_text (entry); + text = gtk_editable_get_text (GTK_EDITABLE (entry)); g_signal_handlers_block_by_func (entry, rgba_changed, entry); if (gdk_rgba_parse (&rgba, text)) @@ -28,7 +28,7 @@ rgba_changed (GtkColorChooser *chooser, GParamSpec *pspec, gpointer data) s = gdk_rgba_to_string (&color); g_signal_handlers_block_by_func (entry, text_activated, chooser); - gtk_entry_set_text (GTK_ENTRY (entry), s); + gtk_editable_set_text (GTK_EDITABLE (entry), s); g_signal_handlers_unblock_by_func (entry, text_activated, chooser); g_free (s); diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c index bc019d4841..3967c0bba6 100644 --- a/tests/testentrycompletion.c +++ b/tests/testentrycompletion.c @@ -279,7 +279,7 @@ match_selected_cb (GtkEntryCompletion *completion, entry = gtk_entry_completion_get_entry (completion); gtk_tree_model_get (GTK_TREE_MODEL (model), iter, 1, &str, -1); - gtk_entry_set_text (GTK_ENTRY (entry), str); + gtk_editable_set_text (GTK_EDITABLE (entry), str); gtk_editable_set_position (GTK_EDITABLE (entry), -1); g_free (str); diff --git a/tests/testentryicons.c b/tests/testentryicons.c index e6381ed045..2dc2756ddb 100644 --- a/tests/testentryicons.c +++ b/tests/testentryicons.c @@ -5,7 +5,7 @@ static void clear_pressed (GtkEntry *entry, gint icon, gpointer data) { if (icon == GTK_ENTRY_ICON_SECONDARY) - gtk_entry_set_text (entry, ""); + gtk_editable_set_text (GTK_EDITABLE (entry), ""); } static void @@ -180,7 +180,7 @@ main (int argc, char **argv) entry = gtk_entry_new (); gtk_widget_set_hexpand (entry, TRUE); gtk_grid_attach (GTK_GRID (grid), entry, 1, 1, 1, 1); - gtk_entry_set_text (GTK_ENTRY (entry), "Right-to-left"); + gtk_editable_set_text (GTK_EDITABLE (entry), "Right-to-left"); gtk_widget_set_direction (entry, GTK_TEXT_DIR_RTL); gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), diff --git a/tests/testgtk.c b/tests/testgtk.c index 507f9da953..ab22813c20 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2353,7 +2353,7 @@ create_entry (GtkWidget *widget) gtk_container_add (GTK_CONTAINER (box2), hbox); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "hello world \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205"); + gtk_editable_set_text (GTK_EDITABLE (entry), "hello world \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205"); gtk_editable_select_region (GTK_EDITABLE (entry), 0, 5); gtk_container_add (GTK_CONTAINER (hbox), entry); @@ -2372,7 +2372,7 @@ create_entry (GtkWidget *widget) gtk_combo_box_text_append_text (cb, "item9 item9"); cb_entry = gtk_bin_get_child (GTK_BIN (cb)); - gtk_entry_set_text (GTK_ENTRY (cb_entry), "hello world \n\n\n foo"); + gtk_editable_set_text (GTK_EDITABLE (cb_entry), "hello world \n\n\n foo"); gtk_editable_select_region (GTK_EDITABLE (cb_entry), 0, -1); gtk_container_add (GTK_CONTAINER (box2), GTK_WIDGET (cb)); @@ -2713,8 +2713,8 @@ spin_button_time_output_func (GtkSpinButton *spin_button) hours = gtk_adjustment_get_value (adjustment) / 60.0; minutes = (fabs(floor (hours) - hours) < 1e-5) ? 0.0 : 30; sprintf (buf, "%02.0f:%02.0f", floor (hours), minutes); - 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); return TRUE; } @@ -2732,7 +2732,7 @@ spin_button_month_input_func (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); @@ -2764,8 +2764,8 @@ spin_button_month_output_func (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; } @@ -2778,7 +2778,7 @@ spin_button_hex_input_func (GtkSpinButton *spin_button, gchar *err; gdouble res; - buf = gtk_spin_button_get_text (GTK_SPIN_BUTTON (spin_button)); + buf = gtk_editable_get_text (GTK_EDITABLE (spin_button)); res = strtol(buf, &err, 16); *new_val = res; if (*err) @@ -2800,8 +2800,8 @@ spin_button_hex_output_func (GtkSpinButton *spin_button) sprintf (buf, "0x00"); else sprintf (buf, "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); return TRUE; } @@ -2864,7 +2864,7 @@ create_spins (GtkWidget *widget) G_CALLBACK (spin_button_time_output_func), NULL); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE); - gtk_spin_button_set_width_chars (GTK_SPIN_BUTTON (spinner), 5); + gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 5); gtk_container_add (GTK_CONTAINER (vbox2), spinner); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); @@ -2889,7 +2889,7 @@ create_spins (GtkWidget *widget) G_CALLBACK (spin_button_month_output_func), NULL); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE); - gtk_spin_button_set_width_chars (GTK_SPIN_BUTTON (spinner), 9); + gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 9); gtk_container_add (GTK_CONTAINER (vbox2), spinner); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); @@ -2912,7 +2912,7 @@ create_spins (GtkWidget *widget) G_CALLBACK (spin_button_hex_output_func), NULL); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE); - gtk_spin_button_set_width_chars (GTK_SPIN_BUTTON (spinner), 4); + gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 4); gtk_container_add (GTK_CONTAINER (vbox2), spinner); frame = gtk_frame_new ("Accelerated"); @@ -3193,7 +3193,7 @@ cursor_pressed_cb (GtkGesture *gesture, else i = (i + n - 1) % n; - gtk_entry_set_text (GTK_ENTRY (entry), cursor_names[i]); + gtk_editable_set_text (GTK_EDITABLE (entry), cursor_names[i]); } static void @@ -3202,7 +3202,7 @@ set_cursor_from_name (GtkWidget *entry, { const gchar *name; - name = gtk_entry_get_text (GTK_ENTRY (entry)); + name = gtk_editable_get_text (GTK_EDITABLE (entry)); gtk_widget_set_cursor_from_name (widget, name); g_object_set_data_full (G_OBJECT (widget), "name", g_strdup (name), g_free); @@ -3227,7 +3227,7 @@ change_cursor_theme (GtkWidget *widget, children = gtk_container_get_children (GTK_CONTAINER (data)); - theme = gtk_entry_get_text (GTK_ENTRY (children->next->data)); + theme = gtk_editable_get_text (GTK_EDITABLE (children->next->data)); size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (children->next->next->data)); g_list_free (children); @@ -3306,7 +3306,7 @@ create_cursors (GtkWidget *widget) gtk_container_add (GTK_CONTAINER (hbox), label); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "default"); + gtk_editable_set_text (GTK_EDITABLE (entry), "default"); gtk_container_add (GTK_CONTAINER (hbox), entry); size = gtk_spin_button_new_with_range (1.0, 128.0, 1.0); @@ -3372,7 +3372,7 @@ create_cursors (GtkWidget *widget) gtk_widget_show (window); - gtk_entry_set_text (GTK_ENTRY (entry), "arrow"); + gtk_editable_set_text (GTK_EDITABLE (entry), "arrow"); } else gtk_widget_destroy (window); @@ -3699,7 +3699,7 @@ screen_display_check (GtkWidget *widget, ScreenDisplaySelection *data) GdkDisplay *new_display = NULL; GdkDisplay *current_display = gtk_widget_get_display (widget); - display_name = gtk_entry_get_text (GTK_ENTRY (data->entry)); + display_name = gtk_editable_get_text (GTK_EDITABLE (data->entry)); display = gdk_display_open (display_name); if (!display) @@ -3780,8 +3780,8 @@ create_display_screen (GtkWidget *widget) combo_dpy = gtk_combo_box_text_new_with_entry (); gtk_widget_set_hexpand (combo_dpy, TRUE); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_dpy), "diabolo:0.0"); - gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_dpy))), - "<hostname>:<X Server Num>.<Screen Num>"); + gtk_editable_set_text (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (combo_dpy))), + "<hostname>:<X Server Num>.<Screen Num>"); gtk_grid_attach (GTK_GRID (grid), label_dpy, 0, 0, 1, 1); gtk_grid_attach (GTK_GRID (grid), combo_dpy, 0, 1, 1, 1); @@ -5759,7 +5759,7 @@ static void entry_changed (GtkWidget *widget, ProgressData *pdata) { gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pdata->pbar), - gtk_entry_get_text (GTK_ENTRY (pdata->entry))); + gtk_editable_get_text (GTK_EDITABLE (pdata->entry))); } void diff --git a/tests/testlogout.c b/tests/testlogout.c index 5d9a21ff41..4c13518fdb 100644 --- a/tests/testlogout.c +++ b/tests/testlogout.c @@ -18,7 +18,7 @@ inhibitor_toggled (GtkToggleButton *button, GtkApplication *app) guint cookie; active = gtk_toggle_button_get_active (button); - reason = gtk_entry_get_text (GTK_ENTRY (inhibit_entry)); + reason = gtk_editable_get_text (GTK_EDITABLE (inhibit_entry)); flags = 0; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (inhibit_logout))) diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c index a0b321eb41..13b2806585 100644 --- a/tests/testnotebookdnd.c +++ b/tests/testnotebookdnd.c @@ -140,7 +140,7 @@ action_clicked_cb (GtkWidget *button, GtkWidget *page, *title; page = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (page), "Addition"); + gtk_editable_set_text (GTK_EDITABLE (page), "Addition"); title = gtk_label_new ("Addition"); @@ -174,7 +174,7 @@ create_notebook (gchar **labels, while (*labels) { page = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (page), *labels); + gtk_editable_set_text (GTK_EDITABLE (page), *labels); title = gtk_label_new (*labels); diff --git a/tests/testrevealer.c b/tests/testrevealer.c index 28b79b6a4e..f166956fad 100644 --- a/tests/testrevealer.c +++ b/tests/testrevealer.c @@ -34,7 +34,7 @@ main (gint argc, gtk_widget_set_halign (revealer, GTK_ALIGN_START); gtk_widget_set_valign (revealer, GTK_ALIGN_START); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "00000"); + gtk_editable_set_text (GTK_EDITABLE (entry), "00000"); gtk_container_add (GTK_CONTAINER (revealer), entry); g_object_bind_property (widget, "active", revealer, "reveal-child", 0); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE); @@ -47,7 +47,7 @@ main (gint argc, gtk_widget_set_halign (revealer, GTK_ALIGN_END); gtk_widget_set_valign (revealer, GTK_ALIGN_END); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "00000"); + gtk_editable_set_text (GTK_EDITABLE (entry), "00000"); gtk_container_add (GTK_CONTAINER (revealer), entry); g_object_bind_property (widget, "active", revealer, "reveal-child", 0); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE); @@ -60,7 +60,7 @@ main (gint argc, gtk_widget_set_hexpand (revealer, TRUE); gtk_widget_set_halign (revealer, GTK_ALIGN_START); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "12345"); + gtk_editable_set_text (GTK_EDITABLE (entry), "12345"); gtk_container_add (GTK_CONTAINER (revealer), entry); g_object_bind_property (widget, "active", revealer, "reveal-child", 0); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT); @@ -73,7 +73,7 @@ main (gint argc, gtk_widget_set_vexpand (revealer, TRUE); gtk_widget_set_valign (revealer, GTK_ALIGN_START); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "23456"); + gtk_editable_set_text (GTK_ENTRY (entry), "23456"); gtk_container_add (GTK_CONTAINER (revealer), entry); g_object_bind_property (widget, "active", revealer, "reveal-child", 0); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN); @@ -86,7 +86,7 @@ main (gint argc, gtk_widget_set_hexpand (revealer, TRUE); gtk_widget_set_halign (revealer, GTK_ALIGN_END); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "34567"); + gtk_editable_set_text (GTK_EDITABLE (entry), "34567"); gtk_container_add (GTK_CONTAINER (revealer), entry); g_object_bind_property (widget, "active", revealer, "reveal-child", 0); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT); @@ -99,7 +99,7 @@ main (gint argc, gtk_widget_set_vexpand (revealer, TRUE); gtk_widget_set_valign (revealer, GTK_ALIGN_END); entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), "45678"); + gtk_editable_set_text (GTK_EDITABLE (entry), "45678"); gtk_container_add (GTK_CONTAINER (revealer), entry); g_object_bind_property (widget, "active", revealer, "reveal-child", 0); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP); diff --git a/tests/testtitlebar.c b/tests/testtitlebar.c index 49c89b528a..640882b800 100644 --- a/tests/testtitlebar.c +++ b/tests/testtitlebar.c @@ -7,7 +7,7 @@ on_text_changed (GtkEntry *entry, { const gchar *layout; - layout = gtk_entry_get_text (entry); + layout = gtk_editable_get_text (GTK_EDITABLE (entry)); gtk_header_bar_set_decoration_layout (bar, layout); } @@ -137,7 +137,7 @@ activate (GApplication *gapp) entry = gtk_entry_new (); g_object_get (gtk_widget_get_settings (window), "gtk-decoration-layout", &layout, NULL); - gtk_entry_set_text (GTK_ENTRY (entry), layout); + gtk_editable_set_text (GTK_EDITABLE (entry), layout); g_free (layout); g_signal_connect (entry, "notify::text", diff --git a/tests/testtreelistmodel.c b/tests/testtreelistmodel.c index 88f219797b..277a6e156d 100644 --- a/tests/testtreelistmodel.c +++ b/tests/testtreelistmodel.c @@ -289,7 +289,7 @@ match_file (gpointer item, gpointer data) path = g_file_get_path (file); - result = strstr (path, gtk_entry_get_text (GTK_ENTRY (search_entry))) != NULL; + result = strstr (path, gtk_editable_get_text (GTK_EDITABLE (search_entry))) != NULL; g_object_unref (info); g_free (path); diff --git a/tests/treestoretest.c b/tests/treestoretest.c index 370bbdd111..2eaddcf702 100644 --- a/tests/treestoretest.c +++ b/tests/treestoretest.c @@ -87,14 +87,14 @@ iter_insert (GtkWidget *button, GtkTreeView *tree_view) gtk_tree_store_insert (GTK_TREE_STORE (model), &iter, &selected, - atoi (gtk_entry_get_text (GTK_ENTRY (entry)))); + atoi (gtk_editable_get_text (GTK_EDITABLE (entry)))); } else { gtk_tree_store_insert (GTK_TREE_STORE (model), &iter, NULL, - atoi (gtk_entry_get_text (GTK_ENTRY (entry)))); + atoi (gtk_editable_get_text (GTK_EDITABLE (entry)))); } node_set (&iter); @@ -114,7 +114,7 @@ iter_change (GtkWidget *button, GtkTreeView *tree_view) gtk_tree_store_set (GTK_TREE_STORE (model), &selected, 1, - gtk_entry_get_text (GTK_ENTRY (entry)), + gtk_editable_get_text (GTK_EDITABLE (entry)), -1); } } @@ -130,7 +130,7 @@ iter_insert_with_values (GtkWidget *button, GtkTreeView *tree_view) entry = g_object_get_data (G_OBJECT (button), "user_data"); str1 = g_strdup_printf ("Row (<span color=\"red\">%d</span>)", node_count++); - str2 = g_strdup_printf ("%d", atoi (gtk_entry_get_text (GTK_ENTRY (entry)))); + str2 = g_strdup_printf ("%d", atoi (gtk_editable_get_text (GTK_EDITABLE (entry)))); if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)), NULL, |