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 gtk_app_chooser_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); switch (property_id) { case PROP_GFILE: if (self->priv->gfile != NULL) g_value_set_object (value, self->priv->gfile); break; case PROP_CONTENT_TYPE: g_value_set_string (value, self->priv->content_type); break; case PROP_HEADING: g_value_set_string (value, self->priv->heading); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void gtk_app_chooser_dialog_refresh (GtkAppChooser *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); gtk_app_chooser_refresh (GTK_APP_CHOOSER (self->priv->app_chooser_widget)); }
static void gtk_app_chooser_dialog_style_updated (GtkWidget *widget) { GTK_WIDGET_CLASS (gtk_app_chooser_dialog_parent_class)->style_updated (widget); update_spacings (GTK_APP_CHOOSER_DIALOG (widget)); }
static void gtk_app_chooser_dialog_finalize (GObject *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); g_free (self->priv->content_type); G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->finalize (object); }
static void gtk_app_chooser_dialog_dispose (GObject *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); g_clear_object (&self->priv->gfile); g_clear_object (&self->priv->online); G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->dispose (object); }
static GAppInfo * gtk_app_chooser_dialog_get_app_info (GtkAppChooser *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); GAppInfo *app = NULL; if (!check_application (self, &app)) return NULL; return app; }
static void gtk_app_chooser_dialog_constructed (GObject *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); if (G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed != NULL) G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed (object); build_dialog_ui (self); set_dialog_properties (self); ensure_online_button (self); }
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 gtk_app_chooser_dialog_constructed (GObject *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); if (G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed != NULL) G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->constructed (object); construct_appchooser_widget (self); set_dialog_properties (self); ensure_software_button (self); setup_search (self); }
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); }
static void gtk_app_chooser_dialog_response (GtkDialog *dialog, gint response_id, gpointer user_data) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (dialog); switch (response_id) { case GTK_RESPONSE_OK: add_or_find_application (self); break; default : break; } }
static void gtk_app_chooser_dialog_response (GtkDialog *dialog, gint response_id, gpointer user_data) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (dialog); switch (response_id) { case GTK_RESPONSE_OK: add_or_find_application (self); break; case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: self->priv->dismissed = TRUE; default: break; } }
static GAppInfo * gtk_app_chooser_dialog_get_app_info (GtkAppChooser *object) { GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object); return gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget)); }
GtkAppChooserDialog* cast_GtkAppChooserDialog(GtkWidget* widget) { return GTK_APP_CHOOSER_DIALOG(widget); }