static void gtk_app_chooser_dialog_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); switch (property_id) { case PROP_GFILE: set_gfile_and_content_type (self, g_value_get_object (value)); break; case PROP_CONTENT_TYPE: /* don't try to override a value previously set with the GFile */ if (self->priv->content_type == NULL) self->priv->content_type = g_value_dup_string (value); break; case PROP_HEADING: gtk_app_chooser_dialog_set_heading (self, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void prepare_dialog (void) { gboolean use_file = FALSE; gchar *content_type = NULL; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_file))) use_file = TRUE; else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_content))) use_file = FALSE; if (use_file) { dialog = gtk_app_chooser_dialog_new (GTK_WINDOW (toplevel), 0, file); } else { GFileInfo *info; info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL, NULL); content_type = g_strdup (g_file_info_get_content_type (info)); g_object_unref (info); dialog = gtk_app_chooser_dialog_new_for_content_type (GTK_WINDOW (toplevel), 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); g_free (content_type); app_chooser_widget = gtk_app_chooser_dialog_get_widget (GTK_APP_CHOOSER_DIALOG (dialog)); bind_props (); }
static void other_application_item_activated_cb (GtkAppChooserButton *self) { GtkWidget *dialog, *widget; GtkWindow *toplevel; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))); dialog = gtk_app_chooser_dialog_new_for_content_type (toplevel, GTK_DIALOG_DESTROY_WITH_PARENT, self->priv->content_type); gtk_window_set_modal (GTK_WINDOW (dialog), gtk_window_get_modal (toplevel)); gtk_app_chooser_dialog_set_heading (GTK_APP_CHOOSER_DIALOG (dialog), self->priv->heading); widget = gtk_app_chooser_dialog_get_widget (GTK_APP_CHOOSER_DIALOG (dialog)); g_object_set (widget, "show-fallback", TRUE, "show-other", TRUE, NULL); gtk_widget_show (dialog); g_signal_connect (dialog, "response", G_CALLBACK (other_application_dialog_response_cb), self); }