summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--polkitgtkmate/example.c15
-rw-r--r--src/polkitmateauthenticationdialog.c41
2 files changed, 53 insertions, 3 deletions
diff --git a/polkitgtkmate/example.c b/polkitgtkmate/example.c
index 8b2da85..e6786c1 100644
--- a/polkitgtkmate/example.c
+++ b/polkitgtkmate/example.c
@@ -125,19 +125,34 @@ int main(int argc, char* argv[])
s = g_strdup_printf("Showing PolkitLockButton for action id: %s", action_id);
label = gtk_label_new(s);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+#endif
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
g_free(s);
label = gtk_label_new(NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+#endif
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
system_bus_name_authorized_label = label;
label = gtk_label_new(NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+#endif
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
unix_process_authorized_label = label;
diff --git a/src/polkitmateauthenticationdialog.c b/src/polkitmateauthenticationdialog.c
index b8267a4..391a915 100644
--- a/src/polkitmateauthenticationdialog.c
+++ b/src/polkitmateauthenticationdialog.c
@@ -519,7 +519,12 @@ add_row (GtkWidget *table, int row, const char *label_text, GtkWidget *entry)
label = gtk_label_new_with_mnemonic (label_text);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 1.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label,
0, 1, row, row + 1,
@@ -668,7 +673,12 @@ polkit_mate_authentication_dialog_constructed (GObject *object)
gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
image = get_image (dialog);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+ 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);
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -683,7 +693,12 @@ polkit_mate_authentication_dialog_constructed (GObject *object)
s = g_strdup_printf ("<big><b>%s</b></big>", dialog->priv->message);
gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (label), 50);
@@ -713,7 +728,12 @@ polkit_mate_authentication_dialog_constructed (GObject *object)
"Authentication as the super user is required to perform this action."));
}
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (label), 50);
@@ -806,7 +826,12 @@ polkit_mate_authentication_dialog_constructed (GObject *object)
s = g_strdup_printf ("<small>%s</small>", value);
gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 1.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
+#endif
s = g_strdup_printf ("<small><b>%s:</b></small>", key);
add_row (table, rows, s, label);
g_free (s);
@@ -825,7 +850,12 @@ polkit_mate_authentication_dialog_constructed (GObject *object)
dialog->priv->action_id);
gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 1.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
+#endif
add_row (table, rows++, _("<small><b>Action:</b></small>"), label);
g_signal_connect (label, "activate-link", G_CALLBACK (action_id_activated), NULL);
@@ -842,7 +872,12 @@ polkit_mate_authentication_dialog_constructed (GObject *object)
dialog->priv->vendor);
gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 1.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
+#endif
add_row (table, rows++, _("<small><b>Vendor:</b></small>"), label);
s = g_strdup_printf (_("Click to open %s"), dialog->priv->vendor_url);