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>
24
#include "../interface.h"
29
link_note_format_value (const DiaryLink *link)
31
return g_strdup (link->value);
35
link_note_view (const DiaryLink *link)
37
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (diary->main_window),
38
GTK_DIALOG_DESTROY_WITH_PARENT,
42
gtk_dialog_run (GTK_DIALOG (dialog));
43
gtk_widget_destroy (dialog);
49
link_note_build_dialog (const gchar *type, GtkTable *dialog_table)
51
GtkWidget *text_view, *scrolled_window;
53
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
54
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
56
GTK_POLICY_AUTOMATIC);
57
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
59
text_view = gtk_text_view_new ();
60
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
62
gtk_table_attach_defaults (dialog_table, scrolled_window, 1, 3, 2, 3);
63
gtk_widget_show_all (GTK_WIDGET (dialog_table));
65
g_object_set_data (G_OBJECT (diary->add_link_dialog), "text-view", text_view);
69
link_note_get_values (DiaryLink *link)
71
GtkTextView *text_view;
72
GtkTextBuffer *buffer;
73
GtkTextIter start_iter, end_iter;
75
text_view = GTK_TEXT_VIEW (g_object_get_data (G_OBJECT (diary->add_link_dialog), "text-view"));
76
buffer = gtk_text_view_get_buffer (text_view);
77
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
79
link->value = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);