summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-06-23 00:22:11 +0200
committerraveit65 <[email protected]>2016-06-24 20:48:20 +0200
commitf320383369c4105e8076a0a5248a728fac76a0c0 (patch)
tree6197bb42e94e0a7e06a19489b2e301edbee45729 /shell
parentf87c11ab0472e8a105c2aaab8ba97886960c141f (diff)
downloadatril-f320383369c4105e8076a0a5248a728fac76a0c0.tar.bz2
atril-f320383369c4105e8076a0a5248a728fac76a0c0.tar.xz
GTK+-3: Use GtkGrid instead of GtkTable
taken from: https://git.gnome.org/browse/evince/commit/?id=da8f31e
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-annotation-properties-dialog.c95
-rw-r--r--shell/ev-password-view.c20
2 files changed, 115 insertions, 0 deletions
diff --git a/shell/ev-annotation-properties-dialog.c b/shell/ev-annotation-properties-dialog.c
index 3d413096..eb736c5d 100644
--- a/shell/ev-annotation-properties-dialog.c
+++ b/shell/ev-annotation-properties-dialog.c
@@ -39,7 +39,11 @@ struct _EvAnnotationPropertiesDialog {
EvAnnotationType annot_type;
EvAnnotation *annot;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *grid;
+#else
GtkWidget *table;
+#endif
GtkWidget *author;
GtkWidget *color;
@@ -90,15 +94,23 @@ static void
ev_annotation_properties_dialog_constructed (GObject *object)
{
EvAnnotationPropertiesDialog *dialog = EV_ANNOTATION_PROPERTIES_DIALOG (object);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *grid = dialog->grid;
+#else
GtkWidget *table = dialog->table;
+#endif
GtkWidget *label;
switch (dialog->annot_type) {
case EV_ANNOTATION_TYPE_TEXT:
label = gtk_label_new (_("Icon:"));
gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1);
+#else
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6,
GTK_FILL, GTK_FILL, 0, 0);
+#endif
gtk_widget_show (label);
dialog->icon = gtk_combo_box_text_new ();
@@ -113,9 +125,14 @@ 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);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_grid_attach (GTK_GRID (grid), dialog->icon, 1, 5, 1, 1);
+ gtk_widget_set_hexpand (dialog->icon, TRUE);
+#else
gtk_table_attach (GTK_TABLE (table), dialog->icon,
1, 2, 5, 6,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
+#endif
gtk_widget_show (dialog->icon);
break;
@@ -132,7 +149,11 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog
GtkDialog *dialog = GTK_DIALOG (annot_dialog);
GtkWidget *content_area;
GtkWidget *label;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *grid;
+#else
GtkWidget *table;
+#endif
GtkWidget *hbox;
gchar *markup;
GdkColor color = { 0, 65535, 65535, 0 };
@@ -149,6 +170,79 @@ 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);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ 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_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_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_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
+ gtk_widget_show (label);
+
+ annot_dialog->color = gtk_color_button_new_with_color (&color);
+ 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_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_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);
+
+ label = gtk_label_new (NULL);
+ markup = g_strdup_printf ("<small>%s</small>", _("Transparent"));
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free (markup);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ label = gtk_label_new (NULL);
+ markup = g_strdup_printf ("<small>%s</small>", _("Opaque"));
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free (markup);
+ gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ 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_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_grid_attach (GTK_GRID (grid), annot_dialog->popup_state, 1, 4, 1, 1);
+ gtk_widget_set_hexpand (annot_dialog->popup_state, TRUE);
+#else
table = gtk_table_new (5, 2, FALSE);
annot_dialog->table = table;
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
@@ -229,6 +323,7 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog
gtk_table_attach (GTK_TABLE (table), annot_dialog->popup_state,
1, 2, 4, 5,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
+#endif
gtk_widget_show (annot_dialog->popup_state);
}
diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c
index 5e5a5559..545c064c 100644
--- a/shell/ev-password-view.c
+++ b/shell/ev-password-view.c
@@ -251,7 +251,11 @@ ev_password_view_ask_password (EvPasswordView *password_view)
GtkWidget *content_area, *action_area;
GtkWidget *entry_container;
GtkWidget *hbox, *main_vbox, *vbox, *icon;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *grid;
+#else
GtkWidget *table;
+#endif
GtkWidget *label;
gchar *format, *markup, *file_name;
@@ -332,11 +336,19 @@ ev_password_view_ask_password (EvPasswordView *password_view)
FALSE, FALSE, 0);
gtk_widget_show (entry_container);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ 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);
+#else
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);
+#endif
label = gtk_label_new_with_mnemonic (_("_Password:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -349,6 +361,13 @@ 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);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
+ gtk_widget_show (label);
+
+ 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);
+#else
gtk_table_attach (GTK_TABLE (table), label,
0, 1, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
@@ -356,6 +375,7 @@ ev_password_view_ask_password (EvPasswordView *password_view)
gtk_table_attach_defaults (GTK_TABLE (table), password_view->priv->password_entry,
1, 2, 0, 1);
+#endif
gtk_widget_show (password_view->priv->password_entry);
gtk_label_set_mnemonic_widget (GTK_LABEL (label),