summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2015-09-02 15:56:41 +0200
committerinfirit <[email protected]>2015-09-06 13:08:32 +0200
commit4a7304dcb64cd908a2e4e9c907efd5ad40d82a48 (patch)
tree690ce2246b1e495847f3abdb64ac9b6f198ffceb
parenta3362f16408b7d4e36c917e384dd346cc8cc40c4 (diff)
downloadeom-4a7304dcb64cd908a2e4e9c907efd5ad40d82a48.tar.bz2
eom-4a7304dcb64cd908a2e4e9c907efd5ad40d82a48.tar.xz
Gtk3: Drop GtkMisc and GtkAlignment usage
Both are deprecated and can be replaced by simple GtkWidget properties. This leaves out the dialogs made with Glade as it doesn't have support for the new margin-start property yet. taken from: https://git.gnome.org/browse/eog/commit/?id=2fad221
-rw-r--r--src/eom-close-confirmation-dialog.c28
-rw-r--r--src/eom-error-message-area.c12
-rw-r--r--src/eom-plugin-manager.c4
-rw-r--r--src/eom-print-image-setup.c28
-rw-r--r--src/eom-window.c12
5 files changed, 84 insertions, 0 deletions
diff --git a/src/eom-close-confirmation-dialog.c b/src/eom-close-confirmation-dialog.c
index 119ff44..4608b71 100644
--- a/src/eom-close-confirmation-dialog.c
+++ b/src/eom-close-confirmation-dialog.c
@@ -399,13 +399,21 @@ build_single_img_dialog (EomCloseConfirmationDialog *dlg)
/* Image */
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_DIALOG);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_valign (image, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+#endif
/* Primary label */
primary_label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (primary_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
image_name = eom_image_get_caption (img);
@@ -424,7 +432,11 @@ build_single_img_dialog (EomCloseConfirmationDialog *dlg)
secondary_label = gtk_label_new (str);
g_free (str);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
+#endif
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
hbox = gtk_hbox_new (FALSE, 12);
@@ -591,7 +603,11 @@ build_multiple_imgs_dialog (EomCloseConfirmationDialog *dlg)
/* Image */
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_DIALOG);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_valign (image, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+#endif
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, 12);
@@ -601,7 +617,11 @@ build_multiple_imgs_dialog (EomCloseConfirmationDialog *dlg)
primary_label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (primary_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
+#endif
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
str = g_strdup_printf (
@@ -626,7 +646,11 @@ build_multiple_imgs_dialog (EomCloseConfirmationDialog *dlg)
gtk_box_pack_start (GTK_BOX (vbox2), select_label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (select_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (select_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (select_label), 0.0, 0.5);
+#endif
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow, TRUE, TRUE, 0);
@@ -645,7 +669,11 @@ build_multiple_imgs_dialog (EomCloseConfirmationDialog *dlg)
gtk_box_pack_start (GTK_BOX (vbox2), secondary_label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5);
+#endif
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_mnemonic_widget (GTK_LABEL (select_label), treeview);
diff --git a/src/eom-error-message-area.c b/src/eom-error-message-area.c
index 14a5362..552e2bd 100644
--- a/src/eom-error-message-area.c
+++ b/src/eom-error-message-area.c
@@ -59,7 +59,11 @@ set_message_area_text_and_icon (GtkInfoBar *message_area,
image = gtk_image_new_from_stock (icon_stock_id, GTK_ICON_SIZE_DIALOG);
gtk_widget_show (image);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_valign (image, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
+#endif
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
@@ -74,7 +78,11 @@ set_message_area_text_and_icon (GtkInfoBar *message_area,
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), FALSE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (primary_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
+#endif
gtk_widget_set_can_focus (primary_label, TRUE);
@@ -95,7 +103,11 @@ set_message_area_text_and_icon (GtkInfoBar *message_area,
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5);
+#endif
}
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (message_area))), hbox_content, TRUE, TRUE, 0);
diff --git a/src/eom-plugin-manager.c b/src/eom-plugin-manager.c
index befbea4..c1e063e 100644
--- a/src/eom-plugin-manager.c
+++ b/src/eom-plugin-manager.c
@@ -835,7 +835,11 @@ eom_plugin_manager_init (EomPluginManager *pm)
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (pm), label, FALSE, TRUE, 0);
diff --git a/src/eom-print-image-setup.c b/src/eom-print-image-setup.c
index ee258b5..c8c0e46 100644
--- a/src/eom-print-image-setup.c
+++ b/src/eom-print-image-setup.c
@@ -648,11 +648,19 @@ static GtkWidget *
wrap_in_frame (const gchar *label,
GtkWidget *child)
{
+#if GTK_CHECK_VERSION (3, 14, 0)
+ GtkWidget *frame, *label_widget;
+#else
GtkWidget *frame, *alignment, *label_widget;
+#endif
gchar *bold_text;
label_widget = gtk_label_new ("");
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label_widget, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
+#endif
gtk_widget_show (label_widget);
bold_text = g_markup_printf_escaped ("<b>%s</b>", label);
@@ -661,6 +669,13 @@ wrap_in_frame (const gchar *label,
frame = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (frame), label_widget, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_box_pack_start (GTK_BOX (frame), child, FALSE, FALSE, 0);
+
+ gtk_widget_set_margin_start (child, 12);
+
+ gtk_widget_show (frame);
+#else
alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
@@ -671,6 +686,7 @@ wrap_in_frame (const gchar *label,
gtk_widget_show (frame);
gtk_widget_show (alignment);
+#endif
return frame;
}
@@ -687,7 +703,11 @@ table_attach_spin_button_with_label (GtkWidget *table,
GtkWidget *label, *spin_button;
label = gtk_label_new_with_mnemonic (text_label);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
spin_button = gtk_spin_button_new_with_range (0, 100, 0.01);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button), 2);
gtk_entry_set_width_chars (GTK_ENTRY (spin_button), 6);
@@ -917,7 +937,11 @@ eom_print_image_setup_init (EomPrintImageSetup *setup)
#endif
label = gtk_label_new_with_mnemonic (_("C_enter:"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
combobox = gtk_combo_box_text_new ();
gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combobox),
@@ -1000,7 +1024,11 @@ eom_print_image_setup_init (EomPrintImageSetup *setup)
priv->scaling = hscale;
label = gtk_label_new_with_mnemonic (_("_Unit:"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
combobox = gtk_combo_box_text_new ();
gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combobox), UNIT_MM,
diff --git a/src/eom-window.c b/src/eom-window.c
index fd9c3ac..db0240e 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -829,9 +829,15 @@ image_file_changed_cb (EomImage *img, EomWindow *window)
hbox = gtk_hbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_valign (image, GTK_ALIGN_START);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar))), hbox, TRUE, TRUE, 0);
gtk_widget_show_all (hbox);
gtk_widget_show (info_bar);
@@ -2737,9 +2743,15 @@ eom_window_set_wallpaper (EomWindow *window, const gchar *filename, const gchar
hbox = gtk_hbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_valign (image, GTK_ALIGN_START);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar))), hbox, TRUE, TRUE, 0);
gtk_widget_show_all (hbox);
gtk_widget_show (info_bar);