From ee51aa3168c69233b78c0cb46414fb7b49fbccb0 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Fri, 5 Aug 2016 11:25:24 +0200 Subject: GTK+-3 weather-dialog: port to GtkGrid --- mateweather/mateweather-dialog.c | 117 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'mateweather') diff --git a/mateweather/mateweather-dialog.c b/mateweather/mateweather-dialog.c index f627c43b..30e5a042 100644 --- a/mateweather/mateweather-dialog.c +++ b/mateweather/mateweather-dialog.c @@ -156,7 +156,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) GtkWidget *weather_vbox; GtkWidget *weather_notebook; GtkWidget *cond_hbox; +#if GTK_CHECK_VERSION (3, 0, 0) + GtkWidget *cond_grid; +#else GtkWidget *cond_table; +#endif GtkWidget *cond_location_lbl; GtkWidget *cond_update_lbl; GtkWidget *cond_temp_lbl; @@ -221,6 +225,18 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) gtk_container_add (GTK_CONTAINER (weather_notebook), cond_hbox); gtk_container_set_border_width (GTK_CONTAINER (cond_hbox), 4); +#if GTK_CHECK_VERSION (3, 0, 0) + cond_grid = gtk_grid_new (); + gtk_widget_show (cond_grid); + gtk_box_pack_start (GTK_BOX (cond_hbox), cond_grid, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (cond_grid), 12); + gtk_grid_set_row_spacing (GTK_GRID (cond_grid), 6); + gtk_grid_set_column_spacing (GTK_GRID (cond_grid), 12); + + cond_location_lbl = gtk_label_new (_("City:")); + gtk_widget_show (cond_location_lbl); + gtk_grid_attach (GTK_GRID (cond_grid), cond_location_lbl, 0, 0, 1, 1); +#else cond_table = gtk_table_new (13, 2, FALSE); gtk_widget_show (cond_table); gtk_box_pack_start (GTK_BOX (cond_hbox), cond_table, TRUE, TRUE, 0); @@ -233,6 +249,7 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) gtk_table_attach (GTK_TABLE (cond_table), cond_location_lbl, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_location_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_location_lbl), 0.0); @@ -242,9 +259,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_update_lbl = gtk_label_new (_("Last update:")); gtk_widget_show (cond_update_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_update_lbl, 0, 1, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_update_lbl, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_update_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_update_lbl), 0.0); @@ -254,9 +275,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_cond_lbl = gtk_label_new (_("Conditions:")); gtk_widget_show (cond_cond_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_cond_lbl, 0, 2, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_cond_lbl, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_cond_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_cond_lbl), 0.0); @@ -266,9 +291,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_sky_lbl = gtk_label_new (_("Sky:")); gtk_widget_show (cond_sky_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_sky_lbl, 0, 3, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_sky_lbl, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_sky_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_sky_lbl), 0.0); @@ -278,9 +307,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_temp_lbl = gtk_label_new (_("Temperature:")); gtk_widget_show (cond_temp_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_temp_lbl, 0, 4, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_temp_lbl, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_temp_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_temp_lbl), 0.0); @@ -290,9 +323,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_apparent_lbl = gtk_label_new (_("Feels like:")); gtk_widget_show (cond_apparent_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_apparent_lbl, 0, 5, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_apparent_lbl, 0, 1, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_apparent_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_apparent_lbl), 0.0); @@ -302,9 +339,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_dew_lbl = gtk_label_new (_("Dew point:")); gtk_widget_show (cond_dew_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_dew_lbl, 0, 6, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_dew_lbl, 0, 1, 6, 7, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_dew_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_dew_lbl), 0.0); @@ -314,9 +355,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_humidity_lbl = gtk_label_new (_("Relative humidity:")); gtk_widget_show (cond_humidity_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_humidity_lbl, 0, 7, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_humidity_lbl, 0, 1, 7, 8, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_humidity_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_humidity_lbl), 0.0); @@ -326,9 +371,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_wind_lbl = gtk_label_new (_("Wind:")); gtk_widget_show (cond_wind_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_wind_lbl, 0, 8, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_wind_lbl, 0, 1, 8, 9, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_wind_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_wind_lbl), 0.0); @@ -338,9 +387,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_pressure_lbl = gtk_label_new (_("Pressure:")); gtk_widget_show (cond_pressure_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_pressure_lbl, 0, 9, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_pressure_lbl, 0, 1, 9, 10, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_pressure_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_pressure_lbl), 0.0); @@ -350,9 +403,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_vis_lbl = gtk_label_new (_("Visibility:")); gtk_widget_show (cond_vis_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_vis_lbl, 0, 10, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_vis_lbl, 0, 1, 10, 11, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_vis_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_vis_lbl), 0.0); @@ -362,9 +419,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_sunrise_lbl = gtk_label_new (_("Sunrise:")); gtk_widget_show (cond_sunrise_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_sunrise_lbl, 0, 11, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_sunrise_lbl, 0, 1, 11, 12, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_sunrise_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_sunrise_lbl), 0.0); @@ -374,9 +435,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) cond_sunset_lbl = gtk_label_new (_("Sunset:")); gtk_widget_show (cond_sunset_lbl); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), cond_sunset_lbl, 0, 12, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), cond_sunset_lbl, 0, 1, 12, 13, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_justify (GTK_LABEL (cond_sunset_lbl), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (cond_sunset_lbl), 0.0); @@ -386,9 +451,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_location = gtk_label_new (""); gtk_widget_show (priv->cond_location); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_location, 1, 0, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_location, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_location), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_location), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -399,9 +468,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_update = gtk_label_new (""); gtk_widget_show (priv->cond_update); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_update, 1, 1, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_update, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_update), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_update), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -412,9 +485,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_cond = gtk_label_new (""); gtk_widget_show (priv->cond_cond); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_cond, 1, 2, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_cond, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_cond), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_cond), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -425,9 +502,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_sky = gtk_label_new (""); gtk_widget_show (priv->cond_sky); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_sky, 1, 3, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_sky, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_sky), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_sky), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -438,9 +519,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_temp = gtk_label_new (""); gtk_widget_show (priv->cond_temp); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_temp, 1, 4, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_temp, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_temp), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_temp), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -451,9 +536,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_apparent = gtk_label_new (""); gtk_widget_show (priv->cond_apparent); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_apparent, 1, 5, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_apparent, 1, 2, 5, 6, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_apparent), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_apparent), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -464,9 +553,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_dew = gtk_label_new (""); gtk_widget_show (priv->cond_dew); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_dew, 1, 6, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_dew, 1, 2, 6, 7, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_dew), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_dew), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -477,9 +570,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_humidity = gtk_label_new (""); gtk_widget_show (priv->cond_humidity); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_humidity, 1, 7, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_humidity, 1, 2, 7, 8, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_humidity), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_humidity), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -490,9 +587,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_wind = gtk_label_new (""); gtk_widget_show (priv->cond_wind); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_wind, 1, 8, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_wind, 1, 2, 8, 9, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_wind), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_wind), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -503,9 +604,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_pressure = gtk_label_new (""); gtk_widget_show (priv->cond_pressure); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_pressure, 1, 9, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_pressure, 1, 2, 9, 10, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_pressure), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_pressure), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -516,9 +621,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_vis = gtk_label_new (""); gtk_widget_show (priv->cond_vis); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_vis, 1, 10, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_vis, 1, 2, 10, 11, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_vis), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_vis), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -529,9 +638,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_sunrise = gtk_label_new (""); gtk_widget_show (priv->cond_sunrise); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_sunrise, 1, 11, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_sunrise, 1, 2, 11, 12, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_sunrise), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_sunrise), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) @@ -542,9 +655,13 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) priv->cond_sunset = gtk_label_new (""); gtk_widget_show (priv->cond_sunset); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (cond_grid), priv->cond_sunset, 1, 12, 1, 1); +#else gtk_table_attach (GTK_TABLE (cond_table), priv->cond_sunset, 1, 2, 12, 13, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); +#endif gtk_label_set_selectable (GTK_LABEL (priv->cond_sunset), TRUE); gtk_label_set_justify (GTK_LABEL (priv->cond_sunset), GTK_JUSTIFY_LEFT); #if GTK_CHECK_VERSION (3, 16, 0) -- cgit v1.2.1