[gnome-music/playlists: 10/10] clean duplicated code



commit 35204ee8968b720e2c31fcd67e6abaac31d41da6
Author: Eslam Mostafa <me eslammostafa com>
Date:   Tue Jul 2 03:00:58 2013 +0200

    clean duplicated code

 src/view.js    |   46 ----------------------------------------------
 src/widgets.js |   32 --------------------------------
 2 files changed, 0 insertions(+), 78 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index a243bef..f058c1a 100644
--- a/src/view.js
+++ b/src/view.js
@@ -319,47 +319,13 @@ const Songs = new Lang.Class({
         this.countQuery = Query.songs_count;
         this._items = {};
         this.isStarred = null;
-<<<<<<< HEAD
         this.view = new Widgets.SongsList(player, this._model);
-=======
-        this.view = new Widgets.SongsList(player);
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
         this._iconHeight = 32;
         this._iconWidth = 32;
         this._symbolicIcon = albumArtCache.makeDefaultIcon(this._iconHeight, this._iconWidth)
         this.player = player;
     },
 
-<<<<<<< HEAD
-=======
-    _addItem: function(source, param, item) {
-        if (item != null) {
-            this._offset += 1;
-            var iter = this._model.append();
-            if ((item.get_title() == null) && (item.get_url() != null)) {
-                item.set_title (extractFileName(item.get_url()));
-            }
-            try{
-                if (item.get_url())
-                    this.player.discoverer.discover_uri(item.get_url());
-                this._model.set(
-                        iter,
-                        [5, 8, 9, 10],
-                        [item, nowPlayingIconName, false, false]
-                    );
-            } catch(err) {
-                log(err.message);
-                log("failed to discover url " + item.get_url());
-                this._model.set(
-                        iter,
-                        [5, 8, 9, 10],
-                        [item, errorIconName, false, true]
-                    );
-            }
-        }
-    },
-
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
     populate: function() {
         if (grilo.tracker != null)
             grilo.populateSongs (this._offset, Lang.bind(this, this.view.addItem, null));
@@ -489,30 +455,18 @@ const Playlists = new Lang.Class({
         this.view.set_hexpand(false);
         this.view.get_style_context().add_class("artist-panel");
         this.view.get_generic_view().get_selection().set_mode(Gtk.SelectionMode.SINGLE);
-<<<<<<< HEAD
         this._songsListWidget = new Widgets.SongsList(this.player, null);
         let builder = new Gtk.Builder();
         //builder.add_from_resource('/org/gnome/music/PlaylistControls.ui');
         //let controls = builder.get_object('container');
-=======
-        this._songsListWidget = new Widgets.SongsList(this.player);
-        let builder = new Gtk.Builder();
-        builder.add_from_resource('/org/gnome/music/PlaylistControls.ui');
-        let controls = builder.get_object('container');
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
         builder.add_from_resource('/org/gnome/music/PlaylistSongs.ui');
         let songsFrame = builder.get_object('container');
         let viewport = builder.get_object('viewport');
         viewport.add(this._songsListWidget);
         this._grid.attach(new Gtk.Separator(), 0, 1, 1, 1);
         //this._grid.attach(controls, 0, 2, 1, 1);
-<<<<<<< HEAD
         this._grid.attach(new Gtk.Separator({orientation: Gtk.Orientation.VERTICAL}), 1, 0, 1, 2);
         this._grid.attach(songsFrame, 2, 0, 2, 2);
-=======
-        this._grid.attach(new Gtk.Separator({orientation: Gtk.Orientation.VERTICAL}), 1, 0, 1, 3);
-        this._grid.attach(songsFrame, 2, 0, 2, 3);
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
         this._addListRenderers();
         if(Gtk.Settings.get_default().gtk_application_prefer_dark_theme) {
             this.view.get_generic_view().get_style_context().add_class("artist-panel-dark");
diff --git a/src/widgets.js b/src/widgets.js
index 7747873..422f39d 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -637,17 +637,12 @@ const SongsList = new Lang.Class({
     Name: "SongsList",
     Extends: Gd.MainView,
 
-<<<<<<< HEAD
     _init: function(player, model){
-=======
-    _init: function(player){
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
         this.parent();
         this.set_shadow_type(Gtk.ShadowType.NONE);
         this.player = player;
         this.set_view_type(Gd.MainViewType.LIST);
         this.get_generic_view().get_style_context().add_class("songs-list")
-<<<<<<< HEAD
         this.model = model;
         if (this.model == null) {
             this.model = Gtk.ListStore.new([
@@ -664,28 +659,12 @@ const SongsList = new Lang.Class({
             ]);
         }
         this.set_model(this.model);
-=======
-        this._model = Gtk.ListStore.new([
-            GObject.TYPE_STRING,
-            GObject.TYPE_STRING,
-            GObject.TYPE_STRING,
-            GObject.TYPE_STRING,
-            GdkPixbuf.Pixbuf,
-            GObject.TYPE_OBJECT,
-            GObject.TYPE_BOOLEAN,
-            GObject.TYPE_STRING,
-            GObject.TYPE_BOOLEAN,
-            GObject.TYPE_BOOLEAN
-        ]);
-        this.set_model(this._model);
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
         this._addListRenderers();
         this.show_all();
         this.connect('item-activated', Lang.bind(this, this._onItemActivated));
         this.player.connect('playlist-item-changed', Lang.bind(this, this.updateModel));
     },
 
-<<<<<<< HEAD
     addItem: function(source, param, item) {
         if (item != null) {
             this._offset += 1;
@@ -716,11 +695,6 @@ const SongsList = new Lang.Class({
     update: function(title, playlist) {
         this.playlist = playlist;
         this.model.clear();
-=======
-    update: function(title, playlist) {
-        this.playlist = playlist;
-        this._model.clear();
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
         this.show_all();
     },
 
@@ -736,15 +710,9 @@ const SongsList = new Lang.Class({
     },
 
     _onItemActivated: function (widget, id, path) {
-<<<<<<< HEAD
         var iter = this.model.get_iter(path)[1]
         if (this.model.get_value(iter, 7) != errorIconName) {
             this.player.setPlaylist("Playlist", null, this.model, iter, 5);
-=======
-        var iter = this._model.get_iter(path)[1]
-        if (this._model.get_value(iter, 7) != errorIconName) {
-            this.player.setPlaylist("Playlist", null, this._model, iter, 5);
->>>>>>> 4411477b1930fb8bf0910e666c6d4c28b1c3080c
             this.player.setPlaying(true);
         }
     },


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