X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=tests%2Ftestappchooser.c;h=221bd613ec133940f6cdc99c287d88fe502a73b9;hb=HEAD;hp=43b7f35e9be90c7ffed428c7aab40199c27cb993;hpb=a498d9a9bac007fb2b9b7ab3a960b853818867c2;p=~andy%2Fgtk
diff --git a/tests/testappchooser.c b/tests/testappchooser.c
index 43b7f35e9..221bd613e 100644
--- a/tests/testappchooser.c
+++ b/tests/testappchooser.c
@@ -13,11 +13,11 @@
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see .
*/
+#include "config.h"
+
#include
#include
@@ -26,7 +26,7 @@ static GFile *file;
static GtkWidget *grid, *file_l, *open;
static GtkWidget *radio_file, *radio_content, *dialog;
static GtkWidget *app_chooser_widget;
-static GtkWidget *recommended, *fallback, *other, *all;
+static GtkWidget *def, *recommended, *fallback, *other, *all;
static void
dialog_response (GtkDialog *d,
@@ -41,10 +41,14 @@ dialog_response (GtkDialog *d,
if (response_id == GTK_RESPONSE_OK)
{
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (d));
- name = g_app_info_get_name (app_info);
- g_print ("Application selected: %s\n", name);
-
- g_object_unref (app_info);
+ if (app_info)
+ {
+ name = g_app_info_get_name (app_info);
+ g_print ("Application selected: %s\n", name);
+ g_object_unref (app_info);
+ }
+ else
+ g_print ("No application selected\n");
}
gtk_widget_destroy (GTK_WIDGET (d));
@@ -54,6 +58,9 @@ dialog_response (GtkDialog *d,
static void
bind_props (void)
{
+ g_object_bind_property (def, "active",
+ app_chooser_widget, "show-default",
+ G_BINDING_SYNC_CREATE);
g_object_bind_property (recommended, "active",
app_chooser_widget, "show-recommended",
G_BINDING_SYNC_CREATE);
@@ -95,9 +102,11 @@ prepare_dialog (void)
g_object_unref (info);
dialog = gtk_app_chooser_dialog_new_for_content_type (GTK_WINDOW (toplevel),
- 0, content_type);
+ 0, content_type);
}
+ gtk_app_chooser_dialog_set_heading (GTK_APP_CHOOSER_DIALOG (dialog), "Select one already, you fool");
+
g_signal_connect (dialog, "response",
G_CALLBACK (dialog_response), NULL);
@@ -148,7 +157,6 @@ main (int argc, char **argv)
GtkWidget *w1;
gchar *path;
- g_type_init ();
gtk_init (&argc, &argv);
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -202,6 +210,11 @@ main (int argc, char **argv)
gtk_grid_attach_next_to (GTK_GRID (grid), all,
other, GTK_POS_RIGHT, 1, 1);
+ def = gtk_check_button_new_with_label ("Show default");
+ gtk_grid_attach_next_to (GTK_GRID (grid), def,
+ all, GTK_POS_RIGHT, 1, 1);
+
+ g_object_set (recommended, "active", TRUE, NULL);
prepare_dialog ();
g_signal_connect (open, "clicked",
G_CALLBACK (display_dialog), NULL);