| 129 | } |
| 130 | |
| 131 | void |
| 132 | ghb_file_chooser_set_initial_file (GtkFileChooser *chooser, const char *file) |
| 133 | { |
| 134 | if (!file || !file[0]) |
| 135 | { |
| 136 | return; |
| 137 | } |
| 138 | else if (g_file_test(file, G_FILE_TEST_IS_DIR)) |
| 139 | { |
| 140 | GFile *gfile = g_file_new_for_path(file); |
| 141 | gtk_file_chooser_set_current_folder(chooser, gfile, NULL); |
| 142 | g_object_unref(gfile); |
| 143 | } |
| 144 | else |
| 145 | { |
| 146 | char *dir = g_path_get_dirname(file); |
| 147 | if (g_file_test(dir, G_FILE_TEST_IS_DIR)) |
| 148 | { |
| 149 | GFile *gfile = g_file_new_for_path(dir); |
| 150 | gtk_file_chooser_set_current_folder(chooser, gfile, NULL); |
| 151 | g_object_unref(gfile); |
| 152 | } |
| 153 | g_free(dir); |
| 154 | if (gtk_file_chooser_get_action(chooser) == GTK_FILE_CHOOSER_ACTION_SAVE) |
| 155 | { |
| 156 | char *base = g_path_get_basename(file); |
| 157 | gtk_file_chooser_set_current_name(chooser, base); |
| 158 | g_free(base); |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | char * |
| 164 | ghb_file_chooser_get_filename (GtkFileChooser *chooser) |
no outgoing calls
no test coverage detected