info,app: move label to separate info class

Info class will run discover and have the detailed UI.
This commit is contained in:
Stefan Sauer 2010-10-17 22:36:39 +03:00
parent ae703c4f47
commit c10728a7a9
3 changed files with 49 additions and 9 deletions

View file

@ -13,7 +13,8 @@ VALAFLAGS = \
gst_mi_SOURCES = \
mi.vala \
mi-app.vala
mi-app.vala \
mi-info.vala
gst_mi_LDADD = \
$(MI_LIBS)

View file

@ -18,11 +18,12 @@
*/
using Gtk;
using MediaInfo;
public class MediaInfo.App : Window
{
private FileChooserWidget chooser;
private Label info;
private Info info;
public App()
{
@ -41,10 +42,9 @@ public class MediaInfo.App : Window
chooser = new FileChooserWidget (FileChooserAction.OPEN);
vbox.pack_start (chooser, true, true, 3);
// FIXME: use proper widget
info = new Label ("");
info = new Info ();
chooser.set_preview_widget (info);
chooser.use_preview_label = false;
chooser.set_use_preview_label (false);
chooser.update_preview.connect (on_update_preview);
}
@ -78,11 +78,9 @@ public class MediaInfo.App : Window
private void on_update_preview ()
{
string uri = chooser.get_preview_uri();
bool res = info.discover (uri);
// FIXME: do real preview
info.set_text (uri);
chooser.set_preview_widget_active (true);
chooser.set_preview_widget_active (res);
}
}

View file

@ -0,0 +1,41 @@
/* GStreamer media browser
* Copyright (C) 2010 Stefan Sauer <ensonic@user.sf.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Steet,
* Boston, MA 02110-1301, USA.
*/
using Gtk;
public class MediaInfo.Info : VBox
{
private Label uri;
public Info ()
{
set_homogeneous (false);
uri = new Label ("");
pack_start (uri, false, false, 0);
show_all ();
}
public bool discover (string uri)
{
this.uri.set_text (uri);
return (true);
}
}