From 6544e8fe4cec675b96564c037c378b62c9b8b6c0 Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Tue, 27 Feb 2018 21:01:47 +0100 Subject: [PATCH] hide button for mobile panels --- ...ithub.artemanufrij.playmymusic.appdata.xml | 6 +- po/com.github.artemanufrij.playmymusic.pot | 97 ++++++++++--------- src/MainWindow.vala | 14 +-- src/Utils/Utils.vala | 4 + src/Widgets/Views/MobilePhone.vala | 58 +++++++---- 5 files changed, 106 insertions(+), 73 deletions(-) diff --git a/data/com.github.artemanufrij.playmymusic.appdata.xml b/data/com.github.artemanufrij.playmymusic.appdata.xml index 6231fd0..c19cc60 100644 --- a/data/com.github.artemanufrij.playmymusic.appdata.xml +++ b/data/com.github.artemanufrij.playmymusic.appdata.xml @@ -59,8 +59,12 @@ - + +

New:

+
    +
  • Hide button for Mobile Panel
  • +

Translation:

  • Catalan (by Adolfo Jayme-Barrientos)
  • diff --git a/po/com.github.artemanufrij.playmymusic.pot b/po/com.github.artemanufrij.playmymusic.pot index 8fa61c3..7c13b50 100644 --- a/po/com.github.artemanufrij.playmymusic.pot +++ b/po/com.github.artemanufrij.playmymusic.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-19 21:43+0100\n" +"POT-Creation-Date: 2018-02-27 21:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -136,28 +136,29 @@ msgstr "" msgid "Save" msgstr "" -#: ../src/Widgets/Views/TracksView.vala:153 -msgid "ID" +#: ../src/Widgets/Views/TracksView.vala:166 +msgid "Nr" msgstr "" -#: ../src/Widgets/Views/TracksView.vala:154 -msgid "Artist" +#: ../src/Widgets/Views/TracksView.vala:173 +msgid "Title" msgstr "" -#: ../src/Widgets/Views/TracksView.vala:161 +#: ../src/Widgets/Views/TracksView.vala:180 msgid "Album" msgstr "" -#: ../src/Widgets/Views/TracksView.vala:168 -msgid "Title" +#: ../src/Widgets/Views/TracksView.vala:182 +msgid "Artist" msgstr "" -#: ../src/Widgets/Views/TracksView.vala:173 -msgid "Nr" +#: ../src/Widgets/Views/TracksView.vala:187 +msgid "Duration" msgstr "" -#: ../src/Widgets/Views/TracksView.vala:178 -msgid "Duration" +#: ../src/Widgets/Views/TracksView.vala:258 ../src/MainWindow.vala:723 +#: ../src/MainWindow.vala:731 +msgid "%s by %s" msgstr "" #: ../src/Widgets/Views/PlaylistView.vala:101 @@ -196,6 +197,10 @@ msgstr "" msgid "Add a playlist for manage your favorite songs." msgstr "" +#: ../src/Widgets/Views/MobilePhone.vala:108 +msgid "Hide Mobile Panel" +msgstr "" + #: ../src/Widgets/Track.vala:69 msgid "" "File couldn't be found\n" @@ -214,33 +219,33 @@ msgstr "" msgid "Remove Radio Station" msgstr "" -#: ../src/Services/LibraryManager.vala:294 +#: ../src/Services/LibraryManager.vala:295 msgid "New Playlist" msgstr "" -#: ../src/Services/LibraryManager.vala:337 +#: ../src/Services/LibraryManager.vala:353 msgid "Choose an image…" msgstr "" -#: ../src/Services/LibraryManager.vala:339 -#: ../src/Services/LibraryManager.vala:360 +#: ../src/Services/LibraryManager.vala:355 +#: ../src/Services/LibraryManager.vala:376 msgid "_Cancel" msgstr "" -#: ../src/Services/LibraryManager.vala:340 -#: ../src/Services/LibraryManager.vala:361 +#: ../src/Services/LibraryManager.vala:356 +#: ../src/Services/LibraryManager.vala:377 msgid "_Open" msgstr "" -#: ../src/Services/LibraryManager.vala:343 +#: ../src/Services/LibraryManager.vala:359 msgid "Images" msgstr "" -#: ../src/Services/LibraryManager.vala:359 +#: ../src/Services/LibraryManager.vala:375 msgid "Select a folder." msgstr "" -#: ../src/Services/LibraryManager.vala:364 +#: ../src/Services/LibraryManager.vala:380 msgid "Folder" msgstr "" @@ -261,86 +266,90 @@ msgstr "" msgid "No Music Files found" msgstr "" -#: ../src/MainWindow.vala:137 +#: ../src/MainWindow.vala:146 msgid "Pause" msgstr "" -#: ../src/MainWindow.vala:157 ../src/MainWindow.vala:311 +#: ../src/MainWindow.vala:166 ../src/MainWindow.vala:308 msgid "Melody" msgstr "" -#: ../src/MainWindow.vala:160 ../src/MainWindow.vala:331 +#: ../src/MainWindow.vala:169 ../src/MainWindow.vala:329 msgid "Play" msgstr "" -#: ../src/MainWindow.vala:322 +#: ../src/MainWindow.vala:319 msgid "Previous" msgstr "" -#: ../src/MainWindow.vala:339 +#: ../src/MainWindow.vala:338 msgid "Next" msgstr "" -#: ../src/MainWindow.vala:388 +#: ../src/MainWindow.vala:389 msgid "Change Music Folder…" msgstr "" -#: ../src/MainWindow.vala:397 +#: ../src/MainWindow.vala:399 msgid "Import Music…" msgstr "" -#: ../src/MainWindow.vala:405 +#: ../src/MainWindow.vala:408 msgid "Reset all views" msgstr "" -#: ../src/MainWindow.vala:411 +#: ../src/MainWindow.vala:415 msgid "Resync Library" msgstr "" -#: ../src/MainWindow.vala:416 +#: ../src/MainWindow.vala:421 msgid "Preferences" msgstr "" -#: ../src/MainWindow.vala:436 +#: ../src/MainWindow.vala:442 msgid "Search Music" msgstr "" -#: ../src/MainWindow.vala:476 +#: ../src/MainWindow.vala:483 msgid "Shuffle" msgstr "" -#: ../src/MainWindow.vala:488 +#: ../src/MainWindow.vala:496 msgid "Repeat" msgstr "" -#: ../src/MainWindow.vala:555 +#: ../src/MainWindow.vala:534 +msgid "Loading…" +msgstr "" + +#: ../src/MainWindow.vala:534 +msgid "Reading out database content" +msgstr "" + +#: ../src/MainWindow.vala:572 msgid "Albums" msgstr "" -#: ../src/MainWindow.vala:559 +#: ../src/MainWindow.vala:576 msgid "Artists" msgstr "" -#: ../src/MainWindow.vala:564 +#: ../src/MainWindow.vala:581 msgid "Tracks" msgstr "" -#: ../src/MainWindow.vala:569 +#: ../src/MainWindow.vala:586 msgid "Playlists" msgstr "" -#: ../src/MainWindow.vala:574 +#: ../src/MainWindow.vala:591 msgid "Radio Stations" msgstr "" -#: ../src/MainWindow.vala:581 +#: ../src/MainWindow.vala:598 msgid "Audio CD" msgstr "" -#: ../src/MainWindow.vala:705 ../src/MainWindow.vala:713 -msgid "%s by %s" -msgstr "" - #: ../src/Dialogs/Preferences.vala:60 msgid "Use Dark Theme" msgstr "" diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 11f1210..8df3f42 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -549,7 +549,7 @@ namespace PlayMyMusic { this.show_all (); audio_cd_widget.hide (); - mobile_phone_view.set_reveal_child (false); + mobile_phone_view.reveal_child = false; mobile_phone_view.hide_spinner (); library_manager.device_manager.init (); @@ -643,7 +643,7 @@ namespace PlayMyMusic { private void show_albums () { mode_buttons.opacity = 1; if (mobile_phone_view.current_mobile_phone != null) { - mobile_phone_view.set_reveal_child (true); + mobile_phone_view.reveal_child = true; } content.visible_child_name = "albums"; search_entry.text = albums_view.filter; @@ -652,7 +652,7 @@ namespace PlayMyMusic { private void show_artists () { mode_buttons.opacity = 1; if (mobile_phone_view.current_mobile_phone != null) { - mobile_phone_view.set_reveal_child (true); + mobile_phone_view.reveal_child = true; } if (artist_button.sensitive) { content.visible_child_name = "artists"; @@ -665,7 +665,7 @@ namespace PlayMyMusic { private void show_tracks () { mode_buttons.opacity = 0; - mobile_phone_view.set_reveal_child (false); + mobile_phone_view.reveal_child = false; if (tracks_button.sensitive) { content.visible_child_name = "tracks"; search_entry.text = tracks_view.filter; @@ -677,7 +677,7 @@ namespace PlayMyMusic { private void show_playlists () { mode_buttons.opacity = 1; - mobile_phone_view.set_reveal_child (false); + mobile_phone_view.reveal_child = false; if (playlist_button.sensitive) { if (library_manager.player.play_mode != PlayMyMusic.Services.PlayMode.PLAYLIST || playlists_view.filter != "") { search_entry.grab_focus (); @@ -691,7 +691,7 @@ namespace PlayMyMusic { private void show_radiostations () { mode_buttons.opacity = 0; - mobile_phone_view.set_reveal_child (false); + mobile_phone_view.reveal_child = false; if (library_manager.player.current_radio == null || radios_view.filter != "") { search_entry.grab_focus (); } @@ -701,7 +701,7 @@ namespace PlayMyMusic { private void show_audio_cd () { mode_buttons.opacity = 1; - mobile_phone_view.set_reveal_child (false); + mobile_phone_view.reveal_child = false; if (library_manager.player.play_mode != PlayMyMusic.Services.PlayMode.AUDIO_CD || audio_cd_view.filter != "") { search_entry.grab_focus (); } diff --git a/src/Utils/Utils.vala b/src/Utils/Utils.vala index 8b4a1fc..e624bff 100644 --- a/src/Utils/Utils.vala +++ b/src/Utils/Utils.vala @@ -95,6 +95,10 @@ namespace PlayMyMusic.Utils { .track-drag-begin { border-top: 1px solid black; } + .mobile-close-button { + padding: 3px; + opacity: 0.75; + } """, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION ); diff --git a/src/Widgets/Views/MobilePhone.vala b/src/Widgets/Views/MobilePhone.vala index 1b61f9d..83bd8f4 100644 --- a/src/Widgets/Views/MobilePhone.vala +++ b/src/Widgets/Views/MobilePhone.vala @@ -29,7 +29,7 @@ namespace PlayMyMusic.Widgets.Views { public class MobilePhone : Gtk.Revealer { Services.LibraryManager library_manager; - public Objects.MobilePhone? current_mobile_phone { get; private set; default = null;} + public Objects.MobilePhone ? current_mobile_phone { get; private set; default = null; } public Granite.Widgets.SourceList folders { get; private set; } Gtk.Label title; @@ -41,16 +41,18 @@ namespace PlayMyMusic.Widgets.Views { construct { library_manager = Services.LibraryManager.instance; - library_manager.mobile_phone_connected.connect ((mobile_phone) => { - show_mobile_phone (mobile_phone); - set_reveal_child (true); - }); - library_manager.mobile_phone_disconnected.connect ((volume) => { - if (current_mobile_phone.volume == volume) { - set_reveal_child (false); - reset (); - } - }); + library_manager.mobile_phone_connected.connect ( + (mobile_phone) => { + show_mobile_phone (mobile_phone); + set_reveal_child (true); + }); + library_manager.mobile_phone_disconnected.connect ( + (volume) => { + if (current_mobile_phone.volume == volume) { + set_reveal_child (false); + reset (); + } + }); } public MobilePhone () { @@ -92,14 +94,27 @@ namespace PlayMyMusic.Widgets.Views { folders = new Granite.Widgets.SourceList (); folders.hexpand = false; folders.events |= Gdk.EventMask.KEY_RELEASE_MASK; - folders.key_release_event.connect ((key) => { - if (key.keyval == Gdk.Key.Delete && (folders.selected is Objects.MobilePhoneMusicFolder)) { - (folders.selected as Objects.MobilePhoneMusicFolder).delete (); - } - return true; - }); + folders.key_release_event.connect ( + (key) => { + if (key.keyval == Gdk.Key.Delete && (folders.selected is Objects.MobilePhoneMusicFolder)) { + (folders.selected as Objects.MobilePhoneMusicFolder).delete (); + } + return true; + }); + + var close_button = new Gtk.Button.from_icon_name ("pane-hide-symbolic-rtl", Gtk.IconSize.BUTTON); + close_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + close_button.get_style_context ().add_class ("mobile-close-button"); + close_button.tooltip_text = _("Hide Mobile Panel"); + close_button.valign = Gtk.Align.START; + close_button.halign = Gtk.Align.END; + close_button.clicked.connect ( + () => { + this.reveal_child = false; + }); var content = new Gtk.Grid (); + content.attach (close_button, 0, 0); content.attach (header, 0, 0); content.attach (folders, 0, 1); content.attach (new Gtk.Separator (Gtk.Orientation.VERTICAL), 1, 0, 1, 2); @@ -172,10 +187,11 @@ namespace PlayMyMusic.Widgets.Views { message.hide (); music_folder.collapsible = false; - Idle.add (() => { - folders.root.add (music_folder); - return false; - }); + Idle.add ( + () => { + folders.root.add (music_folder); + return false; + }); } } }