]> granicus.if.org Git - handbrake/commitdiff
LinGui: disable gtk4 key-press handling for chapter list
authorJohn Stebbins <jstebbins.hb@gmail.com>
Mon, 29 Jul 2019 17:02:02 +0000 (10:02 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Mon, 29 Jul 2019 17:02:02 +0000 (10:02 -0700)
gtk4 makes it very difficult to handle key-press in a GtkCellRenderer
I will need to rewrite the capter list as a GtkListBox instead of a
GtkTreeView to re-enable this.

key-press handling is used here to automatically move to the next
chapter when finished editing the current

gtk/src/callbacks.c
gtk/src/main.c

index 6138d280fd258bb56ad849365e28588845e4a945..eee58d38ba37582bb71d1d4ca222ddffa9ab2eda 100644 (file)
@@ -4695,7 +4695,7 @@ static guint chapter_edit_key = 0;
 
 G_MODULE_EXPORT gboolean
 chapter_keypress_cb(
-    GhbCellRendererText *cell,
+    GtkCellRendererText *cell,
     GdkEvent *event,
     signal_user_data_t *ud)
 {
@@ -4705,7 +4705,7 @@ chapter_keypress_cb(
 
 G_MODULE_EXPORT void
 chapter_edited_cb(
-    GhbCellRendererText *cell,
+    GtkCellRendererText *cell,
     gchar *path,
     gchar *text,
     signal_user_data_t *ud)
index ba51b65469f3a966f9b7dc3799bf87e56838b014..1acdc4da1e0419dde37ff1a747fa5aa177503889 100644 (file)
@@ -217,7 +217,11 @@ bind_chapter_tree_model(signal_user_data_t *ud)
     treestore = gtk_list_store_new(5, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
     gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
 
+#if GTK_CHECK_VERSION(3, 90, 0)
+    cell = gtk_cell_renderer_text_new();
+#else
     cell = ghb_cell_renderer_text_new();
+#endif
     column = gtk_tree_view_column_new_with_attributes(
                                     _("Index"), cell, "text", 0, NULL);
     gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
@@ -237,7 +241,10 @@ bind_chapter_tree_model(signal_user_data_t *ud)
                     _("Title"), cell, "text", 3, "editable", 4, NULL);
     gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
 
+#if GTK_CHECK_VERSION(3, 90, 0)
+#else
     g_signal_connect(cell, "key-press-event", chapter_keypress_cb, ud);
+#endif
     g_signal_connect(cell, "edited", chapter_edited_cb, ud);
     g_debug("Done\n");
 }