diff options
author | raveit65 <[email protected]> | 2016-07-28 14:52:41 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-08-03 11:13:18 +0200 |
commit | ecf1736ccbc673a1d808d667b4516ecb5edffefe (patch) | |
tree | 950b56fb1f785425fc93797c1c8508cbef2b5797 | |
parent | 1630aae8163fa2778ed556c36ab00cd76080394e (diff) | |
download | mate-panel-ecf1736ccbc673a1d808d667b4516ecb5edffefe.tar.bz2 mate-panel-ecf1736ccbc673a1d808d667b4516ecb5edffefe.tar.xz |
GTK+-3 panel-toplevel: port to GtkGrid
taken from:
https://git.gnome.org/browse/gnome-panel/commit/?id=281f4d5
-rw-r--r-- | mate-panel/panel-toplevel.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index 749e04df..e765f98f 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -146,7 +146,11 @@ struct _PanelToplevelPrivate { PanelWidget *panel_widget; PanelFrame *inner_frame; +#if GTK_CHECK_VERSION (3, 0, 0) + GtkWidget *grid; +#else GtkWidget *table; +#endif GtkWidget *hide_button_top; GtkWidget *hide_button_bottom; GtkWidget *hide_button_left; @@ -1224,10 +1228,15 @@ set_arrow_type (GtkImage *image, static GtkWidget * panel_toplevel_add_hide_button (PanelToplevel *toplevel, GtkArrowType arrow_type, +#if GTK_CHECK_VERSION (3, 0, 0) + int left, + int top) +#else int left_attach, int right_attach, int top_attach, int bottom_attach) +#endif { GtkWidget *button; AtkObject *obj; @@ -1287,6 +1296,9 @@ panel_toplevel_add_hide_button (PanelToplevel *toplevel, g_signal_connect_swapped (button, "button_release_event", G_CALLBACK (panel_toplevel_hide_button_event), toplevel); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (toplevel->priv->grid), button, left, top, 1, 1); +#else gtk_table_attach (GTK_TABLE (toplevel->priv->table), button, left_attach, @@ -1297,6 +1309,7 @@ panel_toplevel_add_hide_button (PanelToplevel *toplevel, GTK_FILL, 0, 0); +#endif return button; } @@ -5032,6 +5045,14 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) { GtkWidget* container; +#if GTK_CHECK_VERSION (3, 0, 0) + toplevel->priv->grid = gtk_grid_new (); + + toplevel->priv->hide_button_top = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_UP, 1, 0); + toplevel->priv->hide_button_bottom = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_DOWN, 1, 2); + toplevel->priv->hide_button_left = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_LEFT, 0, 1); + toplevel->priv->hide_button_right = panel_toplevel_add_hide_button (toplevel, GTK_ARROW_RIGHT, 2, 1); +#else toplevel->priv->table = gtk_table_new(3, 3, FALSE); toplevel->priv->hide_button_top = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_UP, 1, 2, 0, 1); @@ -5041,6 +5062,7 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) toplevel->priv->hide_button_left = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_LEFT, 0, 1, 1, 2); toplevel->priv->hide_button_right = panel_toplevel_add_hide_button(toplevel, GTK_ARROW_RIGHT, 2, 3, 1, 2); +#endif if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) { @@ -5055,6 +5077,12 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) toplevel->priv->inner_frame = g_object_new(PANEL_TYPE_FRAME, NULL); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_hexpand (GTK_WIDGET (toplevel->priv->inner_frame), TRUE); + gtk_widget_set_vexpand (GTK_WIDGET (toplevel->priv->inner_frame), TRUE); + + gtk_grid_attach (GTK_GRID (toplevel->priv->grid), GTK_WIDGET (toplevel->priv->inner_frame), 1, 1, 1, 1); +#else gtk_table_attach (GTK_TABLE (toplevel->priv->table), GTK_WIDGET (toplevel->priv->inner_frame), 1, 2, @@ -5062,6 +5090,7 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); +#endif gtk_widget_show (GTK_WIDGET (toplevel->priv->inner_frame)); container = panel_widget_new (toplevel, @@ -5076,8 +5105,13 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) gtk_container_add(GTK_CONTAINER(toplevel->priv->inner_frame), container); gtk_widget_show(container); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_container_add (GTK_CONTAINER (toplevel), toplevel->priv->grid); + gtk_widget_show (toplevel->priv->grid); +#else gtk_container_add(GTK_CONTAINER(toplevel), toplevel->priv->table); gtk_widget_show(toplevel->priv->table); +#endif } #if GTK_CHECK_VERSION (3, 18, 0) @@ -5150,7 +5184,11 @@ panel_toplevel_init (PanelToplevel *toplevel) toplevel->priv->panel_widget = NULL; toplevel->priv->inner_frame = NULL; +#if GTK_CHECK_VERSION (3, 0, 0) + toplevel->priv->grid = NULL; +#else toplevel->priv->table = NULL; +#endif toplevel->priv->hide_button_top = NULL; toplevel->priv->hide_button_bottom = NULL; toplevel->priv->hide_button_left = NULL; |