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_uri_format_value (const DiaryLink *link)
32
return g_strdup (link->value);
36
link_uri_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 URI cannot be opened."), diary->main_window);
46
link_uri_build_dialog (const gchar *type, GtkTable *dialog_table)
48
GtkWidget *label, *entry;
50
label = gtk_label_new (_("URI"));
51
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
53
entry = gtk_entry_new ();
54
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
56
gtk_table_attach_defaults (dialog_table, label, 1, 2, 2, 3);
57
gtk_table_attach_defaults (dialog_table, entry, 2, 3, 2, 3);
59
gtk_widget_show_all (GTK_WIDGET (dialog_table));
61
g_object_set_data (G_OBJECT (diary->add_link_dialog), "entry", entry);
65
link_uri_get_values (DiaryLink *link)
67
GtkEntry *entry = GTK_ENTRY (g_object_get_data (G_OBJECT (diary->add_link_dialog), "entry"));
68
link->value = g_strdup (gtk_entry_get_text (entry));