After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 666815 - Use GtkApplication
Use GtkApplication
Product: four-in-a-row
Classification: Applications
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: four-in-a-row-maint
Depends on:
Blocks: 666500 722224
Reported: 2011-12-24 23:26 UTC by Robert Ancell
Modified: 2014-01-24 01:54 UTC
See Also:
GNOME target: ---
GNOME version: ---

Patch to use GtkApplication and GMenu (12.91 KB, patch)
2014-01-22 22:18 UTC, David Sedeño Fernández
needs-work Details | Review
Update patch with suggestions (13.93 KB, patch)
2014-01-23 17:56 UTC, David Sedeño Fernández
committed Details | Review

Description Robert Ancell 2011-12-24 23:26:52 UTC
Use GtkApplication
Comment 1 David Sedeño Fernández 2014-01-22 22:18:14 UTC
Created attachment 267004 [details] [review]
Patch to use GtkApplication and GMenu

Patch to port to GtkApplication and to GMenu.
Comment 2 Michael Catanzaro 2014-01-22 23:48:19 UTC
Review of attachment 267004 [details] [review]:

Looks great, thanks a bunch!

Some nitpicks:

::: src/main.c
@@ +374,3 @@
+GAction *undo_action;
+GAction *hint_action;
+GAction *fullscreen_action;

Can you move these to the top of the file?

@@ +413,3 @@
   stop_anim ();
+  g_simple_action_set_enabled (((GSimpleAction *) undo_action), FALSE);

Instead of (GSimpleAction *) x, can you use G_SIMPLE_ACTION (x)?  (Everywhere it occurs.)

@@ +587,2 @@
   stop_anim ();
+  g_application_quit (G_APPLICATION(application));

Missing a space

@@ +677,3 @@
+    gtk_window_fullscreen (app);
+  else
+    gtk_window_unfullscreen (app);

According to my compiler warnings, we're missing a cast: should be GTK_WINDOW (app)

@@ +1199,3 @@
+  {"preferences", on_settings_preferences, NULL, NULL, NULL},
+  {"help", on_help_contents, NULL, NULL, NULL},
+  {"about", on_help_about, NULL, NULL, NULL}

The function signatures on all of the callbacks is wrong; this only works because the parameters are never used. You'll want to update these, e.g.

static void
on_settings_preferences (GSimpleAction *action,
                                         GVariant           *parameter,
                                         gpointer              user_data)
  prefsbox_open ();

@@ +1358,3 @@
+  g_application_run (G_APPLICATION (application), argc, argv);

You should use the return value from g_application_run() as the exit status for the program.
Comment 3 David Sedeño Fernández 2014-01-23 17:56:10 UTC
Created attachment 267068 [details] [review]
Update patch with suggestions

I have update the patch with the suggestions. Also modify the parameters of on_game_new as per compilation warning.
Comment 4 Michael Catanzaro 2014-01-24 01:54:36 UTC
Looks good, thanks!