printers: Don't update alignment padding for dialogs
The update of alignment padding is not needed since gtk+ 3.14. It was needed for proper alignment of widgets of action area with those from content area. https://bugzilla.gnome.org/show_bug.cgi?id=739737
This commit is contained in:
parent
b6754b0efd
commit
15b5045ed3
4 changed files with 0 additions and 189 deletions
|
@ -382,46 +382,6 @@ jobs_dialog_response_cb (GtkDialog *dialog,
|
||||||
jobs_dialog->user_data);
|
jobs_dialog->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
update_alignment_padding (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkAllocation allocation2;
|
|
||||||
PpJobsDialog *dialog = (PpJobsDialog*) user_data;
|
|
||||||
GtkWidget *action_area;
|
|
||||||
gint offset_left, offset_right;
|
|
||||||
guint padding_left, padding_right,
|
|
||||||
padding_top, padding_bottom;
|
|
||||||
|
|
||||||
action_area = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (dialog->builder, "dialog-action-area1");
|
|
||||||
gtk_widget_get_allocation (action_area, &allocation2);
|
|
||||||
|
|
||||||
offset_left = allocation2.x - allocation->x;
|
|
||||||
offset_right = (allocation->x + allocation->width) -
|
|
||||||
(allocation2.x + allocation2.width);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (widget),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (allocation->x >= 0 && allocation2.x >= 0)
|
|
||||||
{
|
|
||||||
if (offset_left > 0 && offset_left != padding_left)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (widget),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
offset_left, padding_right);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (widget),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (offset_right > 0 && offset_right != padding_right)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (widget),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
padding_left, offset_right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PpJobsDialog *
|
PpJobsDialog *
|
||||||
pp_jobs_dialog_new (GtkWindow *parent,
|
pp_jobs_dialog_new (GtkWindow *parent,
|
||||||
UserResponseCallback user_callback,
|
UserResponseCallback user_callback,
|
||||||
|
@ -463,10 +423,6 @@ pp_jobs_dialog_new (GtkWindow *parent,
|
||||||
g_signal_connect (dialog->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
g_signal_connect (dialog->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
||||||
g_signal_connect (dialog->dialog, "response", G_CALLBACK (jobs_dialog_response_cb), dialog);
|
g_signal_connect (dialog->dialog, "response", G_CALLBACK (jobs_dialog_response_cb), dialog);
|
||||||
|
|
||||||
widget = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (dialog->builder, "content-alignment");
|
|
||||||
g_signal_connect (widget, "size-allocate", G_CALLBACK (update_alignment_padding), dialog);
|
|
||||||
|
|
||||||
widget = (GtkWidget*)
|
widget = (GtkWidget*)
|
||||||
gtk_builder_get_object (dialog->builder, "job-cancel-button");
|
gtk_builder_get_object (dialog->builder, "job-cancel-button");
|
||||||
g_signal_connect (widget, "clicked", G_CALLBACK (job_process_cb), dialog);
|
g_signal_connect (widget, "clicked", G_CALLBACK (job_process_cb), dialog);
|
||||||
|
|
|
@ -229,56 +229,6 @@ emit_response (PpNewPrinterDialog *dialog,
|
||||||
g_signal_emit (dialog, signals[RESPONSE], 0, response_id);
|
g_signal_emit (dialog, signals[RESPONSE], 0, response_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Modify padding of the content area of the GtkDialog
|
|
||||||
* so it is aligned with the action area.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
update_alignment_padding (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PpNewPrinterDialog *dialog = (PpNewPrinterDialog *) user_data;
|
|
||||||
PpNewPrinterDialogPrivate *priv = dialog->priv;
|
|
||||||
GtkAllocation allocation1, allocation2;
|
|
||||||
GtkWidget *action_area;
|
|
||||||
GtkWidget *content_area;
|
|
||||||
gint offset_left, offset_right;
|
|
||||||
guint padding_left, padding_right,
|
|
||||||
padding_top, padding_bottom;
|
|
||||||
|
|
||||||
action_area = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (priv->builder, "dialog-action-area1");
|
|
||||||
gtk_widget_get_allocation (action_area, &allocation2);
|
|
||||||
|
|
||||||
content_area = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (priv->builder, "content-alignment");
|
|
||||||
gtk_widget_get_allocation (content_area, &allocation1);
|
|
||||||
|
|
||||||
offset_left = allocation2.x - allocation1.x;
|
|
||||||
offset_right = (allocation1.x + allocation1.width) -
|
|
||||||
(allocation2.x + allocation2.width);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (allocation1.x >= 0 && allocation2.x >= 0)
|
|
||||||
{
|
|
||||||
if (offset_left > 0 && offset_left != padding_left)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
offset_left, padding_right);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (offset_right > 0 && offset_right != padding_right)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
padding_left, offset_right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gchar *server_name;
|
gchar *server_name;
|
||||||
|
@ -448,7 +398,6 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
|
||||||
|
|
||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
g_signal_connect (priv->dialog, "response", G_CALLBACK (new_printer_dialog_response_cb), dialog);
|
g_signal_connect (priv->dialog, "response", G_CALLBACK (new_printer_dialog_response_cb), dialog);
|
||||||
g_signal_connect (priv->dialog, "size-allocate", G_CALLBACK (update_alignment_padding), dialog);
|
|
||||||
|
|
||||||
widget = (GtkWidget*)
|
widget = (GtkWidget*)
|
||||||
gtk_builder_get_object (priv->builder, "search-entry");
|
gtk_builder_get_object (priv->builder, "search-entry");
|
||||||
|
|
|
@ -810,55 +810,6 @@ populate_options (PpOptionsDialog *dialog)
|
||||||
dialog);
|
dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Modify padding of the content area of the GtkDialog
|
|
||||||
* so it is aligned with the action area.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
update_alignment_padding (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PpOptionsDialog *dialog = (PpOptionsDialog*) user_data;
|
|
||||||
GtkAllocation allocation1, allocation2;
|
|
||||||
GtkWidget *action_area;
|
|
||||||
GtkWidget *content_area;
|
|
||||||
gint offset_left, offset_right;
|
|
||||||
guint padding_left, padding_right,
|
|
||||||
padding_top, padding_bottom;
|
|
||||||
|
|
||||||
action_area = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (dialog->builder, "dialog-action-area1");
|
|
||||||
gtk_widget_get_allocation (action_area, &allocation2);
|
|
||||||
|
|
||||||
content_area = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (dialog->builder, "content-alignment");
|
|
||||||
gtk_widget_get_allocation (content_area, &allocation1);
|
|
||||||
|
|
||||||
offset_left = allocation2.x - allocation1.x;
|
|
||||||
offset_right = (allocation1.x + allocation1.width) -
|
|
||||||
(allocation2.x + allocation2.width);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (allocation1.x >= 0 && allocation2.x >= 0)
|
|
||||||
{
|
|
||||||
if (offset_left > 0 && offset_left != padding_left)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
offset_left, padding_right);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (offset_right > 0 && offset_right != padding_right)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (content_area),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
padding_left, offset_right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
options_dialog_response_cb (GtkDialog *_dialog,
|
options_dialog_response_cb (GtkDialog *_dialog,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
|
@ -924,7 +875,6 @@ pp_options_dialog_new (GtkWindow *parent,
|
||||||
|
|
||||||
/* connect signals */
|
/* connect signals */
|
||||||
g_signal_connect (dialog->dialog, "response", G_CALLBACK (options_dialog_response_cb), dialog);
|
g_signal_connect (dialog->dialog, "response", G_CALLBACK (options_dialog_response_cb), dialog);
|
||||||
g_signal_connect (dialog->dialog, "size-allocate", G_CALLBACK (update_alignment_padding), dialog);
|
|
||||||
|
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog->dialog), printer_name);
|
gtk_window_set_title (GTK_WINDOW (dialog->dialog), printer_name);
|
||||||
|
|
||||||
|
|
|
@ -324,46 +324,6 @@ ppd_selection_dialog_response_cb (GtkDialog *dialog,
|
||||||
ppd_selection_dialog->user_data);
|
ppd_selection_dialog->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
update_alignment_padding (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
PpPPDSelectionDialog *dialog = (PpPPDSelectionDialog*) user_data;
|
|
||||||
GtkAllocation allocation2;
|
|
||||||
GtkWidget *action_area;
|
|
||||||
gint offset_left, offset_right;
|
|
||||||
guint padding_left, padding_right,
|
|
||||||
padding_top, padding_bottom;
|
|
||||||
|
|
||||||
action_area = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (dialog->builder, "dialog-action-area1");
|
|
||||||
gtk_widget_get_allocation (action_area, &allocation2);
|
|
||||||
|
|
||||||
offset_left = allocation2.x - allocation->x;
|
|
||||||
offset_right = (allocation->x + allocation->width) -
|
|
||||||
(allocation2.x + allocation2.width);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (widget),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (allocation->x >= 0 && allocation2.x >= 0)
|
|
||||||
{
|
|
||||||
if (offset_left > 0 && offset_left != padding_left)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (widget),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
offset_left, padding_right);
|
|
||||||
|
|
||||||
gtk_alignment_get_padding (GTK_ALIGNMENT (widget),
|
|
||||||
&padding_top, &padding_bottom,
|
|
||||||
&padding_left, &padding_right);
|
|
||||||
if (offset_right > 0 && offset_right != padding_right)
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (widget),
|
|
||||||
padding_top, padding_bottom,
|
|
||||||
padding_left, offset_right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PpPPDSelectionDialog *
|
PpPPDSelectionDialog *
|
||||||
pp_ppd_selection_dialog_new (GtkWindow *parent,
|
pp_ppd_selection_dialog_new (GtkWindow *parent,
|
||||||
PPDList *ppd_list,
|
PPDList *ppd_list,
|
||||||
|
@ -406,10 +366,6 @@ pp_ppd_selection_dialog_new (GtkWindow *parent,
|
||||||
g_signal_connect (dialog->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
g_signal_connect (dialog->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
||||||
g_signal_connect (dialog->dialog, "response", G_CALLBACK (ppd_selection_dialog_response_cb), dialog);
|
g_signal_connect (dialog->dialog, "response", G_CALLBACK (ppd_selection_dialog_response_cb), dialog);
|
||||||
|
|
||||||
widget = (GtkWidget*)
|
|
||||||
gtk_builder_get_object (dialog->builder, "content-alignment");
|
|
||||||
g_signal_connect (widget, "size-allocate", G_CALLBACK (update_alignment_padding), dialog);
|
|
||||||
|
|
||||||
widget = (GtkWidget*)
|
widget = (GtkWidget*)
|
||||||
gtk_builder_get_object (dialog->builder, "ppd-spinner");
|
gtk_builder_get_object (dialog->builder, "ppd-spinner");
|
||||||
gtk_spinner_start (GTK_SPINNER (widget));
|
gtk_spinner_start (GTK_SPINNER (widget));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue