Skip to content

Commit

Permalink
hide button for mobile panels
Browse files Browse the repository at this point in the history
  • Loading branch information
artemanufrij committed Feb 27, 2018
1 parent 88e754f commit 6544e8f
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 73 deletions.
6 changes: 5 additions & 1 deletion data/com.github.artemanufrij.playmymusic.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@
</screenshot>
</screenshots>
<releases>
<release version="0.6.3" date="2018-02-30">
<release version="0.6.3" date="2018-02-28">
<description>
<p>New:</p>
<ul>
<li>Hide button for Mobile Panel</li>
</ul>
<p>Translation:</p>
<ul>
<li>Catalan (by Adolfo Jayme-Barrientos)</li>
Expand Down
97 changes: 53 additions & 44 deletions po/com.github.artemanufrij.playmymusic.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -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 "<b>%s</b> by <b>%s</b>"
msgstr ""

#: ../src/Widgets/Views/PlaylistView.vala:101
Expand Down Expand Up @@ -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"
Expand All @@ -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 ""

Expand All @@ -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 "<b>%s</b> by <b>%s</b>"
msgstr ""

#: ../src/Dialogs/Preferences.vala:60
msgid "Use Dark Theme"
msgstr ""
Expand Down
14 changes: 7 additions & 7 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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 ();
Expand All @@ -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 ();
}
Expand All @@ -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 ();
}
Expand Down
4 changes: 4 additions & 0 deletions src/Utils/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
58 changes: 37 additions & 21 deletions src/Widgets/Views/MobilePhone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 () {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
});
}
}
}

0 comments on commit 6544e8f

Please sign in to comment.