printers: Make the options dialog a full widget using GtkTemplate
This commit is contained in:
parent
6d23ac0892
commit
60ea08cc64
4 changed files with 109 additions and 211 deletions
|
@ -41,13 +41,14 @@
|
|||
#include "pp-printer.h"
|
||||
|
||||
struct _PpOptionsDialog {
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *parent;
|
||||
GtkDialog parent_instance;
|
||||
|
||||
GtkWidget *dialog;
|
||||
|
||||
UserResponseCallback user_callback;
|
||||
gpointer user_data;
|
||||
GtkTreeSelection *categories_selection;
|
||||
GtkTreeView *categories_treeview;
|
||||
GtkNotebook *notebook;
|
||||
GtkSpinner *spinner;
|
||||
GtkStack *stack;
|
||||
GtkButton *test_page_button;
|
||||
|
||||
gchar *printer_name;
|
||||
|
||||
|
@ -67,7 +68,7 @@ struct _PpOptionsDialog {
|
|||
gboolean sensitive;
|
||||
};
|
||||
|
||||
static void pp_options_dialog_hide (PpOptionsDialog *self);
|
||||
G_DEFINE_TYPE (PpOptionsDialog, pp_options_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -358,10 +359,12 @@ ipp_option_add (IPPAttribute *attr_supported,
|
|||
printer_name);
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show_all (widget);
|
||||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
position = grid_get_height (grid);
|
||||
|
||||
label = gtk_label_new (option_display_name);
|
||||
gtk_widget_show (GTK_WIDGET (label));
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
|
||||
context = gtk_widget_get_style_context (label);
|
||||
gtk_style_context_add_class (context, "dim-label");
|
||||
|
@ -391,10 +394,12 @@ ppd_option_add (ppd_option_t option,
|
|||
widget = (GtkWidget *) pp_ppd_option_widget_new (&option, printer_name);
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show_all (widget);
|
||||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
position = grid_get_height (grid);
|
||||
|
||||
label = gtk_label_new (ppd_option_name_translate (&option));
|
||||
gtk_widget_show (GTK_WIDGET (label));
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
|
||||
context = gtk_widget_get_style_context (label);
|
||||
gtk_style_context_add_class (context, "dim-label");
|
||||
|
@ -416,6 +421,7 @@ tab_grid_new ()
|
|||
GtkWidget *grid;
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_show (GTK_WIDGET (grid));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (grid), 20);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 15);
|
||||
|
||||
|
@ -423,9 +429,8 @@ tab_grid_new ()
|
|||
}
|
||||
|
||||
static void
|
||||
tab_add (const gchar *tab_name,
|
||||
GtkWidget *options_notebook,
|
||||
GtkTreeView *treeview,
|
||||
tab_add (PpOptionsDialog *self,
|
||||
const gchar *tab_name,
|
||||
GtkWidget *grid)
|
||||
{
|
||||
GtkListStore *store;
|
||||
|
@ -437,18 +442,19 @@ tab_add (const gchar *tab_name,
|
|||
if (!grid_is_empty (grid))
|
||||
{
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (GTK_WIDGET (scrolled_window));
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), grid);
|
||||
|
||||
id = gtk_notebook_append_page (GTK_NOTEBOOK (options_notebook),
|
||||
id = gtk_notebook_append_page (self->notebook,
|
||||
scrolled_window,
|
||||
NULL);
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
store = GTK_LIST_STORE (gtk_tree_view_get_model (treeview));
|
||||
store = GTK_LIST_STORE (gtk_tree_view_get_model (self->categories_treeview));
|
||||
if (!store)
|
||||
{
|
||||
store = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);
|
||||
|
@ -463,7 +469,7 @@ tab_add (const gchar *tab_name,
|
|||
|
||||
if (unref_store)
|
||||
{
|
||||
gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
|
||||
gtk_tree_view_set_model (self->categories_treeview, GTK_TREE_MODEL (store));
|
||||
g_object_unref (store);
|
||||
}
|
||||
}
|
||||
|
@ -482,7 +488,6 @@ category_selection_changed_cb (GtkTreeSelection *selection,
|
|||
PpOptionsDialog *self = (PpOptionsDialog *) user_data;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *options_notebook;
|
||||
gint id = -1;
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
|
@ -494,22 +499,16 @@ category_selection_changed_cb (GtkTreeSelection *selection,
|
|||
|
||||
if (id >= 0)
|
||||
{
|
||||
options_notebook = (GtkWidget*)
|
||||
gtk_builder_get_object (self->builder, "options-notebook");
|
||||
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (options_notebook), id);
|
||||
gtk_notebook_set_current_page (self->notebook, id);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
populate_options_real (PpOptionsDialog *self)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeView *treeview;
|
||||
GtkTreeIter iter;
|
||||
ppd_file_t *ppd_file;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *general_tab_grid = tab_grid_new ();
|
||||
GtkWidget *page_setup_tab_grid = tab_grid_new ();
|
||||
|
@ -519,22 +518,11 @@ populate_options_real (PpOptionsDialog *self)
|
|||
GtkWidget *color_tab_grid = tab_grid_new ();
|
||||
GtkWidget *finishing_tab_grid = tab_grid_new ();
|
||||
GtkWidget *advanced_tab_grid = tab_grid_new ();
|
||||
GtkWidget *widget;
|
||||
gint i, j;
|
||||
|
||||
widget = (GtkWidget*)
|
||||
gtk_builder_get_object (self->builder, "options-spinner");
|
||||
gtk_spinner_stop (GTK_SPINNER (widget));
|
||||
gtk_spinner_stop (self->spinner);
|
||||
|
||||
widget = (GtkWidget*)
|
||||
gtk_builder_get_object (self->builder, "stack");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), "main-box");
|
||||
|
||||
treeview = (GtkTreeView *)
|
||||
gtk_builder_get_object (self->builder, "options-categories-treeview");
|
||||
|
||||
notebook = (GtkWidget *)
|
||||
gtk_builder_get_object (self->builder, "options-notebook");
|
||||
gtk_stack_set_visible_child_name (self->stack, "main-box");
|
||||
|
||||
if (self->ipp_attributes)
|
||||
{
|
||||
|
@ -666,48 +654,39 @@ populate_options_real (PpOptionsDialog *self)
|
|||
}
|
||||
|
||||
/* Translators: "General" tab contains general printer options */
|
||||
tab_add (C_("Printer Option Group", "General"), notebook, treeview, general_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "General"), general_tab_grid);
|
||||
|
||||
/* Translators: "Page Setup" tab contains settings related to pages (page size, paper source, etc.) */
|
||||
tab_add (C_("Printer Option Group", "Page Setup"), notebook, treeview, page_setup_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "Page Setup"), page_setup_tab_grid);
|
||||
|
||||
/* Translators: "Installable Options" tab contains settings of presence of installed options (amount of RAM, duplex unit, etc.) */
|
||||
tab_add (C_("Printer Option Group", "Installable Options"), notebook, treeview, installable_options_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "Installable Options"), installable_options_tab_grid);
|
||||
|
||||
/* Translators: "Job" tab contains settings for jobs */
|
||||
tab_add (C_("Printer Option Group", "Job"), notebook, treeview, job_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "Job"), job_tab_grid);
|
||||
|
||||
/* Translators: "Image Quality" tab contains settings for quality of output print (e.g. resolution) */
|
||||
tab_add (C_("Printer Option Group", "Image Quality"), notebook, treeview, image_quality_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "Image Quality"), image_quality_tab_grid);
|
||||
|
||||
/* Translators: "Color" tab contains color settings (e.g. color printing) */
|
||||
tab_add (C_("Printer Option Group", "Color"), notebook, treeview, color_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "Color"), color_tab_grid);
|
||||
|
||||
/* Translators: "Finishing" tab contains finishing settings (e.g. booklet printing) */
|
||||
tab_add (C_("Printer Option Group", "Finishing"), notebook, treeview, finishing_tab_grid);
|
||||
tab_add (self, C_("Printer Option Group", "Finishing"), finishing_tab_grid);
|
||||
|
||||
/* Translators: "Advanced" tab contains all others settings */
|
||||
tab_add (C_("Printer Option Group", "Advanced"), notebook, treeview, advanced_tab_grid);
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (notebook));
|
||||
tab_add (self, C_("Printer Option Group", "Advanced"), advanced_tab_grid);
|
||||
|
||||
/* Select the first option group */
|
||||
if ((selection = gtk_tree_view_get_selection (treeview)) != NULL)
|
||||
{
|
||||
g_signal_connect (selection,
|
||||
g_signal_connect (self->categories_selection,
|
||||
"changed",
|
||||
G_CALLBACK (category_selection_changed_cb), self);
|
||||
|
||||
if ((model = gtk_tree_view_get_model (treeview)) != NULL &&
|
||||
if ((model = gtk_tree_view_get_model (self->categories_treeview)) != NULL &&
|
||||
gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_tree_selection_select_iter (selection, &iter);
|
||||
}
|
||||
gtk_tree_selection_select_iter (self->categories_selection, &iter);
|
||||
|
||||
self->populating_dialog = FALSE;
|
||||
if (self->response != GTK_RESPONSE_NONE)
|
||||
{
|
||||
self->user_callback (GTK_DIALOG (self->dialog), self->response, self->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -775,8 +754,6 @@ populate_options (PpOptionsDialog *self)
|
|||
{
|
||||
GtkTreeViewColumn *column;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeView *treeview;
|
||||
GtkWidget *widget;
|
||||
/*
|
||||
* Options which we need to obtain through an IPP request
|
||||
* to be able to fill the options dialog.
|
||||
|
@ -792,23 +769,16 @@ populate_options (PpOptionsDialog *self)
|
|||
"orientation-requested-default",
|
||||
NULL};
|
||||
|
||||
widget = (GtkWidget*)
|
||||
gtk_builder_get_object (self->builder, "stack");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), "progress-box");
|
||||
|
||||
treeview = (GtkTreeView *)
|
||||
gtk_builder_get_object (self->builder, "options-categories-treeview");
|
||||
gtk_stack_set_visible_child_name (self->stack, "progress-box");
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
|
||||
column = gtk_tree_view_column_new_with_attributes ("Categories", renderer,
|
||||
"text", CATEGORY_NAMES_COLUMN, NULL);
|
||||
gtk_tree_view_column_set_expand (column, TRUE);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
gtk_tree_view_append_column (self->categories_treeview, column);
|
||||
|
||||
widget = (GtkWidget*)
|
||||
gtk_builder_get_object (self->builder, "options-spinner");
|
||||
gtk_spinner_start (GTK_SPINNER (widget));
|
||||
gtk_spinner_start (self->spinner);
|
||||
|
||||
printer_get_ppd_async (self->printer_name,
|
||||
NULL,
|
||||
|
@ -924,53 +894,15 @@ test_page_cb (GtkButton *button,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
options_dialog_response_cb (GtkDialog *_dialog,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
PpOptionsDialog *self = (PpOptionsDialog*) user_data;
|
||||
|
||||
pp_options_dialog_hide (self);
|
||||
self->response = response_id;
|
||||
|
||||
if (!self->populating_dialog)
|
||||
self->user_callback (GTK_DIALOG (self->dialog), response_id, self->user_data);
|
||||
}
|
||||
|
||||
PpOptionsDialog *
|
||||
pp_options_dialog_new (GtkWindow *parent,
|
||||
UserResponseCallback user_callback,
|
||||
gpointer user_data,
|
||||
gchar *printer_name,
|
||||
pp_options_dialog_new (gchar *printer_name,
|
||||
gboolean sensitive)
|
||||
{
|
||||
PpOptionsDialog *self;
|
||||
GtkWidget *test_page_button;
|
||||
g_autoptr(GError) error = NULL;
|
||||
gchar *objects[] = { "options-dialog", NULL };
|
||||
guint builder_result;
|
||||
|
||||
self = g_new0 (PpOptionsDialog, 1);
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
self->parent = GTK_WIDGET (parent);
|
||||
|
||||
builder_result = gtk_builder_add_objects_from_resource (self->builder,
|
||||
"/org/gnome/control-center/printers/pp-options-dialog.ui",
|
||||
objects, &error);
|
||||
|
||||
if (builder_result == 0)
|
||||
{
|
||||
g_warning ("Could not load ui: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->dialog = (GtkWidget *) gtk_builder_get_object (self->builder, "options-dialog");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (parent));
|
||||
|
||||
self->user_callback = user_callback;
|
||||
self->user_data = user_data;
|
||||
self = g_object_new (pp_options_dialog_get_type (),
|
||||
"use-header-bar", 1,
|
||||
NULL);
|
||||
|
||||
self->printer_name = g_strdup (printer_name);
|
||||
|
||||
|
@ -983,18 +915,12 @@ pp_options_dialog_new (GtkWindow *parent,
|
|||
self->ipp_attributes = NULL;
|
||||
self->ipp_attributes_set = FALSE;
|
||||
|
||||
self->response = GTK_RESPONSE_NONE;
|
||||
|
||||
self->sensitive = sensitive;
|
||||
|
||||
/* connect signals */
|
||||
g_signal_connect (self->dialog, "response", G_CALLBACK (options_dialog_response_cb), self);
|
||||
test_page_button = (GtkWidget*) gtk_builder_get_object (self->builder, "print-test-page");
|
||||
g_signal_connect (test_page_button, "clicked", G_CALLBACK (test_page_cb), self);
|
||||
g_signal_connect (self->test_page_button, "clicked", G_CALLBACK (test_page_cb), self);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (self->dialog), printer_name);
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (self->dialog));
|
||||
gtk_window_set_title (GTK_WINDOW (self), printer_name);
|
||||
|
||||
self->populating_dialog = TRUE;
|
||||
populate_options (self);
|
||||
|
@ -1002,26 +928,10 @@ pp_options_dialog_new (GtkWindow *parent,
|
|||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
pp_options_dialog_set_callback (PpOptionsDialog *self,
|
||||
UserResponseCallback user_callback,
|
||||
gpointer user_data)
|
||||
static void
|
||||
pp_options_dialog_dispose (GObject *object)
|
||||
{
|
||||
if (self != NULL)
|
||||
{
|
||||
self->user_callback = user_callback;
|
||||
self->user_data = user_data;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pp_options_dialog_free (PpOptionsDialog *self)
|
||||
{
|
||||
gtk_widget_destroy (GTK_WIDGET (self->dialog));
|
||||
self->dialog = NULL;
|
||||
|
||||
g_object_unref (self->builder);
|
||||
self->builder = NULL;
|
||||
PpOptionsDialog *self = PP_OPTIONS_DIALOG (object);
|
||||
|
||||
g_free (self->printer_name);
|
||||
self->printer_name = NULL;
|
||||
|
@ -1045,11 +955,29 @@ pp_options_dialog_free (PpOptionsDialog *self)
|
|||
self->ipp_attributes = NULL;
|
||||
}
|
||||
|
||||
g_free (self);
|
||||
G_OBJECT_CLASS (pp_options_dialog_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
pp_options_dialog_hide (PpOptionsDialog *self)
|
||||
void
|
||||
pp_options_dialog_class_init (PpOptionsDialogClass *klass)
|
||||
{
|
||||
gtk_widget_hide (GTK_WIDGET (self->dialog));
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = pp_options_dialog_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/printers/pp-options-dialog.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, PpOptionsDialog, categories_selection);
|
||||
gtk_widget_class_bind_template_child (widget_class, PpOptionsDialog, categories_treeview);
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
pp_options_dialog_init (PpOptionsDialog *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
|
|
@ -25,16 +25,10 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PpOptionsDialog PpOptionsDialog;
|
||||
#define PP_TYPE_OPTIONS_DIALOG (pp_options_dialog_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (PpOptionsDialog, pp_options_dialog, PP, OPTIONS_DIALOG, GtkDialog)
|
||||
|
||||
PpOptionsDialog *pp_options_dialog_new (GtkWindow *parent,
|
||||
UserResponseCallback user_callback,
|
||||
gpointer user_data,
|
||||
gchar *printer_name,
|
||||
PpOptionsDialog *pp_options_dialog_new (gchar *printer_name,
|
||||
gboolean sensitive);
|
||||
void pp_options_dialog_set_callback (PpOptionsDialog *dialog,
|
||||
UserResponseCallback user_callback,
|
||||
gpointer user_data);
|
||||
void pp_options_dialog_free (PpOptionsDialog *dialog);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -2,22 +2,18 @@
|
|||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkDialog" id="options-dialog">
|
||||
<template class="PpOptionsDialog" parent="GtkDialog">
|
||||
<property name="width_request">500</property>
|
||||
<property name="height_request">400</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title"> </property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="use_header_bar">1</property>
|
||||
<child internal-child="headerbar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="print-test-page">
|
||||
<object class="GtkButton" id="test_page_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes" comments="Translators: This button triggers the printing of a test page.">Test Page</property>
|
||||
</object>
|
||||
|
@ -53,12 +49,12 @@
|
|||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="options-categories-treeview">
|
||||
<object class="GtkTreeView" id="categories_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection"/>
|
||||
<object class="GtkTreeSelection" id="categories_selection"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -70,7 +66,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="options-notebook">
|
||||
<object class="GtkNotebook" id="notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tab_pos">left</property>
|
||||
|
@ -96,7 +92,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="options-spinner">
|
||||
<object class="GtkSpinner" id="spinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="width_request">24</property>
|
||||
<property name="height_request">24</property>
|
||||
|
@ -110,5 +106,5 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
@ -80,8 +80,9 @@ struct _PpPrinterEntry
|
|||
GtkLabel *error_status;
|
||||
|
||||
/* Dialogs */
|
||||
PpOptionsDialog *pp_options_dialog;
|
||||
PpDetailsDialog *pp_details_dialog;
|
||||
PpJobsDialog *pp_jobs_dialog;
|
||||
PpOptionsDialog *pp_options_dialog;
|
||||
|
||||
GCancellable *get_jobs_cancellable;
|
||||
};
|
||||
|
@ -459,38 +460,20 @@ on_show_printer_details_dialog (GtkButton *button,
|
|||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
printer_options_dialog_cb (GtkDialog *dialog,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
PpPrinterEntry *self = user_data;
|
||||
|
||||
if (self->pp_options_dialog != NULL)
|
||||
{
|
||||
pp_options_dialog_free (self->pp_options_dialog);
|
||||
self->pp_options_dialog = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
printer_options_dialog_free_cb (GtkDialog *dialog,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
pp_options_dialog_free ((PpOptionsDialog *) user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
on_show_printer_options_dialog (GtkButton *button,
|
||||
PpPrinterEntry *self)
|
||||
{
|
||||
self->pp_options_dialog = pp_options_dialog_new (
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
||||
printer_options_dialog_cb,
|
||||
self,
|
||||
self->printer_name,
|
||||
self->is_authorized);
|
||||
PpOptionsDialog *dialog;
|
||||
|
||||
dialog = pp_options_dialog_new (self->printer_name, self->is_authorized);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -996,9 +979,6 @@ pp_printer_entry_dispose (GObject *object)
|
|||
g_cancellable_cancel (self->get_jobs_cancellable);
|
||||
g_cancellable_cancel (self->check_clean_heads_cancellable);
|
||||
|
||||
if (self->pp_options_dialog != NULL)
|
||||
pp_options_dialog_set_callback (self->pp_options_dialog, printer_options_dialog_free_cb, self->pp_options_dialog);
|
||||
|
||||
if (self->pp_jobs_dialog != NULL)
|
||||
pp_jobs_dialog_set_callback (self->pp_jobs_dialog, printer_jobs_dialog_free_cb, self->pp_jobs_dialog);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue