1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
From: sid <sidtosh4@gmail.com>
Date: Mon, 3 Jun 2024 09:29:16 +0100
Subject: Remove libegg multidrag treeview support for in-built
'GtkFileChooser'
This fixes the following message while using the 'GtkFileChooser'
within brasero.
(brasero:571263): GLib-GObject-CRITICAL **: 11:29:32.207: attempting to add an interface (EggTreeMultiDragSource) to class (GtkFileSystemModel) after class_init
This is due to the fact that GLib removed support for adding
interfaces to object types after the class has been initialized (
around GLib 2.35 / 2.36 ). Since then, this code never worked. And the
model used by 'GtkFileChooser' ('GtkFileSystemModel') is private to
GLib. So, any attempts to add libegg multidrag interface to
'GtkFileSystemModel' via 'g_type_add_interface_static ()' before class
initialization is not possible anymore. So, we remove the non-working
code.
With this change, single row drag works as expected. So, atleast it
would be consistent with 'GtkFileChooser' behaviour elsewhere.
Refer: https://gitlab.gnome.org/GNOME/glib/-/issues/624
Refer: https://gitlab.gnome.org/GNOME/gtk/-/issues/217
Forwarded: https://gitlab.gnome.org/GNOME/brasero/-/merge_requests/29
---
src/brasero-file-chooser.c | 52 +---------------------------------------------
src/brasero-multi-dnd.c | 9 --------
src/brasero-multi-dnd.h | 3 ---
3 files changed, 1 insertion(+), 63 deletions(-)
diff --git a/src/brasero-file-chooser.c b/src/brasero-file-chooser.c
index b658daf..124295a 100644
--- a/src/brasero-file-chooser.c
+++ b/src/brasero-file-chooser.c
@@ -211,60 +211,10 @@ brasero_file_chooser_allocation_changed (GtkWidget *widget,
brasero_file_chooser_position_percent (G_OBJECT (widget), width, position);
}
-static void
-brasero_file_chooser_notify_model (GtkTreeView *treeview,
- GParamSpec *pspec,
- gpointer NULL_data)
-{
- GtkTreeModel *model;
-
- model = gtk_tree_view_get_model (treeview);
- if (model && !EGG_IS_TREE_MULTI_DRAG_SOURCE (model)) {
- GType type;
-
- type = G_OBJECT_TYPE (model);
- brasero_enable_multi_DND_for_model_type (type);
- }
-}
-
void
brasero_file_chooser_customize (GtkWidget *widget, gpointer null_data)
{
- /* we explore everything until we reach a treeview (there are two) */
- if (GTK_IS_TREE_VIEW (widget)) {
- GtkTargetList *list;
- GdkAtom target;
- gboolean found;
- guint num;
-
- list = gtk_drag_source_get_target_list (widget);
- target = gdk_atom_intern ("text/uri-list", TRUE);
- found = gtk_target_list_find (list, target, &num);
- /* FIXME: should we unref them ? apparently not according to
- * the warning messages we get if we do */
-
- if (found
- && gtk_tree_selection_get_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget))) == GTK_SELECTION_MULTIPLE) {
- GtkTreeModel *model;
-
- /* This is done because GtkFileChooser does not use a
- * GtkListStore or GtkTreeStore any more. */
- egg_tree_multi_drag_add_drag_support (GTK_TREE_VIEW (widget));
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
- if (model) {
- GType type;
-
- type = G_OBJECT_TYPE (model);
- brasero_enable_multi_DND_for_model_type (type);
- }
- else
- g_signal_connect (widget,
- "notify::model",
- G_CALLBACK (brasero_file_chooser_notify_model),
- NULL);
- }
- }
- else if (GTK_IS_BUTTON (widget)) {
+ if (GTK_IS_BUTTON (widget)) {
GtkWidget *image;
gchar *stock_id = NULL;
diff --git a/src/brasero-multi-dnd.c b/src/brasero-multi-dnd.c
index bf7b6a2..bf8fe9c 100644
--- a/src/brasero-multi-dnd.c
+++ b/src/brasero-multi-dnd.c
@@ -200,15 +200,6 @@ static const GInterfaceInfo brasero_data_track_cfg_multi_DND_drag_source_info =
NULL
};
-gboolean
-brasero_enable_multi_DND_for_model_type (GType type)
-{
- g_type_add_interface_static (type,
- EGG_TYPE_TREE_MULTI_DRAG_SOURCE,
- &multi_DND_drag_source_info);
- return TRUE;
-}
-
void
brasero_enable_multi_DND (void)
{
diff --git a/src/brasero-multi-dnd.h b/src/brasero-multi-dnd.h
index 8a37637..507d93e 100644
--- a/src/brasero-multi-dnd.h
+++ b/src/brasero-multi-dnd.h
@@ -33,9 +33,6 @@ G_BEGIN_DECLS
void
brasero_enable_multi_DND (void);
-gboolean
-brasero_enable_multi_DND_for_model_type (GType type);
-
G_END_DECLS
#endif /* _MULTI_DND_H */
|