/*
 * GtkVolumeButton sppears buggy when placed inside a GtkDialog - one can't
 * interact with the volume slider using the mouse. Focus issue?
 *
 * gcc -o test test.c `pkg-config --libs --cflags gtk+-3.0`
 *
 */

#include <gtk/gtk.h>

void
btn_clicked_cb (GtkButton *button,
                gpointer dialog)
{
  gtk_dialog_run (GTK_DIALOG (dialog));
}

int
main (int argc, char **argv)
{
  GtkWidget *win, *btn, *dia, *volume;

  gtk_init (&argc, &argv);

  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_show (win);
  g_signal_connect (win, "destroy", gtk_main_quit, NULL);

  btn = gtk_button_new_with_label ("Volume");
  gtk_widget_show (btn);
  gtk_container_add (GTK_CONTAINER (win), btn);

  dia = gtk_dialog_new ();
  gtk_window_set_transient_for (GTK_WINDOW (dia), GTK_WINDOW (win));
  gtk_window_set_destroy_with_parent (GTK_WINDOW (dia), TRUE);
  gtk_window_set_modal (GTK_WINDOW (dia), TRUE);

  g_signal_connect (btn, "clicked", G_CALLBACK (btn_clicked_cb), dia);

  //volume = gtk_volume_button_new ();
  volume = gtk_scale_button_new (GTK_ICON_SIZE_MENU, 0.0, 1.0, 0.2, NULL);
  gtk_scale_button_set_value (GTK_SCALE_BUTTON (volume), 0.3);
  gtk_widget_show (volume);
  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dia))), volume);

  gtk_main ();

  return 0;
}
