summaryrefslogtreecommitdiffstats
path: root/gtk/src/callbacks.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-18 15:13:47 +0000
committerjstebbins <[email protected]>2015-04-18 15:13:47 +0000
commita39cfcd93434dcc73a67c993fc5020c65b4ef099 (patch)
treec07b637c967b9a36d8b0a3ce5f701953704ca791 /gtk/src/callbacks.c
parentfe4ceda48e5359d46a168bd19d283328d78ce7c9 (diff)
LinGui: Modify how dest filename is constructed for iso images
Use base filename instead of iso volume label when constructing the default destination filename. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7096 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/callbacks.c')
-rw-r--r--gtk/src/callbacks.c94
1 files changed, 51 insertions, 43 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 321f823b1..13216d828 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -724,6 +724,7 @@ resolve_drive_name(gchar *filename)
static gboolean
update_source_label(signal_user_data_t *ud, const gchar *source)
{
+ GStatBuf stat_buf;
gchar *label = NULL;
gint len;
gchar **path;
@@ -731,74 +732,81 @@ update_source_label(signal_user_data_t *ud, const gchar *source)
gchar *filename = g_strdup(source);
g_debug("update_source_label()");
- len = strlen(filename);
- if (g_file_test(filename, G_FILE_TEST_IS_DIR))
+ if (g_stat(filename, &stat_buf) == 0)
{
- // Skip dos drive letters
+ len = strlen(filename);
+ if (stat_buf.st_mode & S_IFDIR)
+ {
+ // Skip dos drive letters
#if defined(_WIN32)
- start = strchr(filename, ':');
+ start = strchr(filename, ':');
#else
- start = filename;
+ start = filename;
#endif
- label = resolve_drive_name(filename);
- if (label != NULL)
- {
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
- }
- else
- {
- if (filename[len-1] == G_DIR_SEPARATOR) filename[len-1] = 0;
- if (start != NULL)
- start++;
- else
- start = filename;
-
- path = g_strsplit(start, G_DIR_SEPARATOR_S, -1);
- len = g_strv_length (path);
- if ((len > 1) && (strcmp("VIDEO_TS", path[len-1]) == 0))
+ label = resolve_drive_name(filename);
+ if (label != NULL)
{
- label = g_strdup(path[len-2]);
if (uppers_and_unders(label))
{
camel_convert(label);
}
}
- else if (len > 0)
+ else
{
- if (path[len-1][0] != 0)
+ if (filename[len-1] == G_DIR_SEPARATOR) filename[len-1] = 0;
+ if (start != NULL)
+ start++;
+ else
+ start = filename;
+
+ path = g_strsplit(start, G_DIR_SEPARATOR_S, -1);
+ len = g_strv_length (path);
+ if ((len > 1) && (strcmp("VIDEO_TS", path[len-1]) == 0))
{
- label = g_strdup(path[len-1]);
+ label = g_strdup(path[len-2]);
if (uppers_and_unders(label))
{
camel_convert(label);
}
}
+ else if (len > 0)
+ {
+ if (path[len-1][0] != 0)
+ {
+ label = g_strdup(path[len-1]);
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
+ }
+ else
+ label = g_strdup("new_video");
+ }
else
label = g_strdup("new_video");
+ g_strfreev (path);
}
- else
- label = g_strdup("new_video");
- g_strfreev (path);
}
- }
- else
- {
- // Is regular file or block dev.
- // Check to see if it is a dvd image
- label = ghb_dvd_volname (filename);
- if (label == NULL)
+ else if (stat_buf.st_mode & S_IFBLK)
{
- label = get_file_label(filename);
+ // Is regular file or block dev.
+ // Check to see if it is a dvd image
+ label = ghb_dvd_volname (filename);
+ if (label == NULL)
+ {
+ label = get_file_label(filename);
+ }
+ else
+ {
+ if (uppers_and_unders(label))
+ {
+ camel_convert(label);
+ }
+ }
}
else
{
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
+ label = get_file_label(filename);
}
}
g_free(filename);