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

« back to all changes in this revision

Viewing changes to src/links/note.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
 
 
24
 
#include "../interface.h"
25
 
#include "../main.h"
26
 
#include "../link.h"
27
 
 
28
 
gchar *
29
 
link_note_format_value (const DiaryLink *link)
30
 
{
31
 
        return g_strdup (link->value);
32
 
}
33
 
 
34
 
gboolean
35
 
link_note_view (const DiaryLink *link)
36
 
{
37
 
        GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (diary->main_window),
38
 
                                GTK_DIALOG_DESTROY_WITH_PARENT,
39
 
                                GTK_MESSAGE_INFO,
40
 
                                GTK_BUTTONS_CLOSE,
41
 
                                link->value);
42
 
        gtk_dialog_run (GTK_DIALOG (dialog));
43
 
        gtk_widget_destroy (dialog);
44
 
 
45
 
        return TRUE;
46
 
}
47
 
 
48
 
void
49
 
link_note_build_dialog (const gchar *type, GtkTable *dialog_table)
50
 
{
51
 
        GtkWidget *text_view, *scrolled_window;
52
 
 
53
 
        scrolled_window = gtk_scrolled_window_new (NULL, NULL);
54
 
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
55
 
                                        GTK_POLICY_AUTOMATIC,
56
 
                                        GTK_POLICY_AUTOMATIC);
57
 
        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
58
 
                                             GTK_SHADOW_IN);
59
 
        text_view = gtk_text_view_new ();
60
 
        gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
61
 
 
62
 
        gtk_table_attach_defaults (dialog_table, scrolled_window, 1, 3, 2, 3);
63
 
        gtk_widget_show_all (GTK_WIDGET (dialog_table));
64
 
 
65
 
        g_object_set_data (G_OBJECT (diary->add_link_dialog), "text-view", text_view);
66
 
}
67
 
 
68
 
void
69
 
link_note_get_values (DiaryLink *link)
70
 
{
71
 
        GtkTextView *text_view;
72
 
        GtkTextBuffer *buffer;
73
 
        GtkTextIter start_iter, end_iter;
74
 
 
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);
78
 
 
79
 
        link->value = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
80
 
        link->value2 = NULL;
81
 
}