Commit 948fc073 authored by Canek Peláez's avatar Canek Peláez
Browse files

Warning dialogs.

parent 924517e2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,5 +5,6 @@
    <file preprocess="xml-stripblanks">mlm.ui</file>
    <file preprocess="xml-stripblanks">mlm.svg</file>
    <file preprocess="xml-stripblanks">shortcuts.ui</file>
    <file preprocess="xml-stripblanks">warning.ui</file>
  </gresource>
</gresources>

data/warning.ui

0 → 100644
+65 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk+" version="3.20"/>
  <template class="MLMWarningDialog" parent="GtkDialog">
    <property name="visible">false</property>
    <property name="type-hint">dialog</property>
    <property name="icon">resource:///mx/unam/MLM/mlm.svg</property>
    <child type="action">
      <object class="GtkButton" id="understood_button">
        <property name="label" translatable="yes">Understood</property>
        <property name="visible">true</property>
        <property name="can-default">true</property>
      </object>
    </child>
    <child type="titlebar">
      <object class="GtkHeaderBar" id="header">
        <property name="visible">true</property>
        <property name="title">Warning</property>
        <child>
          <object class="GtkBox" id="icon_box">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <property name="spacing">0</property>
            <property name="orientation">horizontal</property>
            <child>
              <object class="GtkImage" id="dialog_icon">
                <property name="visible">true</property>
                <property name="can-focus">false</property>
                <property name="margin-left">6</property>
                <property name="tooltip-text" translatable="yes">Warning</property>
                <property name="icon-name">dialog-warning-symbolic</property>
                <property name="icon-size">1</property>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>
    <child internal-child="vbox">
      <object class="GtkBox">
        <property name="orientation">horizontal</property>
        <property name="spacing">2</property>
        <child>
          <object class="GtkLabel" id="message_label">
            <property name="visible">true</property>
            <property name="can-focus">false</property>
            <property name="margin">20</property>
          </object>
        </child>
        <child>
          <object class="GtkImage" id="message_icon">
            <property name="visible">true</property>
            <property name="can-focus">false</property>
            <property name="margin">20</property>
            <property name="icon-name">dialog-warning-symbolic</property>
            <property name="icon-size">5</property>
          </object>
        </child>
      </object>
    </child>
    <action-widgets>
      <action-widget response="ok" default="true">understood_button</action-widget>
    </action-widgets>
  </template>
</interface>
+2 −1
Original line number Diff line number Diff line
@@ -135,7 +135,8 @@ mlm_gui_sources = [
  'src/application/main.vala',
  'src/application/media.vala',
  'src/application/player.vala',
  'src/application/shortcuts-window.vala'
  'src/application/shortcuts-window.vala',
  'src/application/warning-dialog.vala'
]

mlm_gui_dependencies = [
+11 −2
Original line number Diff line number Diff line
@@ -417,7 +417,9 @@ namespace MLM {
                FileUtils.get_data(fn, out data);
                return data;
            } catch (GLib.FileError fe) {
                warning(_("There was an error loading image '%s'").printf(fn));
                var bn = GLib.Path.get_basename(fn);
                var m = _("There was an error loading image '%s'").printf(bn);
                show_warning(m);
            }
            return null;
        }
@@ -447,12 +449,19 @@ namespace MLM {
                                            (int)(pixbuf.height*scale),
                                            Gdk.InterpType.BILINEAR);
            } catch (GLib.Error e) {
                warning(_("Could not set pixbuf from data."));
                show_warning(_("Could not set pixbuf from data."));
                set_default_image(image);
                return;
            }
            save_button.sensitive = true;
            image.set_from_pixbuf(thumb);
        }

        /* Shows a warning dialog. */
        private void show_warning(string message) {
            var dialog = new WarningDialog(this, message);
            dialog.run();
            dialog.destroy();
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ namespace MLM {
        /* The shortcuts action. */
        private void shortcuts() {
            if (shortcuts_window == null)
                shortcuts_window = new ShortcutsWindow();
                shortcuts_window = new ShortcutsWindow(window);
            shortcuts_window.show_all();
        }

Loading