diff --git a/mediainfo/src/mi-app.vala b/mediainfo/src/mi-app.vala index 3b4ffc5481..e0f7463ca9 100644 --- a/mediainfo/src/mi-app.vala +++ b/mediainfo/src/mi-app.vala @@ -72,32 +72,32 @@ public class MediaInfo.App : Window private MenuBar create_menu () { MenuBar menu_bar = new MenuBar (); - MenuItem item; - Menu sub_menu; + Gtk.MenuItem item; + Gtk.Menu sub_menu; AccelGroup accel_group; accel_group = new AccelGroup (); this.add_accel_group (accel_group); - item = new MenuItem.with_label (_("File")); + item = new Gtk.MenuItem.with_label (_("File")); menu_bar.append (item); - sub_menu = new Menu (); + sub_menu = new Gtk.Menu (); item.set_submenu (sub_menu); // TODO: add "open uri" item // -> dialog with text entry (pre-file with clipboard content) // -> discover that uri and clear selection in browser - item = new ImageMenuItem.from_stock (STOCK_QUIT, accel_group); + item = new ImageMenuItem.from_stock (Stock.QUIT, accel_group); sub_menu.append (item); item.activate.connect (Gtk.main_quit); - item = new MenuItem.with_label (_("View")); + item = new Gtk.MenuItem.with_label (_("View")); //item.set_accel_path ("/MainMenu/View"); menu_bar.append (item); - sub_menu = new Menu (); + sub_menu = new Gtk.Menu (); item.set_submenu (sub_menu); CheckMenuItem citem = new CheckMenuItem.with_label (_("Full Screen")); @@ -111,13 +111,13 @@ public class MediaInfo.App : Window citem.toggled.connect (on_fullscreen_toggled); // add "help" menu with "about" item - item = new MenuItem.with_label (_("Help")); + item = new Gtk.MenuItem.with_label (_("Help")); menu_bar.append (item); - sub_menu = new Menu (); + sub_menu = new Gtk.Menu (); item.set_submenu (sub_menu); - item = new ImageMenuItem.from_stock (STOCK_ABOUT, accel_group); + item = new ImageMenuItem.from_stock (Stock.ABOUT, accel_group); sub_menu.append (item); item.activate.connect (on_about_clicked); @@ -146,7 +146,7 @@ public class MediaInfo.App : Window } } - private void on_about_clicked (MenuItem item) + private void on_about_clicked (Gtk.MenuItem item) { AboutDialog dlg = new AboutDialog (); diff --git a/mediainfo/src/mi-info.vala b/mediainfo/src/mi-info.vala index 23c916a444..d0ab2533cd 100644 --- a/mediainfo/src/mi-info.vala +++ b/mediainfo/src/mi-info.vala @@ -289,8 +289,8 @@ public class MediaInfo.Info : VPaned try { FileInfo finfo = file.query_info ("standard::*", FileQueryInfoFlags.NONE, null); - mime_type.set_text (finfo.get_attribute_string (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)); - icon_image.set_from_gicon ((Icon) finfo.get_attribute_object (FILE_ATTRIBUTE_STANDARD_ICON), IconSize.DIALOG); + mime_type.set_text (finfo.get_attribute_string (FileAttribute.STANDARD_CONTENT_TYPE)); + icon_image.set_from_gicon ((Icon) finfo.get_attribute_object (FileAttribute.STANDARD_ICON), IconSize.DIALOG); } catch (Error e) { debug ("Failed to query file info from %s: %s: %s", uri, e.domain.to_string (), e.message); } @@ -298,7 +298,7 @@ public class MediaInfo.Info : VPaned if (false) { /* sync API */ try { - on_uri_discovered (dc.discover_uri (uri), null); + process_new_uri (dc.discover_uri (uri)); } catch (Error e) { debug ("Failed to extract metadata from %s: %s: %s", uri, e.domain.to_string (), e.message); } @@ -311,8 +311,18 @@ public class MediaInfo.Info : VPaned } return (res); } - + private void on_uri_discovered (DiscovererInfo info, Error e) + { + if (e != null) { + debug ("Failed to extract metadata from %s: %s: %s", info.get_uri(), e.domain.to_string (), e.message); + container_name.set_text (""); + duration.set_text (""); + } + process_new_uri (info); + } + + private void process_new_uri (DiscovererInfo info) { string uri = info.get_uri(); GLib.List l; @@ -329,11 +339,6 @@ public class MediaInfo.Info : VPaned Caps caps; Structure s; - if (e != null) { - debug ("Failed to extract metadata from %s: %s: %s", uri, e.domain.to_string (), e.message); - container_name.set_text (""); - duration.set_text (""); - } if (info == null) { container_name.set_text (""); duration.set_text (""); @@ -775,7 +780,7 @@ public class MediaInfo.Info : VPaned Caps c = buf.get_caps(); try { - InputStream is = new MemoryInputStream.from_data (buf.data,buf.size,null); + InputStream is = new MemoryInputStream.from_data (buf.data,null); album_art = new Gdk.Pixbuf.from_stream (is, null); is.close(null); } catch (Error e) {