builder: Remove user_data argument from gtk_builder_connect_signals()

This is pretty unused and gets in the way of the next steps.

A potential side effect is that for templates the widget was passed as
the user data argument. If that turns out to be important, we have to
special case that situation.
This commit is contained in:
Benjamin Otte 2019-11-21 19:36:06 +01:00
parent f5e4dc824c
commit 27d05102ab
20 changed files with 25 additions and 28 deletions

View File

@ -59,7 +59,7 @@ do_builder (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -24,7 +24,7 @@ do_cursors (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -122,7 +122,7 @@ do_filtermodel (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/filtermodel/filtermodel.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -293,7 +293,7 @@ do_fishbowl (GtkWidget *do_widget)
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
"changes_toggled_cb", G_CALLBACK (changes_toggled_cb),
NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@ -1221,7 +1221,7 @@ do_font_features (GtkWidget *do_widget)
gtk_builder_add_callback_symbol (builder, "reset", reset_features);
gtk_builder_add_callback_symbol (builder, "stop_edit", G_CALLBACK (stop_edit));
gtk_builder_add_callback_symbol (builder, "toggle_edit", G_CALLBACK (toggle_edit));
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));

View File

@ -248,7 +248,7 @@ do_fontrendering (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/fontrendering/fontrendering.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -210,7 +210,7 @@ do_iconscroll (GtkWidget *do_widget)
"next_clicked_cb", G_CALLBACK (next_clicked_cb),
"prev_clicked_cb", G_CALLBACK (prev_clicked_cb),
NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@ -41,7 +41,7 @@ do_modelbutton (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
gtk_builder_add_callback_symbol (builder, "tool_clicked", G_CALLBACK (tool_clicked));
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -69,7 +69,7 @@ do_revealer (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/revealer/revealer.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -18,7 +18,7 @@ do_scale (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/scale/scale.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -95,7 +95,7 @@ do_shortcuts (GtkWidget *do_widget)
"boxes_shortcuts_wizard", G_CALLBACK (boxes_shortcuts_wizard),
"boxes_shortcuts_display", G_CALLBACK (boxes_shortcuts_display),
NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -199,7 +199,7 @@ do_spinbutton (GtkWidget *do_widget)
"month_spin_input", G_CALLBACK (month_spin_input),
"month_spin_output", G_CALLBACK (month_spin_output),
NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -18,7 +18,7 @@ do_stack (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -1729,7 +1729,7 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), window);

View File

@ -1689,7 +1689,6 @@ gtk_builder_connect_signals_default (GtkBuilder *builder,
/**
* gtk_builder_connect_signals:
* @builder: a #GtkBuilder
* @user_data: user data to pass back with all signals
*
* This method is a simpler variation of gtk_builder_connect_signals_full().
* It uses symbols explicitly added to @builder with prior calls to
@ -1714,14 +1713,13 @@ gtk_builder_connect_signals_default (GtkBuilder *builder,
* gmodule-export-2.0.
**/
void
gtk_builder_connect_signals (GtkBuilder *builder,
gpointer user_data)
gtk_builder_connect_signals (GtkBuilder *builder)
{
g_return_if_fail (GTK_IS_BUILDER (builder));
gtk_builder_connect_signals_full (builder,
gtk_builder_connect_signals_default,
user_data);
NULL);
}
/**

View File

@ -150,8 +150,7 @@ void gtk_builder_expose_object (GtkBuilder *builder,
const gchar *name,
GObject *object);
GDK_AVAILABLE_IN_ALL
void gtk_builder_connect_signals (GtkBuilder *builder,
gpointer user_data);
void gtk_builder_connect_signals (GtkBuilder *builder);
GDK_AVAILABLE_IN_ALL
void gtk_builder_connect_signals_full (GtkBuilder *builder,
GtkBuilderConnectFunc func,

View File

@ -12212,7 +12212,7 @@ gtk_widget_init_template (GtkWidget *widget)
if (template->connect_func)
gtk_builder_connect_signals_full (builder, template->connect_func, template->connect_data);
else
gtk_builder_connect_signals (builder, object);
gtk_builder_connect_signals (builder);
g_object_unref (builder);
}

View File

@ -34,7 +34,7 @@ main (int argc, char *argv[])
gtk_builder_add_callback_symbol (builder, "back_to_main", G_CALLBACK (back_to_main));
gtk_builder_add_callback_symbol (builder, "go_to_secondary", G_CALLBACK (go_to_secondary));
gtk_builder_add_from_file (builder, "teststackedheaders.ui", NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
win = (GtkWidget *)gtk_builder_get_object (builder, "window");
header_stack = (GtkWidget *)gtk_builder_get_object (builder, "header_stack");

View File

@ -68,7 +68,7 @@ main (int argc, char *argv[])
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, filename, NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
g_object_unref (G_OBJECT (builder));

View File

@ -244,7 +244,7 @@ test_connect_signals (void)
"</interface>";
builder = builder_new_from_string (buffer, -1, NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = gtk_builder_get_object (builder, "window1");
gtk_window_set_title (GTK_WINDOW (window), "test");
@ -258,7 +258,7 @@ test_connect_signals (void)
g_object_unref (builder);
builder = builder_new_from_string (buffer_order, -1, NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = gtk_builder_get_object (builder, "window1");
normal = 0;
gtk_window_set_title (GTK_WINDOW (window), "test");
@ -270,7 +270,7 @@ test_connect_signals (void)
strlen (buffer_extra), NULL);
gtk_builder_add_from_string (builder, buffer_extra2,
strlen (buffer_extra2), NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
window = gtk_builder_get_object (builder, "window2");
gtk_window_set_title (GTK_WINDOW (window), "test");
g_assert (normal == 30);
@ -289,7 +289,7 @@ test_connect_signals (void)
builder = builder_new_from_string (buffer_after_child, -1, NULL);
window = gtk_builder_get_object (builder, "window1");
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
gtk_window_set_title (GTK_WINDOW (window), "test");
g_assert (normal == 1);
@ -2601,7 +2601,7 @@ test_anaconda_signal (void)
"</interface>";
builder = builder_new_from_string (buffer, -1, NULL);
gtk_builder_connect_signals (builder, NULL);
gtk_builder_connect_signals (builder);
g_object_unref (builder);
}