mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
open-with-dialog: remove automatic setting of support-for-type
We don't want to hardcode any kind of policy in these widgets/dialogs from now on.
This commit is contained in:
parent
3b6941f087
commit
4cfe121296
@ -187,55 +187,6 @@ check_application (GtkOpenWithDialog *self,
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
add_or_find_application (GtkOpenWithDialog *self)
|
||||
{
|
||||
GAppInfo *app;
|
||||
GList *applications;
|
||||
|
||||
app = gtk_open_with_get_app_info (GTK_OPEN_WITH (self));
|
||||
|
||||
if (app == NULL)
|
||||
{
|
||||
/* TODO: better error? */
|
||||
show_error_dialog (_("Could not add application"),
|
||||
NULL,
|
||||
GTK_WINDOW (self));
|
||||
return;
|
||||
}
|
||||
|
||||
applications = g_app_info_get_all_for_type (self->priv->content_type);
|
||||
if (self->priv->content_type != NULL && applications != NULL)
|
||||
{
|
||||
/* we don't care about reporting errors here */
|
||||
g_app_info_add_supports_type (app,
|
||||
self->priv->content_type,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (applications != NULL)
|
||||
g_list_free_full (applications, g_object_unref);
|
||||
|
||||
g_object_unref (app);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_open_with_dialog_response (GtkDialog *dialog,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkOpenWithDialog *self = GTK_OPEN_WITH_DIALOG (dialog);
|
||||
|
||||
switch (response_id)
|
||||
{
|
||||
case GTK_RESPONSE_OK:
|
||||
add_or_find_application (self);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
widget_application_selected_cb (GtkOpenWithWidget *widget,
|
||||
GAppInfo *app_info,
|
||||
@ -537,12 +488,6 @@ gtk_open_with_dialog_init (GtkOpenWithDialog *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_OPEN_WITH_DIALOG,
|
||||
GtkOpenWithDialogPrivate);
|
||||
|
||||
/* we can't override the class signal handler here, as it's a RUN_LAST;
|
||||
* we want our signal handler instead to be executed before any user code.
|
||||
*/
|
||||
g_signal_connect (self, "response",
|
||||
G_CALLBACK (gtk_open_with_dialog_response), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user