Port PidginRoomlistDialog to GTK4

Review Request #1423 — Created May 7, 2022 and submitted

Information

pidgin/pidgin
gtk4

Reviewers

Port PidginRoomlistDialog to GTK4

Compiled.

Summary ID
Port PidginRoomlistDialog to GTK4
Testing Done: Compiled. Reviewed at https://reviews.imfreedom.org/r/1423/
61337b8f8147c0c7f3b19c1cdaf7479bb7921618
Description From Last Updated

It might be a lot easier if we just add a helper function to get the selected room. That should …

grimgrim

These should be named spaced, but we also try to avoid prototypes by just defining functions before they are needed.

grimgrim

you probably want gtk_widget_get_toplevel instead.

grimgrim

likewise on gtk_widget_get_toplevel

grimgrim

according to your g_action_group_add_entries call, this data should be set on dialog

grimgrim

according to the gtk4-demo menu progran, you just bind the child menu to the parent, and then call popup on …

grimgrim

The menu element can and should be put directly in roomlist.ui at the same level as the template element. This …

grimgrim

delete-event was replaced with close-request. Which also means delete_win_cb should be renamed and have it's properties adjusted.

grimgrim

This should probably be visible.

grimgrim

the box itself wasn't set to fill or expand.

grimgrim

needs halign = fill or GTK_ALIGN_FILL as well.

grimgrim

seeds valign set to GTK_ALIGN_FILL

grimgrim

the old progress bar didn't have align or expand set.

grimgrim

action area got reworked see https://docs.gtk.org/gtk4/class.Dialog.html#gtkdialog-as-gtkbuildable for an example. And we should be using response ids instead of direct callbacks.

grimgrim

You can bind the selection via the ui file and gtk_widget_class_bind_template_child in pidgin_roomlist_class_init to avoid having to do this lookup. …

grimgrim

alignment is off, should be using spaces to align it with the first parameter after the (.

grimgrim

unused parameters should be marked with G_GNUC_UNUSED like G_GNUC_UNUSED GSimpleActions *action, G_GNUC_UNUSED GVariant *parameter

grimgrim

alignment again

grimgrim

d is unused and should be marked as so.

grimgrim

w is unused and should be marked as so.

grimgrim

There should probably be a if(PURPLE_IS_ROOMLIST_ROOM(room)) before this.

grimgrim

You don't need to typecast a gpointer, it'll be implicitly cast.

grimgrim

gdouble for consistency

grimgrim

no need for the cast

grimgrim

Typically we validate parameters before acting on them. So this should use g_return_if_fail(PURPLE_IS_ACCOUNT(account)); before creating the dialog, which that that …

grimgrim

this should probably be start i think?

grimgrim

Action area has been removed in GTK4. The child buttons are just normal children with an additional attribute of type="action" …

grimgrim

We should probably make sure that a room was selected before attempting to join it.

grimgrim
grim
  1. 
      
  2. Show all issues

    It might be a lot easier if we just add a helper function to get the selected room. That should avoid all the g_object_[gs]et_data stuff.

  3. pidgin/gtkroomlist.c (Diff revision 1)
     
     
    Show all issues

    These should be named spaced, but we also try to avoid prototypes by just defining functions before they are needed.

  4. pidgin/gtkroomlist.c (Diff revision 1)
     
     
    Show all issues

    you probably want gtk_widget_get_toplevel instead.

  5. pidgin/gtkroomlist.c (Diff revision 1)
     
     
    Show all issues

    likewise on gtk_widget_get_toplevel

  6. pidgin/gtkroomlist.c (Diff revision 1)
     
     
    Show all issues

    according to your g_action_group_add_entries call, this data should be set on dialog

  7. pidgin/gtkroomlist.c (Diff revision 1)
     
     
    Show all issues

    according to the gtk4-demo menu progran, you just bind the child menu to the parent, and then call popup on it when you need it. Therefore avoiding needing to get an object from gtk builder and so on.

  8. pidgin/resources/Roomlist/menu.ui (Diff revision 1)
     
     
    Show all issues

    The menu element can and should be put directly in roomlist.ui at the same level as the template element. This will allow you to use the gtk_widget_class_bind_template_child.

  9. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    delete-event was replaced with close-request. Which also means delete_win_cb should be renamed and have it's properties adjusted.

  10. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    This should probably be visible.

  11. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    the box itself wasn't set to fill or expand.

  12. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    needs halign = fill or GTK_ALIGN_FILL as well.

  13. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    seeds valign set to GTK_ALIGN_FILL

  14. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    the old progress bar didn't have align or expand set.

  15. pidgin/resources/Roomlist/roomlist.ui (Diff revision 1)
     
     
    Show all issues

    action area got reworked see https://docs.gtk.org/gtk4/class.Dialog.html#gtkdialog-as-gtkbuildable for an example. And we should be using response ids instead of direct callbacks.

  16. 
      
belgin
grim
  1. 
      
  2. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    You can bind the selection via the ui file and gtk_widget_class_bind_template_child in pidgin_roomlist_class_init to avoid having to do this lookup. See https://docs.gtk.org/gtk4/class.TreeView.html#gtktreeview-as-gtkbuildable for the ui file syntax.

  3. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    alignment is off, should be using spaces to align it with the first parameter after the (.

  4. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    unused parameters should be marked with G_GNUC_UNUSED like G_GNUC_UNUSED GSimpleActions *action, G_GNUC_UNUSED GVariant *parameter

  5. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    alignment again

  6. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    d is unused and should be marked as so.

  7. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    w is unused and should be marked as so.

  8. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    There should probably be a if(PURPLE_IS_ROOMLIST_ROOM(room)) before this.

  9. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    You don't need to typecast a gpointer, it'll be implicitly cast.

  10. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    gdouble for consistency

  11. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    no need for the cast

  12. pidgin/gtkroomlist.c (Diff revision 2)
     
     
    Show all issues

    Typically we validate parameters before acting on them.

    So this should use g_return_if_fail(PURPLE_IS_ACCOUNT(account)); before creating the dialog, which that that point should be valid and not need a g_return_if_* macro.

  13. pidgin/resources/Roomlist/roomlist.ui (Diff revision 2)
     
     
    Show all issues

    this should probably be start i think?

  14. pidgin/resources/Roomlist/roomlist.ui (Diff revision 2)
     
     
    Show all issues

    Action area has been removed in GTK4. The child buttons are just normal children with an additional attribute of type="action" on them.

    https://docs.gtk.org/gtk4/class.Dialog.html#gtkdialog-as-gtkbuildable

  15. 
      
belgin
grim
  1. 
      
  2. pidgin/gtkroomlist.c (Diff revision 3)
     
     
    Show all issues

    We should probably make sure that a room was selected before attempting to join it.

  3. 
      
belgin
grim
  1. Ship It!
  2. Awesome work, thank you so much for seeing this through until the end!!

  3. 
      
grim
Review request changed
Status:
Completed