[five-or-more] Fix warnings
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [five-or-more] Fix warnings
- Date: Tue, 27 Mar 2018 21:10:29 +0000 (UTC)
commit d38d21ab62bf3f45949465d0c62ab9cca9b90610
Author: Ruxandra Simion <ruxandra simion93 gmail com>
Date: Thu Mar 22 00:17:58 2018 +0200
Fix warnings
Remove deprecated method calls and solve all other warnings.
https://bugzilla.gnome.org/show_bug.cgi?id=794268
src/balls-preview.c | 11 +++++++----
src/five-or-more-app.c | 25 +++++++++++++------------
2 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/src/balls-preview.c b/src/balls-preview.c
index c68e3e0..79dd2e8 100644
--- a/src/balls-preview.c
+++ b/src/balls-preview.c
@@ -80,7 +80,7 @@ refresh_preview_surfaces (void)
GdkPixbuf *scaled = NULL;
GtkWidget *widget = GTK_WIDGET (preview_images[0]);
GtkStyleContext *context;
- GdkRGBA bg;
+ GdkRGBA *bg = NULL;
cairo_t *cr;
GdkRectangle preview_rect;
cairo_surface_t *blank_preview_surface = NULL;
@@ -88,7 +88,9 @@ refresh_preview_surfaces (void)
cairo_surface_t *preview_surface = NULL;
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &bg);
+ gtk_style_context_get (context, gtk_style_context_get_state (context),
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
+ &bg, NULL);
/* Like the refresh_pixmaps() function, we may be called before
* the window is ready. */
@@ -119,7 +121,7 @@ refresh_preview_surfaces (void)
CAIRO_FORMAT_ARGB32,
PREVIEW_IMAGE_WIDTH, PREVIEW_IMAGE_HEIGHT, 1);
cr = cairo_create (preview_surface);
- gdk_cairo_set_source_rgba (cr, &bg);
+ gdk_cairo_set_source_rgba (cr, bg);
gdk_cairo_rectangle (cr, &preview_rect);
cairo_fill (cr);
@@ -140,13 +142,14 @@ refresh_preview_surfaces (void)
CAIRO_CONTENT_COLOR_ALPHA,
PREVIEW_IMAGE_WIDTH, PREVIEW_IMAGE_HEIGHT);
cr = cairo_create (blank_preview_surface);
- gdk_cairo_set_source_rgba (cr, &bg);
+ gdk_cairo_set_source_rgba (cr, bg);
gdk_cairo_rectangle (cr, &preview_rect);
cairo_fill (cr);
cairo_surface_destroy (blank_preview_surface);
cairo_destroy (cr);
g_object_unref (scaled);
+ gdk_rgba_free(bg);
}
GtkImage **
diff --git a/src/five-or-more-app.c b/src/five-or-more-app.c
index 839c95f..00e3ffe 100644
--- a/src/five-or-more-app.c
+++ b/src/five-or-more-app.c
@@ -392,7 +392,7 @@ bg_color_callback (GtkWidget * widget, gpointer data)
static void
size_callback (GtkWidget * widget, gpointer data)
{
- GtkWidget *size_radio, *content_area, *label;
+ GtkWidget *size_radio;
game_size = g_settings_get_int (settings, KEY_SIZE);
if (pref_dialog_done && game_size != GPOINTER_TO_INT (data) && !restart_game_dialog) {
@@ -419,14 +419,17 @@ size_callback (GtkWidget * widget, gpointer data)
case GTK_RESPONSE_CANCEL:
switch (game_size) {
case SMALL:
- size_radio = size_radio_s;
- break;
+ size_radio = size_radio_s;
+ break;
case MEDIUM:
- size_radio = size_radio_m;
- break;
+ size_radio = size_radio_m;
+ break;
case LARGE:
- size_radio = size_radio_l;
- break;
+ size_radio = size_radio_l;
+ break;
+ default:
+ size_radio = size_radio_m;
+ break;
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (size_radio), TRUE);
}
@@ -548,7 +551,7 @@ game_help_callback (GSimpleAction *action,
{
GError *error = NULL;
- gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (app)), "help:five-or-more", gtk_get_current_event_time
(), &error);
+ gtk_show_uri_on_window (GTK_WINDOW (app), "help:five-or-more", gtk_get_current_event_time (), &error);
if (error)
g_warning ("Failed to show help: %s", error->message);
g_clear_error (&error);
@@ -608,7 +611,6 @@ startup_cb (GApplication *application)
gchar *ui_path;
GtkWidget *hbox;
GtkWidget *preview_hbox;
- GtkWidget *new_game_button;
guint i;
GError *error = NULL;
GamesScoresDirectoryImporter *importer;
@@ -626,7 +628,8 @@ startup_cb (GApplication *application)
app_actions, G_N_ELEMENTS (app_actions),
application);
- gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>N", "app.new-game", NULL);
+ const gchar *accels[] = { "<Primary>N", NULL };
+ gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.new-game", accels);
settings = g_settings_new ("org.gnome.five-or-more");
@@ -686,8 +689,6 @@ startup_cb (GApplication *application)
gtk_container_add (GTK_CONTAINER (gridframe), draw_area);
gtk_box_pack_start (GTK_BOX (hbox), gridframe, TRUE, TRUE, 0);
- new_game_button = GTK_WIDGET (gtk_builder_get_object (builder, "new_game_button"));
-
importer = games_scores_directory_importer_new ();
highscores = games_scores_context_new_with_importer ("five-or-more",
_("Board Size: "),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]