* 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 <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <gtk/gtk.h>
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,
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));
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);
0, content_type);
}
+ gtk_app_chooser_dialog_set_heading (GTK_APP_CHOOSER_DIALOG (dialog), "Select one already, you <i>fool</i>");
+
g_signal_connect (dialog, "response",
G_CALLBACK (dialog_response), NULL);
GtkWidget *w1;
gchar *path;
- g_type_init ();
gtk_init (&argc, &argv);
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
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);