summaryrefslogtreecommitdiff
path: root/gtk/gtkappchooserdialog.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-05-04 17:53:54 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2013-03-04 14:41:21 -0500
commit944fa635ae4e9bae6246e8137d8bb19d836e4e86 (patch)
tree54af593478ea9d9b6a02c3940f8bd10d89dafa37 /gtk/gtkappchooserdialog.c
parent0db32f0632ef4675bfcfc9ec201f7af157a48ab0 (diff)
downloadgtk+-944fa635ae4e9bae6246e8137d8bb19d836e4e86.tar.gz
appchooserdialog: remove redundant checks
This is checked by GIO for us now. Also, it's generally just a bad idea spawning error dialogs from inside a library on top of other dialogs: lesson learned. https://bugzilla.gnome.org/show_bug.cgi?id=675333
Diffstat (limited to 'gtk/gtkappchooserdialog.c')
-rw-r--r--gtk/gtkappchooserdialog.c72
1 files changed, 1 insertions, 71 deletions
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index b63f0df72a..00882d5584 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -212,71 +212,6 @@ ensure_online_button (GtkAppChooserDialog *self)
g_object_ref (self));
}
-/* An application is valid if:
- *
- * 1) The file exists
- * 2) The user has permissions to run the file
- */
-static gboolean
-check_application (GtkAppChooserDialog *self,
- GAppInfo **app_out)
-{
- const char *command;
- char *path = NULL;
- char **argv = NULL;
- int argc;
- GError *error = NULL;
- gint retval = TRUE;
- GAppInfo *info;
-
- command = NULL;
-
- info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
- if (info == NULL)
- {
- *app_out = NULL;
- return FALSE;
- }
-
- command = g_app_info_get_executable (info);
-
- g_shell_parse_argv (command, &argc, &argv, &error);
-
- if (error)
- {
- show_error_dialog (_("Could not run application"),
- error->message,
- GTK_WINDOW (self));
- g_error_free (error);
- retval = FALSE;
- goto cleanup;
- }
-
- path = g_find_program_in_path (argv[0]);
- if (!path)
- {
- char *error_message;
-
- error_message = g_strdup_printf (_("Could not find '%s'"),
- argv[0]);
-
- show_error_dialog (_("Could not find application"),
- error_message,
- GTK_WINDOW (self));
- g_free (error_message);
- retval = FALSE;
- goto cleanup;
- }
-
- *app_out = info;
-
- cleanup:
- g_strfreev (argv);
- g_free (path);
-
- return retval;
-}
-
static void
add_or_find_application (GtkAppChooserDialog *self)
{
@@ -606,12 +541,7 @@ 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;
+ return gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
}
static void