#include <time.h>
#include <glib/gi18n-lib.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkimagemenuitem.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtksizegroup.h>
-#include <glade/glade.h>
+#include <gtk/gtk.h>
#include <telepathy-glib/util.h>
#include <libmissioncontrol/mc-account.h>
#define MAX_SCROLL_TIME 0.4 /* seconds */
#define SCROLL_DELAY 33 /* milliseconds */
-#define SCHEMES "(https?|ftps?|nntp|news|javascript|about|ghelp|apt|telnet|"\
- "file|webcal|mailto)"
-#define BODY "([^\\ ]+)"
-#define END_BODY "([^\\ ]*[^,;\?><()\\ \"\\.])"
-#define URI_REGEX "("SCHEMES"://"END_BODY")" \
- "|((mailto:)?"BODY"@"BODY"\\."END_BODY")"\
- "|((www|ftp)\\."END_BODY")"
-static GRegex *uri_regex = NULL;
-
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatTextView)
typedef struct {
&start, &end, FALSE);
}
- if (G_STR_EMPTY (str)) {
+ if (EMP_STR_EMPTY (str)) {
g_free (str);
return;
}
date = g_date_new ();
g_date_set_time_t (date, timestamp);
- g_date_strftime (buf, 256, _("%A %d %B %Y"), date);
+ /* Translators: timestamp displayed between conversations in
+ * chat windows (strftime format string) */
+ g_date_strftime (buf, 256, _("%A %B %d %Y"), date);
g_string_append (str, buf);
g_string_append (str, ", ");
g_date_free (date);
g_return_if_fail (EMPATHY_IS_CHAT_TEXT_VIEW (view));
- g_return_if_fail (!G_STR_EMPTY (str));
+ g_return_if_fail (!EMP_STR_EMPTY (str));
bottom = chat_text_view_is_scrolled_down (text_view);
chat_text_view_maybe_trim_buffer (EMPATHY_CHAT_TEXT_VIEW (view));
buffer = priv->buffer;
- if (G_STR_EMPTY (search_criteria)) {
+ if (EMP_STR_EMPTY (search_criteria)) {
if (priv->find_mark_previous) {
gtk_text_buffer_get_start_iter (buffer, &iter_at_mark);
buffer = priv->buffer;
- if (G_STR_EMPTY (search_criteria)) {
+ if (EMP_STR_EMPTY (search_criteria)) {
if (priv->find_mark_next) {
gtk_text_buffer_get_start_iter (buffer, &iter_at_mark);
&iter_start,
&iter_end);
- if (G_STR_EMPTY (text)) {
+ if (EMP_STR_EMPTY (text)) {
return;
}
GtkTextIter start_iter, end_iter;
GtkTextMark *mark;
GtkTextIter iter;
+ GRegex *uri_regex;
GMatchInfo *match_info;
gboolean match;
gint last = 0;
gtk_text_buffer_get_end_iter (priv->buffer, &start_iter);
mark = gtk_text_buffer_create_mark (priv->buffer, NULL, &start_iter, TRUE);
- if (!uri_regex) {
- uri_regex = g_regex_new (URI_REGEX, 0, 0, NULL);
- }
-
+ uri_regex = empathy_uri_regex_dup_singleton ();
for (match = g_regex_match (uri_regex, body, 0, &match_info); match;
match = g_match_info_next (match_info, NULL)) {
if (!g_match_info_fetch_pos (match_info, 0, &s, &e))
last = e;
}
g_match_info_free (match_info);
+ g_regex_unref (uri_regex);
if (last < strlen (body)) {
gtk_text_buffer_get_end_iter (priv->buffer, &iter);