[gtk/matthiasc/for-master] docs: Add GtkEmojiChooser to the gallery
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] docs: Add GtkEmojiChooser to the gallery
- Date: Mon, 26 Oct 2020 04:31:49 +0000 (UTC)
commit c3df4fc832bc569ee2bd613df57792c7dc06e519
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 25 23:18:51 2020 -0400
docs: Add GtkEmojiChooser to the gallery
To make this possible enable the doc shooter
to take screenshots of popovers.
docs/reference/gtk/images/emojichooser.png | Bin 0 -> 55610 bytes
docs/reference/gtk/meson.build | 1 +
docs/reference/gtk/visual_index.xml | 1 +
docs/tools/shooter.c | 17 ++++++++++++++--
docs/tools/widgets.c | 30 ++++++++++++++++++++++++++++-
docs/tools/widgets.h | 1 +
6 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gtk/images/emojichooser.png b/docs/reference/gtk/images/emojichooser.png
new file mode 100644
index 0000000000..e68b9ce3b4
Binary files /dev/null and b/docs/reference/gtk/images/emojichooser.png differ
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index b00bdb5285..3f7ff975f4 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -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',
diff --git a/docs/reference/gtk/visual_index.xml b/docs/reference/gtk/visual_index.xml
index 97c3644e52..4164e0ec86 100644
--- a/docs/reference/gtk/visual_index.xml
+++ b/docs/reference/gtk/visual_index.xml
@@ -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>
diff --git a/docs/tools/shooter.c b/docs/tools/shooter.c
index ff81d44e1f..58bccc609b 100644
--- a/docs/tools/shooter.c
+++ b/docs/tools/shooter.c
@@ -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;
}
@@ -139,6 +139,7 @@ main (int argc, char **argv)
char *filename;
cairo_surface_t *surface;
GdkPixbuf *pixbuf;
+ GtkWidget *widget;
info = node->data;
@@ -151,6 +152,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 +174,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),
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 7583272577..a920ad21ac 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -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;
}
diff --git a/docs/tools/widgets.h b/docs/tools/widgets.h
index 99e0d4a1fa..3ef1d61dce 100644
--- a/docs/tools/widgets.h
+++ b/docs/tools/widgets.h
@@ -18,6 +18,7 @@ typedef struct WidgetInfo
char *name;
gboolean no_focus;
gboolean include_decorations;
+ gboolean snapshot_popover;
guint wait;
WidgetSize size;
} WidgetInfo;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]