Commit da8f31ef authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

Use GtkGrid instead of GtkTable

parent bf90f90e
......@@ -1867,7 +1867,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print,
{
GtkPrintSettings *settings;
GtkWidget *label;
GtkWidget *table;
GtkWidget *grid;
EvPrintScale page_scale;
gboolean autorotate;
gboolean use_source_size;
......@@ -1879,13 +1879,13 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print,
TRUE;
use_source_size = gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_PAGE_SIZE);
table = gtk_table_new (3, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
label = gtk_label_new (_("Page Scaling:"));
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
label = gtk_label_new (_("Page Scaling:"));
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
gtk_widget_show (label);
print->scale_combo = gtk_combo_box_text_new ();
......@@ -1903,7 +1903,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print,
"\n"
"• \"Fit to Printable Area\": Document pages are enlarged or reduced as"
" required to fit the printable area of the printer page.\n"));
gtk_table_attach (GTK_TABLE (table), print->scale_combo, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
gtk_grid_attach (GTK_GRID (grid), print->scale_combo, 1, 0, 1, 1);
gtk_widget_show (print->scale_combo);
print->autorotate_button = gtk_check_button_new_with_label (_("Auto Rotate and Center"));
......@@ -1911,17 +1911,17 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print,
gtk_widget_set_tooltip_text (print->autorotate_button,
_("Rotate printer page orientation of each page to match orientation of each document page. "
"Document pages will be centered within the printer page."));
gtk_table_attach (GTK_TABLE (table), print->autorotate_button, 0, 2, 1, 2, GTK_FILL, 0, 0, 0);
gtk_grid_attach (GTK_GRID (grid), print->autorotate_button, 0, 1, 2, 1);
gtk_widget_show (print->autorotate_button);
print->source_button = gtk_check_button_new_with_label (_("Select page size using document page size"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (print->source_button), use_source_size);
gtk_widget_set_tooltip_text (print->source_button, _("When enabled, each page will be printed on "
"the same size paper as the document page."));
gtk_table_attach (GTK_TABLE (table), print->source_button, 0, 2, 2, 3, GTK_FILL, 0, 0, 0);
gtk_grid_attach (GTK_GRID (grid), print->source_button, 0, 2, 2, 1);
gtk_widget_show (print->source_button);
return G_OBJECT (table);
return G_OBJECT (grid);
}
static void
......
......@@ -76,7 +76,7 @@ static const PropertyInfo properties_info[] = {
struct _EvPropertiesView {
GtkVBox base_instance;
GtkWidget *table;
GtkWidget *grid;
GtkWidget *labels[N_PROPERTIES];
gchar *uri;
};
......@@ -150,7 +150,7 @@ make_valid_utf8 (const gchar *name)
static void
set_property (EvPropertiesView *properties,
GtkTable *table,
GtkGrid *grid,
Property property,
const gchar *text,
gint *row)
......@@ -166,8 +166,7 @@ set_property (EvPropertiesView *properties,
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
gtk_table_attach (table, label, 0, 1, *row, *row + 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_grid_attach (grid, label, 0, *row, 1, 1);
gtk_widget_show (label);
}
......@@ -177,7 +176,7 @@ set_property (EvPropertiesView *properties,
g_object_set (G_OBJECT (label),
"xalign", 0.0,
"width_chars", 25,
"selectable", TRUE,
"selecgrid", TRUE,
"ellipsize", PANGO_ELLIPSIZE_END,
NULL);
} else {
......@@ -195,8 +194,7 @@ set_property (EvPropertiesView *properties,
}
if (!properties->labels[property]) {
gtk_table_attach (table, label, 1, 2, *row, *row + 1,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (grid, label, 1, *row, 1, 1);
properties->labels[property] = label;
}
......@@ -313,58 +311,58 @@ ev_regular_paper_size (const EvDocumentInfo *info)
void
ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo *info)
{
GtkWidget *table;
GtkWidget *grid;
gchar *text;
gint row = 0;
table = properties->table;
grid = properties->grid;
if (info->fields_mask & EV_DOCUMENT_INFO_TITLE) {
set_property (properties, GTK_TABLE (table), TITLE_PROPERTY, info->title, &row);
set_property (properties, GTK_GRID (grid), TITLE_PROPERTY, info->title, &row);
}
set_property (properties, GTK_TABLE (table), URI_PROPERTY, properties->uri, &row);
set_property (properties, GTK_GRID (grid), URI_PROPERTY, properties->uri, &row);
if (info->fields_mask & EV_DOCUMENT_INFO_SUBJECT) {
set_property (properties, GTK_TABLE (table), SUBJECT_PROPERTY, info->subject, &row);
set_property (properties, GTK_GRID (grid), SUBJECT_PROPERTY, info->subject, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_AUTHOR) {
set_property (properties, GTK_TABLE (table), AUTHOR_PROPERTY, info->author, &row);
set_property (properties, GTK_GRID (grid), AUTHOR_PROPERTY, info->author, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_KEYWORDS) {
set_property (properties, GTK_TABLE (table), KEYWORDS_PROPERTY, info->keywords, &row);
set_property (properties, GTK_GRID (grid), KEYWORDS_PROPERTY, info->keywords, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_PRODUCER) {
set_property (properties, GTK_TABLE (table), PRODUCER_PROPERTY, info->producer, &row);
set_property (properties, GTK_GRID (grid), PRODUCER_PROPERTY, info->producer, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_CREATOR) {
set_property (properties, GTK_TABLE (table), CREATOR_PROPERTY, info->creator, &row);
set_property (properties, GTK_GRID (grid), CREATOR_PROPERTY, info->creator, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_CREATION_DATE) {
text = ev_document_misc_format_date (info->creation_date);
set_property (properties, GTK_TABLE (table), CREATION_DATE_PROPERTY, text, &row);
set_property (properties, GTK_GRID (grid), CREATION_DATE_PROPERTY, text, &row);
g_free (text);
}
if (info->fields_mask & EV_DOCUMENT_INFO_MOD_DATE) {
text = ev_document_misc_format_date (info->modified_date);
set_property (properties, GTK_TABLE (table), MOD_DATE_PROPERTY, text, &row);
set_property (properties, GTK_GRID (grid), MOD_DATE_PROPERTY, text, &row);
g_free (text);
}
if (info->fields_mask & EV_DOCUMENT_INFO_FORMAT) {
set_property (properties, GTK_TABLE (table), FORMAT_PROPERTY, info->format, &row);
set_property (properties, GTK_GRID (grid), FORMAT_PROPERTY, info->format, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_N_PAGES) {
text = g_strdup_printf ("%d", info->n_pages);
set_property (properties, GTK_TABLE (table), N_PAGES_PROPERTY, text, &row);
set_property (properties, GTK_GRID (grid), N_PAGES_PROPERTY, text, &row);
g_free (text);
}
if (info->fields_mask & EV_DOCUMENT_INFO_LINEARIZED) {
set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, info->linearized, &row);
set_property (properties, GTK_GRID (grid), LINEARIZED_PROPERTY, info->linearized, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_SECURITY) {
set_property (properties, GTK_TABLE (table), SECURITY_PROPERTY, info->security, &row);
set_property (properties, GTK_GRID (grid), SECURITY_PROPERTY, info->security, &row);
}
if (info->fields_mask & EV_DOCUMENT_INFO_PAPER_SIZE) {
text = ev_regular_paper_size (info);
set_property (properties, GTK_TABLE (table), PAPER_SIZE_PROPERTY, text, &row);
set_property (properties, GTK_GRID (grid), PAPER_SIZE_PROPERTY, text, &row);
g_free (text);
}
}
......@@ -372,13 +370,12 @@ ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo
static void
ev_properties_view_init (EvPropertiesView *properties)
{
properties->table = gtk_table_new (13, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (properties->table), 12);
gtk_table_set_row_spacings (GTK_TABLE (properties->table), 6);
gtk_container_set_border_width (GTK_CONTAINER (properties->table), 12);
gtk_box_pack_start (GTK_BOX (properties), properties->table,
TRUE, TRUE, 0);
gtk_widget_show (properties->table);
properties->grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (properties->grid), 12);
gtk_grid_set_row_spacing (GTK_GRID (properties->grid), 6);
gtk_container_set_border_width (GTK_CONTAINER (properties->grid), 12);
gtk_box_pack_start (GTK_BOX (properties), properties->grid, TRUE, TRUE, 0);
gtk_widget_show (properties->grid);
}
void
......
......@@ -35,7 +35,7 @@ struct _EvAnnotationPropertiesDialog {
EvAnnotationType annot_type;
EvAnnotation *annot;
GtkWidget *table;
GtkWidget *grid;
GtkWidget *author;
GtkWidget *color;
......@@ -87,7 +87,7 @@ ev_annotation_properties_dialog_constructed (GObject *object)
{
EvAnnotationPropertiesDialog *dialog = EV_ANNOTATION_PROPERTIES_DIALOG (object);
GtkWidget *contant_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
GtkWidget *table = dialog->table;
GtkWidget *grid = dialog->grid;
GtkWidget *label;
contant_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
......@@ -96,8 +96,7 @@ ev_annotation_properties_dialog_constructed (GObject *object)
case EV_ANNOTATION_TYPE_TEXT:
label = gtk_label_new (_("Icon:"));
gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6,
GTK_FILL, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1);
gtk_widget_show (label);
dialog->icon = gtk_combo_box_text_new ();
......@@ -112,9 +111,8 @@ ev_annotation_properties_dialog_constructed (GObject *object)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Circle"));
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Unknown"));
gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->icon), 0);
gtk_table_attach (GTK_TABLE (table), dialog->icon,
1, 2, 5, 6,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), dialog->icon, 1, 5, 1, 1);
gtk_widget_set_hexpand (dialog->icon, TRUE);
gtk_widget_show (dialog->icon);
break;
......@@ -131,7 +129,7 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog
GtkDialog *dialog = GTK_DIALOG (annot_dialog);
GtkWidget *content_area;
GtkWidget *label;
GtkWidget *table;
GtkWidget *grid;
GtkWidget *hbox;
gchar *markup;
GdkColor color = { 0, 65535, 65535, 0 };
......@@ -148,50 +146,44 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog
content_area = gtk_dialog_get_content_area (dialog);
gtk_box_set_spacing (GTK_BOX (content_area), 2);
table = gtk_table_new (5, 2, FALSE);
annot_dialog->table = table;
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
gtk_box_pack_start (GTK_BOX (content_area), table, FALSE, FALSE, 0);
gtk_widget_show (table);
grid = gtk_grid_new ();
annot_dialog->grid = grid;
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
gtk_box_pack_start (GTK_BOX (content_area), grid, FALSE, FALSE, 0);
gtk_widget_show (grid);
label = gtk_label_new (_("Author:"));
gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
gtk_widget_show (label);
annot_dialog->author = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (annot_dialog->author), g_get_real_name ());
gtk_table_attach (GTK_TABLE (table), annot_dialog->author,
1, 2, 0, 1,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), annot_dialog->author, 1, 0, 1, 1);
gtk_widget_set_hexpand (annot_dialog->author, TRUE);
gtk_widget_show (annot_dialog->author);
label = gtk_label_new (_("Color:"));
gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
GTK_FILL, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
gtk_widget_show (label);
annot_dialog->color = gtk_color_button_new_with_color (&color);
gtk_table_attach (GTK_TABLE (table), annot_dialog->color,
1, 2, 1, 2,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), annot_dialog->color, 1, 1, 1, 1);
gtk_widget_set_hexpand (annot_dialog->color, TRUE);
gtk_widget_show (annot_dialog->color);
label = gtk_label_new (_("Style:"));
gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
GTK_FILL, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
gtk_widget_show (label);
annot_dialog->opacity = gtk_hscale_new_with_range (0, 100, 5);
gtk_range_set_value (GTK_RANGE (annot_dialog->opacity), 100);
gtk_table_attach (GTK_TABLE (table), annot_dialog->opacity,
1, 2, 2, 3,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), annot_dialog->opacity, 1, 2, 1, 1);
gtk_widget_set_hexpand (annot_dialog->opacity, TRUE);
gtk_widget_show (annot_dialog->opacity);
hbox = gtk_hbox_new (FALSE, 6);
......@@ -210,24 +202,21 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), hbox,
1, 2, 3, 4,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 3, 1, 1);
gtk_widget_set_hexpand (hbox, TRUE);
gtk_widget_show (hbox);
label = gtk_label_new (_("Initial window state:"));
gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
GTK_FILL, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1);
gtk_widget_show (label);
annot_dialog->popup_state = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->popup_state), _("Open"));
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->popup_state), _("Close"));
gtk_combo_box_set_active (GTK_COMBO_BOX (annot_dialog->popup_state), 1);
gtk_table_attach (GTK_TABLE (table), annot_dialog->popup_state,
1, 2, 4, 5,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), annot_dialog->popup_state, 1, 4, 1, 1);
gtk_widget_set_hexpand (annot_dialog->popup_state, TRUE);
gtk_widget_show (annot_dialog->popup_state);
}
......
......@@ -244,7 +244,7 @@ ev_password_view_ask_password (EvPasswordView *password_view)
GtkWidget *content_area, *action_area;
GtkWidget *entry_container;
GtkWidget *hbox, *main_vbox, *vbox, *icon;
GtkWidget *table;
GtkWidget *grid;
GtkWidget *label;
gchar *format, *markup, *file_name;
......@@ -325,11 +325,11 @@ ev_password_view_ask_password (EvPasswordView *password_view)
FALSE, FALSE, 0);
gtk_widget_show (entry_container);
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_container_add (GTK_CONTAINER (entry_container), table);
gtk_widget_show (table);
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_container_add (GTK_CONTAINER (entry_container), grid);
gtk_widget_show (grid);
label = gtk_label_new_with_mnemonic (_("_Password:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
......@@ -342,13 +342,11 @@ ev_password_view_ask_password (EvPasswordView *password_view)
g_signal_connect (password_view->priv->password_entry, "activate",
G_CALLBACK (ev_password_dialog_entry_activated_cb),
dialog);
gtk_table_attach (GTK_TABLE (table), label,
0, 1, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
gtk_widget_show (label);
gtk_table_attach_defaults (GTK_TABLE (table), password_view->priv->password_entry,
1, 2, 0, 1);
gtk_grid_attach (GTK_GRID (grid), password_view->priv->password_entry, 1, 0, 1, 1);
gtk_widget_set_hexpand (password_view->priv->password_entry, TRUE);
gtk_widget_show (password_view->priv->password_entry);
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment