2010-07-19 17:02:41 +00:00
|
|
|
#include <gtk/gtk.h>
|
2010-07-20 15:05:26 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <ges/ges.h>
|
|
|
|
|
2010-07-20 15:55:06 +00:00
|
|
|
typedef struct App
|
|
|
|
{
|
|
|
|
GESTimeline *timeline;
|
|
|
|
GESTimelinePipeline *pipeline;
|
|
|
|
GtkWidget *main_window;
|
|
|
|
} App;
|
|
|
|
|
|
|
|
App *app_new (void);
|
|
|
|
|
|
|
|
void app_dispose (App * app);
|
|
|
|
|
2010-07-20 15:05:26 +00:00
|
|
|
void window_destroy_cb (GtkObject * window, gpointer user);
|
|
|
|
|
|
|
|
void quit_item_activate_cb (GtkMenuItem * item, gpointer user);
|
|
|
|
|
|
|
|
void delete_item_activate_cb (GtkMenuItem * item, gpointer user);
|
|
|
|
|
|
|
|
void add_file_item_activate_cb (GtkMenuItem * item, gpointer user);
|
|
|
|
|
2010-07-20 15:55:06 +00:00
|
|
|
GtkWidget *create_ui (App * app);
|
2010-07-19 17:02:41 +00:00
|
|
|
|
2010-07-19 17:39:26 +00:00
|
|
|
void
|
|
|
|
window_destroy_cb (GtkObject * window, gpointer user)
|
|
|
|
{
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
2010-07-20 11:57:28 +00:00
|
|
|
void
|
|
|
|
quit_item_activate_cb (GtkMenuItem * item, gpointer user)
|
|
|
|
{
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
delete_item_activate_cb (GtkMenuItem * item, gpointer user)
|
|
|
|
{
|
|
|
|
g_print ("beleted!");
|
|
|
|
}
|
|
|
|
|
2010-07-20 13:56:12 +00:00
|
|
|
void
|
|
|
|
add_file_item_activate_cb (GtkMenuItem * item, gpointer user)
|
|
|
|
{
|
|
|
|
g_print ("add file");
|
|
|
|
}
|
|
|
|
|
2010-07-20 15:55:06 +00:00
|
|
|
App *
|
|
|
|
app_new (void)
|
|
|
|
{
|
|
|
|
App *ret;
|
|
|
|
ret = g_new0 (App, 1);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (!(ret->timeline = ges_timeline_new_audio_video ()))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (!(ret->pipeline = ges_timeline_pipeline_new ()))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (!ges_timeline_pipeline_add_timeline (ret->pipeline, ret->timeline))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (!(ret->main_window = create_ui (ret)))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
app_dispose (ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
app_dispose (App * app)
|
|
|
|
{
|
|
|
|
if (app) {
|
|
|
|
if (app->pipeline)
|
|
|
|
gst_object_unref (app->pipeline);
|
|
|
|
|
|
|
|
if (app->timeline)
|
|
|
|
g_object_unref (app->timeline);
|
|
|
|
|
|
|
|
if (app->main_window)
|
|
|
|
g_object_unref (app->main_window);
|
|
|
|
|
|
|
|
g_free (app);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-20 15:05:26 +00:00
|
|
|
GtkWidget *
|
2010-07-20 15:55:06 +00:00
|
|
|
create_ui (App * data)
|
2010-07-19 17:02:41 +00:00
|
|
|
{
|
|
|
|
GtkBuilder *builder;
|
|
|
|
GtkWidget *window;
|
|
|
|
|
|
|
|
builder = gtk_builder_new ();
|
|
|
|
gtk_builder_add_from_file (builder, "ges-ui.glade", NULL);
|
|
|
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
2010-07-19 17:39:26 +00:00
|
|
|
gtk_builder_connect_signals (builder, NULL);
|
2010-07-19 17:02:41 +00:00
|
|
|
g_object_unref (G_OBJECT (builder));
|
|
|
|
|
|
|
|
gtk_widget_show (window);
|
2010-07-20 15:05:26 +00:00
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
2010-07-20 15:55:06 +00:00
|
|
|
App *app;
|
2010-07-20 15:05:26 +00:00
|
|
|
|
|
|
|
/* intialize GStreamer and GES */
|
|
|
|
if (!g_thread_supported ())
|
|
|
|
g_thread_init (NULL);
|
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
ges_init ();
|
|
|
|
|
|
|
|
/* initialize UI */
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
2010-07-20 15:55:06 +00:00
|
|
|
app = app_new ();
|
2010-07-20 15:05:26 +00:00
|
|
|
|
2010-07-19 17:02:41 +00:00
|
|
|
gtk_main ();
|
2010-07-20 15:55:06 +00:00
|
|
|
|
2010-07-19 17:02:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|