diff options
Diffstat (limited to 'mateweather')
-rw-r--r-- | mateweather/mateweather-applet.c | 8 | ||||
-rw-r--r-- | mateweather/mateweather-dialog.c | 104 | ||||
-rw-r--r-- | mateweather/mateweather-pref.c | 24 |
3 files changed, 136 insertions, 0 deletions
diff --git a/mateweather/mateweather-applet.c b/mateweather/mateweather-applet.c index 7a404025..a3fdfd73 100644 --- a/mateweather/mateweather-applet.c +++ b/mateweather/mateweather-applet.c @@ -152,7 +152,11 @@ static void place_widgets (MateWeatherApplet *gw_applet) gw_applet->image = gtk_image_new_from_icon_name(icon_name, GTK_ICON_SIZE_BUTTON); if (icon_name != NULL) { +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_get_preferred_size (gw_applet->image, &req, NULL); +#else gtk_widget_size_request(gw_applet->image, &req); +#endif if (horizontal) total_size += req.height; else @@ -168,7 +172,11 @@ static void place_widgets (MateWeatherApplet *gw_applet) gtk_label_set_text(GTK_LABEL(gw_applet->label), temp); /* Check the label size to determine box layout */ +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_get_preferred_size (gw_applet->label, &req, NULL); +#else gtk_widget_size_request(gw_applet->label, &req); +#endif if (horizontal) total_size += req.height; else diff --git a/mateweather/mateweather-dialog.c b/mateweather/mateweather-dialog.c index a50cbec2..510de399 100644 --- a/mateweather/mateweather-dialog.c +++ b/mateweather/mateweather-dialog.c @@ -234,7 +234,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_location_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_location_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_location_lbl), 0, 0.5); +#endif cond_update_lbl = gtk_label_new (_("Last update:")); gtk_widget_show (cond_update_lbl); @@ -242,7 +246,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_update_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_update_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_update_lbl), 0, 0.5); +#endif cond_cond_lbl = gtk_label_new (_("Conditions:")); gtk_widget_show (cond_cond_lbl); @@ -250,7 +258,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_cond_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_cond_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_cond_lbl), 0, 0.5); +#endif cond_sky_lbl = gtk_label_new (_("Sky:")); gtk_widget_show (cond_sky_lbl); @@ -258,7 +270,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_sky_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_sky_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_sky_lbl), 0, 0.5); +#endif cond_temp_lbl = gtk_label_new (_("Temperature:")); gtk_widget_show (cond_temp_lbl); @@ -266,7 +282,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_temp_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_temp_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_temp_lbl), 0, 0.5); +#endif cond_apparent_lbl = gtk_label_new (_("Feels like:")); gtk_widget_show (cond_apparent_lbl); @@ -274,7 +294,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_apparent_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_apparent_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_apparent_lbl), 0, 0.5); +#endif cond_dew_lbl = gtk_label_new (_("Dew point:")); gtk_widget_show (cond_dew_lbl); @@ -282,7 +306,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_dew_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_dew_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_dew_lbl), 0, 0.5); +#endif cond_humidity_lbl = gtk_label_new (_("Relative humidity:")); gtk_widget_show (cond_humidity_lbl); @@ -290,7 +318,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_humidity_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_humidity_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_humidity_lbl), 0, 0.5); +#endif cond_wind_lbl = gtk_label_new (_("Wind:")); gtk_widget_show (cond_wind_lbl); @@ -298,7 +330,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_wind_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_wind_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_wind_lbl), 0, 0.5); +#endif cond_pressure_lbl = gtk_label_new (_("Pressure:")); gtk_widget_show (cond_pressure_lbl); @@ -306,7 +342,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_pressure_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_pressure_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_pressure_lbl), 0, 0.5); +#endif cond_vis_lbl = gtk_label_new (_("Visibility:")); gtk_widget_show (cond_vis_lbl); @@ -314,7 +354,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_vis_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_vis_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_vis_lbl), 0, 0.5); +#endif cond_sunrise_lbl = gtk_label_new (_("Sunrise:")); gtk_widget_show (cond_sunrise_lbl); @@ -322,7 +366,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_sunrise_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_sunrise_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_sunrise_lbl), 0, 0.5); +#endif cond_sunset_lbl = gtk_label_new (_("Sunset:")); gtk_widget_show (cond_sunset_lbl); @@ -330,7 +378,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (cond_sunset_lbl), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (cond_sunset_lbl, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (cond_sunset_lbl), 0, 0.5); +#endif priv->cond_location = gtk_label_new (""); gtk_widget_show (priv->cond_location); @@ -339,7 +391,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_location, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_location), 0, 0.5); +#endif priv->cond_update = gtk_label_new (""); gtk_widget_show (priv->cond_update); @@ -348,7 +404,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_update, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_update), 0, 0.5); +#endif priv->cond_cond = gtk_label_new (""); gtk_widget_show (priv->cond_cond); @@ -357,7 +417,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_cond, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_cond), 0, 0.5); +#endif priv->cond_sky = gtk_label_new (""); gtk_widget_show (priv->cond_sky); @@ -366,7 +430,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_sky, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_sky), 0, 0.5); +#endif priv->cond_temp = gtk_label_new (""); gtk_widget_show (priv->cond_temp); @@ -375,7 +443,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_temp, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_temp), 0, 0.5); +#endif priv->cond_apparent = gtk_label_new (""); gtk_widget_show (priv->cond_apparent); @@ -384,7 +456,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_apparent, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_apparent), 0, 0.5); +#endif priv->cond_dew = gtk_label_new (""); gtk_widget_show (priv->cond_dew); @@ -393,7 +469,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_dew, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_dew), 0, 0.5); +#endif priv->cond_humidity = gtk_label_new (""); gtk_widget_show (priv->cond_humidity); @@ -402,7 +482,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_humidity, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_humidity), 0, 0.5); +#endif priv->cond_wind = gtk_label_new (""); gtk_widget_show (priv->cond_wind); @@ -411,7 +495,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_wind, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_wind), 0, 0.5); +#endif priv->cond_pressure = gtk_label_new (""); gtk_widget_show (priv->cond_pressure); @@ -420,7 +508,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_pressure, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_pressure), 0, 0.5); +#endif priv->cond_vis = gtk_label_new (""); gtk_widget_show (priv->cond_vis); @@ -429,7 +521,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_vis, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_vis), 0, 0.5); +#endif priv->cond_sunrise = gtk_label_new (""); gtk_widget_show (priv->cond_sunrise); @@ -438,7 +534,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_sunrise, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_sunrise), 0, 0.5); +#endif priv->cond_sunset = gtk_label_new (""); gtk_widget_show (priv->cond_sunset); @@ -447,7 +547,11 @@ static void mateweather_dialog_create(MateWeatherDialog* dialog) (GtkAttachOptions) (0), 0, 0); 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, 0, 0) + gtk_widget_set_halign (priv->cond_sunset, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (priv->cond_sunset), 0, 0.5); +#endif cond_frame_alignment = gtk_alignment_new (0.5, 0, 1, 0); gtk_widget_show (cond_frame_alignment); diff --git a/mateweather/mateweather-pref.c b/mateweather/mateweather-pref.c index 45f56228..6d64a59d 100644 --- a/mateweather/mateweather-pref.c +++ b/mateweather/mateweather-pref.c @@ -575,7 +575,11 @@ static GtkWidget* create_hig_catagory(GtkWidget* main_box, gchar* title) tmp = g_strdup_printf ("<b>%s</b>", title); label = gtk_label_new (NULL); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); +#endif gtk_label_set_markup (GTK_LABEL (label), tmp); g_free (tmp); gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0); @@ -867,7 +871,11 @@ static void mateweather_pref_create(MateWeatherPref* pref) temp_label = gtk_label_new_with_mnemonic (_("_Temperature unit:")); gtk_label_set_use_markup (GTK_LABEL (temp_label), TRUE); gtk_label_set_justify (GTK_LABEL (temp_label), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (temp_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (temp_label), 0, 0.5); +#endif gtk_widget_show (temp_label); temp_combo = gtk_combo_box_text_new (); @@ -889,7 +897,11 @@ static void mateweather_pref_create(MateWeatherPref* pref) speed_label = gtk_label_new_with_mnemonic (_("_Wind speed unit:")); gtk_label_set_use_markup (GTK_LABEL (speed_label), TRUE); gtk_label_set_justify (GTK_LABEL (speed_label), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (speed_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (speed_label), 0, 0.5); +#endif gtk_widget_show (speed_label); speed_combo = gtk_combo_box_text_new (); @@ -916,7 +928,11 @@ static void mateweather_pref_create(MateWeatherPref* pref) pres_label = gtk_label_new_with_mnemonic (_("_Pressure unit:")); gtk_label_set_use_markup (GTK_LABEL (pres_label), TRUE); gtk_label_set_justify (GTK_LABEL (pres_label), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (pres_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (pres_label), 0, 0.5); +#endif gtk_widget_show (pres_label); pres_combo = gtk_combo_box_text_new (); @@ -946,7 +962,11 @@ static void mateweather_pref_create(MateWeatherPref* pref) dist_label = gtk_label_new_with_mnemonic (_("_Visibility unit:")); gtk_label_set_use_markup (GTK_LABEL (dist_label), TRUE); gtk_label_set_justify (GTK_LABEL (dist_label), GTK_JUSTIFY_LEFT); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (dist_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (dist_label), 0, 0.5); +#endif gtk_widget_show (dist_label); dist_combo = gtk_combo_box_text_new (); @@ -1115,7 +1135,11 @@ static void mateweather_pref_create(MateWeatherPref* pref) gtk_container_add (GTK_CONTAINER (pref_notebook), pref_loc_hbox); tree_label = gtk_label_new_with_mnemonic (_("_Select a location:")); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (tree_label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (tree_label), 0.0, 0.5); +#endif gtk_box_pack_start (GTK_BOX (pref_loc_hbox), tree_label, FALSE, FALSE, 0); scrolled_window = gtk_scrolled_window_new (NULL, NULL); |