From a58c47065ecb0e58cc06873b8f63fdf231ea23c1 Mon Sep 17 00:00:00 2001 From: monsta Date: Thu, 4 Feb 2016 14:07:54 +0300 Subject: [GTK+3] use x/y align functions of GtkLabel in GTK+ >= 3.16 --- capplets/windows/mate-metacity-support.c | 5 ++--- capplets/windows/mate-window-properties.c | 12 ++++++------ font-viewer/font-view.c | 6 +++--- libslab/app-shell.c | 10 ++++------ libslab/application-tile.c | 10 ++++------ libslab/directory-tile.c | 10 ++++------ libslab/document-tile.c | 15 ++++++--------- libslab/system-tile.c | 5 ++--- 8 files changed, 31 insertions(+), 42 deletions(-) diff --git a/capplets/windows/mate-metacity-support.c b/capplets/windows/mate-metacity-support.c index 43518759..ec9ca7aa 100644 --- a/capplets/windows/mate-metacity-support.c +++ b/capplets/windows/mate-metacity-support.c @@ -56,9 +56,8 @@ mate_metacity_config_tool () widget = gtk_label_new (str); g_free (str); gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (widget, GTK_ALIGN_START); - gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (widget), 0.0); #else gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); #endif diff --git a/capplets/windows/mate-window-properties.c b/capplets/windows/mate-window-properties.c index f0e0395d..7f8442f9 100644 --- a/capplets/windows/mate-window-properties.c +++ b/capplets/windows/mate-window-properties.c @@ -303,9 +303,9 @@ title_label_new (const char* title) g_free (str); gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (widget, GTK_ALIGN_START); - gtk_widget_set_valign (widget, GTK_ALIGN_START); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (widget), 0.0); + gtk_label_set_yalign (GTK_LABEL (widget), 0.0); #else gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0); #endif @@ -550,9 +550,9 @@ main (int argc, char **argv) #endif widget = gtk_label_new_with_mnemonic (_("To move a window, press-and-hold this key then grab the window:")); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (widget, GTK_ALIGN_START); - gtk_widget_set_valign (widget, GTK_ALIGN_START); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (widget), 0.0); + gtk_label_set_yalign (GTK_LABEL (widget), 0.0); #else gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0); #endif diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c index 2b416a02..0bd32be1 100644 --- a/font-viewer/font-view.c +++ b/font-viewer/font-view.c @@ -255,9 +255,9 @@ add_row (GtkWidget *table, bold_name = g_strconcat ("", name, "", NULL); name_w = gtk_label_new (bold_name); g_free (bold_name); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (name_w, GTK_ALIGN_START); - gtk_widget_set_valign (name_w, GTK_ALIGN_START); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (name_w), 0.0); + gtk_label_set_yalign (GTK_LABEL (name_w), 0.0); #else gtk_misc_set_alignment (GTK_MISC (name_w), 0.0, 0.0); #endif diff --git a/libslab/app-shell.c b/libslab/app-shell.c index 3045fff8..9e84e1c5 100644 --- a/libslab/app-shell.c +++ b/libslab/app-shell.c @@ -418,9 +418,8 @@ create_actions_section (AppShellData * app_data, const gchar * title, action = (AppAction *) actions->data; header = gtk_label_new (action->name); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif @@ -718,9 +717,8 @@ create_application_category_sections (AppShellData * app_data) GtkWidget *hbox; GtkWidget *table; -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif diff --git a/libslab/application-tile.c b/libslab/application-tile.c index 88fe066a..7d98da80 100644 --- a/libslab/application-tile.c +++ b/libslab/application-tile.c @@ -402,9 +402,8 @@ create_header (const gchar *name) header = gtk_label_new (name); gtk_label_set_line_wrap (GTK_LABEL (header), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif @@ -426,9 +425,8 @@ create_subheader (const gchar *desc) subheader = gtk_label_new (desc); gtk_label_set_ellipsize (GTK_LABEL (subheader), PANGO_ELLIPSIZE_END); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (subheader, GTK_ALIGN_START); - gtk_widget_set_valign (subheader, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (subheader), 0.0); #else gtk_misc_set_alignment (GTK_MISC (subheader), 0.0, 0.5); #endif diff --git a/libslab/directory-tile.c b/libslab/directory-tile.c index f8a57cfb..ecd5b23a 100644 --- a/libslab/directory-tile.c +++ b/libslab/directory-tile.c @@ -342,9 +342,8 @@ create_header (const gchar *name) header = gtk_label_new (name); gtk_label_set_ellipsize (GTK_LABEL (header), PANGO_ELLIPSIZE_END); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif @@ -414,9 +413,8 @@ rename_entry_activate_cb (GtkEntry *entry, gpointer user_data) g_object_unref (dst_file); header = gtk_label_new (priv->basename); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif diff --git a/libslab/document-tile.c b/libslab/document-tile.c index f2187b04..89f37478 100644 --- a/libslab/document-tile.c +++ b/libslab/document-tile.c @@ -690,9 +690,8 @@ create_header (const gchar *name) header = gtk_label_new (name); gtk_label_set_ellipsize (GTK_LABEL (header), PANGO_ELLIPSIZE_END); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif @@ -713,9 +712,8 @@ create_subheader (const gchar *desc) subheader = gtk_label_new (desc); gtk_label_set_ellipsize (GTK_LABEL (subheader), PANGO_ELLIPSIZE_END); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (subheader, GTK_ALIGN_START); - gtk_widget_set_valign (subheader, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (subheader), 0.0); #else gtk_misc_set_alignment (GTK_MISC (subheader), 0.0, 0.5); #endif @@ -810,9 +808,8 @@ rename_entry_activate_cb (GtkEntry *entry, gpointer user_data) } header = gtk_label_new (priv->basename); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif diff --git a/libslab/system-tile.c b/libslab/system-tile.c index c60291c0..d05fc84a 100644 --- a/libslab/system-tile.c +++ b/libslab/system-tile.c @@ -242,9 +242,8 @@ create_header (const gchar *name) header = gtk_label_new (name); gtk_label_set_use_underline (GTK_LABEL (header), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_halign (header, GTK_ALIGN_START); - gtk_widget_set_valign (header, GTK_ALIGN_CENTER); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (header), 0.0); #else gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5); #endif -- cgit v1.2.1