summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2015-11-13 18:09:29 +0100
committerWolfgang Ulbrich <[email protected]>2015-12-02 12:12:11 +0100
commit2806828e15d85f82c84d889e5eca8ec4ddbe23e5 (patch)
treee1ea6b47fb4e051f43ef84bcdbbd635eb130d810
parentf06e8d7315c41caf5784822c227084216af7513c (diff)
downloadmarco-2806828e15d85f82c84d889e5eca8ec4ddbe23e5.tar.bz2
marco-2806828e15d85f82c84d889e5eca8ec4ddbe23e5.tar.xz
Gtk+-3.14 menu.c + metaaccellable.c: don't use deprecated GtkMisc
taken from: https://git.gnome.org/browse/metacity/commit/?id=7a5c50c
-rw-r--r--src/ui/menu.c4
-rw-r--r--src/ui/metaaccellabel.c21
2 files changed, 25 insertions, 0 deletions
diff --git a/src/ui/menu.c b/src/ui/menu.c
index 407ef986..e989b526 100644
--- a/src/ui/menu.c
+++ b/src/ui/menu.c
@@ -304,7 +304,11 @@ static GtkWidget* menu_item_new(MenuItem* menuitem, int workspace_id)
meta_core_get_menu_accelerator (menuitem->op, workspace_id, &key, &mods);
accel_label = meta_accel_label_new_with_mnemonic (i18n_label);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_label_set_xalign (GTK_LABEL (accel_label), 0.0);
+#else
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
+#endif
gtk_container_add (GTK_CONTAINER (mi), accel_label);
gtk_widget_show (accel_label);
diff --git a/src/ui/metaaccellabel.c b/src/ui/metaaccellabel.c
index da040ee8..d752678a 100644
--- a/src/ui/metaaccellabel.c
+++ b/src/ui/metaaccellabel.c
@@ -330,7 +330,9 @@ meta_accel_label_draw (GtkWidget *widget,
cairo_t *cr)
{
MetaAccelLabel *accel_label = META_ACCEL_LABEL (widget);
+#if !GTK_CHECK_VERSION (3, 14, 0)
GtkMisc *misc = GTK_MISC (accel_label);
+#endif
GtkTextDirection direction;
int ac_width;
GtkAllocation allocation;
@@ -349,10 +351,19 @@ meta_accel_label_draw (GtkWidget *widget,
PangoLayout *accel_layout;
GtkLabel *label = GTK_LABEL (widget);
gint x, y, xpad, ypad;
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gint margin_start, margin_end, margin_top, margin_bottom;
+ gfloat yalign;
+#else
gfloat xalign, yalign;
+#endif
label_layout = gtk_label_get_layout (GTK_LABEL (accel_label));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ yalign = gtk_label_get_yalign (GTK_LABEL (accel_label));
+#else
gtk_misc_get_alignment (misc, &xalign, &yalign);
+#endif
cairo_save (cr);
@@ -379,7 +390,17 @@ meta_accel_label_draw (GtkWidget *widget,
cairo_restore (cr);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ margin_start = gtk_widget_get_margin_start (widget);
+ margin_end = gtk_widget_get_margin_end (widget);
+ margin_top = gtk_widget_get_margin_top (widget);
+ margin_bottom = gtk_widget_get_margin_bottom (widget);
+
+ xpad = margin_start + margin_end;
+ ypad = margin_top + margin_bottom;
+#else
gtk_misc_get_padding (misc, &xpad, &ypad);
+#endif
if (direction == GTK_TEXT_DIR_RTL)
x = xpad;