printers: Move callbacks into .ui file
This commit is contained in:
parent
015c79411a
commit
b842a33316
2 changed files with 15 additions and 22 deletions
|
@ -49,7 +49,6 @@ struct _PpOptionsDialog {
|
|||
GtkNotebook *notebook;
|
||||
GtkSpinner *spinner;
|
||||
GtkStack *stack;
|
||||
GtkButton *test_page_button;
|
||||
|
||||
gchar *printer_name;
|
||||
|
||||
|
@ -483,15 +482,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,
|
||||
|
@ -679,10 +676,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);
|
||||
|
@ -842,11 +835,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)
|
||||
{
|
||||
|
@ -918,9 +909,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;
|
||||
|
@ -975,7 +963,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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue