forked from AuroraMiddleware/gtk
widget-factory: Port to async dialog API
This commit is contained in:
parent
756888a53d
commit
ad2552ee43
@ -214,10 +214,19 @@ activate_background (GSimpleAction *action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_chooser_response (GtkNativeDialog *self,
|
file_chooser_response (GObject *source,
|
||||||
int response)
|
GAsyncResult *result,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
gtk_native_dialog_destroy (self);
|
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||||
|
GFile *file;
|
||||||
|
|
||||||
|
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
g_print ("File selected: %s", g_file_peek_path (file));
|
||||||
|
g_object_unref (file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -225,17 +234,11 @@ activate_open_file (GSimpleAction *action,
|
|||||||
GVariant *parameter,
|
GVariant *parameter,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkFileChooserNative *chooser;
|
GtkFileDialog *dialog;
|
||||||
|
|
||||||
chooser = gtk_file_chooser_native_new ("Open file",
|
dialog = gtk_file_dialog_new ();
|
||||||
NULL,
|
gtk_file_dialog_open (dialog, NULL, NULL, NULL, file_chooser_response, NULL);
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
g_object_unref (dialog);
|
||||||
"Open",
|
|
||||||
"Cancel");
|
|
||||||
|
|
||||||
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), NULL);
|
|
||||||
|
|
||||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user