[snappy] snappy: load with no input file
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy] snappy: load with no input file
- Date: Mon, 11 Mar 2013 16:18:46 +0000 (UTC)
commit e354ef4f40ca9f3f412590f2c668da7527485dee
Author: Luis de Bethencourt <luis debethencourt com>
Date: Mon Mar 11 12:17:54 2013 -0400
snappy: load with no input file
src/gst_engine.c | 8 +++++---
src/snappy.c | 8 ++++----
src/user_interface.c | 23 +++++++++++++++++------
src/user_interface.h | 3 +++
4 files changed, 29 insertions(+), 13 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index 8a5128e..86bc01e 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -728,10 +728,12 @@ engine_load_uri (GstEngine * engine, gchar * uri)
engine->has_started = FALSE;
engine->queries_blocked = TRUE;
- discover (engine, uri);
+ if (uri) {
+ discover (engine, uri);
- g_print ("Loading: %s\n", uri);
- g_object_set (G_OBJECT (engine->player), "uri", uri, NULL);
+ g_print ("Loading: %s\n", uri);
+ g_object_set (G_OBJECT (engine->player), "uri", uri, NULL);
+ }
return;
}
diff --git a/src/snappy.c b/src/snappy.c
index 280fd0e..eebff3f 100644
--- a/src/snappy.c
+++ b/src/snappy.c
@@ -144,6 +144,7 @@ process_args (int argc, char *argv[],
}
} else {
/* If no files passed by user display help */
+ g_print ("Opening snappy without content.\n\n");
g_print ("%s", g_option_context_get_help (context, TRUE, NULL));
}
@@ -164,7 +165,7 @@ main (int argc, char *argv[])
gboolean secret = FALSE, tags = FALSE;
gint ret = 0;
guint c, index, pos = 0;
- gchar *uri;
+ gchar *uri = NULL;
gchar *suburi = NULL;
gchar *version_str;
GList *uri_list;
@@ -207,8 +208,6 @@ main (int argc, char *argv[])
/* Process command arguments */
uri_list = process_args (argc, argv, &blind, &fullscreen, &hide,
&loop, &secret, &suburi, &tags, context);
- if (uri_list == NULL)
- goto quit;
/* User Interface */
ui = g_new (UserInterface, 1);
@@ -250,7 +249,8 @@ main (int argc, char *argv[])
gst_object_unref (engine->bus);
/* Get uri to load */
- uri = g_list_first (uri_list)->data;
+ if (uri_list)
+ uri = g_list_first (uri_list)->data;
/* Load engine and start interface */
engine_load_uri (engine, uri);
diff --git a/src/user_interface.c b/src/user_interface.c
index 32b8189..00bbe53 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -1193,14 +1193,25 @@ interface_start (UserInterface * ui, gchar * uri)
g_print ("Loading ui!\n");
// Init UserInterface structure variables
- ui->fileuri = uri;
- ui->filename = g_path_get_basename (ui->fileuri);
+ if (uri) {
+ ui->fileuri = uri;
- ui->media_width = ui->engine->media_width;
- ui->media_height = ui->engine->media_height;
+ ui->filename = g_path_get_basename (ui->fileuri);
+
+ ui->media_width = ui->engine->media_width;
+ ui->media_height = ui->engine->media_height;
- ui->stage_width = ui->media_width;
- ui->stage_height = ui->media_height;
+ ui->stage_width = ui->media_width;
+ ui->stage_height = ui->media_height;
+ } else {
+ ui->filename = "";
+
+ ui->media_width = DEFAULT_WIDTH;
+ ui->media_height = DEFAULT_HEIGHT;
+
+ ui->stage_width = DEFAULT_WIDTH;
+ ui->stage_height = DEFAULT_HEIGHT;
+ }
/* Create the window and some child widgets: */
ui->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
diff --git a/src/user_interface.h b/src/user_interface.h
index 1bf09c7..75d7863 100644
--- a/src/user_interface.h
+++ b/src/user_interface.h
@@ -64,6 +64,9 @@
#define PENALTY_TIME G_TIME_SPAN_MILLISECOND / 2
+#define DEFAULT_WIDTH 640
+#define DEFAULT_HEIGHT 480
+
G_BEGIN_DECLS
enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]