1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6
* Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
#include "file-utils.h"
26
#include "glib-utils.h"
27
#include "gtk-utils.h"
29
#include "fr-window.h"
30
#include "dlg-open-with.h"
40
app_chooser_response_cb (GtkDialog *dialog,
44
OpenData *o_data = user_data;
47
switch (response_id) {
49
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
50
if (app_info != NULL) {
51
fr_window_open_files_with_application (o_data->window, o_data->file_list, app_info);
52
g_object_unref (app_info);
55
gtk_widget_destroy (GTK_WIDGET (dialog));
58
case GTK_RESPONSE_CANCEL:
59
case GTK_RESPONSE_DELETE_EVENT:
61
gtk_widget_destroy (GTK_WIDGET (dialog));
71
dlg_open_with (FrWindow *window,
75
GtkWidget *app_chooser;
77
o_data = g_new0 (OpenData, 1);
78
o_data->window = window;
79
o_data->file_list = file_list;
81
app_chooser = gtk_app_chooser_dialog_new (GTK_WINDOW (window),
83
G_FILE (file_list->data));
84
g_signal_connect (app_chooser,
86
G_CALLBACK (app_chooser_response_cb),
88
gtk_widget_show (app_chooser);
93
open_with_cb (GtkWidget *widget,
96
FrWindow *window = callback_data;
99
file_list = fr_window_get_file_list_selection (window, FALSE, NULL);
100
if (file_list == NULL)
103
fr_window_open_files (window, file_list, TRUE);
104
_g_string_list_free (file_list);