diff options
author | Wolfgang Ulbrich <[email protected]> | 2015-12-19 16:15:42 +0100 |
---|---|---|
committer | Wolfgang Ulbrich <[email protected]> | 2015-12-19 16:15:42 +0100 |
commit | 11c296282054815bac8fc08520a8971e36b51190 (patch) | |
tree | 345253cf37cb4285d794b2a80c1912dc91bb8423 /drivemount | |
parent | 050f41189d3e6d45a209c685f20af0c189b986b6 (diff) | |
download | mate-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')
-rw-r--r-- | drivemount/drive-list.c | 23 | ||||
-rw-r--r-- | drivemount/drive-list.h | 8 |
2 files changed, 31 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; } diff --git a/drivemount/drive-list.h b/drivemount/drive-list.h index 9028d39e..76693ca7 100644 --- a/drivemount/drive-list.h +++ b/drivemount/drive-list.h @@ -39,7 +39,11 @@ typedef struct _DriveListClass DriveListClass; struct _DriveList { +#if GTK_CHECK_VERSION(3, 0, 0) + GtkGrid parent; +#else GtkTable parent; +#endif GHashTable *volumes; GHashTable *mounts; @@ -52,7 +56,11 @@ struct _DriveList struct _DriveListClass { +#if GTK_CHECK_VERSION(3, 0, 0) + GtkGridClass parent_class; +#else GtkTableClass parent_class; +#endif }; GType drive_list_get_type (void); |