~ubuntu-branches/ubuntu/maverick/almanah/maverick

« back to all changes in this revision

Viewing changes to src/links/file.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2009-05-16 15:49:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090516154921-2uhvlj8btb4qygmd
Tags: 0.6.1-0ubuntu1
* New upstream release (LP: #368078)
* debian/control:
  - Bump Standards-Version to 3.8.1
  - Add intltool, libedataserver1.2-dev, libedataserverui1.2-dev, 
    libecal1.2-dev, libcryptui-dev as build dependency
  - Remove build dependency on autotools-dev and chrpath
* debian/{control/compat/rules}: Move to mimalistic dh7 style
* Update debian/watch
* Update copyright information

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2
 
/*
3
 
 * Diary
4
 
 * Copyright (C) Philip Withnall 2008 <philip@tecnocode.co.uk>
5
 
 * 
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.
10
 
 *
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.
15
 
 *
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/>.
18
 
 */
19
 
 
20
 
#include <glib.h>
21
 
#include <gtk/gtk.h>
22
 
#include <glib/gi18n.h>
23
 
#include <gio/gio.h>
24
 
 
25
 
#include "../interface.h"
26
 
#include "../main.h"
27
 
#include "../link.h"
28
 
 
29
 
gchar *
30
 
link_file_format_value (const DiaryLink *link)
31
 
{
32
 
        return g_strdup (link->value);
33
 
}
34
 
 
35
 
gboolean
36
 
link_file_view (const DiaryLink *link)
37
 
{
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);
40
 
                return FALSE;
41
 
        }
42
 
        return TRUE;
43
 
}
44
 
 
45
 
void
46
 
link_file_build_dialog (const gchar *type, GtkTable *dialog_table)
47
 
{
48
 
        GtkWidget *chooser;
49
 
 
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));
53
 
 
54
 
        g_object_set_data (G_OBJECT (diary->add_link_dialog), "chooser", chooser);
55
 
}
56
 
 
57
 
void
58
 
link_file_get_values (DiaryLink *link)
59
 
{
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);
62
 
        link->value2 = NULL;
63
 
}