Commit 8692f5d8 authored by Matthias Clasen's avatar Matthias Clasen

docs: Add GtkEmojiChooser to the gallery

To make this possible enable the doc shooter
to take screenshots of popovers.
parent 42e2c549
......@@ -264,6 +264,7 @@ images = [
'images/ease-out.png',
'images/ease.png',
'images/editable-label.png',
'images/emojichooser.png',
'images/entry.png',
'images/exampleapp.png',
'images/expanders.png',
......
......@@ -23,6 +23,7 @@
<link linkend="GtkVideo"><inlinegraphic fileref="video.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkMediaControls"><inlinegraphic fileref="media-controls.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkWindowControls"><inlinegraphic fileref="windowcontrols.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkEmojiChooser"><inlinegraphic fileref="emojichooser.png" format="PNG"></inlinegraphic></link>
</para>
</section>
......
......@@ -112,7 +112,7 @@ snapshot_widget (GtkWidget *widget)
g_main_loop_unref (loop);
g_object_unref (paintable);
gtk_window_destroy (GTK_WINDOW (widget));
gtk_window_destroy (GTK_WINDOW (gtk_widget_get_root (widget)));
return surface;
}
......@@ -121,6 +121,7 @@ static gboolean
quit_cb (gpointer data)
{
*(gboolean *)data = TRUE;
g_main_context_wakeup (NULL);
return G_SOURCE_REMOVE;
}
......@@ -139,6 +140,7 @@ main (int argc, char **argv)
char *filename;
cairo_surface_t *surface;
GdkPixbuf *pixbuf;
GtkWidget *widget;
info = node->data;
......@@ -151,6 +153,18 @@ main (int argc, char **argv)
NULL);
}
if (info->snapshot_popover)
{
GtkWidget *button = gtk_window_get_child (GTK_WINDOW (info->window));
gtk_menu_button_popup (GTK_MENU_BUTTON (button));
widget = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button)));
}
else
{
widget = info->window;
}
if (info->wait > 0)
{
gboolean quit = FALSE;
......@@ -161,7 +175,7 @@ main (int argc, char **argv)
g_main_context_iteration (NULL, TRUE);
}
surface = snapshot_widget (info->window);
surface = snapshot_widget (widget);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
cairo_image_surface_get_width (surface),
......
......@@ -33,6 +33,18 @@ new_widget_info (const char *name,
gtk_window_set_resizable (GTK_WINDOW (info->window), FALSE);
info->include_decorations = TRUE;
}
else if (GTK_IS_POPOVER (widget))
{
GtkWidget *button;
info->snapshot_popover = TRUE;
info->window = gtk_window_new ();
gtk_window_set_decorated (GTK_WINDOW (info->window), FALSE);
info->include_decorations = TRUE;
button = gtk_menu_button_new ();
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), widget);
gtk_window_set_child (GTK_WINDOW (info->window), button);
}
else
{
info->window = gtk_window_new ();
......@@ -54,7 +66,7 @@ new_widget_info (const char *name,
gtk_widget_set_size_request (info->window, 240, 240);
break;
default:
break;
break;
}
return info;
......@@ -1549,6 +1561,21 @@ create_calendar (void)
return new_widget_info ("calendar", vbox, MEDIUM);
}
static WidgetInfo *
create_emojichooser (void)
{
GtkWidget *widget;
WidgetInfo *info;
widget = gtk_emoji_chooser_new ();
g_object_set (widget, "autohide", FALSE, NULL);
info = new_widget_info ("emojichooser", widget, ASIS);
info->wait = 2000;
return info;
}
GList *
get_all_widgets (void)
{
......@@ -1616,6 +1643,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_drop_down ());
retval = g_list_prepend (retval, create_window_controls ());
retval = g_list_prepend (retval, create_calendar ());
retval = g_list_prepend (retval, create_emojichooser ());
return retval;
}
......@@ -18,6 +18,7 @@ typedef struct WidgetInfo
char *name;
gboolean no_focus;
gboolean include_decorations;
gboolean snapshot_popover;
guint wait;
WidgetSize size;
} WidgetInfo;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment