chiark / gitweb /
Don't allocate per-queue tabtype. In fact the allocate version broken
[disorder] / disobedience / queue-menu.c
index d7d18ea961cd3a3e5f50c36f2898219ac6f525a0..ac3479aa9fbda091a47c99974ced396cfe92fb7d 100644 (file)
@@ -93,8 +93,7 @@ static void ql_remove_sensitive_callback(GtkTreeModel *model,
                                          GtkTreePath attribute((unused)) *path,
                                          GtkTreeIter *iter,
                                          gpointer data) {
-  struct queuelike *ql = g_object_get_data(G_OBJECT(model), "ql");
-  struct queue_entry *q = ql_iter_to_q(ql, iter);
+  struct queue_entry *q = ql_iter_to_q(model, iter);
   const int removable = (q != playing_track
                          && right_removable(last_rights, config->username, q));
   int *const counts = data;
@@ -121,8 +120,7 @@ static void ql_remove_activate_callback(GtkTreeModel *model,
                                         GtkTreePath attribute((unused)) *path,
                                         GtkTreeIter *iter,
                                         gpointer attribute((unused)) data) {
-  struct queuelike *ql = g_object_get_data(G_OBJECT(model), "ql");
-  struct queue_entry *q = ql_iter_to_q(ql, iter);
+  struct queue_entry *q = ql_iter_to_q(model, iter);
 
   disorder_eclient_remove(client, q->id, ql_remove_completed, q);
 }
@@ -151,8 +149,7 @@ static void ql_play_activate_callback(GtkTreeModel *model,
                                       GtkTreePath attribute((unused)) *path,
                                       GtkTreeIter *iter,
                                       gpointer attribute((unused)) data) {
-  struct queuelike *ql = g_object_get_data(G_OBJECT(model), "ql");
-  struct queue_entry *q = ql_iter_to_q(ql, iter);
+  struct queue_entry *q = ql_iter_to_q(model, iter);
 
   disorder_eclient_play(client, q->track, ql_play_completed, q);
 }
@@ -261,10 +258,9 @@ struct tabtype *ql_tabtype(struct queuelike *ql) {
     0
   };
 
-  struct tabtype *t = xmalloc(sizeof *t);
-  *t = ql_tabtype;
-  t->extra = ql;
-  return t;
+  ql->tabtype = ql_tabtype;
+  ql->tabtype.extra = ql;
+  return &ql->tabtype;
 }
 
 /*