question-avatar-chooser-hang



Hi,

For some time now I am trying to understand why the patch I made for
Empathy using cheese-avatar-chooser works only with a virtual camera.
If I try it with a real camera the interface hangs.
I have no idea were the problem is.
I have to test cases: one that works and one that doesn't.
The working test case creates a cheese-avatar-chooser in the callback
of a button.
The one that almost always hangs creates a file chooser, displays it
and then creates the cheese-avatar-chooser.
I attach the code.
When you have time please run it and maybe tell me why one works and
why the other doesn't.
If you have any idea were should I file a bug please let me know.


-- 
Raluca-Elena
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gst/gst.h>
#include <clutter-gtk/clutter-gtk.h>
#include "cheese-avatar-chooser.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 ();
}

static void
on_open_avatar (GtkWidget           *button,
                void                *nothing)
{
 	GtkWidget *chooser_window;
 	chooser_window = cheese_avatar_chooser_new (); 
 	g_signal_connect (G_OBJECT (chooser_window), "response",G_CALLBACK (response_cb),
 					 chooser_window);
        gtk_widget_show_all (chooser_window);
}

static void
on_open_image (GtkButton* button, gpointer user_data)
{
	GtkWidget *toplevel = gtk_widget_get_toplevel (button);
	GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Open image"),
	                                                 GTK_WINDOW (toplevel),
	                                                 GTK_FILE_CHOOSER_ACTION_OPEN,
	                                                 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
	                                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
	                                                 NULL);

	gtk_dialog_run (GTK_DIALOG (dialog));
	on_open_avatar (button, NULL);
	gtk_widget_destroy (dialog);
}

int
main (int argc, char *argv[])
{
 	GtkWidget *mwindow;
 	GtkWidget *button1;
	GtkWidget *button2;
 	GtkWidget *box;
	gtk_init (&argc, &argv); 
  	
  	gst_init (&argc, &argv);	
 	mwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 	box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
 	button1 = gtk_button_new_with_label ("Dialog crashes");
 	button2 = gtk_button_new_with_label ("Dialog works");
	gtk_box_pack_start (GTK_BOX (box), button2, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (box), button1, FALSE, FALSE, 0);
	gtk_container_add (GTK_CONTAINER (mwindow), box);	
	g_signal_connect(button2, "clicked", G_CALLBACK(on_open_avatar), NULL);
	g_signal_connect (button1, "clicked", G_CALLBACK (on_open_image), NULL);
	gtk_widget_show_all (mwindow);
	gtk_main ();
	return 0;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]