summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com>2009-04-12 18:15:53 -0400
committerSøren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com>2009-04-12 18:15:53 -0400
commit21e1aecdc3fcb5e674b12d394f6066e898ce1cdf (patch)
treecdaf1a588408cd160528b5209e381e932601f3c6 /window.c
parentde30d95d3f9f601ea2804547726e6d7ac3907dc4 (diff)
Add support for command line loading into empty window
Diffstat (limited to 'window.c')
-rw-r--r--window.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/window.c b/window.c
index 9873952..0ab616b 100644
--- a/window.c
+++ b/window.c
@@ -1029,7 +1029,8 @@ canonicalize_filename (const char *filename)
{
memmove (p, p+1, strlen (p+1)+1);
}
- else if (p[0] == '.' && p[1] == '.' && (p[2] == 0 || G_IS_DIR_SEPARATOR (p[2])))
+ else if (p[0] == '.' && p[1] == '.' &&
+ (p[2] == 0 || G_IS_DIR_SEPARATOR (p[2])))
{
q = p + 2;
/* Skip previous separator */
@@ -1124,25 +1125,29 @@ gboolean
window_load_file (SivWindow *window, const char *filename, GError **err)
{
GdkPixbuf *pixbuf;
+ gchar *canon;
- window->filename = canonicalize_filename (filename);
+ canon = canonicalize_filename (filename);
pixbuf = gdk_pixbuf_new_from_file (filename, err);
- if (!pixbuf)
- {
- return FALSE;
- }
- else
+ if (pixbuf)
{
window->original = pixbuf;
+ window->filename = canon;
- apply_meta_data (window, window->filename);
+ apply_meta_data (window, filename);
rebuild (window);
return TRUE;
}
+ else
+ {
+ g_free (canon);
+
+ return FALSE;
+ }
}
SivWindow *
@@ -1217,3 +1222,9 @@ window_show (SivWindow *window, guint32 time)
gtk_window_present_with_time (get_widget (window, "main_window"), time);
}
+
+const char *
+window_get_filename (SivWindow *window)
+{
+ return window->filename;
+}