summaryrefslogtreecommitdiff
path: root/drivemount/drive-list.c
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2015-12-19 16:15:42 +0100
committerWolfgang Ulbrich <[email protected]>2015-12-19 16:15:42 +0100
commit11c296282054815bac8fc08520a8971e36b51190 (patch)
tree345253cf37cb4285d794b2a80c1912dc91bb8423 /drivemount/drive-list.c
parent050f41189d3e6d45a209c685f20af0c189b986b6 (diff)
downloadmate-applets-11c296282054815bac8fc08520a8971e36b51190.tar.bz2
mate-applets-11c296282054815bac8fc08520a8971e36b51190.tar.xz
GTK3 drivemount: port GtkTable to GtkGrid
taken from: https://git.gnome.org/browse/gnome-applets/commit/?id=41c210b
Diffstat (limited to 'drivemount/drive-list.c')
-rw-r--r--drivemount/drive-list.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivemount/drive-list.c b/drivemount/drive-list.c
index 2f8eb6f3..a6b811ec 100644
--- a/drivemount/drive-list.c
+++ b/drivemount/drive-list.c
@@ -30,7 +30,11 @@
#include "drive-button.h"
#include <glib/gi18n.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+G_DEFINE_TYPE (DriveList, drive_list, GTK_TYPE_GRID);
+#else
G_DEFINE_TYPE (DriveList, drive_list, GTK_TYPE_TABLE);
+#endif
static GVolumeMonitor *volume_monitor = NULL;
@@ -80,7 +84,12 @@ drive_list_init (DriveList *self)
{
GList *volumes, *mounts, *tmp;
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_grid_set_column_homogeneous (GTK_GRID (self), TRUE);
+ gtk_grid_set_row_homogeneous (GTK_GRID (self), TRUE);
+#else
gtk_table_set_homogeneous (GTK_TABLE (self), TRUE);
+#endif
self->volumes = g_hash_table_new (NULL, NULL);
self->mounts = g_hash_table_new (NULL, NULL);
@@ -239,22 +248,36 @@ relayout_buttons (gpointer data)
if (self->orientation == GTK_ORIENTATION_HORIZONTAL) {
gtk_container_child_set (GTK_CONTAINER (self), button,
+#if GTK_CHECK_VERSION(3, 0, 0)
+ "left-attach", i + 1, "top-attach", 0,
+ "width", 1, "height", 1,
+ NULL);
+#else
"left_attach", i, "right_attach", i+1,
"top_attach", 0, "bottom_attach", 1,
"x_options", GTK_FILL,
"y_options", GTK_FILL,
NULL);
+#endif
} else {
gtk_container_child_set (GTK_CONTAINER (self), button,
+#if GTK_CHECK_VERSION(3, 0, 0)
+ "left-attach", 0, "top-attach", i + 1,
+ "width", 1, "height", 1,
+ NULL);
+#else
"left_attach", 0, "right_attach", 1,
"top_attach", i, "bottom_attach", i+1,
"x_options", GTK_FILL,
"y_options", GTK_FILL,
NULL);
+#endif
}
}
+#if !GTK_CHECK_VERSION(3, 0, 0)
/* shrink wrap the table */
gtk_table_resize (GTK_TABLE (self), 1, 1);
+#endif
return FALSE;
}