[gnome-control-center/gnome-3-8] background: Add test program for the selection dialog



commit fba69ce079bfddcd6d40bf7b165373d2fdd48851
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 2 13:38:27 2013 +0200

    background: Add test program for the selection dialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709243

 panels/background/Makefile.am           |   18 ++++++++++++------
 panels/background/test-chooser-dialog.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 6 deletions(-)
---
diff --git a/panels/background/Makefile.am b/panels/background/Makefile.am
index 5541911..f24f8b3 100644
--- a/panels/background/Makefile.am
+++ b/panels/background/Makefile.am
@@ -15,20 +15,18 @@ INCLUDES =                                          \
        -DGNOME_DESKTOP_USE_UNSTABLE_API                \
        $(NULL)
 
-noinst_LTLIBRARIES = libbackground.la
-
 BUILT_SOURCES =                        \
        cc-background-resources.c       \
        cc-background-resources.h       \
        gdesktop-enums-types.c          \
        gdesktop-enums-types.h
 
-libbackground_la_SOURCES =             \
+noinst_LTLIBRARIES = libbackground.la libbackground-chooser.la
+
+libbackground_chooser_la_SOURCES =     \
        $(BUILT_SOURCES)                \
        cc-background-chooser-dialog.c  \
        cc-background-chooser-dialog.h  \
-       cc-background-panel.c           \
-       cc-background-panel.h           \
        cc-background-item.c            \
        cc-background-item.h            \
        cc-background-xml.c             \
@@ -42,8 +40,11 @@ libbackground_la_SOURCES =           \
        bg-colors-source.c              \
        bg-colors-source.h
 
+libbackground_la_SOURCES =             \
+       cc-background-panel.c           \
+       cc-background-panel.h
 
-libbackground_la_LIBADD = $(PANEL_LIBS) $(BACKGROUND_PANEL_LIBS)
+libbackground_la_LIBADD = $(PANEL_LIBS) $(BACKGROUND_PANEL_LIBS) libbackground-chooser.la
 
 if WITH_LIBSOCIALWEB
 libbackground_la_SOURCES += bg-flickr-source.c bg-flickr-source.h
@@ -51,6 +52,11 @@ INCLUDES += $(SOCIALWEB_CFLAGS)
 libbackground_la_LIBADD += $(SOCIALWEB_LIBS)
 endif
 
+noinst_PROGRAMS = test-chooser-dialog
+test_chooser_dialog_SOURCES = test-chooser-dialog.c
+test_chooser_dialog_LDADD = libbackground-chooser.la
+test_chooser_dialog_LDFLAGS = $(PANEL_LIBS) $(BACKGROUND_PANEL_LIBS)
+
 resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/background.gresource.xml)
 cc-background-resources.c: background.gresource.xml $(resource_files)
        $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name 
cc_background $<
diff --git a/panels/background/test-chooser-dialog.c b/panels/background/test-chooser-dialog.c
new file mode 100644
index 0000000..b31e5aa
--- /dev/null
+++ b/panels/background/test-chooser-dialog.c
@@ -0,0 +1,28 @@
+#include <gtk/gtk.h>
+#include "cc-background-chooser-dialog.h"
+
+static void
+on_dialog_response (GtkDialog *dialog,
+                   int        response_id,
+                   gpointer   user_data)
+{
+       g_message ("response: %d", response_id);
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+       gtk_main_quit ();
+}
+
+int main (int argc, char **argv)
+{
+       GtkWidget *dialog;
+
+       gtk_init (&argc, &argv);
+
+       dialog = cc_background_chooser_dialog_new ();
+       g_signal_connect (G_OBJECT (dialog), "response",
+                         G_CALLBACK (on_dialog_response), NULL);
+       gtk_widget_show_all (dialog);
+
+       gtk_main ();
+
+       return 0;
+}


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