[gtk+] Add a test for dialog placement with csd
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a test for dialog placement with csd
- Date: Mon, 13 May 2013 10:05:59 +0000 (UTC)
commit 1b99a016a361e2fd02a6285ef63d965b24f14ce6
Author: Matthias Clasen <mclasen redhat com>
Date: Mon May 13 06:06:10 2013 -0400
Add a test for dialog placement with csd
Taken from
https://bugzilla.gnome.org/show_bug.cgi?id=700056
tests/testheaderbar.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c
index 18b2b42..a04be6f 100644
--- a/tests/testheaderbar.c
+++ b/tests/testheaderbar.c
@@ -1,7 +1,7 @@
#include <gtk/gtk.h>
static const gchar css[] =
- ".background { "
+ ".main.background { "
" background-image: -gtk-gradient (linear, center top, center bottom, "
" from (red), "
" to (blue)); "
@@ -21,6 +21,25 @@ static const gchar css[] =
"}";
static void
+on_bookmark_clicked (GtkButton *button, gpointer data)
+{
+ GtkWindow *window = GTK_WINDOW (data);
+ GtkWidget *chooser;
+
+ chooser = gtk_file_chooser_dialog_new ("File Chooser Test",
+ window,
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE,
+ NULL);
+
+ g_signal_connect (chooser, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+
+ gtk_widget_show (chooser);
+}
+
+static void
change_title (GtkButton *button, gpointer data)
{
GtkWidget *headerbar = GTK_WIDGET (data);
@@ -84,6 +103,7 @@ main (int argc, char *argv[])
gtk_init (NULL, NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_style_context_add_class (gtk_widget_get_style_context (window), "main");
header = gtk_header_bar_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (header), "titlebar");
@@ -103,6 +123,7 @@ main (int argc, char *argv[])
button = gtk_button_new ();
image = gtk_image_new_from_icon_name ("bookmark-new-symbolic", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (button, "clicked", G_CALLBACK (on_bookmark_clicked), window);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]