[easytag/wip/musicbrainz-support-merge: 8/75] Make TreeView multi selectable



commit 2504a91e3b231a8fd1742bca91322d73eae22cae
Author: Abhinav <abhijangda hotmail com>
Date:   Thu Aug 7 22:25:28 2014 +0530

    Make TreeView multi selectable
    
    Modified GtkTreeView in EtMbEntityView to select more than one rows.

 src/mb_search.h    |    4 +++-
 src/mbentityview.c |   18 +++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/mb_search.h b/src/mb_search.h
index 4f7035f..6ba9e7b 100644
--- a/src/mb_search.h
+++ b/src/mb_search.h
@@ -32,6 +32,8 @@
  ****************/
 
 #define NAME_MAX_SIZE 256
+#define SEARCH_LIMIT_INT 2
+#define SEARCH_LIMIT_STR "2"
 
 GCancellable *mb5_search_cancellable;
 
@@ -92,4 +94,4 @@ et_musicbrainz_search (gchar *string, enum MB_ENTITY_TYPE type, GNode *root,
                        GError **error);
 void
 free_mb_tree (GNode *node);
-#endif /* __MB_SEARCH_H__ */
\ No newline at end of file
+#endif /* __MB_SEARCH_H__ */
diff --git a/src/mbentityview.c b/src/mbentityview.c
index 5e8801b..43ab295 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -955,10 +955,16 @@ et_mb_entity_view_select_up (EtMbEntityView *entity_view)
 
     priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
-    selected_rows = gtk_tree_selection_get_selected_rows (selection, &priv->filter);
+    selected_rows = gtk_tree_selection_get_selected_rows (selection,
+                                                          &priv->filter);
+    if (!selected_rows)
+    {
+        return;
+    }
+
     gtk_tree_model_get_iter (priv->filter, &iter,
                              (g_list_first (selected_rows)->data));
-    if (!gtk_tree_model_iter_next (priv->filter, &iter))
+    if (!gtk_tree_model_iter_previous (priv->filter, &iter))
     {
         goto exit;
     }
@@ -985,7 +991,13 @@ et_mb_entity_view_select_down (EtMbEntityView *entity_view)
 
     priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
-    selected_rows = gtk_tree_selection_get_selected_rows (selection, &priv->filter);
+    selected_rows = gtk_tree_selection_get_selected_rows (selection,
+                                                          &priv->filter);
+    if (!selected_rows)
+    {
+        return;
+    }
+
     gtk_tree_model_get_iter (priv->filter, &iter,
                              g_list_last (selected_rows)->data);
     if (!gtk_tree_model_iter_next (priv->filter, &iter))


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