1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
4
* Copyright (C) Philip Withnall 2008 <philip@tecnocode.co.uk>
6
* Diary is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* Diary is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with Diary. If not, see <http://www.gnu.org/licenses/>.
22
#include <glib/gi18n.h>
25
#include "../interface.h"
30
link_file_format_value (const DiaryLink *link)
32
return g_strdup (link->value);
36
link_file_view (const DiaryLink *link)
38
if (g_app_info_launch_default_for_uri (link->value, NULL, NULL) == FALSE) {
39
diary_interface_error (_("Due to an unknown error the file cannot be opened."), diary->main_window);
46
link_file_build_dialog (const gchar *type, GtkTable *dialog_table)
50
chooser = gtk_file_chooser_button_new (_("Select File"), GTK_FILE_CHOOSER_ACTION_OPEN);
51
gtk_table_attach_defaults (dialog_table, chooser, 1, 3, 2, 3);
52
gtk_widget_show_all (GTK_WIDGET (dialog_table));
54
g_object_set_data (G_OBJECT (diary->add_link_dialog), "chooser", chooser);
58
link_file_get_values (DiaryLink *link)
60
GtkFileChooser *chooser = GTK_FILE_CHOOSER (g_object_get_data (G_OBJECT (diary->add_link_dialog), "chooser"));
61
link->value = gtk_file_chooser_get_uri (chooser);