Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More GtkBuilder and other stuff #168

Merged
merged 2 commits into from
Jun 27, 2015
Merged

More GtkBuilder and other stuff #168

merged 2 commits into from
Jun 27, 2015

Conversation

vorot93
Copy link
Contributor

@vorot93 vorot93 commented Jun 26, 2015

This is a massive pull request that represents significant GUI overhaul.

  • Menus ported to GtkBuilder. No more manual menu generation, all menus are now created in glade and imported at runtime
  • Replaced preferences menu with item in Edit menu. This was duplicate function that pulled hundreds of lines of code. For navigation inside preferences dialog use notebook tabs instead.
  • No more static functions in xqf.c. Invisible functions break introspection required for autoconnection of signals.
  • New preferences dialog for GTK+ 3. Made with GtkBuilder too.

  • Removed tons of commented code. Garbage's place is in the trash bin, really.

As usual, this is an atomic commit: should not break anything, took some time to weed out bugs. Additional testing is welcome though.

@illwieckz
Copy link
Member

Hi @skybon, thanks a lot it's awesome.

is this warning introduced with this commit?

gcc:

/home/illwieckz/dev/xqf-skybon/src/xqf.c: In function ‘player_clist_event_callback’:
/home/illwieckz/dev/xqf-skybon/src/xqf.c:2241:25: warning: passing argument 1 of ‘gtk_menu_popup’ from incompatible pointer type
         gtk_menu_popup (gtk_builder_get_object (builder, "player_menu"), NULL, NULL, NULL, NULL, bevent->button, bevent->time);
                         ^
In file included from /usr/include/gtk-2.0/gtk/gtklabel.h:36:0,
                 from /usr/include/gtk-2.0/gtk/gtkaccellabel.h:38,
                 from /usr/include/gtk-2.0/gtk/gtk.h:35,
                 from /home/illwieckz/dev/xqf-skybon/src/xqf.c:44:
/usr/include/gtk-2.0/gtk/gtkmenu.h:129:9: note: expected ‘struct GtkMenu *’ but argument is of type ‘struct GObject *’
 void    gtk_menu_popup    (GtkMenu        *menu,

clang:

/home/illwieckz/dev/xqf-skybon/src/xqf.c:2241:25: warning: incompatible pointer types passing 'GObject *'
      (aka 'struct _GObject *') to parameter of type 'GtkMenu *' (aka 'struct _GtkMenu *')
      [-Wincompatible-pointer-types]
  ...gtk_menu_popup (gtk_builder_get_object (builder, "player_menu"), NULL, NULL, NULL, NULL, bevent->button, bevent...
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/gtk-2.0/gtk/gtkmenu.h:129:44: note: passing argument to parameter 'menu' here
void       gtk_menu_popup                 (GtkMenu             *menu,
                                                                ^
1 warning generated.

@vorot93
Copy link
Contributor Author

vorot93 commented Jun 26, 2015

@illwieckz Fixed

@illwieckz
Copy link
Member

So, I like the code, but just for the future, please do not lost your precious time to rewrite part only to unfollow guidelines 😛

But if you want to rewrite lines that are multilines without no other reason than the old 80 char columns (as you did), you can, breaking lines is an editor rendering task, and diffs are easier to understand when there is no useless line breaks. 😄

@illwieckz
Copy link
Member

In fact, previously, the code was just a mess with per-file-implicit-coding-guidelines and sometime it was so weird (like “use space indentation if this not a multiple of 8, use tab if it's a multiple of 8”).

So some files used space before function parenthesis, others files not. I unified many things but I did not spent time to unify that.

@@ -180,8 +179,8 @@ static int server_clist_refresh_row (struct server *s, int row) {
else
g_snprintf (buf4, 32, "%d/%d", players, s->maxplayers);

// set text only if no players are on the server. Otherwise an icon is added
// later together with this text
// set text only if no players are on the server. Otherwise an icon is added later together with this text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to say: I'm not against this kind of cleaning, thanks ;-)

@illwieckz
Copy link
Member

  • Removed tons of commented code. Garbage's place is in the trash bin, really.

👍

illwieckz added a commit that referenced this pull request Jun 27, 2015
port menu to gtkbuilder, move “Preferences” in “Edit” menu, improve GTK+3 stuff etc. ref #14
@illwieckz illwieckz merged commit 0c3481e into XQF:master Jun 27, 2015
@illwieckz illwieckz added this to the XQF 1.0.7 milestone Jun 27, 2015
@vorot93 vorot93 deleted the gtkbuilder branch June 27, 2015 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants