background: Add test program for the selection dialog

https://bugzilla.gnome.org/show_bug.cgi?id=709243
This commit is contained in:
Bastien Nocera 2013-10-02 13:38:27 +02:00
parent c2413a3c3e
commit d331444591
2 changed files with 40 additions and 6 deletions

View file

@ -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 $<

View file

@ -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;
}