make sure we get everythign we need from the XML file

This commit is contained in:
Brandon Lewis 2010-07-20 19:41:58 +02:00 committed by Edward Hervey
parent 2cb291b191
commit feca823168
2 changed files with 20 additions and 10 deletions

View file

@ -28,6 +28,7 @@ typedef struct App
GESTimelinePipeline *pipeline;
GESTimelineLayer *layer;
GtkWidget *main_window;
GtkListStore *model;
} App;
App *app_new (void);
@ -44,7 +45,7 @@ void delete_item_activate_cb (GtkMenuItem * item, App * app);
void add_file_item_activate_cb (GtkMenuItem * item, App * app);
GtkWidget *create_ui (App * app);
gboolean create_ui (App * app);
/* signal handlers **********************************************************/
@ -121,7 +122,7 @@ app_new (void)
if (!(ges_timeline_add_layer (ret->timeline, ret->layer)))
goto fail;
if (!(ret->main_window = create_ui (ret)))
if (!(create_ui (ret)))
goto fail;
return ret;
@ -162,26 +163,35 @@ layer_object_removed_cb (GESTimelineLayer * layer, GESTimelineObject * object,
/* Layout *******************************************************************/
GtkWidget *
gboolean
create_ui (App * app)
{
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"));
app->main_window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
app->model =
GTK_LIST_STORE (gtk_builder_get_object (builder, "timeline_model"));
if (!(app->main_window && app->model)) {
g_print ("Could not retrieve all widgets from the XML");
return FALSE;
}
gtk_builder_connect_signals (builder, app);
g_object_unref (G_OBJECT (builder));
gtk_widget_show (window);
gtk_widget_show (app->main_window);
g_signal_connect (app->layer, "object-added",
G_CALLBACK (layer_object_added_cb), app);
g_signal_connect (app->layer, "object-removed",
G_CALLBACK (layer_object_removed_cb), app);
return window;
return TRUE;
}
/* main *********************************************************************/

View file

@ -2,7 +2,7 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="timeline">
<object class="GtkListStore" id="timeline_model">
<columns>
<!-- column-name Clip -->
<column type="gchararray"/>
@ -183,10 +183,10 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="treeview1">
<object class="GtkTreeView" id="timeline_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">timeline</property>
<property name="model">timeline_model</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child>