MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / subtitle_remove_cb

Function subtitle_remove_cb

gtk/src/subtitlehandler.c:1849–1922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1847}
1848
1849G_MODULE_EXPORT void
1850subtitle_remove_cb (GSimpleAction *action, GVariant *param, gpointer data)
1851{
1852 GtkTreeView *tv;
1853 GtkTreePath *tp;
1854 GtkTreeModel *tm;
1855 GtkTreeSelection *ts;
1856 GtkTreeIter ti, nextIter;
1857 gint row;
1858 gint *indices;
1859 GhbValue *subtitle_list, *subtitle_search;
1860 signal_user_data_t *ud = ghb_ud();
1861
1862 tv = GTK_TREE_VIEW(ghb_builder_widget("subtitle_list_view"));
1863 ts = gtk_tree_view_get_selection(tv);
1864 tm = gtk_tree_view_get_model(tv);
1865 if (gtk_tree_selection_get_selected(ts, &tm, &ti))
1866 {
1867 nextIter = ti;
1868 if (!gtk_tree_model_iter_next(tm, &nextIter))
1869 {
1870 nextIter = ti;
1871 if (gtk_tree_model_get_iter_first(tm, &nextIter))
1872 {
1873 gtk_tree_selection_select_iter(ts, &nextIter);
1874 }
1875 }
1876 else
1877 {
1878 gtk_tree_selection_select_iter(ts, &nextIter);
1879 }
1880
1881 subtitle_search = ghb_get_job_subtitle_search(ud->settings);
1882 subtitle_list = ghb_get_job_subtitle_list(ud->settings);
1883
1884 // Get the row number
1885 tp = gtk_tree_model_get_path(tm, &ti);
1886 indices = gtk_tree_path_get_indices(tp);
1887 row = indices[0];
1888 if (ghb_dict_get_bool(subtitle_search, "Enable"))
1889 {
1890 if (row == 0)
1891 {
1892 ghb_dict_set_bool(subtitle_search, "Enable", 0);
1893 gtk_tree_store_remove(GTK_TREE_STORE(tm), &ti);
1894
1895 // Enable FAS button
1896 GSimpleAction *fas_action = G_SIMPLE_ACTION(GHB_ACTION("subtitle-add-fas"));
1897 g_simple_action_set_enabled(fas_action, 1);
1898 ghb_update_summary_info(ud);
1899 return;
1900 }
1901 row--;
1902 }
1903 if (row < 0 || row >= ghb_array_len(subtitle_list))
1904 {
1905 gtk_tree_path_free(tp);
1906 return;

Callers

nothing calls this directly

Calls 8

ghb_udFunction · 0.85
ghb_builder_widgetFunction · 0.85
ghb_dict_get_boolFunction · 0.85
ghb_dict_set_boolFunction · 0.85
ghb_update_summary_infoFunction · 0.85
ghb_live_resetFunction · 0.85

Tested by

no test coverage detected