chiark / gitweb /
Refetch queue on pause/resume so that start times are always right (or
[disorder] / disobedience / queue-menu.c
index 8734cf6b0e6ef67a847d162caa8a8ebf6d2af746..52548711a420e695da759b010422cadacdaf834e 100644 (file)
@@ -135,14 +135,24 @@ static void ql_configure_menu(struct queuelike *ql) {
 }
 
 /** @brief Called when a button is released over a queuelike */
-gboolean ql_button_release(GtkWidget attribute((unused)) *widget,
+gboolean ql_button_release(GtkWidget*widget,
                            GdkEventButton *event,
                            gpointer user_data) {
   struct queuelike *ql = user_data;
 
   if(event->type == GDK_BUTTON_PRESS
      && event->button == 3) {
-    /* Right button click.   */
+    /* Right button click. */
+    if(gtk_tree_selection_count_selected_rows(ql->selection) == 0) {
+      /* Nothing is selected, select whatever is under the pointer */
+      GtkTreePath *path;
+      if(gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
+                                       event->x, event->y,
+                                       &path,
+                                       NULL,
+                                       NULL, NULL)) 
+        gtk_tree_selection_select_path(ql->selection, path);
+    }
     ql_create_menu(ql);
     ql_configure_menu(ql);
     gtk_widget_show_all(ql->menu);
@@ -154,6 +164,48 @@ gboolean ql_button_release(GtkWidget attribute((unused)) *widget,
   return FALSE;
 }
 
+static int ql_tab_selectall_sensitive(void *extra) {
+  return ql_selectall_sensitive(extra);
+}
+  
+static void ql_tab_selectall_activate(void *extra) {
+  ql_selectall_activate(NULL, extra);
+}
+  
+static int ql_tab_selectnone_sensitive(void *extra) {
+  return ql_selectnone_sensitive(extra);
+}
+  
+static void ql_tab_selectnone_activate(void *extra) {
+  ql_selectnone_activate(NULL, extra);
+}
+  
+static int ql_tab_properties_sensitive(void *extra) {
+  return ql_properties_sensitive(extra);
+}
+  
+static void ql_tab_properties_activate(void *extra) {
+  ql_properties_activate(NULL, extra);
+}
+
+struct tabtype *ql_tabtype(struct queuelike *ql) {
+  static const struct tabtype ql_tabtype = {
+    ql_tab_properties_sensitive,
+    ql_tab_selectall_sensitive,
+    ql_tab_selectnone_sensitive,
+    ql_tab_properties_activate,
+    ql_tab_selectall_activate,
+    ql_tab_selectnone_activate,
+    0,
+    0
+  };
+
+  struct tabtype *t = xmalloc(sizeof *t);
+  *t = ql_tabtype;
+  t->extra = ql;
+  return t;
+}
+
 /*
 Local Variables:
 c-basic-offset:2