[gnome-control-center/gbsneto/gtk4: 10/13] printers: Port to GTK4
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/gtk4: 10/13] printers: Port to GTK4
- Date: Mon, 1 Nov 2021 20:15:39 +0000 (UTC)
commit 1cc9ee14dce4f362aada4f44ef5fec51b12e6f62
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Oct 29 17:16:45 2021 -0300
printers: Port to GTK4
Fortunately for us GtkTreeView still operates pretty
much exactly like in GTK3. Other than that, it's a
dense junction of all that we've done so far to port
other panels.
panels/meson.build | 2 +-
panels/printers/authentication-dialog.ui | 136 +++-----
panels/printers/cc-printers-panel.c | 56 +--
panels/printers/new-printer-dialog.ui | 577 ++++++++++++++-----------------
panels/printers/pp-details-dialog.c | 60 ++--
panels/printers/pp-details-dialog.ui | 108 +++---
panels/printers/pp-ipp-option-widget.c | 12 +-
panels/printers/pp-job-row.c | 16 +-
panels/printers/pp-job-row.ui | 34 +-
panels/printers/pp-jobs-dialog.c | 33 +-
panels/printers/pp-jobs-dialog.ui | 252 +++-----------
panels/printers/pp-new-printer-dialog.c | 67 ++--
panels/printers/pp-options-dialog.c | 49 +--
panels/printers/pp-options-dialog.ui | 48 +--
panels/printers/pp-ppd-option-widget.c | 17 +-
panels/printers/pp-printer-entry.c | 80 +++--
panels/printers/printer-entry.ui | 188 +++++-----
panels/printers/printers.ui | 287 +++++++--------
shell/cc-panel-loader.c | 4 +-
19 files changed, 793 insertions(+), 1233 deletions(-)
---
diff --git a/panels/meson.build b/panels/meson.build
index cdc147b3a..90f6d62f6 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -19,7 +19,7 @@ panels = [
'notifications',
# 'online-accounts',
'power',
-# 'printers',
+ 'printers',
# 'region',
'removable-media',
'search',
diff --git a/panels/printers/authentication-dialog.ui b/panels/printers/authentication-dialog.ui
index 965a2b4fa..c9e9a05b9 100644
--- a/panels/printers/authentication-dialog.ui
+++ b/panels/printers/authentication-dialog.ui
@@ -5,66 +5,29 @@
<object class="GtkDialog" id="authentication-dialog">
<property name="width_request">430</property>
<property name="height_request">270</property>
- <property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="border_width">5</property>
<property name="title" translatable="yes"> </property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox" id="main-vbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action-area1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="authentication-button">
- <property name="label" translatable="yes">Authenticate</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <child type="action">
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">Cancel</property>
+ </object>
+ </child>
+ <child type="action">
+ <object class="GtkButton" id="authentication-button">
+ <property name="label" translatable="yes">Authenticate</property>
+ <property name="sensitive">False</property>
+ <property name="receives_default">True</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_start">5</property>
<property name="margin_end">5</property>
<property name="hexpand">True</property>
@@ -73,115 +36,96 @@
<property name="column_spacing">15</property>
<child>
<object class="GtkLabel" id="username-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Username</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="password-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">end</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Password</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="username-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="password-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="invisible_char">●</property>
<property name="activates_default">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="authentication-title">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Authentication Required</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="pixel_size">48</property>
<property name="icon_name">dialog-password-symbolic</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ <property name="height">2</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="height">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="authentication-text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_bottom">15</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="max_width_chars">36</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 880d5a4a0..437c8282c 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -238,11 +238,8 @@ cc_printers_panel_constructed (GObject *object)
widget = (GtkWidget*)
gtk_builder_get_object (self->builder, "search-bar");
- g_signal_connect_object (shell,
- "key-press-event",
- G_CALLBACK (gtk_search_bar_handle_event),
- widget,
- G_CONNECT_SWAPPED);
+ gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (widget),
+ GTK_WIDGET (shell));
}
static void
@@ -769,13 +766,12 @@ set_current_page (GObject *source_object,
update_sensitivity (user_data);
}
-static void
-destroy_nonexisting_entries (PpPrinterEntry *entry,
- gpointer user_data)
+static gboolean
+remove_nonexisting_entry (CcPrintersPanel *self,
+ PpPrinterEntry *entry)
{
- CcPrintersPanel *self = (CcPrintersPanel *) user_data;
- gboolean exists = FALSE;
- gint i;
+ gboolean exists = FALSE;
+ gint i;
for (i = 0; i < self->num_dests; i++)
{
@@ -787,10 +783,9 @@ destroy_nonexisting_entries (PpPrinterEntry *entry,
}
if (!exists)
- {
- g_hash_table_remove (self->printer_entries, pp_printer_entry_get_name (entry));
- gtk_widget_destroy (GTK_WIDGET (entry));
- }
+ g_hash_table_remove (self->printer_entries, pp_printer_entry_get_name (entry));
+
+ return !exists;
}
static void
@@ -801,6 +796,7 @@ actualize_printers_list_cb (GObject *source_object,
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkWidget *widget;
PpCupsDests *cups_dests;
+ GtkWidget *child;
gboolean new_printer_available = FALSE;
g_autoptr(GError) error = NULL;
gpointer item;
@@ -830,7 +826,16 @@ actualize_printers_list_cb (GObject *source_object,
gtk_stack_set_visible_child_name (GTK_STACK (widget), "printers-list");
widget = (GtkWidget*) gtk_builder_get_object (self->builder, "content");
- gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) destroy_nonexisting_entries, self);
+ child = gtk_widget_get_first_child (widget);
+ while (child)
+ {
+ GtkWidget *next = gtk_widget_get_next_sibling (child);
+
+ if (remove_nonexisting_entry (self, PP_PRINTER_ENTRY (child)))
+ gtk_list_box_remove (GTK_LIST_BOX (widget), child);
+
+ child = next;
+ }
for (i = 0; i < self->num_dests; i++)
{
@@ -926,7 +931,7 @@ printer_add_async_cb (GObject *source_object,
_("Failed to add new printer."));
g_signal_connect (message_dialog,
"response",
- G_CALLBACK (gtk_widget_destroy),
+ G_CALLBACK (gtk_window_destroy),
NULL);
gtk_widget_show (message_dialog);
}
@@ -957,22 +962,22 @@ new_printer_dialog_response_cb (GtkDialog *_dialog,
self);
}
- gtk_widget_destroy (GTK_WIDGET (pp_new_printer_dialog));
+ gtk_window_destroy (GTK_WINDOW (pp_new_printer_dialog));
self->pp_new_printer_dialog = NULL;
}
static void
printer_add_cb (CcPrintersPanel *self)
{
- GtkWidget *toplevel;
+ GtkNative *native;
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+ native = gtk_widget_get_native (GTK_WIDGET (self));
self->pp_new_printer_dialog = pp_new_printer_dialog_new (self->all_ppds_list,
new_printer_dialog_response_cb,
self);
gtk_window_set_transient_for (GTK_WINDOW (self->pp_new_printer_dialog),
- GTK_WINDOW (toplevel));
+ GTK_WINDOW (native));
gtk_widget_show (GTK_WIDGET (self->pp_new_printer_dialog));
}
@@ -1124,11 +1129,13 @@ filter_function (GtkListBoxRow *row,
g_autofree gchar *name = NULL;
g_autofree gchar *location = NULL;
GList *iter;
+ const gchar *search_text;
search_entry = (GtkWidget*)
gtk_builder_get_object (self->builder, "search-entry");
+ search_text = gtk_editable_get_text (GTK_EDITABLE (search_entry));
- if (gtk_entry_get_text_length (GTK_ENTRY (search_entry)) == 0)
+ if (g_utf8_strlen (search_text, -1) == 0)
{
retval = TRUE;
}
@@ -1137,7 +1144,7 @@ filter_function (GtkListBoxRow *row,
name = cc_util_normalize_casefold_and_unaccent (pp_printer_entry_get_name (entry));
location = cc_util_normalize_casefold_and_unaccent (pp_printer_entry_get_location (entry));
- search = cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (GTK_ENTRY (search_entry)));
+ search = cc_util_normalize_casefold_and_unaccent (search_text);
retval = strstr (name, search) != NULL;
if (location != NULL)
@@ -1309,6 +1316,5 @@ Please check your installation");
self);
pp_cups_connection_test_async (self->cups, cc_panel_get_cancellable (CC_PANEL (self)), connection_test_cb,
self);
- gtk_container_add (GTK_CONTAINER (self), top_widget);
- gtk_widget_show (GTK_WIDGET (self));
+ adw_bin_set_child (ADW_BIN (self), top_widget);
}
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index 20b89e4b2..561b6df65 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -25,393 +25,332 @@
<template class="PpNewPrinterDialog" parent="GtkDialog">
<property name="width_request">480</property>
<property name="height_request">490</property>
- <property name="can_focus">False</property>
<property name="title" translatable="yes" comments="Translators: This is the title presented at top of
the dialog.">Add Printer</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" id="headerbar">
- <property name="visible">True</property>
- <property name="show-close-button">False</property>
+ <property name="show-title-buttons">False</property>
+ <property name="title-widget">
+ <object class="AdwWindowTitle" id="header_title">
+ <property name="title" translatable="yes" comments="Translators: This is the title presented at
top of the dialog.">Add Printer</property>
+ </object>
+ </property>
<child>
<object class="GtkStack" id="headerbar_topleft_buttons">
- <property name="visible">True</property>
<property name="valign">center</property>
+
<child>
- <object class="GtkButton" id="new_printer_cancel_button">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">addprinter-page</property>
- </packing>
+ <property name="child">
+ <object class="GtkButton" id="new_printer_cancel_button">
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_underline">True</property>
+ </object>
+ </property>
+ </object>
</child>
+
<child>
- <object class="GtkButton" id="go_back_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">start</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">go-previous-symbolic</property>
+ <object class="GtkStackPage">
+ <property name="name">authentication-page</property>
+ <property name="child">
+ <object class="GtkButton" id="go_back_button">
+ <property name="halign">start</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">go-previous-symbolic</property>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">authentication-page</property>
- </packing>
</child>
+
</object>
</child>
- <child>
+ <child type="end">
<object class="GtkStack" id="headerbar_topright_buttons">
- <property name="visible">True</property>
<property name="valign">center</property>
+
<child>
- <object class="GtkButton" id="new_printer_add_button">
- <property name="label" translatable="yes">_Add</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">addprinter-page</property>
- </packing>
+ <property name="child">
+ <object class="GtkButton" id="new_printer_add_button">
+ <property name="label" translatable="yes">_Add</property>
+ <property name="sensitive">False</property>
+ <property name="use_underline">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </property>
+ </object>
</child>
+
<child>
- <object class="GtkButton" id="unlock_button">
- <property name="label" translatable="yes" comments="Translators: This button opens
authentication dialog for selected server.">_Unlock</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">unlock_button</property>
- </packing>
+ <property name="child">
+ <object class="GtkButton" id="unlock_button">
+ <property name="label" translatable="yes" comments="Translators: This button opens
authentication dialog for selected server.">_Unlock</property>
+ <property name="use_underline">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </property>
+ </object>
</child>
+
<child>
- <object class="GtkButton" id="authenticate_button">
- <property name="label" translatable="yes" comments="Translators: This buttons submits the
credentials for the selected server.">_Unlock</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">authentication-page</property>
- </packing>
+ <property name="child">
+ <object class="GtkButton" id="authenticate_button">
+ <property name="label" translatable="yes" comments="Translators: This buttons submits
the credentials for the selected server.">_Unlock</property>
+ <property name="use_underline">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </property>
+ </object>
</child>
+
</object>
- <packing>
- <property name="pack-type">GTK_PACK_END</property>
- </packing>
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
- <property name="border_width">0</property>
<child>
<object class="GtkStack" id="dialog_stack">
- <property name="visible">True</property>
- <property name="border_width">0</property>
<child>
- <object class="GtkBox" id="box2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child>
- <object class="GtkStack" id="stack">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="transition-type">none</property>
- <property name="has_focus">True</property>
- <style>
- <class name="view"/>
- </style>
+ <object class="GtkStackPage">
+ <property name="name">addprinter-page</property>
+ <property name="child">
+ <object class="GtkBox" id="box2">
+ <property name="orientation">vertical</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkStack" id="stack">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="transition-type">none</property>
+ <style>
+ <class name="view"/>
+ </style>
+
<child>
- <object class="GtkTreeView" id="devices_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">devices_model_filter</property>
- <property name="headers_visible">False</property>
- <property name="enable-grid-lines">GTK_TREE_VIEW_GRID_LINES_HORIZONTAL</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection"/>
- </child>
+ <object class="GtkStackPage">
+ <property name="name">standard-page</property>
+ <property name="child">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <child>
+ <object class="GtkTreeView" id="devices_treeview">
+ <property name="model">devices_model_filter</property>
+ <property name="headers_visible">False</property>
+ <property
name="enable-grid-lines">GTK_TREE_VIEW_GRID_LINES_HORIZONTAL</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </property>
</object>
</child>
- </object>
- <packing>
- <property name="name">standard-page</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
- <property name="valign">GTK_ALIGN_CENTER</property>
- <property name="spacing">10</property>
+
<child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">GTK_ALIGN_START</property>
- <property name="pixel_size">80</property>
- <property name="icon_name">printer-symbolic</property>
- <property name="opacity">0.6</property>
- <style>
- <class name="dim-label"/>
- </style>
+ <object class="GtkStackPage">
+ <property name="name">no-printers-page</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
+ <property name="valign">GTK_ALIGN_CENTER</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkImage">
+ <property name="valign">GTK_ALIGN_START</property>
+ <property name="pixel_size">80</property>
+ <property name="icon_name">printer-symbolic</property>
+ <property name="opacity">0.6</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="no-devices-label">
+ <property name="sensitive">False</property>
+ <property name="label" translatable="yes" comments="Translators: No
printers were detected">No Printers Found</property>
+ <property name="opacity">0.6</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ </property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
</child>
+
<child>
- <object class="GtkLabel" id="no-devices-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="sensitive">False</property>
- <property name="label" translatable="yes" comments="Translators: No printers
were detected">No Printers Found</property>
- <property name="opacity">0.6</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <object class="GtkStackPage">
+ <property name="name">loading-page</property>
+ <property name="child">
+ <object class="GtkBox">
+ <style>
+ <class name="view"/>
+ </style>
+ <child>
+ <object class="GtkSpinner" id="spinner">
+ <property name="spinning">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="sensitive">False</property>
+ <property name="opacity">0.6</property>
+ </object>
+ </child>
+ </object>
+ </property>
</object>
</child>
+
</object>
- <packing>
- <property name="name">no-printers-page</property>
- </packing>
</child>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <style>
- <class name="view"/>
- </style>
- <child>
- <object class="GtkSpinner" id="spinner">
- <property name="visible">True</property>
- <property name="active">True</property>
- <property name="expand">True</property>
- <property name="sensitive">False</property>
- <property name="opacity">0.6</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="name">loading-page</property>
- </packing>
+ <object class="GtkSeparator" />
</child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparator">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolbar" id="toolbar1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">icons</property>
- <property name="icon_size">1</property>
- <style>
- <class name="toolbar"/>
- </style>
<child>
- <object class="GtkToolItem" id="toolbutton1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkBox" id="box1">
+ <property name="margin-top">4</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
<child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">4</property>
- <child>
- <object class="GtkSearchEntry" id="search_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_tooltip">True</property>
- <property name="invisible_char">●</property>
- <property name="truncate_multiline">True</property>
- <property name="invisible_char_set">True</property>
- <property name="placeholder_text" translatable="yes" comments="Translators:
The entered text should contain network address of a printer or a text which will filter found devices (their
names and locations)">Enter a network address or search for a printer</property>
- <property name="margin_start">40</property>
- <property name="margin_end">40</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <object class="GtkSearchEntry" id="search_entry">
+ <property name="has_tooltip">True</property>
+ <property name="placeholder_text" translatable="yes" comments="Translators: The
entered text should contain network address of a printer or a text which will filter found devices (their
names and locations)">Enter a network address or search for a printer</property>
+ <property name="margin_start">40</property>
+ <property name="margin_end">40</property>
</object>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">addprinter-page</property>
- </packing>
</child>
+
<child>
- <object class="GtkGrid">
- <property name="visible">True</property>
- <property name="margin">20</property>
- <property name="row_spacing">10</property>
- <property name="column_spacing">15</property>
- <property name="expand">True</property>
- <style>
- <class name="background"/>
- </style>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="pixel_size">48</property>
- <property name="icon_name">dialog-password-symbolic</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="height">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="authentication_title">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Authentication Required</property>
- <property name="xalign">0</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="authentication_text">
- <property name="visible">True</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">36</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Enter username and password to view printers
on Print Server.</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Username</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="username_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Password</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="password_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
+ <object class="GtkStackPage">
+ <property name="name">authentication-page</property>
+ <property name="child">
+ <object class="GtkGrid">
+ <property name="margin-top">20</property>
+ <property name="margin-bottom">20</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
+ <property name="row_spacing">10</property>
+ <property name="column_spacing">15</property>
<property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <style>
+ <class name="background"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="pixel_size">48</property>
+ <property name="icon_name">dialog-password-symbolic</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ <property name="row-span">2</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="authentication_title">
+ <property name="label" translatable="yes">Authentication Required</property>
+ <property name="xalign">0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="authentication_text">
+ <property name="wrap">True</property>
+ <property name="max_width_chars">36</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Enter username and password to view
printers on Print Server.</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Username</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEntry" id="username_entry">
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="hexpand">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Password</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEntry" id="password_entry">
+ <property name="visibility">False</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="hexpand">True</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
+ </object>
+ </child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">authentication-page</property>
- </packing>
</child>
+
</object>
</child>
</object>
diff --git a/panels/printers/pp-details-dialog.c b/panels/printers/pp-details-dialog.c
index 65589a7c8..ece9345f0 100644
--- a/panels/printers/pp-details-dialog.c
+++ b/panels/printers/pp-details-dialog.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+/*
*
* Copyright 2016 Red Hat, Inc,
*
@@ -42,7 +42,7 @@ struct _PpDetailsDialog {
GtkDialog parent_instance;
GtkLabel *dialog_title;
- GtkButtonBox *driver_buttons;
+ GtkBox *driver_buttons;
GtkBox *loading_box;
GtkLabel *printer_address_label;
GtkEntry *printer_location_entry;
@@ -154,7 +154,7 @@ ppd_selection_dialog_response_cb (GtkDialog *dialog,
}
}
- gtk_widget_destroy (GTK_WIDGET (self->pp_ppd_selection_dialog));
+ gtk_window_destroy (GTK_WINDOW (self->pp_ppd_selection_dialog));
self->pp_ppd_selection_dialog = NULL;
}
@@ -223,6 +223,34 @@ select_ppd_in_dialog (PpDetailsDialog *self)
}
}
+static void
+ppd_file_select_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ PpDetailsDialog *self = PP_DETAILS_DIALOG (user_data);
+
+ if (response_id == GTK_RESPONSE_ACCEPT)
+ {
+ g_autoptr(GFile) file = NULL;
+ g_autofree gchar *ppd_filename = NULL;
+
+ file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+ ppd_filename = g_file_get_path (file);
+
+ if (self->printer_name && ppd_filename)
+ {
+ printer_set_ppd_file_async (self->printer_name,
+ ppd_filename,
+ self->cancellable,
+ set_ppd_cb,
+ self);
+ }
+ }
+
+ gtk_window_destroy (GTK_WINDOW (dialog));
+}
+
static void
select_ppd_manually (PpDetailsDialog *self)
{
@@ -247,23 +275,7 @@ select_ppd_manually (PpDetailsDialog *self)
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
- {
- g_autofree gchar *ppd_filename = NULL;
-
- ppd_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
- if (self->printer_name && ppd_filename)
- {
- printer_set_ppd_file_async (self->printer_name,
- ppd_filename,
- self->cancellable,
- set_ppd_cb,
- self);
- }
- }
-
- gtk_widget_destroy (dialog);
+ g_signal_connect (dialog, "response", G_CALLBACK (ppd_file_select_response_cb), self);
}
static void
@@ -354,8 +366,8 @@ pp_details_dialog_new (gchar *printer_name,
printer_url = g_strdup_printf ("<a href=\"http://%s:%d\">%s</a>", printer_address, ippPort (),
printer_address);
gtk_label_set_markup (GTK_LABEL (self->printer_address_label), printer_url);
- gtk_entry_set_text (GTK_ENTRY (self->printer_name_entry), printer_name);
- gtk_entry_set_text (GTK_ENTRY (self->printer_location_entry), printer_location);
+ gtk_editable_set_text (GTK_EDITABLE (self->printer_name_entry), printer_name);
+ gtk_editable_set_text (GTK_EDITABLE (self->printer_location_entry), printer_location);
gtk_label_set_text (GTK_LABEL (self->printer_model_label), printer_make_and_model);
update_sensitivity (self, sensitive);
@@ -367,12 +379,12 @@ const gchar *
pp_details_dialog_get_printer_name (PpDetailsDialog *self)
{
g_return_val_if_fail (PP_IS_DETAILS_DIALOG (self), NULL);
- return gtk_entry_get_text (GTK_ENTRY (self->printer_name_entry));
+ return gtk_editable_get_text (GTK_EDITABLE (self->printer_name_entry));
}
const gchar *
pp_details_dialog_get_printer_location (PpDetailsDialog *self)
{
g_return_val_if_fail (PP_IS_DETAILS_DIALOG (self), NULL);
- return gtk_entry_get_text (GTK_ENTRY (self->printer_location_entry));
+ return gtk_editable_get_text (GTK_EDITABLE (self->printer_location_entry));
}
diff --git a/panels/printers/pp-details-dialog.ui b/panels/printers/pp-details-dialog.ui
index 0d93c13d3..3f432db33 100644
--- a/panels/printers/pp-details-dialog.ui
+++ b/panels/printers/pp-details-dialog.ui
@@ -3,20 +3,15 @@
<interface>
<requires lib="gtk+" version="3.12"/>
<template class="PpDetailsDialog" parent="GtkDialog">
- <property name="can_focus">False</property>
- <property name="border_width">0</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>
- <property name="show_close_button">True</property>
+ <property name="show_title_buttons">True</property>
<child type="title">
<object class="GtkLabel" id="dialog_title">
- <property name="visible">True</property>
<property name="wrap">True</property>
<property name="max_width_chars">30</property>
<property name="ellipsize">middle</property>
@@ -24,120 +19,116 @@
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">20</property>
+ <property name="margin-top">20</property>
+ <property name="margin-bottom">20</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
<property name="halign">center</property>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="label" translatable="yes">Name</property>
<property name="halign">end</property>
<property name="mnemonic_widget">printer_name_entry</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="printer_name_entry">
- <property name="visible">True</property>
<property name="halign">fill</property>
<property name="width_request">320</property>
<signal name="changed" handler="printer_name_changed" object="PpDetailsDialog"
swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="label" translatable="yes">Location</property>
<property name="halign">end</property>
<property name="mnemonic_widget">printer_location_entry</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="printer_location_entry">
- <property name="visible">True</property>
<property name="width_request">320</property>
<property name="halign">fill</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="label" translatable="yes">Address</property>
<property name="halign">end</property>
<property name="mnemonic_widget">printer_address_label</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="printer_address_label">
- <property name="visible">True</property>
<property name="label">192.168.0.1</property>
<property name="halign">start</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="label" translatable="yes">Driver</property>
<property name="halign">end</property>
<property name="mnemonic_widget">printer_model_label</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- </packing>
</child>
<child>
<object class="GtkStack" id="printer_model_stack">
- <property name="visible">True</property>
<property name="halign">start</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
<child>
<object class="GtkLabel" id="printer_model_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<property name="label">HP Inkjet Delux 9000</property>
<property name="selectable">True</property>
@@ -145,19 +136,16 @@
</child>
<child>
<object class="GtkBox" id="loading_box">
- <property name="visible">True</property>
<property name="halign">start</property>
<property name="spacing">5</property>
<child>
<object class="GtkSpinner">
- <property name="visible">True</property>
- <property name="active">True</property>
+ <property name="spinning">True</property>
<property name="halign">start</property>
</object>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Searching for preferred drivers…</property>
</object>
@@ -165,21 +153,19 @@
</object>
</child>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">3</property>
- </packing>
</child>
<child>
- <object class="GtkButtonBox" id="driver_buttons">
- <property name="visible">True</property>
+ <object class="GtkBox" id="driver_buttons">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="halign">start</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">4</property>
+ </layout>
<child>
<object class="GtkButton" id="search_for_drivers_button">
- <property name="visible">True</property>
<property name="label" translatable="yes">Search for Drivers</property>
<property name="halign">fill</property>
<signal name="clicked" handler="search_for_drivers" object="PpDetailsDialog"
swapped="yes"/>
@@ -188,7 +174,6 @@
<child>
<object class="GtkButton" id="select_from_database_button">
- <property name="visible">True</property>
<property name="label" translatable="yes">Select from Database…</property>
<property name="halign">fill</property>
<signal name="clicked" handler="select_ppd_in_dialog" object="PpDetailsDialog"
swapped="yes"/>
@@ -197,17 +182,12 @@
<child>
<object class="GtkButton" id="install_ppd_button">
- <property name="visible">True</property>
<property name="label" translatable="yes">Install PPD File…</property>
<property name="halign">fill</property>
<signal name="clicked" handler="select_ppd_manually" object="PpDetailsDialog"
swapped="yes"/>
</object>
</child>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">4</property>
- </packing>
</child>
</object>
diff --git a/panels/printers/pp-ipp-option-widget.c b/panels/printers/pp-ipp-option-widget.c
index ec2c92a82..8ab7ea06f 100644
--- a/panels/printers/pp-ipp-option-widget.c
+++ b/panels/printers/pp-ipp-option-widget.c
@@ -374,15 +374,13 @@ construct_widget (PpIPPOptionWidget *self)
{
case IPP_ATTRIBUTE_TYPE_BOOLEAN:
self->switch_button = gtk_switch_new ();
- gtk_widget_show (self->switch_button);
- gtk_box_pack_start (GTK_BOX (self), self->switch_button, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (self), self->switch_button);
g_signal_connect_object (self->switch_button, "notify::active", G_CALLBACK
(switch_changed_cb), self, G_CONNECT_SWAPPED);
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
self->combo = combo_box_new ();
- gtk_widget_show (self->combo);
for (i = 0; i < self->option_supported->num_of_values; i++)
{
@@ -395,13 +393,12 @@ construct_widget (PpIPPOptionWidget *self)
value);
}
- gtk_box_pack_start (GTK_BOX (self), self->combo, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (self), self->combo);
g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self,
G_CONNECT_SWAPPED);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
self->combo = combo_box_new ();
- gtk_widget_show (self->combo);
for (i = 0; i < self->option_supported->num_of_values; i++)
combo_box_append (self->combo,
@@ -409,7 +406,7 @@ construct_widget (PpIPPOptionWidget *self)
self->option_supported->attribute_values[i].string_value),
self->option_supported->attribute_values[i].string_value);
- gtk_box_pack_start (GTK_BOX (self), self->combo, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (self), self->combo);
g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self,
G_CONNECT_SWAPPED);
break;
@@ -418,9 +415,8 @@ construct_widget (PpIPPOptionWidget *self)
self->option_supported->attribute_values[0].lower_range,
self->option_supported->attribute_values[0].upper_range,
1);
- gtk_widget_show (self->spin_button);
- gtk_box_pack_start (GTK_BOX (self), self->spin_button, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (self), self->spin_button);
g_signal_connect_object (self->spin_button, "value-changed", G_CALLBACK
(spin_button_changed_cb), self, G_CONNECT_SWAPPED);
break;
diff --git a/panels/printers/pp-job-row.c b/panels/printers/pp-job-row.c
index 7caa8319b..9aa834c1f 100644
--- a/panels/printers/pp-job-row.c
+++ b/panels/printers/pp-job-row.c
@@ -29,7 +29,6 @@ struct _PpJobRow
GtkListBoxRow parent;
GtkButton *pause_button;
- GtkImage *pause_image;
GtkLabel *state_label;
GtkLabel *title_label;
@@ -42,10 +41,9 @@ static void
pause_cb (PpJobRow *self)
{
pp_job_set_hold_until_async (self->job, pp_job_get_state (self->job) == IPP_JOB_HELD ? "no-hold" :
"indefinite");
- gtk_image_set_from_icon_name (self->pause_image,
- pp_job_get_state (self->job) == IPP_JOB_HELD ?
- "media-playback-pause-symbolic" :
"media-playback-start-symbolic",
- GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_button_set_icon_name (self->pause_button,
+ pp_job_get_state (self->job) == IPP_JOB_HELD ?
+ "media-playback-pause-symbolic" :
"media-playback-start-symbolic");
}
static void
@@ -75,7 +73,6 @@ pp_job_row_class_init (PpJobRowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/printers/pp-job-row.ui");
gtk_widget_class_bind_template_child (widget_class, PpJobRow, pause_button);
- gtk_widget_class_bind_template_child (widget_class, PpJobRow, pause_image);
gtk_widget_class_bind_template_child (widget_class, PpJobRow, state_label);
gtk_widget_class_bind_template_child (widget_class, PpJobRow, title_label);
@@ -142,10 +139,9 @@ pp_job_row_new (PpJob *job)
gtk_label_set_text (self->title_label, pp_job_get_title (job));
gtk_label_set_markup (self->state_label, state_string);
gtk_widget_set_sensitive (GTK_WIDGET (self->pause_button), pp_job_get_auth_info_required (job) == NULL);
- gtk_image_set_from_icon_name (self->pause_image,
- pp_job_get_state (self->job) == IPP_JOB_HELD ?
- "media-playback-start-symbolic" :
"media-playback-pause-symbolic",
- GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_button_set_icon_name (self->pause_button,
+ pp_job_get_state (self->job) == IPP_JOB_HELD ?
+ "media-playback-start-symbolic" :
"media-playback-pause-symbolic");
return self;
}
diff --git a/panels/printers/pp-job-row.ui b/panels/printers/pp-job-row.ui
index 50674871e..c411146dc 100644
--- a/panels/printers/pp-job-row.ui
+++ b/panels/printers/pp-job-row.ui
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="PpJobRow" parent="GtkListBoxRow">
- <property name="visible">True</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="border-width">2</property>
- <property name="margin">6</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">6</property>
<child>
<object class="GtkLabel" id="title_label">
- <property name="visible">True</property>
<property name="ellipsize">end</property>
<property name="max-width-chars">40</property>
<property name="halign">start</property>
@@ -20,7 +19,6 @@
</child>
<child>
<object class="GtkLabel" id="state_label">
- <property name="visible">True</property>
<property name="halign">end</property>
<property name="margin-start">74</property>
<property name="margin-end">74</property>
@@ -28,37 +26,23 @@
</child>
<child>
<object class="GtkButton" id="pause_button">
- <property name="visible">True</property>
- <property name="margin-left">4</property>
- <property name="margin-right">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
<signal name="clicked" handler="pause_cb" object="PpJobRow" swapped="yes" />
<style>
<class name="image-button"/>
</style>
- <child>
- <object class="GtkImage" id="pause_image">
- <property name="visible">True</property>
- <property name="icon-size">2</property>
- </object>
- </child>
</object>
</child>
<child>
<object class="GtkButton">
- <property name="visible">True</property>
- <property name="margin-left">4</property>
- <property name="margin-right">4</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="icon-name">edit-delete-symbolic</property>
<signal name="clicked" handler="stop_cb" object="PpJobRow" swapped="yes" />
<style>
<class name="image-button"/>
</style>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">edit-delete-symbolic</property>
- <property name="icon-size">2</property>
- </object>
- </child>
</object>
</child>
</object>
diff --git a/panels/printers/pp-jobs-dialog.c b/panels/printers/pp-jobs-dialog.c
index c47741fd3..bcc8647d5 100644
--- a/panels/printers/pp-jobs-dialog.c
+++ b/panels/printers/pp-jobs-dialog.c
@@ -31,7 +31,6 @@
#include <cups/cups.h>
-#include "list-box-helper.h"
#include "pp-jobs-dialog.h"
#include "pp-utils.h"
#include "pp-job.h"
@@ -143,7 +142,7 @@ static void
auth_entries_activated (PpJobsDialog *self)
{
if (auth_popup_filled (self))
- gtk_button_clicked (self->authenticate_button);
+ g_signal_emit_by_name (self->authenticate_button, "activate");
}
static void
@@ -160,17 +159,17 @@ authenticate_popover_update (PpJobsDialog *self)
gtk_widget_set_visible (GTK_WIDGET (self->domain_label), domain_required);
gtk_widget_set_visible (GTK_WIDGET (self->domain_entry), domain_required);
if (domain_required)
- gtk_entry_set_text (self->domain_entry, "");
+ gtk_editable_set_text (GTK_EDITABLE (self->domain_entry), "");
gtk_widget_set_visible (GTK_WIDGET (self->username_label), username_required);
gtk_widget_set_visible (GTK_WIDGET (self->username_entry), username_required);
if (username_required)
- gtk_entry_set_text (self->username_entry, cupsUser ());
+ gtk_editable_set_text (GTK_EDITABLE (self->username_entry), cupsUser ());
gtk_widget_set_visible (GTK_WIDGET (self->password_label), password_required);
gtk_widget_set_visible (GTK_WIDGET (self->password_entry), password_required);
if (password_required)
- gtk_entry_set_text (self->password_entry, "");
+ gtk_editable_set_text (GTK_EDITABLE (self->password_entry), "");
gtk_widget_set_sensitive (GTK_WIDGET (self->authenticate_button), FALSE);
}
@@ -346,11 +345,11 @@ authenticate_button_clicked (PpJobsDialog *self)
for (i = 0; self->actual_auth_info_required[i] != NULL; i++)
{
if (g_strcmp0 (self->actual_auth_info_required[i], "domain") == 0)
- auth_info[i] = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->domain_entry)));
+ auth_info[i] = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->domain_entry)));
else if (g_strcmp0 (self->actual_auth_info_required[i], "username") == 0)
- auth_info[i] = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->username_entry)));
+ auth_info[i] = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->username_entry)));
else if (g_strcmp0 (self->actual_auth_info_required[i], "password") == 0)
- auth_info[i] = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->password_entry)));
+ auth_info[i] = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->password_entry)));
}
num_items = g_list_model_get_n_items (G_LIST_MODEL (self->store));
@@ -367,17 +366,6 @@ authenticate_button_clicked (PpJobsDialog *self)
g_strfreev (auth_info);
}
-static gboolean
-key_press_event_cb (GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data)
-{
- if (event->keyval == GDK_KEY_Escape)
- gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_CLOSE);
-
- return FALSE;
-}
-
PpJobsDialog *
pp_jobs_dialog_new (const gchar *printer_name)
{
@@ -394,9 +382,6 @@ pp_jobs_dialog_new (const gchar *printer_name)
self->jobs_filled = FALSE;
self->pop_up_authentication_popup = FALSE;
- /* connect signals */
- g_signal_connect (self, "key-press-event", G_CALLBACK (key_press_event_cb), NULL);
-
/* Translators: This is the printer name for which we are showing the active jobs */
title = g_strdup_printf (C_("Printer jobs dialog title", "%s — Active Jobs"), printer_name);
gtk_window_set_title (GTK_WINDOW (self), title);
@@ -405,8 +390,6 @@ pp_jobs_dialog_new (const gchar *printer_name)
text = g_strdup_printf (_("Enter credentials to print from %s."), printer_name);
gtk_label_set_text (self->authentication_label, text);
- gtk_list_box_set_header_func (self->jobs_listbox,
- cc_list_box_update_header_func, NULL, NULL);
self->store = g_list_store_new (pp_job_get_type ());
gtk_list_box_bind_model (self->jobs_listbox, G_LIST_MODEL (self->store),
create_listbox_row, NULL, NULL);
@@ -481,4 +464,6 @@ pp_jobs_dialog_class_init (PpJobsDialogClass *klass)
gtk_widget_class_bind_template_callback (widget_class, auth_entries_changed);
object_class->dispose = pp_jobs_dialog_dispose;
+
+ gtk_widget_class_add_binding_action (widget_class, GDK_KEY_Escape, 0, "window.close", NULL);
}
diff --git a/panels/printers/pp-jobs-dialog.ui b/panels/printers/pp-jobs-dialog.ui
index 660580eb2..a1a9ae144 100644
--- a/panels/printers/pp-jobs-dialog.ui
+++ b/panels/printers/pp-jobs-dialog.ui
@@ -3,142 +3,106 @@
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkPopover" id="authentication_popover">
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">30</property>
- <property name="margin_right">30</property>
+ <property name="margin_start">30</property>
+ <property name="margin_end">30</property>
<property name="margin_top">20</property>
<property name="margin_bottom">20</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
<object class="GtkLabel" id="authentication_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="no">Enter credentials to print from %s.</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="row_spacing">10</property>
<property name="column_spacing">15</property>
<child>
<object class="GtkLabel" id="domain_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes" comments="Translators: This is a windows domain
used with SMB protocol.">Domain</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="username_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes" comments="Translators: This is a username on a
print server.">Username</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="password_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes" comments="Translators: This is a password needed
for printing.">Password</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="domain_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
<signal name="changed" handler="auth_entries_changed" swapped="yes"/>
<signal name="activate" handler="auth_entries_activated" swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="username_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
<signal name="changed" handler="auth_entries_changed" swapped="yes"/>
<signal name="activate" handler="auth_entries_activated" swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="password_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="invisible_char">*</property>
<property name="input_purpose">password</property>
<signal name="changed" handler="auth_entries_changed" swapped="yes"/>
<signal name="activate" handler="auth_entries_activated" swapped="yes"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="authenticate_button">
<property name="label" translatable="yes" comments="Translators: This button authenticates all
print jobs and send them for printing.">A_uthenticate</property>
<property name="use_underline">True</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<signal name="clicked" handler="authenticate_button_clicked" swapped="yes"/>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
</child>
@@ -153,22 +117,15 @@
<template class="PpJobsDialog" parent="GtkDialog">
<property name="width_request">720</property>
<property name="height_request">500</property>
- <property name="can_focus">False</property>
- <property name="border_width">0</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
<child internal-child="headerbar">
<object class="GtkHeaderBar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">True</property>
+ <property name="show_title_buttons">True</property>
<child>
<object class="GtkButton" id="jobs_clear_all_button">
<property name="label" translatable="yes" comments="Translators: this action removes (purges)
all the listed jobs from the list.">Clear All</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<property name="valign">center</property>
@@ -180,101 +137,20 @@
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
- <property name="can_focus">False</property>
- <property name="border_width">0</property>
+ <property name="orientation">vertical</property>
<style>
<class name="view"/>
</style>
- <property name="orientation">vertical</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox">
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkInfoBar" id="authentication_infobar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox">
- <property name="can_focus">False</property>
- <property name="border_width">12</property>
- <property name="spacing">6</property>
- <property name="layout_style">end</property>
- <property name="margin-end">2</property>
- <child>
- <object class="GtkMenuButton" id="authenticate_jobs_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">end</property>
- <property name="popover">authentication_popover</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="label" translatable="yes" comments="Translators: This button pop
up authentication dialog for print jobs which need credentials.">_Authenticate</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkArrow">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">down</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child internal-child="content_area">
+ <child>
<object class="GtkBox">
- <property name="can_focus">False</property>
<property name="spacing">16</property>
<property name="margin-start">12</property>
<child>
<object class="GtkLabel" id="authenticate_jobs_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<property name="label" translatable="no">2 Jobs Require Authentication</property>
@@ -282,62 +158,49 @@
<attribute name="weight" value="bold"/>
</attributes>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">2</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkMenuButton" id="authenticate_jobs_button">
+ <property name="label" translatable="yes" comments="Translators: This button pop up
authentication dialog for print jobs which need credentials.">_Authenticate</property><property
name="receives_default">False</property>
+ <property name="halign">end</property>
+ <property name="popover">authentication_popover</property>
+ </object>
+ </child>
+ </object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkStack" id="stack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="list_jobs_page">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar-policy">never</property>
- <property name="shadow_type">none</property>
<child>
<object class="GtkListBox" id="jobs_listbox">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="selection-mode">none</property>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="no_jobs_page">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="spacing">10</property>
<property name="orientation">vertical</property>
<property name="valign">center</property>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="valign">start</property>
<property name="pixel_size">64</property>
<property name="icon_name">printer-symbolic</property>
@@ -345,43 +208,20 @@
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes" comments="Translators: this label describes
the dialog empty state, with no jobs listed.">No Active Printer Jobs</property>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
</child>
- <child>
- <placeholder/>
- </child>
</template>
</interface>
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 9ab17211f..e07b7c23b 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -22,10 +22,11 @@
#include <unistd.h>
#include <stdlib.h>
+#include <adwaita.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <gdk/gdkx.h>
+#include <gdk/x11/gdkx.h>
#include <gtk/gtk.h>
#include "pp-new-printer-dialog.h"
@@ -92,7 +93,8 @@ struct _PpNewPrinterDialog
GtkTreeModelFilter *devices_model_filter;
/* headerbar */
- GtkHeaderBar *headerbar;
+ GtkHeaderBar *headerbar;
+ AdwWindowTitle *header_title;
/* headerbar topleft buttons */
GtkStack *headerbar_topleft_buttons;
@@ -113,8 +115,6 @@ struct _PpNewPrinterDialog
GtkScrolledWindow *scrolledwindow1;
GtkTreeView *devices_treeview;
- /* toolbar1 */
- GtkToolbar *toolbar1;
GtkEntry *search_entry;
/* authentication page */
@@ -199,7 +199,8 @@ get_authenticated_samba_devices_cb (GObject *source_object,
if (devices->len > 0)
{
- gtk_entry_set_text (self->search_entry, pp_print_device_get_device_location
(g_ptr_array_index (devices, 0)));
+ gtk_editable_set_text (GTK_EDITABLE (self->search_entry),
+ pp_print_device_get_device_location (g_ptr_array_index (devices,
0)));
search_entry_activated_cb (self);
}
}
@@ -238,8 +239,8 @@ on_authenticate (PpNewPrinterDialog *self)
gchar *username = NULL;
gchar *password = NULL;
- username = g_strdup (gtk_entry_get_text (self->username_entry));
- password = g_strdup (gtk_entry_get_text (self->password_entry));
+ username = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->username_entry)));
+ password = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->password_entry)));
if ((username == NULL) || (username[0] == '\0') ||
(password == NULL) || (password[0] == '\0'))
@@ -251,7 +252,7 @@ on_authenticate (PpNewPrinterDialog *self)
pp_samba_set_auth_info (PP_SAMBA (self->samba_host), username, password);
- gtk_header_bar_set_title (self->headerbar, _("Add Printer"));
+ adw_window_title_set_title (self->header_title, _("Add Printer"));
go_to_page (self, ADDPRINTER_PAGE);
g_object_get (PP_HOST (self->samba_host), "hostname", &hostname, NULL);
@@ -265,8 +266,8 @@ on_authentication_required (PpNewPrinterDialog *self)
g_autofree gchar *title = NULL;
g_autofree gchar *text = NULL;
- gtk_header_bar_set_subtitle (self->headerbar, NULL);
- gtk_header_bar_set_title (self->headerbar, _("Unlock Print Server"));
+ adw_window_title_set_subtitle (self->header_title, NULL);
+ adw_window_title_set_title (self->header_title, _("Unlock Print Server"));
g_object_get (self->samba_host, "hostname", &hostname, NULL);
/* Translators: Samba server needs authentication of the user to show list of its printers. */
@@ -289,8 +290,8 @@ auth_entries_changed (PpNewPrinterDialog *self)
gchar *username = NULL;
gchar *password = NULL;
- username = g_strdup (gtk_entry_get_text (self->username_entry));
- password = g_strdup (gtk_entry_get_text (self->password_entry));
+ username = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->username_entry)));
+ password = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->password_entry)));
can_authenticate = (username != NULL && username[0] != '\0' &&
password != NULL && password[0] != '\0');
@@ -308,7 +309,7 @@ on_go_back_button_clicked (PpNewPrinterDialog *self)
g_clear_object (&self->samba_host);
go_to_page (self, ADDPRINTER_PAGE);
- gtk_header_bar_set_title (self->headerbar, _("Add Printer"));
+ adw_window_title_set_title (self->header_title, _("Add Printer"));
gtk_widget_set_sensitive (GTK_WIDGET (self->new_printer_add_button), FALSE);
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (self->devices_treeview));
@@ -358,16 +359,6 @@ authenticate_samba_server (PpNewPrinterDialog *self)
}
}
-static gboolean
-stack_key_press_cb (PpNewPrinterDialog *self,
- GdkEvent *event)
-{
- gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
- gtk_main_do_event (event);
-
- return TRUE;
-}
-
static void
device_selection_changed_cb (PpNewPrinterDialog *self)
{
@@ -584,11 +575,11 @@ update_dialog_state (PpNewPrinterDialog *self)
if (searching)
{
- gtk_header_bar_set_subtitle (self->headerbar, _("Searching for Printers"));
+ adw_window_title_set_subtitle (self->header_title, _("Searching for Printers"));
}
else
{
- gtk_header_bar_set_subtitle (self->headerbar, NULL);
+ adw_window_title_set_subtitle (self->header_title, NULL);
}
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->devices_liststore), &iter))
@@ -1347,7 +1338,7 @@ search_address (const gchar *text,
static void
search_entry_activated_cb (PpNewPrinterDialog *self)
{
- search_address (gtk_entry_get_text (self->search_entry),
+ search_address (gtk_editable_get_text (GTK_EDITABLE (self->search_entry)),
self,
FALSE);
}
@@ -1355,7 +1346,7 @@ search_entry_activated_cb (PpNewPrinterDialog *self)
static void
search_entry_changed_cb (PpNewPrinterDialog *self)
{
- search_address (gtk_entry_get_text (self->search_entry),
+ search_address (gtk_editable_get_text (GTK_EDITABLE (self->search_entry)),
self,
TRUE);
}
@@ -1627,7 +1618,7 @@ populate_devices_list (PpNewPrinterDialog *self)
self->authenticated_server_icon = g_emblemed_icon_new (icon, emblem);
icon_renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (icon_renderer, "stock-size", GTK_ICON_SIZE_DIALOG, NULL);
+ g_object_set (icon_renderer, "icon-size", GTK_ICON_SIZE_LARGE, NULL);
gtk_cell_renderer_set_alignment (icon_renderer, 1.0, 0.5);
gtk_cell_renderer_set_padding (icon_renderer, 4, 4);
column = gtk_tree_view_column_new_with_attributes ("Icon", icon_renderer,
@@ -1776,7 +1767,6 @@ pp_new_printer_dialog_new (PPDList *ppd_list,
gpointer user_data)
{
PpNewPrinterDialog *self;
- GtkStyleContext *context;
self = g_object_new (pp_new_printer_dialog_get_type (), NULL);
@@ -1797,20 +1787,11 @@ pp_new_printer_dialog_new (PPDList *ppd_list,
g_signal_connect_object (self->unlock_button, "clicked", G_CALLBACK (authenticate_samba_server), self,
G_CONNECT_SWAPPED);
- g_signal_connect_object (self->stack, "key-press-event", G_CALLBACK (stack_key_press_cb), self,
G_CONNECT_SWAPPED);
-
/* Authentication form widgets */
g_signal_connect_object (self->username_entry, "changed", G_CALLBACK (auth_entries_changed), self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->password_entry, "changed", G_CALLBACK (auth_entries_changed), self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->go_back_button, "clicked", G_CALLBACK (on_go_back_button_clicked), self,
G_CONNECT_SWAPPED);
- /* Set junctions */
- context = gtk_widget_get_style_context (GTK_WIDGET (self->scrolledwindow1));
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-
- context = gtk_widget_get_style_context (GTK_WIDGET (self->toolbar1));
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
-
/* Set titlebar */
gtk_window_set_titlebar(GTK_WINDOW (self), GTK_WIDGET (self->headerbar));
@@ -1859,6 +1840,8 @@ pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ g_type_ensure (PP_TYPE_PRINT_DEVICE);
+
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/printers/new-printer-dialog.ui");
gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, devices_liststore);
@@ -1866,6 +1849,7 @@ pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
/* headerbar */
gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, headerbar);
+ gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, header_title);
/* headerbar topleft buttons */
gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, headerbar_topleft_buttons);
@@ -1885,8 +1869,6 @@ pp_new_printer_dialog_class_init (PpNewPrinterDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, scrolledwindow1);
gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, devices_treeview);
- /* toolbar1 */
- gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, toolbar1);
gtk_widget_class_bind_template_child (widget_class, PpNewPrinterDialog, search_entry);
/* authentication page */
@@ -1919,9 +1901,6 @@ PpNewPrinter *
pp_new_printer_dialog_get_new_printer (PpNewPrinterDialog *self)
{
PpNewPrinter *new_printer = NULL;
- guint window_id = 0;
-
- window_id = (guint) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (gtk_window_get_transient_for
(GTK_WINDOW (self)))));
new_printer = pp_new_printer_new ();
g_object_set (new_printer,
@@ -1937,7 +1916,7 @@ pp_new_printer_dialog_get_new_printer (PpNewPrinterDialog *self)
"host-name", pp_print_device_get_host_name (self->new_device),
"host-port", pp_print_device_get_host_port (self->new_device),
"is-network-device", pp_print_device_is_network_device (self->new_device),
- "window-id", window_id,
+ "window-id", 0,
NULL);
return new_printer;
diff --git a/panels/printers/pp-options-dialog.c b/panels/printers/pp-options-dialog.c
index 59229cd48..36e9bb29b 100644
--- a/panels/printers/pp-options-dialog.c
+++ b/panels/printers/pp-options-dialog.c
@@ -295,44 +295,31 @@ ppd_option_name_translate (ppd_option_t *option)
static gint
grid_get_height (GtkWidget *grid)
{
- GList *children;
- GList *child;
+ GtkWidget *child;
gint height = 0;
- gint top_attach = 0;
+ gint row = 0;
gint max = 0;
- children = gtk_container_get_children (GTK_CONTAINER (grid));
- for (child = children; child; child = g_list_next (child))
+ for (child = gtk_widget_get_first_child (grid);
+ child;
+ child = gtk_widget_get_next_sibling (child))
{
- gtk_container_child_get (GTK_CONTAINER (grid), child->data,
- "top-attach", &top_attach,
- "height", &height,
- NULL);
+ gtk_grid_query_child (GTK_GRID (grid),
+ child,
+ NULL, &row,
+ NULL, &height);
- if (height + top_attach > max)
- max = height + top_attach;
+ if (height + row > max)
+ max = height + row;
}
- g_list_free (children);
-
return max;
}
static gboolean
grid_is_empty (GtkWidget *grid)
{
- GList *children;
-
- children = gtk_container_get_children (GTK_CONTAINER (grid));
- if (children)
- {
- g_list_free (children);
- return FALSE;
- }
- else
- {
- return TRUE;
- }
+ return gtk_widget_get_first_child (grid) == NULL;
}
static GtkWidget *
@@ -395,7 +382,6 @@ ppd_option_add (ppd_option_t option,
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");
@@ -417,8 +403,10 @@ 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_widget_set_margin_start (grid, 20);
+ gtk_widget_set_margin_end (grid, 20);
+ gtk_widget_set_margin_top (grid, 20);
+ gtk_widget_set_margin_bottom (grid, 20);
gtk_grid_set_row_spacing (GTK_GRID (grid), 15);
return grid;
@@ -437,12 +425,11 @@ tab_add (PpOptionsDialog *self,
if (!grid_is_empty (grid))
{
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_show (GTK_WIDGET (scrolled_window));
+ scrolled_window = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (scrolled_window), grid);
+ gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), grid);
id = gtk_notebook_append_page (self->notebook,
scrolled_window,
diff --git a/panels/printers/pp-options-dialog.ui b/panels/printers/pp-options-dialog.ui
index 79eaf888e..49e6fb9fe 100644
--- a/panels/printers/pp-options-dialog.ui
+++ b/panels/printers/pp-options-dialog.ui
@@ -5,54 +5,38 @@
<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="resizable">False</property>
- <property name="type_hint">dialog</property>
+ <property name="modal">True</property>
<child internal-child="headerbar">
<object class="GtkHeaderBar">
- <property name="visible">True</property>
<child>
<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>
- </packing>
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child>
<object class="GtkBox">
<child>
<object class="GtkStack" id="stack">
- <property name="visible">True</property>
- <property name="homogeneous">True</property>
+ <property name="hhomogeneous">True</property>
+ <property name="vhomogeneous">True</property>
<child>
<object class="GtkBox" id="main_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="width_request">120</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
- <property name="shadow_type">in</property>
<child>
<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="categories_selection">
@@ -62,41 +46,25 @@
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="tab_pos">left</property>
<property name="show_tabs">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
</child>
<child>
<object class="GtkSpinner" id="spinner">
- <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
<property name="width_request">24</property>
<property name="height_request">24</property>
- <property name="can_focus">False</property>
</object>
</child>
</object>
diff --git a/panels/printers/pp-ppd-option-widget.c b/panels/printers/pp-ppd-option-widget.c
index 9b2520e06..2f3962090 100644
--- a/panels/printers/pp-ppd-option-widget.c
+++ b/panels/printers/pp-ppd-option-widget.c
@@ -388,15 +388,13 @@ construct_widget (PpPPDOptionWidget *self)
{
case PPD_UI_BOOLEAN:
self->switch_button = gtk_switch_new ();
- gtk_widget_show (self->switch_button);
g_signal_connect_object (self->switch_button, "notify::active", G_CALLBACK
(switch_changed_cb), self, G_CONNECT_SWAPPED);
- gtk_box_pack_start (GTK_BOX (self), self->switch_button, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (self), self->switch_button);
break;
case PPD_UI_PICKONE:
self->combo = combo_box_new ();
- gtk_widget_show (self->combo);
for (i = 0; i < self->option->num_choices; i++)
{
@@ -405,13 +403,12 @@ construct_widget (PpPPDOptionWidget *self)
self->option->choices[i].choice);
}
- gtk_box_pack_start (GTK_BOX (self), self->combo, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX (self), self->combo);
g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self,
G_CONNECT_SWAPPED);
break;
case PPD_UI_PICKMANY:
self->combo = combo_box_new ();
- gtk_widget_show (self->combo);
for (i = 0; i < self->option->num_choices; i++)
{
@@ -420,7 +417,7 @@ construct_widget (PpPPDOptionWidget *self)
self->option->choices[i].choice);
}
- gtk_box_pack_start (GTK_BOX (self), self->combo, TRUE, TRUE, 0);
+ gtk_box_append (GTK_BOX (self), self->combo);
g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self,
G_CONNECT_SWAPPED);
break;
@@ -428,12 +425,10 @@ construct_widget (PpPPDOptionWidget *self)
break;
}
- self->image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_MENU);
+ self->image = gtk_image_new_from_icon_name ("dialog-warning-symbolic");
if (!self->image)
- self->image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_MENU);
- gtk_widget_show (self->image);
- gtk_box_pack_start (GTK_BOX (self), self->image, FALSE, FALSE, 0);
- gtk_widget_set_no_show_all (GTK_WIDGET (self->image), TRUE);
+ self->image = gtk_image_new_from_icon_name ("dialog-warning");
+ gtk_box_append (GTK_BOX (self), self->image);
return TRUE;
}
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index 9a2c7cb29..b2e6b32c4 100644
--- a/panels/printers/pp-printer-entry.c
+++ b/panels/printers/pp-printer-entry.c
@@ -72,7 +72,7 @@ struct _PpPrinterEntry
GtkWidget *show_jobs_dialog_button;
GtkWidget *clean_heads_menuitem;
GtkCheckButton *printer_default_checkbutton;
- GtkModelButton *remove_printer_menuitem;
+ GtkWidget *remove_printer_menuitem;
GtkBox *printer_error;
GtkLabel *error_status;
@@ -212,7 +212,7 @@ tone_down_color (GdkRGBA *color,
gdouble saturation_ratio,
gdouble value_ratio)
{
- gdouble h, s, v;
+ gfloat h, s, v;
gtk_rgb_to_hsv (color->red, color->green, color->blue,
&h, &s, &v);
@@ -220,22 +220,21 @@ tone_down_color (GdkRGBA *color,
&color->red, &color->green, &color->blue);
}
-static gboolean
-supply_levels_draw_cb (PpPrinterEntry *self,
- cairo_t *cr)
+static void
+supply_levels_draw_cb (GtkDrawingArea *drawing_area,
+ cairo_t *cr,
+ int width,
+ int height,
+ gpointer user_data)
{
+ PpPrinterEntry *self = PP_PRINTER_ENTRY (user_data);
GtkStyleContext *context;
gboolean is_empty = TRUE;
g_autofree gchar *tooltip_text = NULL;
- gint width;
- gint height;
int i;
context = gtk_widget_get_style_context (GTK_WIDGET (self->supply_drawing_area));
- width = gtk_widget_get_allocated_width (GTK_WIDGET (self->supply_drawing_area));
- height = gtk_widget_get_allocated_height (GTK_WIDGET (self->supply_drawing_area));
-
gtk_render_background (context, cr, 0, 0, width, height);
if (!supply_level_is_empty (self))
@@ -344,8 +343,6 @@ supply_levels_draw_cb (PpPrinterEntry *self,
gtk_widget_set_visible (GTK_WIDGET (self->printer_inklevel_label), !is_empty);
gtk_widget_set_visible (GTK_WIDGET (self->supply_frame), !is_empty);
-
- return TRUE;
}
static void
@@ -362,23 +359,13 @@ on_printer_rename_cb (GObject *source_object,
}
static void
-on_show_printer_details_dialog (GtkButton *button,
- PpPrinterEntry *self)
+show_printer_details_response_cb (PpDetailsDialog *dialog,
+ gint reponse,
+ PpPrinterEntry *self)
{
const gchar *new_name;
const gchar *new_location;
- PpDetailsDialog *dialog = pp_details_dialog_new (self->printer_name,
- self->printer_location,
- self->printer_hostname,
- self->printer_make_and_model,
- 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));
-
new_location = pp_details_dialog_get_printer_location (dialog);
if (g_strcmp0 (self->printer_location, new_location) != 0)
printer_set_location (self->printer_name, new_location);
@@ -397,7 +384,25 @@ on_show_printer_details_dialog (GtkButton *button,
g_signal_emit_by_name (self, "printer-changed");
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
+}
+
+static void
+on_show_printer_details_dialog (GtkButton *button,
+ PpPrinterEntry *self)
+{
+ PpDetailsDialog *dialog = pp_details_dialog_new (self->printer_name,
+ self->printer_location,
+ self->printer_hostname,
+ self->printer_make_and_model,
+ self->is_authorized);
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self))));
+
+ g_signal_connect (dialog, "response", G_CALLBACK (show_printer_details_response_cb), self);
+
+ gtk_window_present (GTK_WINDOW (dialog));
}
static void
@@ -409,16 +414,14 @@ on_show_printer_options_dialog (GtkButton *button,
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_WINDOW (gtk_widget_get_native (GTK_WIDGET (self))));
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_present (GTK_WINDOW (dialog));
}
static void
-set_as_default_printer (GtkToggleButton *button,
- PpPrinterEntry *self)
+set_as_default_printer (GtkCheckButton *button,
+ PpPrinterEntry *self)
{
printer_set_default (self->printer_name);
@@ -567,7 +570,7 @@ jobs_dialog_response_cb (GtkDialog *dialog,
if (self->pp_jobs_dialog != NULL)
{
- gtk_widget_destroy (GTK_WIDGET (self->pp_jobs_dialog));
+ gtk_window_destroy (GTK_WINDOW (self->pp_jobs_dialog));
self->pp_jobs_dialog = NULL;
}
}
@@ -579,7 +582,7 @@ pp_printer_entry_show_jobs_dialog (PpPrinterEntry *self)
{
self->pp_jobs_dialog = pp_jobs_dialog_new (self->printer_name);
g_signal_connect_object (self->pp_jobs_dialog, "response", G_CALLBACK (jobs_dialog_response_cb), self,
0);
- gtk_window_set_transient_for (GTK_WINDOW (self->pp_jobs_dialog), GTK_WINDOW (gtk_widget_get_toplevel
(GTK_WIDGET (self))));
+ gtk_window_set_transient_for (GTK_WINDOW (self->pp_jobs_dialog), GTK_WINDOW (gtk_widget_get_native
(GTK_WIDGET (self))));
gtk_window_present (GTK_WINDOW (self->pp_jobs_dialog));
}
}
@@ -648,7 +651,10 @@ pp_printer_entry_new (cups_dest_t printer,
_("Clean print heads"));
check_clean_heads_maintenance_command (self);
- g_signal_connect_object (self->supply_drawing_area, "draw", G_CALLBACK (supply_levels_draw_cb), self,
G_CONNECT_SWAPPED);
+ gtk_drawing_area_set_draw_func (self->supply_drawing_area,
+ supply_levels_draw_cb,
+ self,
+ NULL);
pp_printer_entry_update (self, printer, is_authorized);
@@ -895,11 +901,11 @@ pp_printer_entry_update (PpPrinterEntry *self,
g_free (self->printer_hostname);
self->printer_hostname = printer_get_hostname (printer_type, device_uri, printer_uri);
- gtk_image_set_from_icon_name (self->printer_icon, printer_icon_name, GTK_ICON_SIZE_DIALOG);
+ gtk_image_set_from_icon_name (self->printer_icon, printer_icon_name);
gtk_label_set_text (self->printer_status, printer_status);
gtk_label_set_text (self->printer_name_label, instance);
g_signal_handlers_block_by_func (self->printer_default_checkbutton, set_as_default_printer, self);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->printer_default_checkbutton), printer.is_default);
+ gtk_check_button_set_active (self->printer_default_checkbutton, printer.is_default);
g_signal_handlers_unblock_by_func (self->printer_default_checkbutton, set_as_default_printer, self);
self->printer_make_and_model = sanitize_printer_model (printer_make_and_model);
diff --git a/panels/printers/printer-entry.ui b/panels/printers/printer-entry.ui
index 71d3e800b..211e94fd4 100644
--- a/panels/printers/printer-entry.ui
+++ b/panels/printers/printer-entry.ui
@@ -2,69 +2,70 @@
<interface>
<!-- interface-requires gtk+ 3.8 -->
<object class="GtkPopover" id="printer-menu">
+ <style>
+ <class name="menu" />
+ </style>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
- <property name="margin">10</property>
+ <property name="margin-top">10</property>
+ <property name="margin-bottom">10</property>
+ <property name="margin-start">10</property>
+ <property name="margin-end">10</property>
<child>
<object class="GtkModelButton">
- <property name="visible">True</property>
<property name="text" translatable="yes">Printing Options</property>
<signal name="clicked" handler="on_show_printer_options_dialog"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkModelButton">
- <property name="visible">True</property>
<property name="text" translatable="yes">Printer Details</property>
<signal name="clicked" handler="on_show_printer_details_dialog"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkCheckButton" id="printer_default_checkbutton">
- <property name="visible">True</property>
<property name="valign">center</property>
<property name="label" translatable="yes" comments="Set this printer as default">Use Printer by
Default</property>
<signal name="toggled" handler="set_as_default_printer"/>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ <property name="column-span">3</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- <property name="width">3</property>
- </packing>
</child>
<child>
<object class="GtkModelButton" id="clean_heads_menuitem">
<property name="visible">False</property>
<property name="text" translatable="yes" comments="Translators: This button executes command
which cleans print heads of the printer.">Clean Print Heads</property>
- <signal name="clicked" handler="clean_heads"/>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">3</property>
- </packing>
+ <signal name="clicked" handler="clean_heads"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ </layout>
+ </object>
</child>
<child>
<object class="GtkModelButton" id="remove_printer_menuitem">
- <property name="visible">True</property>
<property name="text" translatable="yes">Remove Printer</property>
<signal name="clicked" handler="remove_printer"/>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">4</property>
- </packing>
</child>
</object>
</child>
@@ -72,14 +73,14 @@
<template class="PpPrinterEntry" parent="GtkListBoxRow">
<property name="valign">center</property>
- <property name="margin">10</property>
+ <property name="margin-top">10</property>
+ <property name="margin-bottom">10</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="activatable">False</property>
<child>
<object class="GtkFrame" id="content_area">
- <property name="visible">True</property>
<property name="valign">start</property>
<style>
<class name="view"/>
@@ -87,81 +88,78 @@
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
<property name="row-spacing">8</property>
<property name="column-spacing">15</property>
<property name="margin_start">24</property>
<property name="margin_end">20</property>
<property name="margin_top">14</property>
<property name="margin_bottom">20</property>
- <property name="no-show-all">True</property>
<child>
<object class="GtkImage" id="printer_icon">
- <property name="visible">True</property>
<property name="pixel-size">48</property>
<property name="icon_name">printer</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkGrid" id="printer_name_grid">
- <property name="visible">True</property>
- <property name="margin">10</property>
+ <property name="margin-top">10</property>
+ <property name="margin-bottom">10</property>
<property name="margin_start">0</property>
+ <property name="margin-end">10</property>
<property name="halign">start</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
<child>
<object class="GtkLabel" id="printer_name_label">
- <property name="visible">True</property>
<property name="hexpand">True</property>
<property name="halign">start</property>
<property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property>
<property name="width-chars">22</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="printer_status">
- <property name="visible">True</property>
<property name="halign">start</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
<property name="spacing">12</property>
<property name="orientation">horizontal</property>
<property name="valign">center</property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">0</property>
+ </layout>
<child>
<object class="GtkButton" id="show_jobs_dialog_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">No Active Jobs</property>
<signal name="clicked" handler="show_jobs_dialog"/>
@@ -170,80 +168,70 @@
<child>
<object class="GtkMenuButton">
- <property name="visible">True</property>
<property name="popover">printer-menu</property>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
<property name="icon_name">emblem-system-symbolic</property>
</object>
</child>
</object>
</child>
</object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="printer_model_label">
- <property name="visible">True</property>
<property name="label" translatable="yes">Model</property>
<property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property>
<property name="halign">end</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="printer_model">
- <property name="visible">True</property>
<property name="halign">start</property>
<property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="printer_location_label">
- <property name="visible">True</property>
<property name="label" translatable="yes">Location</property>
<property name="halign">end</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="printer_location_address_label">
- <property name="visible">True</property>
<property name="halign">start</property>
<property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
</child>
<child>
@@ -251,14 +239,14 @@
<property name="label" translatable="yes">Ink Level</property>
<property name="halign">end</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- </packing>
</child>
<child>
@@ -267,19 +255,17 @@
<property name="halign">start</property>
<property name="height_request">18</property>
<property name="width_request">300</property>
- <property name="border_width">2</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">3</property>
+ <property name="column-span">2</property>
+ </layout>
<child>
<object class="GtkDrawingArea" id="supply_drawing_area">
- <property name="visible">True</property>
</object>
</child>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">3</property>
- <property name="width">2</property>
- </packing>
</child>
<child>
@@ -287,17 +273,20 @@
<property name="visible">False</property>
<property name="spacing">10</property>
<property name="margin-top">6</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">4</property>
+ <property name="column-span">3</property>
+ </layout>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
<property name="icon_name">dialog-warning-symbolic</property>
</object>
</child>
<child>
<object class="GtkLabel" id="error_status">
- <property name="visible">True</property>
<property name="halign">start</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -307,7 +296,6 @@
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
<property name="hexpand">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes" comments="Translators: This is the message
which follows the printer error.">Please restart when the problem is resolved.</property>
@@ -316,18 +304,12 @@
<child>
<object class="GtkButton">
- <property name="visible">True</property>
<property name="label" translatable="yes" comments="Translators: This is the button
which restarts the printer.">Restart</property>
<signal name="clicked" handler="restart_printer"/>
</object>
</child>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">4</property>
- <property name="width">3</property>
- </packing>
</child>
</object>
</child>
diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
index 5fbaafb02..113166846 100644
--- a/panels/printers/printers.ui
+++ b/panels/printers/printers.ui
@@ -2,11 +2,9 @@
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkBox" id="top-right-buttons">
- <property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="printer-add-button">
- <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="use_underline">True</property>
<property name="label" translatable="yes" comments="Translators: This button adds new printer.">Add
Printer…</property>
@@ -17,14 +15,12 @@
</child>
<child>
<object class="GtkToggleButton" id="search-button">
- <property name="visible">True</property>
<property name="margin-end">6</property> <!-- since we don't have access to the shell header bar -->
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
<property name="icon_name">system-search-symbolic</property>
</object>
</child>
@@ -33,44 +29,36 @@
</object>
<object class="GtkOverlay" id="overlay">
- <property name="visible">True</property>
<child type="overlay">
<object class="GtkRevealer" id="notification">
- <property name="visible">True</property>
<property name="halign">GTK_ALIGN_CENTER</property>
<property name="valign">GTK_ALIGN_START</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
<property name="spacing">6</property>
<style>
<class name="app-notification"/>
</style>
<child>
<object class="GtkLabel" id="notification-label">
- <property name="visible">True</property>
<property name="wrap">True</property>
<property name="max_width_chars">50</property>
</object>
</child>
<child>
<object class="GtkButton" id="notification-undo-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<property name="label" translatable="yes" comments="Translators: This is the button which
allows undoing the removal of the printer.">Undo</property>
</object>
</child>
<child>
<object class="GtkButton" id="notification-dismiss-button">
- <property name="visible">True</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<style>
<class name="flat"/>
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
<property name="icon_name">window-close-symbolic</property>
</object>
</child>
@@ -83,190 +71,163 @@
<child>
<object class="GtkBox">
- <property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
<child>
<object class="CcPermissionInfobar" id="permission-infobar">
- <property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkStack" id="main-vbox">
- <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <child>
- <object class="GtkSpinner" id="loading-spinner">
- <property name="visible">True</property>
- <property name="active">True</property>
- <property name="expand">True</property>
+ <object class="GtkStackPage">
+ <property name="name">loading-page</property>
+ <property name="child">
+ <object class="GtkBox">
+ <child>
+ <object class="GtkSpinner" id="loading-spinner">
+ <property name="spinning">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ </object>
+ </child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">loading-page</property>
- </packing>
</child>
+
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
- <child>
- <object class="GtkSearchBar" id="search-bar">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="search_mode_enabled" bind-source="search-button" bind-property="active"
bind-flags="bidirectional" />
+ <object class="GtkStackPage">
+ <property name="name">printers-list</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkSearchEntry" id="search-entry">
- <property name="visible">True</property>
- <property name="width_chars">30</property>
+ <object class="GtkSearchBar" id="search-bar">
+ <property name="hexpand">True</property>
+ <property name="search_mode_enabled" bind-source="search-button" bind-property="active"
bind-flags="bidirectional" />
+ <child>
+ <object class="GtkSearchEntry" id="search-entry">
+ <property name="width_chars">30</property>
+ </object>
+ </child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolled-window">
- <property name="visible">True</property>
- <property name="hscrollbar-policy">GTK_POLICY_NEVER</property>
- <property name="min-content-height">490</property>
- <property name="vexpand">True</property>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
+ <object class="GtkScrolledWindow" id="scrolled-window">
+ <property name="hscrollbar-policy">never</property>
+ <property name="min-content-height">490</property>
+ <property name="vexpand">True</property>
<child>
- <object class="GtkListBox" id="content">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="selection-mode">GTK_SELECTION_NONE</property>
- <property name="margin-top">32</property>
- <property name="margin-bottom">32</property>
- <style>
- <class name="background"/>
- </style>
+ <object class="GtkBox">
+ <child>
+ <object class="GtkListBox" id="content">
+ <property name="selection-mode">GTK_SELECTION_NONE</property>
+ <property name="margin-top">32</property>
+ <property name="margin-bottom">32</property>
+ <style>
+ <class name="background"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">printers-list</property>
- </packing>
</child>
+
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">10</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="pixel_size">80</property>
- <property name="icon_name">printer-symbolic</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="margin_bottom">15</property>
- <property name="label" translatable="yes">No printers</property>
- <style>
- <class name="dim-label"/>
- </style>
- <attributes>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="printer-add-button2">
- <property name="label" translatable="yes" comments="Translators: This button adds new
printer.">Add a Printer…</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">center</property>
- <property name="relief">normal</property>
- <style>
- <class name="suggested-action"/>
- </style>
+ <object class="GtkStackPage">
+ <property name="name">empty-state</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="spacing">10</property>
+ <property name="orientation">vertical</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkImage">
+ <property name="valign">start</property>
+ <property name="pixel_size">80</property>
+ <property name="icon_name">printer-symbolic</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="margin_bottom">15</property>
+ <property name="label" translatable="yes">No printers</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <attributes>
+ <attribute name="scale" value="1.2"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="printer-add-button2">
+ <property name="label" translatable="yes" comments="Translators: This button adds new
printer.">Add a Printer…</property>
+ <property name="receives_default">True</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">empty-state</property>
- </packing>
</child>
+
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">10</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" comments="Translators: The CUPS server is not running
(we can not connect to it).">Sorry! The system printing service
-doesn’t seem to be available.</property>
- <style>
- <class name="dim-label"/>
- </style>
- <attributes>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="pixel_size">80</property>
- <property name="icon_name">computer-fail-symbolic</property>
- <style>
- <class name="dim-label"/>
- </style>
+ <object class="GtkStackPage">
+ <property name="name">no-cups-page</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="spacing">10</property>
+ <property name="orientation">vertical</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label" translatable="yes" comments="Translators: The CUPS server is not
running (we can not connect to it).">Sorry! The system printing service
+ doesn’t seem to be available.</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <attributes>
+ <attribute name="scale" value="1.2"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="valign">start</property>
+ <property name="pixel_size">80</property>
+ <property name="icon_name">computer-fail-symbolic</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">no-cups-page</property>
- </packing>
</child>
+
</object>
</child>
</object>
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index a26d0a254..450e68335 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -51,7 +51,7 @@ extern GType cc_multitasking_panel_get_type (void);
extern GType cc_notifications_panel_get_type (void);
//extern GType cc_goa_panel_get_type (void);
extern GType cc_power_panel_get_type (void);
-//extern GType cc_printers_panel_get_type (void);
+extern GType cc_printers_panel_get_type (void);
//extern GType cc_region_panel_get_type (void);
extern GType cc_removable_media_panel_get_type (void);
extern GType cc_search_panel_get_type (void);
@@ -122,7 +122,7 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("notifications", cc_notifications_panel_get_type, NULL),
//PANEL_TYPE("online-accounts", cc_goa_panel_get_type, NULL),
PANEL_TYPE("power", cc_power_panel_get_type, NULL),
- //PANEL_TYPE("printers", cc_printers_panel_get_type, NULL),
+ PANEL_TYPE("printers", cc_printers_panel_get_type, NULL),
//PANEL_TYPE("region", cc_region_panel_get_type, NULL),
PANEL_TYPE("removable-media", cc_removable_media_panel_get_type, NULL),
PANEL_TYPE("search", cc_search_panel_get_type, NULL),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]