# HG changeset patch # User Elliott Sales de Andrade # Date 1660624998 18000 # Node ID bfd0330f09fb211170920e80503c05af0cf33054 # Parent ac5416e7e4f5a7435118f06ca3221f4f8b62517e Port XMPP Service Discovery plugin to GTK4 Will probably depend on `gtk4` being rebased on /r/1596. Testing Done: Deleted the Pidgin-specific widgets, and checked the dialog in `gtk4-builder-tool`, so it _probably_ works. Reviewed at https://reviews.imfreedom.org/r/1598/ diff -r ac5416e7e4f5 -r bfd0330f09fb pidgin/plugins/disco/gtkdisco.c --- a/pidgin/plugins/disco/gtkdisco.c Mon Aug 15 02:39:09 2022 -0500 +++ b/pidgin/plugins/disco/gtkdisco.c Mon Aug 15 23:43:18 2022 -0500 @@ -281,9 +281,11 @@ } static gboolean -service_click_cb(GtkTreeView *tree, GdkEventButton *event, gpointer user_data) +service_click_cb(G_GNUC_UNUSED GtkGestureClick *click, + G_GNUC_UNUSED gint n_press, + gdouble x, gdouble y, gpointer data) { - PidginDiscoDialog *dialog = user_data; + PidginDiscoDialog *dialog = data; XmppDiscoService *service; GtkTreePath *path; @@ -292,13 +294,9 @@ GdkRectangle rect; - if (!gdk_event_triggers_context_menu((GdkEvent *)event)) { - return FALSE; - } - /* Figure out what was clicked */ - if (!gtk_tree_view_get_path_at_pos(tree, event->x, event->y, &path, - NULL, NULL, NULL)) + if (!gtk_tree_view_get_path_at_pos(dialog->tree, (gint)x, (gint)y, &path, + NULL, NULL, NULL)) { return FALSE; } @@ -314,8 +312,7 @@ } gtk_tree_view_convert_bin_window_to_widget_coords(dialog->tree, - (gint)event->x, - (gint)event->y, + (gint)x, (gint)y, &rect.x, &rect.y); rect.width = rect.height = 1; @@ -428,11 +425,6 @@ pidgin_disco_list_set_in_progress(dialog->discolist, FALSE); } -static void close_button_cb(GtkButton *button, PidginDiscoDialog *dialog) -{ - gtk_widget_destroy(GTK_WIDGET(dialog)); -} - static gboolean disco_query_tooltip(GtkWidget *widget, int x, int y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data) @@ -565,7 +557,7 @@ while (dialogs) { GtkWidget *dialog = dialogs->data; - gtk_widget_destroy(dialog); + gtk_window_destroy(GTK_WINDOW(dialog)); /* destroy_win_cb removes the dialog from the list */ } } @@ -594,11 +586,8 @@ model); gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, popover); - gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, - popover_menu); gtk_widget_class_bind_template_callback(widget_class, destroy_win_cb); - gtk_widget_class_bind_template_callback(widget_class, close_button_cb); gtk_widget_class_bind_template_callback(widget_class, dialog_select_account_cb); gtk_widget_class_bind_template_callback(widget_class, row_activated_cb); @@ -660,9 +649,6 @@ gtk_widget_insert_action_group(GTK_WIDGET(dialog), "disco", G_ACTION_GROUP(action_group)); - - gtk_popover_bind_model(GTK_POPOVER(dialog->popover), dialog->popover_menu, - NULL); } /****************************************************************************** @@ -679,7 +665,7 @@ pidgin_disco_dialog_new(void) { PidginDiscoDialog *dialog = g_object_new(PIDGIN_TYPE_DISCO_DIALOG, NULL); - gtk_widget_show_all(GTK_WIDGET(dialog)); + gtk_widget_show(GTK_WIDGET(dialog)); return dialog; } diff -r ac5416e7e4f5 -r bfd0330f09fb pidgin/plugins/disco/gtkdisco.h --- a/pidgin/plugins/disco/gtkdisco.h Mon Aug 15 02:39:09 2022 -0500 +++ b/pidgin/plugins/disco/gtkdisco.h Mon Aug 15 23:43:18 2022 -0500 @@ -49,7 +49,6 @@ PidginDiscoList *discolist; GtkPopoverMenu *popover; - GMenuModel *popover_menu; gpointer prompt_handle; }; diff -r ac5416e7e4f5 -r bfd0330f09fb pidgin/plugins/disco/resources/disco.ui --- a/pidgin/plugins/disco/resources/disco.ui Mon Aug 15 02:39:09 2022 -0500 +++ b/pidgin/plugins/disco/resources/disco.ui Mon Aug 15 23:43:18 2022 -0500 @@ -15,12 +15,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +along with this program; if not, see . --> - + @@ -38,11 +37,6 @@ - - False - tree - bottom - accounts @@ -64,192 +58,147 @@