1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2002-2007 Imendio AB
4 * Copyright (C) 2007-2008 Collabora Ltd.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program 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 GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301 USA
21 * Authors: Mikael Hallendal <micke@imendio.com>
22 * Richard Hult <richard@imendio.com>
23 * Martyn Russell <martyn@imendio.com>
24 * Xavier Claessens <xclaesse@gmail.com>
25 * Jonny Lamb <jonny.lamb@collabora.co.uk>
27 * Part of this file is copied from GtkSourceView (gtksourceiter.c):
32 #ifndef __EMPATHY_UI_UTILS_H__
33 #define __EMPATHY_UI_UTILS_H__
37 #include <libempathy/empathy-contact.h>
38 #include <libempathy/empathy-ft-handler.h>
40 #include "empathy-chat-view.h"
44 #define EMPATHY_RECT_IS_ON_SCREEN(x,y,w,h) ((x) + (w) > 0 && \
46 (x) < gdk_screen_width () && \
47 (y) < gdk_screen_height ())
49 void empathy_gtk_init (void);
50 GRegex * empathy_uri_regex_dup_singleton (void);
53 GtkBuilder * empathy_builder_get_file (const gchar *filename,
54 const gchar *first_object,
56 void empathy_builder_connect (GtkBuilder *gui,
60 GtkWidget *empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
64 const gchar * empathy_icon_name_for_presence (TpConnectionPresenceType presence);
65 const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
66 GdkPixbuf * empathy_pixbuf_from_data (gchar *data,
68 GdkPixbuf * empathy_pixbuf_from_data_and_mime (gchar *data,
71 GdkPixbuf * empathy_pixbuf_from_avatar_scaled (EmpathyAvatar *avatar,
74 GdkPixbuf * empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact *contact,
77 GdkPixbuf * empathy_pixbuf_scale_down_if_necessary (GdkPixbuf *pixbuf,
79 GdkPixbuf * empathy_pixbuf_from_icon_name (const gchar *icon_name,
80 GtkIconSize icon_size);
81 GdkPixbuf * empathy_pixbuf_from_icon_name_sized (const gchar *icon_name,
83 gchar * empathy_filename_from_icon_name (const gchar *icon_name,
84 GtkIconSize icon_size);
87 gboolean empathy_text_iter_forward_search (const GtkTextIter*iter,
89 GtkTextIter *match_start,
90 GtkTextIter *match_end,
91 const GtkTextIter*limit);
92 gboolean empathy_text_iter_backward_search (const GtkTextIter*iter,
94 GtkTextIter *match_start,
95 GtkTextIter *match_end,
96 const GtkTextIter*limit);
98 gboolean empathy_window_get_is_visible (GtkWindow *window);
99 void empathy_window_present (GtkWindow *window,
100 gboolean steal_focus);
101 void empathy_window_iconify (GtkWindow *window,
102 GtkStatusIcon *status_icon);
103 GtkWindow * empathy_get_toplevel_window (GtkWidget *widget);
104 void empathy_url_show (GtkWidget *parent,
106 void empathy_toggle_button_set_state_quietly (GtkWidget *widget,
110 GtkWidget * empathy_link_button_new (const gchar *url,
113 void empathy_send_file (EmpathyContact *contact,
115 void empathy_send_file_from_uri_list (EmpathyContact *contact,
116 const gchar *uri_list);
117 void empathy_send_file_with_file_chooser (EmpathyContact *contact);
118 void empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler);
120 gchar * empathy_make_absolute_url (const gchar *url);
121 gchar * empathy_make_absolute_url_len (const gchar *url,
125 typedef struct _EmpathyStringParser EmpathyStringParser;
127 typedef void (*EmpathyStringReplace) (const gchar *text,
131 typedef void (*EmpathyStringMatch) (const gchar *text,
133 EmpathyStringReplace replace_func,
134 EmpathyStringParser *sub_parsers,
137 struct _EmpathyStringParser {
138 EmpathyStringMatch match_func;
139 EmpathyStringReplace replace_func;
143 empathy_string_parser_substr (const gchar *text,
145 EmpathyStringParser *parsers,
149 empathy_string_match_link (const gchar *text,
151 EmpathyStringReplace replace_func,
152 EmpathyStringParser *sub_parsers,
156 empathy_string_match_smiley (const gchar *text,
158 EmpathyStringReplace replace_func,
159 EmpathyStringParser *sub_parsers,
163 empathy_string_match_all (const gchar *text,
165 EmpathyStringReplace replace_func,
166 EmpathyStringParser *sub_parsers,
171 #endif /* __EMPATHY_UI_UTILS_H__ */