Attachment 'test-chooser-hang.c'

Download

   1 #include <gtk/gtk.h>
   2 #include <glib/gi18n.h>
   3 #include <gst/gst.h>
   4 #include <clutter-gtk/clutter-gtk.h>
   5 #include "cheese-avatar-chooser.h"
   6 
   7 static void
   8 response_cb (GtkDialog           *dialog,
   9              int                  response,
  10              CheeseAvatarChooser *chooser)
  11 {
  12 	if (response == GTK_RESPONSE_ACCEPT)
  13 	{
  14 		GdkPixbuf *pixbuf;
  15 		g_message ("got pixbuf captured");
  16 		g_object_get (G_OBJECT (chooser), "pixbuf", &pixbuf, NULL);
  17 	}
  18 
  19 	gtk_main_quit ();
  20 }
  21 
  22 static void
  23 on_open_avatar (GtkWidget           *button,
  24                 void                *nothing)
  25 {
  26  	GtkWidget *chooser_window;
  27  	chooser_window = cheese_avatar_chooser_new (); 
  28  	g_signal_connect (G_OBJECT (chooser_window), "response",G_CALLBACK (response_cb),
  29  					 chooser_window);
  30         gtk_widget_show_all (chooser_window);
  31 }
  32 
  33 static void
  34 on_open_image (GtkButton* button, gpointer user_data)
  35 {
  36 	GtkWidget *toplevel = gtk_widget_get_toplevel (button);
  37 	GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Open image"),
  38 	                                                 GTK_WINDOW (toplevel),
  39 	                                                 GTK_FILE_CHOOSER_ACTION_OPEN,
  40 	                                                 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
  41 	                                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
  42 	                                                 NULL);
  43 
  44 	gtk_dialog_run (GTK_DIALOG (dialog));
  45 	on_open_avatar (button, NULL);
  46 	gtk_widget_destroy (dialog);
  47 }
  48 
  49 int
  50 main (int argc, char *argv[])
  51 {
  52  	GtkWidget *mwindow;
  53  	GtkWidget *button1;
  54 	GtkWidget *button2;
  55  	GtkWidget *box;
  56 	gtk_init (&argc, &argv); 
  57   	
  58   	gst_init (&argc, &argv);	
  59  	mwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  60  	box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  61  	button1 = gtk_button_new_with_label ("Dialog crashes");
  62  	button2 = gtk_button_new_with_label ("Dialog works");
  63 	gtk_box_pack_start (GTK_BOX (box), button2, FALSE, FALSE, 0);
  64 	gtk_box_pack_start (GTK_BOX (box), button1, FALSE, FALSE, 0);
  65 	gtk_container_add (GTK_CONTAINER (mwindow), box);	
  66 	g_signal_connect(button2, "clicked", G_CALLBACK(on_open_avatar), NULL);
  67 	g_signal_connect (button1, "clicked", G_CALLBACK (on_open_image), NULL);
  68 	gtk_widget_show_all (mwindow);
  69 	gtk_main ();
  70 	return 0;
  71 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-02-25 09:57:26, 68.9 KB) [[attachment:Empathy-Take-a-photo-dialog.png]]
  • [get | view] (2021-02-25 09:57:26, 251.8 KB) [[attachment:Screenshot-1.1.png]]
  • [get | view] (2021-02-25 09:57:26, 103.8 KB) [[attachment:Screenshot-1.png]]
  • [get | view] (2021-02-25 09:57:26, 492.9 KB) [[attachment:Screenshot-2.2.png]]
  • [get | view] (2021-02-25 09:57:26, 477.9 KB) [[attachment:Screenshot-3.3.png]]
  • [get | view] (2021-02-25 09:57:26, 496.0 KB) [[attachment:Screenshot-4.4.png]]
  • [get | view] (2021-02-25 09:57:26, 577.0 KB) [[attachment:Screenshot-Call with gabble.echo@test.collabora.co.uk-2.png]]
  • [get | view] (2021-02-25 09:57:26, 350.3 KB) [[attachment:Screenshot-Call with gabble.echo@test.collabora.co.uk-4.png]]
  • [get | view] (2021-02-25 09:57:26, 250.3 KB) [[attachment:Screenshot-Call with gabble.echo@test.collabora.co.uk.png]]
  • [get | view] (2021-02-25 09:57:26, 364.1 KB) [[attachment:Screenshot.png]]
  • [get | view] (2021-02-25 09:57:26, 107.5 KB) [[attachment:best-button-preview-effects.png]]
  • [get | view] (2021-02-25 09:57:26, 53.0 KB) [[attachment:button_middle.png]]
  • [get | view] (2021-02-25 09:57:26, 53.6 KB) [[attachment:camerabin.png]]
  • [get | view] (2021-02-25 09:57:26, 58.2 KB) [[attachment:camerabin2.png]]
  • [get | view] (2021-02-25 09:57:26, 279.0 KB) [[attachment:post-caps.dot.png]]
  • [get | view] (2021-02-25 09:57:26, 279.6 KB) [[attachment:pre-caps.dot.png]]
  • [get | view] (2021-02-25 09:57:26, 2.2 KB) [[attachment:test-chooser-hang.c]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.