summaryrefslogtreecommitdiff
path: root/tests/cheese-test-chooser.c
blob: 9e79ae85876921ba28e23ba3abdc0197e14b6c1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

#include "cheese-config.h"

#include <stdlib.h>

#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
#include <clutter-gtk/clutter-gtk.h>
#include "cheese-avatar-chooser.h"
#include "cheese-gtk.h"

static void
response_cb (GtkDialog           *dialog,
             int                  response,
             CheeseAvatarChooser *chooser)
{
  if (response == GTK_RESPONSE_ACCEPT)
  {
    GdkPixbuf *pixbuf;
    g_message ("got pixbuf captured");
    g_object_get (G_OBJECT (chooser), "pixbuf", &pixbuf, NULL);
  }

  gtk_main_quit ();
}

int
main (int argc, char **argv)
{
  GtkWidget *window;

  gdk_threads_init ();

  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  if (!cheese_gtk_init (&argc, &argv))
    return EXIT_FAILURE;

  window = cheese_avatar_chooser_new ();
  g_signal_connect (G_OBJECT (window), "response",
                    G_CALLBACK (response_cb), window);

  gtk_widget_show_all (window);

  gtk_main ();

  gtk_widget_destroy (window);

  return EXIT_SUCCESS;
}