Blob Blame History Raw
From 17f29c0c1f28e78578e8696a4464dd53ec9de5b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Kudera?= <matejkudera1@seznam.cz>
Date: Tue, 23 May 2017 14:14:38 +0200
Subject: [PATCH] Replacing 'gtk_misc_set_alignment' and 'gtk_misc_set_padding'

Removing if command which handled old versions of dtk-3 because old versions of dtk-3 are now used nowhere.
gtk_misc_set_alignment replaced with gtk_widget_set_halign, gtk_widget_set_valign.
gtk_misc_set_padding replaced with alignment and margin properties.
---
 src/gtk-helpers/autowrapped_label.c   |  5 +++--
 src/gtk-helpers/event_config_dialog.c | 20 ++++++--------------
 src/gui-wizard-gtk/wizard.c           | 11 +++--------
 3 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/src/gtk-helpers/autowrapped_label.c b/src/gtk-helpers/autowrapped_label.c
index b56391c..9abaf82 100644
--- a/src/gtk-helpers/autowrapped_label.c
+++ b/src/gtk-helpers/autowrapped_label.c
@@ -61,8 +61,9 @@ static void rewrap_label_to_parent_size(GtkWidget *widget,
 void make_label_autowrap_on_resize(GtkLabel *label)
 {
     // So far, only tested to work on labels which were set up as:
-    //gtk_label_set_justify(label, GTK_JUSTIFY_LEFT);
-    //gtk_misc_set_alignment(GTK_MISC(label), /*x,yalign:*/ 0.0, 0.0);
+    // gtk_label_set_justify(label, GTK_JUSTIFY_LEFT);
+    // gtk_widget_set_halign (label, GTK_ALIGN_START);
+    // gtk_widget_set_valign (label, GTK_ALIGN_END);
     // yalign != 0 definitely breaks things!
     // also, <property name="ypad">NONZERO</property> would be bad
 
diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index 590a2ed..c5c0c41 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -35,16 +35,12 @@ static GtkWidget *gtk_label_new_justify_left(const gchar *label_str)
 {
     GtkWidget *label = gtk_label_new(label_str);
     gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
-#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 5))
-    gtk_misc_set_alignment(GTK_MISC(label), /*xalign:*/ 0, /*yalign:*/ 0.5);
-    /* Make some space between label and input field to the right of it: */
-    gtk_misc_set_padding(GTK_MISC(label), /*xpad:*/ 5, /*ypad:*/ 0);
-#else
+
     gtk_widget_set_halign (label, GTK_ALIGN_START);
     /* Make some space between label and input field to the right of it: */
     gtk_widget_set_margin_start(label, 5);
     gtk_widget_set_margin_end(label, 5);
-#endif
+
     return label;
 }
 
@@ -153,12 +149,10 @@ static void add_option_to_table(gpointer data, gpointer user_data)
         case OPTION_TYPE_HINT_HTML:
             label = gtk_label_new(option_label);
             gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
-#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 5))
-            gtk_misc_set_alignment(GTK_MISC(label), /*x,yalign:*/ 0.0, 0.0);
-#else
+
             gtk_widget_set_halign(label, GTK_ALIGN_START);
             gtk_widget_set_valign(label, GTK_ALIGN_START);
-#endif
+
             make_label_autowrap_on_resize(GTK_LABEL(label));
 
             last_row = add_one_row_to_grid(option_table);
@@ -190,12 +184,10 @@ static void add_option_to_table(gpointer data, gpointer user_data)
     {
         label = gtk_label_new(option->eo_note_html);
         gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
-#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 5))
-        gtk_misc_set_alignment(GTK_MISC(label), /*x,yalign:*/ 0.0, 0.0);
-#else
+
         gtk_widget_set_halign(label, GTK_ALIGN_START);
         gtk_widget_set_valign(label, GTK_ALIGN_START);
-#endif
+
         make_label_autowrap_on_resize(GTK_LABEL(label));
 
         last_row = add_one_row_to_grid(option_table);
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 8df71c9..b98ecea 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1072,12 +1072,10 @@ static event_gui_data_t *add_event_buttons(GtkBox *box,
     if (!event_name || !event_name[0])
     {
         GtkWidget *lbl = gtk_label_new(_("No reporting targets are defined for this problem. Check configuration in /etc/libreport/*"));
-#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 5))
-        gtk_misc_set_alignment(GTK_MISC(lbl), /*x*/ 0.0, /*y*/ 0.0);
-#else
+
         gtk_widget_set_halign (lbl, GTK_ALIGN_START);
         gtk_widget_set_valign (lbl, GTK_ALIGN_END);
-#endif
+
         make_label_autowrap_on_resize(GTK_LABEL(lbl));
         gtk_box_pack_start(box, lbl, /*expand*/ true, /*fill*/ false, /*padding*/ 0);
         return NULL;
@@ -2266,12 +2264,9 @@ static void add_warning(const char *warning)
     /* should be safe to free it, gtk calls strdup() to copy it */
     free(label_str);
 
-#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 5))
-    gtk_misc_set_alignment(GTK_MISC(warning_lbl), 0.0, 0.0);
-#else
     gtk_widget_set_halign (warning_lbl, GTK_ALIGN_START);
     gtk_widget_set_valign (warning_lbl, GTK_ALIGN_END);
-#endif
+
     gtk_label_set_justify(GTK_LABEL(warning_lbl), GTK_JUSTIFY_LEFT);
     gtk_label_set_line_wrap(GTK_LABEL(warning_lbl), TRUE);
 
-- 
2.21.0