almanah r106 - in trunk: . src src/links
- From: pwithnall svn gnome org
- To: svn-commits-list gnome org
- Subject: almanah r106 - in trunk: . src src/links
- Date: Sun, 16 Nov 2008 12:41:51 +0000 (UTC)
Author: pwithnall
Date: Sun Nov 16 12:41:50 2008
New Revision: 106
URL: http://svn.gnome.org/viewvc/almanah?rev=106&view=rev
Log:
2008-11-16 Philip Withnall <philip tecnocode co uk>
* README:
* configure.ac: Updated GTK+ dependency to 2.14 for
gtk_show_uri().
* src/link.c (almanah_link_get_value),
(almanah_link_get_value2):
* src/link.h:
* src/links/file.c (file_format_value), (file_view):
* src/links/note.c (note_format_value), (note_view):
* src/links/uri.c (uri_format_value), (uri_view):
* src/main-window.c (mw_calendar_day_selected_cb):
* src/storage-manager.c
(almanah_storage_manager_add_entry_link):
Clean up the link API a little to reduce the number of string
duplications, and also clean up the code for viewing URIs and
files.
Modified:
trunk/ChangeLog
trunk/README
trunk/configure.ac
trunk/src/link.c
trunk/src/link.h
trunk/src/links/file.c
trunk/src/links/note.c
trunk/src/links/uri.c
trunk/src/main-window.c
trunk/src/storage-manager.c
Modified: trunk/README
==============================================================================
--- trunk/README (original)
+++ trunk/README Sun Nov 16 12:41:50 2008
@@ -11,7 +11,7 @@
Dependencies
============
-GNOME 2.22 development platform
+GNOME 2.24 development platform
http://www.gnome.org
SQLite 3
http://sqlite.org
@@ -31,7 +31,7 @@
====
Bugs should be filed in GNOME's Bugzilla:
-http://bugzilla.gnome.org/enter_bug.cgi?product=diary
+http://bugzilla.gnome.org/enter_bug.cgi?product=almanah
To get a better debug output, run:
# almanah --debug
@@ -40,4 +40,4 @@
=======
Philip Withnall <philip tecnocode co uk>
-http://tecnocode.co.uk/projects/diary
+http://tecnocode.co.uk/projects/almanah
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sun Nov 16 12:41:50 2008
@@ -68,7 +68,7 @@
AM_PROG_LIBTOOL
AM_GCONF_SOURCE_2
-PKG_CHECK_MODULES(STANDARD, glib-2.0 gtk+-2.0 >= 2.12 gmodule-2.0 gio-2.0 sqlite3 cairo gconf-2.0)
+PKG_CHECK_MODULES(STANDARD, glib-2.0 gtk+-2.0 >= 2.14 gmodule-2.0 gio-2.0 sqlite3 cairo gconf-2.0)
AC_SUBST(STANDARD_CFLAGS)
AC_SUBST(STANDARD_LIBS)
Modified: trunk/src/link.c
==============================================================================
--- trunk/src/link.c (original)
+++ trunk/src/link.c Sun Nov 16 12:41:50 2008
@@ -297,10 +297,10 @@
return klass->icon_name;
}
-gchar *
+const gchar *
almanah_link_get_value (AlmanahLink *self)
{
- return g_strdup (self->priv->value);
+ return self->priv->value;
}
void
@@ -310,10 +310,10 @@
self->priv->value = g_strdup (value);
}
-gchar *
+const gchar *
almanah_link_get_value2 (AlmanahLink *self)
{
- return g_strdup (self->priv->value2);
+ return self->priv->value2;
}
void
Modified: trunk/src/link.h
==============================================================================
--- trunk/src/link.h (original)
+++ trunk/src/link.h Sun Nov 16 12:41:50 2008
@@ -65,9 +65,9 @@
const gchar *almanah_link_get_name (AlmanahLink *self);
const gchar *almanah_link_get_description (AlmanahLink *self);
const gchar *almanah_link_get_icon_name (AlmanahLink *self);
-gchar *almanah_link_get_value (AlmanahLink *self);
+const gchar *almanah_link_get_value (AlmanahLink *self);
void almanah_link_set_value (AlmanahLink *self, const gchar *value);
-gchar *almanah_link_get_value2 (AlmanahLink *self);
+const gchar *almanah_link_get_value2 (AlmanahLink *self);
void almanah_link_set_value2 (AlmanahLink *self, const gchar *value);
G_END_DECLS
Modified: trunk/src/links/file.c
==============================================================================
--- trunk/src/links/file.c (original)
+++ trunk/src/links/file.c Sun Nov 16 12:41:50 2008
@@ -65,16 +65,16 @@
static gchar *
file_format_value (AlmanahLink *link)
{
- return almanah_link_get_value (link);
+ return g_strdup (almanah_link_get_value (link));
}
static gboolean
file_view (AlmanahLink *link)
{
GError *error = NULL;
- gchar *value = almanah_link_get_value (link);
+ const gchar *value = almanah_link_get_value (link);
- if (g_app_info_launch_default_for_uri (value, NULL, &error) == FALSE) {
+ if (gtk_show_uri (gtk_widget_get_screen (almanah->main_window), value, GDK_CURRENT_TIME, &error) == FALSE) {
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (almanah->main_window),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
_("Error opening file"));
@@ -82,13 +82,11 @@
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- g_free (value);
g_error_free (error);
return FALSE;
}
- g_free (value);
return TRUE;
}
Modified: trunk/src/links/note.c
==============================================================================
--- trunk/src/links/note.c (original)
+++ trunk/src/links/note.c Sun Nov 16 12:41:50 2008
@@ -65,13 +65,14 @@
static gchar *
note_format_value (AlmanahLink *link)
{
- return almanah_link_get_value (link);
+ return g_strdup (almanah_link_get_value (link));
}
static gboolean
note_view (AlmanahLink *link)
{
- gchar *value = almanah_link_get_value (link);
+ const gchar *value = almanah_link_get_value (link);
+
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (almanah->main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
@@ -79,7 +80,6 @@
"%s", value);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- g_free (value);
return TRUE;
}
Modified: trunk/src/links/uri.c
==============================================================================
--- trunk/src/links/uri.c (original)
+++ trunk/src/links/uri.c Sun Nov 16 12:41:50 2008
@@ -65,16 +65,16 @@
static gchar *
uri_format_value (AlmanahLink *link)
{
- return almanah_link_get_value (link);
+ return g_strdup (almanah_link_get_value (link));
}
static gboolean
uri_view (AlmanahLink *link)
{
GError *error = NULL;
- gchar *value = almanah_link_get_value (link);
+ const gchar *value = almanah_link_get_value (link);
- if (g_app_info_launch_default_for_uri (value, NULL, &error) == FALSE) {
+ if (gtk_show_uri (gtk_widget_get_screen (almanah->main_window), value, GDK_CURRENT_TIME, &error) == FALSE) {
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (almanah->main_window),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
_("Error opening URI"));
@@ -82,13 +82,11 @@
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- g_free (value);
g_error_free (error);
return FALSE;
}
- g_free (value);
return TRUE;
}
Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c (original)
+++ trunk/src/main-window.c Sun Nov 16 12:41:50 2008
@@ -863,7 +863,7 @@
i = 0;
while (links[i] != NULL) {
- gchar *value, *value2;
+ const gchar *value, *value2;
value = almanah_link_get_value (links[i]);
value2 = almanah_link_get_value2 (links[i]);
@@ -876,8 +876,6 @@
3, almanah_link_get_icon_name (links[i]),
-1);
- g_free (value);
- g_free (value2);
g_object_unref (links[i]);
i++;
Modified: trunk/src/storage-manager.c
==============================================================================
--- trunk/src/storage-manager.c (original)
+++ trunk/src/storage-manager.c Sun Nov 16 12:41:50 2008
@@ -908,8 +908,7 @@
almanah_storage_manager_add_entry_link (AlmanahStorageManager *self, GDate *date, AlmanahLink *link)
{
gboolean return_value;
- gchar *value, *value2;
- const gchar *type_id;
+ const gchar *type_id, *value, *value2;
type_id = almanah_link_get_type_id (link);
value = almanah_link_get_value (link);
@@ -932,9 +931,6 @@
value2);
}
- g_free (value);
- g_free (value2);
-
return return_value;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]