From c10728a7a905cc3e888d0ef087c2e0ef2b39588f Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Sun, 17 Oct 2010 22:36:39 +0300 Subject: [PATCH] info,app: move label to separate info class Info class will run discover and have the detailed UI. --- mediainfo/src/Makefile.am | 3 ++- mediainfo/src/mi-app.vala | 14 ++++++------- mediainfo/src/mi-info.vala | 41 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 mediainfo/src/mi-info.vala diff --git a/mediainfo/src/Makefile.am b/mediainfo/src/Makefile.am index 5716294458..18e4454264 100644 --- a/mediainfo/src/Makefile.am +++ b/mediainfo/src/Makefile.am @@ -13,7 +13,8 @@ VALAFLAGS = \ gst_mi_SOURCES = \ mi.vala \ - mi-app.vala + mi-app.vala \ + mi-info.vala gst_mi_LDADD = \ $(MI_LIBS) diff --git a/mediainfo/src/mi-app.vala b/mediainfo/src/mi-app.vala index a869bd617a..92a0f7fe82 100644 --- a/mediainfo/src/mi-app.vala +++ b/mediainfo/src/mi-app.vala @@ -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); } } diff --git a/mediainfo/src/mi-info.vala b/mediainfo/src/mi-info.vala new file mode 100644 index 0000000000..53d0d7d23f --- /dev/null +++ b/mediainfo/src/mi-info.vala @@ -0,0 +1,41 @@ +/* GStreamer media browser + * Copyright (C) 2010 Stefan Sauer + * + * 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); + } +} \ No newline at end of file