]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-ui-utils.h
hindi update
[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 #include "empathy-chat-view.h"
44
45 G_BEGIN_DECLS
46
47 #define EMPATHY_RECT_IS_ON_SCREEN(x,y,w,h) ((x) + (w) > 0 && \
48                                             (y) + (h) > 0 && \
49                                             (x) < gdk_screen_width () && \
50                                             (y) < gdk_screen_height ())
51
52 #define EMPATHY_DTMF_BUTTON_ID "empathy-call-dtmf-button-id"
53
54 typedef void (*EmpathyPixbufAvatarFromIndividualCb) (FolksIndividual *individual,
55                 GdkPixbuf *pixbuf,
56                 gpointer user_data);
57
58 void            empathy_gtk_init                        (void);
59
60 /* Glade */
61 GtkBuilder *    empathy_builder_get_file                (const gchar      *filename,
62                                                          const gchar      *first_object,
63                                                          ...);
64 void            empathy_builder_connect                 (GtkBuilder       *gui,
65                                                          gpointer          user_data,
66                                                          const gchar      *first_object,
67                                                          ...);
68 GtkWidget     *empathy_builder_unref_and_keep_widget    (GtkBuilder       *gui,
69                                                          GtkWidget        *root);
70
71 /* Pixbufs */
72 const gchar * empathy_icon_name_for_presence            (TpConnectionPresenceType  presence);
73 const gchar * empathy_icon_name_for_contact             (EmpathyContact   *contact);
74 const gchar * empathy_icon_name_for_individual          (FolksIndividual  *individual);
75 const gchar * empathy_protocol_name_for_contact         (EmpathyContact   *contact);
76 GdkPixbuf *   empathy_pixbuf_from_data                  (gchar            *data,
77                                                          gsize             data_size);
78 GdkPixbuf *   empathy_pixbuf_from_data_and_mime         (gchar            *data,
79                                                          gsize             data_size,
80                                                          gchar           **mime_type);
81 void empathy_pixbuf_avatar_from_individual_scaled_async (FolksIndividual     *individual,
82                                                          gint                 width,
83                                                          gint                 height,
84                                                          GCancellable        *cancellable,
85                                                          GAsyncReadyCallback  callback,
86                                                          gpointer             user_data);
87 GdkPixbuf * empathy_pixbuf_avatar_from_individual_scaled_finish (
88                                                          FolksIndividual  *individual,
89                                                          GAsyncResult     *result,
90                                                          GError          **error);
91 GdkPixbuf *   empathy_pixbuf_from_avatar_scaled         (EmpathyAvatar    *avatar,
92                                                          gint              width,
93                                                          gint              height);
94 GdkPixbuf *   empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact   *contact,
95                                                          gint              width,
96                                                          gint              height);
97 GdkPixbuf *   empathy_pixbuf_protocol_from_contact_scaled (EmpathyContact   *contact,
98                                                          gint              width,
99                                                          gint              height);
100 GdkPixbuf *   empathy_pixbuf_contact_status_icon (EmpathyContact   *contact,
101                                                          gboolean          show_protocol);
102 GdkPixbuf *   empathy_pixbuf_contact_status_icon_with_icon_name (EmpathyContact   *contact,
103                                                          const gchar       *icon_name,
104                                                          gboolean          show_protocol);
105 GdkPixbuf *   empathy_pixbuf_scale_down_if_necessary    (GdkPixbuf        *pixbuf,
106                                                          gint              max_size);
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,
110                                                          gint              size);
111 gchar *       empathy_filename_from_icon_name           (const gchar      *icon_name,
112                                                          GtkIconSize       icon_size);
113
114 /* Text view */
115 gboolean    empathy_text_iter_forward_search            (const GtkTextIter*iter,
116                                                          const gchar      *str,
117                                                          GtkTextIter      *match_start,
118                                                          GtkTextIter      *match_end,
119                                                          const GtkTextIter*limit);
120 gboolean    empathy_text_iter_backward_search           (const GtkTextIter*iter,
121                                                          const gchar      *str,
122                                                          GtkTextIter      *match_start,
123                                                          GtkTextIter      *match_end,
124                                                          const GtkTextIter*limit);
125 /* Windows */
126 void        empathy_window_present                      (GtkWindow *window);
127 void        empathy_window_present_with_time            (GtkWindow        *window,
128                                                          guint32 timestamp);
129 GtkWindow * empathy_get_toplevel_window                 (GtkWidget        *widget);
130
131 /* URL */
132 gchar *     empathy_make_absolute_url                   (const gchar      *url);
133
134 gchar *     empathy_make_absolute_url_len               (const gchar      *url,
135                                                          guint             len);
136 void        empathy_url_show                            (GtkWidget        *parent,
137                                                          const char       *url);
138
139 /* File transfer */
140 void        empathy_send_file                           (EmpathyContact   *contact,
141                                                          GFile            *file);
142 void        empathy_send_file_from_uri_list             (EmpathyContact   *contact,
143                                                          const gchar      *uri_list);
144 void        empathy_send_file_with_file_chooser         (EmpathyContact   *contact);
145 void        empathy_receive_file_with_file_chooser      (EmpathyFTHandler *handler);
146 GtkWidget * empathy_create_dtmf_dialpad                 (GObject *self,
147                                                          GCallback pressed_cb,
148                                                          GCallback released_cb);
149
150 /* Misc */
151 void        empathy_make_color_whiter                   (GdkRGBA *color);
152
153 GtkWidget * empathy_context_menu_new                    (GtkWidget *attach_to);
154
155 gint64      empathy_get_current_action_time             (void);
156
157 gboolean empathy_individual_match_string (
158     FolksIndividual *individual,
159     const gchar *text,
160     GPtrArray *words);
161
162 void empathy_launch_program (const gchar *dir,
163     const gchar *name,
164     const gchar *args);
165
166 G_END_DECLS
167
168 #endif /*  __EMPATHY_UI_UTILS_H__ */