Commit e084ca10 authored by Robert Ancell's avatar Robert Ancell

printers: Move callbacks into .ui file

parent 9c0634d1
Pipeline #59031 passed with stages
in 6 minutes and 15 seconds
......@@ -49,7 +49,6 @@ struct _PpOptionsDialog {
GtkNotebook *notebook;
GtkSpinner *spinner;
GtkStack *stack;
GtkButton *test_page_button;
gchar *printer_name;
......@@ -471,15 +470,13 @@ tab_add (PpOptionsDialog *self,
}
static void
category_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
category_selection_changed_cb (PpOptionsDialog *self)
{
PpOptionsDialog *self = (PpOptionsDialog *) user_data;
GtkTreeModel *model;
GtkTreeIter iter;
gint id = -1;
GtkTreeModel *model;
GtkTreeIter iter;
gint id = -1;
if (gtk_tree_selection_get_selected (selection, &model, &iter))
if (gtk_tree_selection_get_selected (self->categories_selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
CATEGORY_IDS_COLUMN, &id,
......@@ -667,10 +664,6 @@ populate_options_real (PpOptionsDialog *self)
tab_add (self, C_("Printer Option Group", "Advanced"), advanced_tab_grid);
/* Select the first option group */
g_signal_connect (self->categories_selection,
"changed",
G_CALLBACK (category_selection_changed_cb), self);
if ((model = gtk_tree_view_get_model (self->categories_treeview)) != NULL &&
gtk_tree_model_get_iter_first (model, &iter))
gtk_tree_selection_select_iter (self->categories_selection, &iter);
......@@ -830,11 +823,9 @@ print_test_page_cb (GObject *source_object,
}
static void
test_page_cb (GtkButton *button,
gpointer user_data)
test_page_cb (PpOptionsDialog *self)
{
PpOptionsDialog *self = (PpOptionsDialog*) user_data;
gint i;
gint i;
if (self->printer_name)
{
......@@ -906,9 +897,6 @@ pp_options_dialog_new (gchar *printer_name,
self->sensitive = sensitive;
/* connect signals */
g_signal_connect (self->test_page_button, "clicked", G_CALLBACK (test_page_cb), self);
gtk_window_set_title (GTK_WINDOW (self), printer_name);
self->populating_dialog = TRUE;
......@@ -963,7 +951,9 @@ pp_options_dialog_class_init (PpOptionsDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, PpOptionsDialog, notebook);
gtk_widget_class_bind_template_child (widget_class, PpOptionsDialog, spinner);
gtk_widget_class_bind_template_child (widget_class, PpOptionsDialog, stack);
gtk_widget_class_bind_template_child (widget_class, PpOptionsDialog, test_page_button);
gtk_widget_class_bind_template_callback (widget_class, category_selection_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, test_page_cb);
}
void
......
......@@ -13,9 +13,10 @@
<object class="GtkHeaderBar">
<property name="visible">True</property>
<child>
<object class="GtkButton" id="test_page_button">
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Translators: This button triggers the printing of a test page.">Test Page</property>
<signal name="clicked" handler="test_page_cb" object="PpOptionsDialog" swapped="yes"/>
</object>
<packing>
<property name="pack_type">start</property>
......@@ -54,7 +55,9 @@
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="categories_selection"/>
<object class="GtkTreeSelection" id="categories_selection">
<signal name="changed" handler="category_selection_changed_cb" object="PpOptionsDialog" swapped="yes"/>
</object>
</child>
</object>
</child>
......
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