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.
8
* You may redistribute it and/or modify it under the terms of the
9
* GNU General Public License, as published by the Free Software
10
* Foundation; either version 2 of the License, or (at your option)
13
* Diary is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
* See the GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Diary. If not, write to:
20
* The Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor
22
* Boston, MA 02110-1301, USA.
27
#include <glib/gi18n.h>
29
#include "../interface.h"
35
* value2: Google username
39
link_picasa_format_value (const DiaryLink *link)
41
/* Translators: First argument is the album name, second is the Google username. */
42
return g_strdup_printf (_("Picasa: %s by %s"), link->value2, link->value);
46
link_picasa_view (const DiaryLink *link)
48
gboolean return_value;
49
gchar *uri = g_strconcat ("http://picasaweb.google.com/", link->value2, "/", link->value, NULL);
51
return_value = g_app_info_launch_default_for_uri (uri, NULL, NULL);
53
if (return_value == FALSE)
54
diary_interface_error (_("Due to an unknown error the URI cannot be opened."), diary->main_window);
62
link_picasa_build_dialog (const gchar *type, GtkTable *dialog_table)
64
GtkWidget *label1, *entry1, *label2, *entry2;
66
/* Google username (value2) */
67
label1 = gtk_label_new (_("Google Username"));
68
gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
70
entry1 = gtk_entry_new ();
71
gtk_entry_set_activates_default (GTK_ENTRY (entry1), TRUE);
73
gtk_table_attach_defaults (dialog_table, label1, 1, 2, 2, 3);
74
gtk_table_attach_defaults (dialog_table, entry1, 2, 3, 2, 3);
76
/* Album name (value) */
77
label2 = gtk_label_new (_("Album Name"));
78
gtk_misc_set_alignment (GTK_MISC (label2), 0.0, 0.5);
80
entry2 = gtk_entry_new ();
81
gtk_entry_set_activates_default (GTK_ENTRY (entry2), TRUE);
83
gtk_table_attach_defaults (dialog_table, label2, 1, 2, 3, 4);
84
gtk_table_attach_defaults (dialog_table, entry2, 2, 3, 3, 4);
86
gtk_widget_show_all (GTK_WIDGET (dialog_table));
88
g_object_set_data (G_OBJECT (diary->add_link_dialog), "entry1", entry1);
89
g_object_set_data (G_OBJECT (diary->add_link_dialog), "entry2", entry2);
93
link_picasa_get_values (DiaryLink *link)
95
GtkEntry *entry1 = GTK_ENTRY (g_object_get_data (G_OBJECT (diary->add_link_dialog), "entry1"));
96
GtkEntry *entry2 = GTK_ENTRY (g_object_get_data (G_OBJECT (diary->add_link_dialog), "entry2"));
98
link->value = g_strdup (gtk_entry_get_text (entry1));
99
link->value2 = g_strdup (gtk_entry_get_text (entry2));