porting: update on vala changes

This commit is contained in:
Stefan Sauer 2012-10-23 15:21:34 +02:00
parent 132b44e7f8
commit 7b3e72ad9d
2 changed files with 26 additions and 21 deletions

View file

@ -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 ("<GstMi-Main>/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 ();

View file

@ -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);
}
@ -313,6 +313,16 @@ public class MediaInfo.Info : VPaned
}
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<DiscovererStreamInfo> 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) {