[Xfce4-commits] [panel-plugins/xfce4-weather-plugin] 11/25: Port non-GdkColor deprecations
noreply at xfce.org
noreply at xfce.org
Mon Sep 17 00:14:08 CEST 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-weather-plugin.
commit 0ed63af4a8f808a5a5ad5a94bab680b6603c1dc5
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Tue Sep 11 20:46:08 2018 -0400
Port non-GdkColor deprecations
---
panel-plugin/weather-config.c | 2 +-
panel-plugin/weather-search.c | 6 +++--
panel-plugin/weather-summary.c | 54 +++++++++++++++++++++++-------------------
panel-plugin/weather.c | 17 +++++++------
4 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 1fee481..bdd8636 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -1151,7 +1151,7 @@ button_scrollbox_font_clicked(GtkWidget *button,
gint result;
fsd = GTK_FONT_CHOOSER_DIALOG
- (gtk_font_chooser_dialog_new(_("Select font"), dialog->dialog));
+ (gtk_font_chooser_dialog_new(_("Select font"), GTK_WINDOW (dialog->dialog)));
if (dialog->pd->scrollbox_font)
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (fsd), dialog->pd->scrollbox_font);
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index b934151..4528403 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -187,7 +187,7 @@ create_search_dialog(GtkWindow *parent,
SoupSession *session)
{
search_dialog *dialog;
- GtkWidget *dialog_vbox, *vbox, *hbox, *scroll, *frame;
+ GtkWidget *dialog_vbox, *vbox, *hbox, *scroll, *frame, *image;
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
dialog = g_slice_new0(search_dialog);
@@ -230,7 +230,9 @@ create_search_dialog(GtkWindow *parent,
g_signal_connect(G_OBJECT(dialog->search_entry), "activate",
G_CALLBACK(search_cb), dialog);
- dialog->find_button = gtk_button_new_from_stock("edit-find");
+ dialog->find_button = gtk_button_new_with_label (_("Search"));
+ image = gtk_image_new_from_icon_name ("edit-find", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (dialog->find_button), image);
gtk_box_pack_start(GTK_BOX(hbox), dialog->find_button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(dialog->find_button), "clicked",
G_CALLBACK(search_cb), dialog);
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index ff7d4a2..8e0a0d8 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -90,12 +90,12 @@ lnk_clicked(GtkTextTag *tag,
#define ATTACH_DAYTIME_HEADER(title, pos) \
if (data->forecast_layout == FC_LAYOUT_CALENDAR) \
gtk_grid_attach \
- (grid, \
+ (GTK_GRID (grid), \
add_forecast_header(title, 90.0, &darkbg), \
0, pos, 1, 1); \
else \
gtk_grid_attach \
- (grid, \
+ (GTK_GRID (grid), \
add_forecast_header(title, 0.0, &darkbg), \
pos, 0, 1, 1); \
@@ -230,6 +230,11 @@ view_scrolled_cb(GtkAdjustment *adj,
GtkRequisition requisition;
if (sum->icon_ebox) {
+ gtk_widget_get_allocation (GTK_WIDGET (sum->text_view), &allocation);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ gtk_widget_get_requisition (GTK_WIDGET (sum->text_view), &requisition);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
/* TRANSLATORS: DO NOT TRANSLATE THIS STRING. This string is
not visible to the user but controls the alignment of the
met.no image on the details tab in the summary window,
@@ -242,9 +247,6 @@ view_scrolled_cb(GtkAdjustment *adj,
If you know of a better way to determine LTR/RTL that makes
this tweak unnecessary, please tell the developer.
*/
- gtk_widget_get_allocation (GTK_WIDGET (sum->text_view), &allocation);
- gtk_widget_get_requisition (GTK_WIDGET (sum->text_view), &requisition);
-
if (!strcmp(_("LTR"), "RTL"))
x1 = -30;
else
@@ -349,8 +351,8 @@ create_summary_tab(plugin_data *data)
sum = g_slice_new0(summary_details);
sum->on_icon = FALSE;
- sum->hand_cursor = gdk_cursor_new(GDK_HAND2);
- sum->text_cursor = gdk_cursor_new(GDK_XTERM);
+ sum->hand_cursor = gdk_cursor_new_for_display (gdk_display_get_default(), GDK_HAND2);
+ sum->text_cursor = gdk_cursor_new_for_display (gdk_display_get_default(), GDK_XTERM);
data->summary_details = sum;
sum->text_view = view = gtk_text_view_new();
@@ -941,12 +943,12 @@ make_forecast(plugin_data *data)
grid = gtk_grid_new ();
- gtk_grid_set_row_spacing(grid, 0);
- gtk_grid_set_column_spacing(grid, 0);
+ gtk_grid_set_row_spacing(GTK_GRID (grid), 0);
+ gtk_grid_set_column_spacing(GTK_GRID (grid), 0);
/* empty upper left corner */
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_grid_attach (grid,
+ gtk_grid_attach (GTK_GRID (grid),
wrap_forecast_cell(box, &darkbg),
0, 0, 1, 1);
@@ -971,10 +973,10 @@ make_forecast(plugin_data *data)
gtk_widget_set_tooltip_markup(GTK_WIDGET(ebox), text);
if (data->forecast_layout == FC_LAYOUT_CALENDAR)
- gtk_grid_attach (grid, GTK_WIDGET(ebox),
+ gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET(ebox),
i+1, 0, 1, 1);
else
- gtk_grid_attach (grid, GTK_WIDGET(ebox),
+ gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET(ebox),
0, i+1, 1, 1);
/* to speed up things, first get forecast data for all daytimes */
@@ -993,11 +995,11 @@ make_forecast(plugin_data *data)
ebox = wrap_forecast_cell(forecast_box, &lightbg);
if (data->forecast_layout == FC_LAYOUT_CALENDAR)
- gtk_grid_attach (grid,
+ gtk_grid_attach (GTK_GRID (grid),
GTK_WIDGET(ebox),
i+1, 1+daytime, 1, 1);
else
- gtk_grid_attach (grid,
+ gtk_grid_attach (GTK_GRID (grid),
GTK_WIDGET(ebox),
1+daytime, i+1, 1, 1);
}
@@ -1010,11 +1012,11 @@ make_forecast(plugin_data *data)
static GtkWidget *
create_forecast_tab(plugin_data *data)
{
- GtkWidget *ebox, *hbox, *scrolled, *table;
+ GtkWidget *ebox, *hbox, *scrolled, *viewport, *table;
GdkWindow *window;
- GdkScreen *screen;
+ GdkMonitor *monitor;
GdkRectangle rect;
- gint monitor_num = 0, h_need, h_max, height;
+ gint h_need, h_max, height;
gint w_need, w_max, width;
/* To avoid causing a GDK assertion, determine the monitor
@@ -1023,10 +1025,10 @@ create_forecast_tab(plugin_data *data)
* maximum height we may use, subtracting some sane value just to
* be on the safe side. */
window = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(data->iconimage)));
- screen = GDK_SCREEN(gtk_widget_get_screen(GTK_WIDGET(data->iconimage)));
- if (G_LIKELY(window && screen))
- monitor_num = gdk_screen_get_monitor_at_window(screen, window);
- gdk_screen_get_monitor_geometry(screen, monitor_num, &rect);
+ monitor = gdk_display_get_monitor_at_window(gdk_display_get_default(), window);
+ if (G_LIKELY(window && monitor)) {
+ gdk_monitor_get_geometry (monitor, &rect);
+ }
/* calculate maximum width and height */
h_max = rect.height - 250;
@@ -1059,8 +1061,10 @@ create_forecast_tab(plugin_data *data)
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_container_set_border_width(GTK_CONTAINER(scrolled), BORDER);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled),
- hbox);
+ viewport = gtk_viewport_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (scrolled), viewport);
+
+ gtk_container_add (GTK_CONTAINER (viewport), hbox);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
@@ -1226,9 +1230,9 @@ summary_details_free(summary_details *sum)
sum->icon_ebox = NULL;
sum->text_view = NULL;
if (sum->hand_cursor)
- gdk_cursor_unref(sum->hand_cursor);
+ g_object_unref (sum->hand_cursor);
sum->hand_cursor = NULL;
if (sum->text_cursor)
- gdk_cursor_unref(sum->text_cursor);
+ g_object_unref (sum->text_cursor);
sum->text_cursor = NULL;
}
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 2159b2e..cc9aedc 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -1642,7 +1642,7 @@ xfceweather_create_options(XfcePanelPlugin *plugin,
xfce_panel_plugin_block_menu(plugin);
if (xfce_titled_dialog_get_type () == 0)
- return FALSE;
+ return;
builder = gtk_builder_new ();
if (gtk_builder_add_from_string (builder, weather_config_ui,
@@ -1704,7 +1704,7 @@ weather_get_tooltip_text(const plugin_data *data)
g_free(sunset);
}
else
- sunval = g_strdup_printf("");
+ sunval = g_strdup("");
sym = get_data(conditions, data->units, SYMBOL, FALSE, data->night_time);
DATA_AND_UNIT(alt, ALTITUDE);
@@ -1905,7 +1905,8 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
/* add widgets to alignment box */
data->vbox_center_scrollbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_misc_set_alignment(GTK_MISC(data->iconimage), 1, 0.5);
+ gtk_widget_set_halign (GTK_WIDGET (data->iconimage), 1);
+ gtk_widget_set_valign (GTK_WIDGET (data->iconimage), 0.5);
gtk_box_pack_start(GTK_BOX(data->alignbox),
data->iconimage, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(data->vbox_center_scrollbox),
@@ -2041,13 +2042,15 @@ xfceweather_set_mode(XfcePanelPlugin *panel,
if (data->panel_orientation == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL ||
(data->panel_orientation == XFCE_PANEL_PLUGIN_MODE_DESKBAR &&
data->single_row)) {
- gtk_orientable_set_orientation(data->alignbox,
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(data->alignbox),
GTK_ORIENTATION_HORIZONTAL);
- gtk_misc_set_alignment(GTK_MISC(data->iconimage), 1, 0.5);
+ gtk_widget_set_halign (GTK_WIDGET (data->iconimage), 1);
+ gtk_widget_set_valign (GTK_WIDGET (data->iconimage), 0.5);
} else {
- gtk_orientable_set_orientation(data->alignbox,
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(data->alignbox),
GTK_ORIENTATION_VERTICAL);
- gtk_misc_set_alignment(GTK_MISC(data->iconimage), 0.5, 1);
+ gtk_widget_set_halign (GTK_WIDGET (data->iconimage), 0.5);
+ gtk_widget_set_valign (GTK_WIDGET (data->iconimage), 1);
}
if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list