2 * Copyright (C) 2002-2007 Imendio AB
3 * Copyright (C) 2007-2010 Collabora Ltd.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301 USA
20 * Authors: Mikael Hallendal <micke@imendio.com>
21 * Richard Hult <richard@imendio.com>
22 * Martyn Russell <martyn@imendio.com>
23 * Xavier Claessens <xclaesse@gmail.com>
24 * Jonny Lamb <jonny.lamb@collabora.co.uk>
25 * Travis Reitter <travis.reitter@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 <folks/folks.h>
39 #include <libempathy/empathy-contact.h>
40 #include <libempathy/empathy-ft-handler.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 typedef void (*EmpathyPixbufAvatarFromIndividualCb) (
50 FolksIndividual *individual,
54 void empathy_gtk_init (void);
57 GtkBuilder * empathy_builder_get_file (const gchar *filename,
58 const gchar *first_object,
60 void empathy_builder_connect (GtkBuilder *gui,
62 const gchar *first_object,
64 GtkWidget * empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
68 const gchar * empathy_icon_name_for_presence (
69 TpConnectionPresenceType presence);
70 const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
71 const gchar * empathy_icon_name_for_individual (FolksIndividual *individual);
72 const gchar * empathy_protocol_name_for_contact (EmpathyContact *contact);
73 GdkPixbuf * empathy_pixbuf_from_data (gchar *data,
75 GdkPixbuf * empathy_pixbuf_from_data_and_mime (gchar *data,
78 void empathy_pixbuf_avatar_from_individual_scaled_async (
79 FolksIndividual *individual,
82 GCancellable *cancellable,
83 GAsyncReadyCallback callback,
85 GdkPixbuf * empathy_pixbuf_avatar_from_individual_scaled_finish (
86 FolksIndividual *individual,
89 GdkPixbuf * empathy_pixbuf_from_avatar_scaled (EmpathyAvatar *avatar,
92 GdkPixbuf * empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact *contact,
95 GdkPixbuf * empathy_pixbuf_protocol_from_contact_scaled (
96 EmpathyContact *contact,
99 GdkPixbuf * empathy_pixbuf_contact_status_icon (EmpathyContact *contact,
100 gboolean show_protocol);
101 GdkPixbuf * empathy_pixbuf_contact_status_icon_with_icon_name (
102 EmpathyContact *contact,
103 const gchar *icon_name,
104 gboolean show_protocol);
105 GdkPixbuf * empathy_pixbuf_scale_down_if_necessary (GdkPixbuf *pixbuf,
107 GdkPixbuf * empathy_pixbuf_from_icon_name (const gchar *icon_name,
108 GtkIconSize icon_size);
109 GdkPixbuf * empathy_pixbuf_from_icon_name_sized (const gchar *icon_name,
111 gchar * empathy_filename_from_icon_name (const gchar *icon_name,
112 GtkIconSize icon_size);
115 gboolean empathy_text_iter_forward_search (const GtkTextIter*iter,
117 GtkTextIter *match_start,
118 GtkTextIter *match_end,
119 const GtkTextIter*limit);
120 gboolean empathy_text_iter_backward_search (const GtkTextIter*iter,
122 GtkTextIter *match_start,
123 GtkTextIter *match_end,
124 const GtkTextIter *limit);
127 void empathy_window_present (GtkWindow *window);
128 void empathy_window_present_with_time (GtkWindow *window,
130 GtkWindow * empathy_get_toplevel_window (GtkWidget *widget);
132 void empathy_move_to_window_desktop (GtkWindow *window,
136 gchar * empathy_make_absolute_url (const gchar *url);
138 gchar * empathy_make_absolute_url_len (const gchar *url,
140 void empathy_url_show (GtkWidget *parent,
144 void empathy_send_file (EmpathyContact *contact,
146 void empathy_send_file_from_uri_list (EmpathyContact *contact,
147 const gchar *uri_list);
148 void empathy_send_file_with_file_chooser (EmpathyContact *contact);
149 void empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler);
152 void empathy_make_color_whiter (GdkRGBA *color);
154 GtkWidget * empathy_context_menu_new (GtkWidget *attach_to);
156 gint64 empathy_get_current_action_time (void);
158 gboolean empathy_individual_match_string (
159 FolksIndividual *individual,
163 void empathy_launch_program (const gchar *dir,
167 void empathy_set_css_provider (GtkWidget *widget);
171 #endif /* __EMPATHY_UI_UTILS_H__ */