]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-ui-utils.h
remove useless chat-view.h includes
[empathy.git] / libempathy-gtk / empathy-ui-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2002-2007 Imendio AB
4  * Copyright (C) 2007-2010 Collabora Ltd.
5  *
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.
10  *
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.
15  *
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
20  *
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>
26  *          Travis Reitter <travis.reitter@collabora.co.uk>
27  *
28  *          Part of this file is copied from GtkSourceView (gtksourceiter.c):
29  *          Paolo Maggi
30  *          Jeroen Zwartepoorte
31  */
32
33 #ifndef __EMPATHY_UI_UTILS_H__
34 #define __EMPATHY_UI_UTILS_H__
35
36 #include <gtk/gtk.h>
37
38 #include <folks/folks.h>
39
40 #include <libempathy/empathy-contact.h>
41 #include <libempathy/empathy-ft-handler.h>
42
43 G_BEGIN_DECLS
44
45 #define EMPATHY_RECT_IS_ON_SCREEN(x,y,w,h) ((x) + (w) > 0 && \
46                                             (y) + (h) > 0 && \
47                                             (x) < gdk_screen_width () && \
48                                             (y) < gdk_screen_height ())
49
50 typedef void (*EmpathyPixbufAvatarFromIndividualCb) (FolksIndividual *individual,
51                 GdkPixbuf *pixbuf,
52                 gpointer user_data);
53
54 void            empathy_gtk_init                        (void);
55
56 /* Glade */
57 GtkBuilder *    empathy_builder_get_file                (const gchar      *filename,
58                                                          const gchar      *first_object,
59                                                          ...);
60 void            empathy_builder_connect                 (GtkBuilder       *gui,
61                                                          gpointer          user_data,
62                                                          const gchar      *first_object,
63                                                          ...);
64 GtkWidget     *empathy_builder_unref_and_keep_widget    (GtkBuilder       *gui,
65                                                          GtkWidget        *root);
66
67 /* Pixbufs */
68 const gchar * empathy_icon_name_for_presence            (TpConnectionPresenceType  presence);
69 const gchar * empathy_icon_name_for_contact             (EmpathyContact   *contact);
70 const gchar * empathy_icon_name_for_individual          (FolksIndividual  *individual);
71 const gchar * empathy_protocol_name_for_contact         (EmpathyContact   *contact);
72 GdkPixbuf *   empathy_pixbuf_from_data                  (gchar            *data,
73                                                          gsize             data_size);
74 GdkPixbuf *   empathy_pixbuf_from_data_and_mime         (gchar            *data,
75                                                          gsize             data_size,
76                                                          gchar           **mime_type);
77 void empathy_pixbuf_avatar_from_individual_scaled_async (FolksIndividual     *individual,
78                                                          gint                 width,
79                                                          gint                 height,
80                                                          GCancellable        *cancellable,
81                                                          GAsyncReadyCallback  callback,
82                                                          gpointer             user_data);
83 GdkPixbuf * empathy_pixbuf_avatar_from_individual_scaled_finish (
84                                                          FolksIndividual  *individual,
85                                                          GAsyncResult     *result,
86                                                          GError          **error);
87 GdkPixbuf *   empathy_pixbuf_from_avatar_scaled         (EmpathyAvatar    *avatar,
88                                                          gint              width,
89                                                          gint              height);
90 GdkPixbuf *   empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact   *contact,
91                                                          gint              width,
92                                                          gint              height);
93 GdkPixbuf *   empathy_pixbuf_protocol_from_contact_scaled (EmpathyContact   *contact,
94                                                          gint              width,
95                                                          gint              height);
96 GdkPixbuf *   empathy_pixbuf_contact_status_icon (EmpathyContact   *contact,
97                                                          gboolean          show_protocol);
98 GdkPixbuf *   empathy_pixbuf_contact_status_icon_with_icon_name (EmpathyContact   *contact,
99                                                          const gchar       *icon_name,
100                                                          gboolean          show_protocol);
101 GdkPixbuf *   empathy_pixbuf_scale_down_if_necessary    (GdkPixbuf        *pixbuf,
102                                                          gint              max_size);
103 GdkPixbuf *   empathy_pixbuf_from_icon_name             (const gchar      *icon_name,
104                                                          GtkIconSize       icon_size);
105 GdkPixbuf *   empathy_pixbuf_from_icon_name_sized       (const gchar      *icon_name,
106                                                          gint              size);
107 gchar *       empathy_filename_from_icon_name           (const gchar      *icon_name,
108                                                          GtkIconSize       icon_size);
109
110 /* Text view */
111 gboolean    empathy_text_iter_forward_search            (const GtkTextIter*iter,
112                                                          const gchar      *str,
113                                                          GtkTextIter      *match_start,
114                                                          GtkTextIter      *match_end,
115                                                          const GtkTextIter*limit);
116 gboolean    empathy_text_iter_backward_search           (const GtkTextIter*iter,
117                                                          const gchar      *str,
118                                                          GtkTextIter      *match_start,
119                                                          GtkTextIter      *match_end,
120                                                          const GtkTextIter*limit);
121 /* Windows */
122 void        empathy_window_present                      (GtkWindow *window);
123 void        empathy_window_present_with_time            (GtkWindow        *window,
124                                                          guint32 timestamp);
125 GtkWindow * empathy_get_toplevel_window                 (GtkWidget        *widget);
126
127 void empathy_move_to_window_desktop (GtkWindow *window,
128     guint32 timestamp);
129
130 /* URL */
131 gchar *     empathy_make_absolute_url                   (const gchar      *url);
132
133 gchar *     empathy_make_absolute_url_len               (const gchar      *url,
134                                                          guint             len);
135 void        empathy_url_show                            (GtkWidget        *parent,
136                                                          const char       *url);
137
138 /* File transfer */
139 void        empathy_send_file                           (EmpathyContact   *contact,
140                                                          GFile            *file);
141 void        empathy_send_file_from_uri_list             (EmpathyContact   *contact,
142                                                          const gchar      *uri_list);
143 void        empathy_send_file_with_file_chooser         (EmpathyContact   *contact);
144 void        empathy_receive_file_with_file_chooser      (EmpathyFTHandler *handler);
145
146 /* Misc */
147 void        empathy_make_color_whiter                   (GdkRGBA *color);
148
149 GtkWidget * empathy_context_menu_new                    (GtkWidget *attach_to);
150
151 gint64      empathy_get_current_action_time             (void);
152
153 gboolean empathy_individual_match_string (
154     FolksIndividual *individual,
155     const gchar *text,
156     GPtrArray *words);
157
158 void empathy_launch_program (const gchar *dir,
159     const gchar *name,
160     const gchar *args);
161
162 void empathy_set_css_provider (GtkWidget *widget);
163
164 G_END_DECLS
165
166 #endif /*  __EMPATHY_UI_UTILS_H__ */