[gnome-sound-recorder] multiple files: various style fixes



commit d3eb326835e76329e36a39782e59384c8fcf73a5
Author: Meg Ford <meg387 gmail com>
Date:   Wed Feb 12 20:26:15 2014 -0600

    multiple files: various style fixes

 src/info.js       |    2 +-
 src/mainWindow.js |    7 ++++---
 src/play.js       |   37 +++++++++++++++++++++++++++++++------
 src/record.js     |   25 ++++++++++++++++---------
 4 files changed, 52 insertions(+), 19 deletions(-)
---
diff --git a/src/info.js b/src/info.js
index 669cf90..92a17a0 100644
--- a/src/info.js
+++ b/src/info.js
@@ -43,7 +43,7 @@ const InfoDialog = new Lang.Class({
                                         default_width: 400,
                                         title: _("Info"),
                                         hexpand: true });
-        
+        this.widget.set_transient_for(Gio.Application.get_default().get_active_window());
         let header = new Gtk.HeaderBar({ hexpand: true });
         header.set_show_close_button(false);
         this.widget.set_titlebar(header);
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 3ec38cd..26de132 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -24,6 +24,7 @@ const Gdk = imports.gi.Gdk;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gio = imports.gi.Gio;
 const Gst = imports.gi.Gst;
+const Pango = imports.gi.Pango;
 
 const AudioProfile = imports.audioProfile;
 const FileUtil = imports.fileUtil;
@@ -137,7 +138,7 @@ const MainView = new Lang.Class({
         this._scrolledWin.add(this.emptyGrid);
 
         let emptyPageImage = new Gtk.Image({ icon_name: 'audio-input-microphone-symbolic',
-                                             icon_size: Gtk.IconSize.LARGE_TOOLBAR });
+                                             icon_size: Gtk.IconSize.DIALOG });
         emptyPageImage.get_style_context().add_class('dim-label');
         this.emptyGrid.add(emptyPageImage);
         let emptyPageTitle = new Gtk.Label({ label: _("Add Recordings"),
@@ -393,7 +394,7 @@ const MainView = new Lang.Class({
                 this._fileName = new Gtk.Label({ use_markup: true,
                                                  halign: Gtk.Align.START,
                                                  valign: Gtk.Align.START,
-                                                 ellipsize: true,
+                                                 ellipsize: rtl ? Pango.EllipsizeMode.START : 
Pango.EllipsizeMode.END,
                                                  xalign: 0,
                                                  width_chars: 40,
                                                  margin_top: 5,
@@ -447,7 +448,7 @@ const MainView = new Lang.Class({
                                                    vexpand: true,
                                                    name: "WaveFormGrid" });
                 this.waveFormGrid.set_no_show_all(true);
-                this.rowGrid.attach(this.waveFormGrid, 11, 1, 18, 4);
+                this.rowGrid.attach(this.waveFormGrid, 11, 1, 18, 2);
                 this.waveFormGrid.show();
                 
                 // info button
diff --git a/src/play.js b/src/play.js
index 2284d36..490032b 100644
--- a/src/play.js
+++ b/src/play.js
@@ -77,7 +77,7 @@ const _TENTH_SEC = 100000000;
         this.playState = PipelineStates.PLAYING;
                 
         if (this.ret == Gst.StateChangeReturn.FAILURE) {
-            this._showErrorDialog(_('Unable to set the playbin to the playing state.')); 
+            this._showErrorDialog(_('Unable to play recording')); 
             this.onEndOfStream();
         } else if (this.ret == Gst.StateChangeReturn.SUCCESS) {        
             MainWindow.view.setVolume(); 
@@ -122,14 +122,32 @@ const _TENTH_SEC = 100000000;
         this.localMsg = message;
         let msg = message.type;
         switch(msg) {
+        
+        case Gst.MessageType.ELEMENT:
+            if (GstPbutils.is_missing_plugin_message(this.localMsg)) {
+                let errorOne = null;
+                let errorTwo = null; 
+                let detail = GstPbutils.missing_plugin_message_get_installer_detail(this.localMsg);
+                       
+                if (detail != null)
+                    errorOne = detail;
+                                                   
+                let description = GstPbutils.missing_plugin_message_get_description(this.localMsg);
+                   
+                if (description != null)
+                    errorTwo = description;
+                        
+                this._showErrorDialog(errorOne, errorTwo);                       
+            }
+            break;
                                                        
         case Gst.MessageType.EOS:               
             this.onEndOfStream(); 
             break;
                 
         case Gst.MessageType.ERROR:
-            let errMsg = "Error:" + message.parse_error();
-            this._showErrorDialog(_(errMsg));
+            let errorMessage = message.parse_error();
+            this._showErrorDialog(errorMessage);              
             this.play.set_state(Gst.State.NULL);
             this.playState = PipelineStates.STOPPED;
             this.playBus.remove_signal_watch();
@@ -218,13 +236,20 @@ const _TENTH_SEC = 100000000;
         this._fileToPlay = MainWindow.view.loadPlay(this._selected);
     },
     
-    _showErrorDialog: function(errorStr) {
+    _showErrorDialog: function(errorStrOne, errorStrTwo) {
         let errorDialog = new Gtk.MessageDialog ({ modal: true,
                                                    destroy_with_parent: true,
                                                    buttons: Gtk.ButtonsType.OK,
-                                                   message_type: Gtk.MessageType.WARNING,
-                                                   text: errorStr });
+                                                   message_type: Gtk.MessageType.ERROR });
+
+        if (errorStrOne != null) {
+            let strOne = errorDialog.set_property('text', errorStrOne);
+        }
+         
+        if (errorStrTwo != null)
+            errorDialog.set_property('secondary-text', errorStrTwo);
 
+        errorDialog.set_transient_for(Gio.Application.get_default().get_active_window());
         errorDialog.connect ('response', Lang.bind(this,
             function() {
                 errorDialog.destroy();
diff --git a/src/record.js b/src/record.js
index d486bad..d65fed4 100644
--- a/src/record.js
+++ b/src/record.js
@@ -26,6 +26,7 @@ const GObject = imports.gi.GObject;
 const Gst = imports.gi.Gst;
 const GstAudio = imports.gi.GstAudio;
 const GstPbutils = imports.gi.GstPbutils;
+const Pango = imports.gi.Pango;
 
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
@@ -145,7 +146,7 @@ const Record = new Lang.Class({
         this.pipeState = PipelineStates.PLAYING;
         
         if (ret == Gst.StateChangeReturn.FAILURE) {
-            this._showErrorDialog(_('Unable to set the pipeline to the recording state.')); 
+            this._showErrorDialog(_('Unable to set the pipeline \n to the recording state')); 
         } else {        
             MainWindow.view.setVolume(); 
         }
@@ -181,8 +182,8 @@ const Record = new Lang.Class({
             
         case Gst.MessageType.ELEMENT:
             if (GstPbutils.is_missing_plugin_message(this.localMsg)) {
-                let errorOne = "";
-                let errorTwo = ""; 
+                let errorOne = null;
+                let errorTwo = null; 
                 let detail = GstPbutils.missing_plugin_message_get_installer_detail(this.localMsg);
                        
                 if (detail != null)
@@ -191,7 +192,8 @@ const Record = new Lang.Class({
                 let description = GstPbutils.missing_plugin_message_get_description(this.localMsg);
                    
                 if (description != null)
-                    errorTwo = description;    
+                    errorTwo = description; 
+                       
                 this._showErrorDialog(errorOne, errorTwo);                       
             }
                 
@@ -243,14 +245,19 @@ const Record = new Lang.Class({
     },
     
     _showErrorDialog: function(errorStrOne, errorStrTwo) {
-        let errors = errorStrOne + " " + errorStrTwo;
         let errorDialog = new Gtk.MessageDialog ({ modal: true,
                                                    destroy_with_parent: true,
                                                    buttons: Gtk.ButtonsType.OK,
-                                                   message_type: Gtk.MessageType.WARNING,
-                                                   text: errors });
-
-        errorDialog.connect ('response', Lang.bind(this,
+                                                   message_type: Gtk.MessageType.ERROR });
+        if (errorStrOne != null) {
+            let strOne = errorDialog.set_property('text', errorStrOne);
+        }
+         
+        if (errorStrTwo != null)
+            errorDialog.set_property('secondary-text', errorStrTwo);
+            
+        errorDialog.set_transient_for(Gio.Application.get_default().get_active_window());
+        errorDialog.connect('response', Lang.bind(this,
             function() {
                 errorDialog.destroy();
                 MainWindow.view.onRecordStopClicked();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]