]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-ui-utils.h
tpaw-utils: move empathy_get_toplevel_window to tp-aw and rename it
[empathy.git] / libempathy-gtk / empathy-ui-utils.h
1 /*
2  * Copyright (C) 2002-2007 Imendio AB
3  * Copyright (C) 2007-2010 Collabora Ltd.
4  *
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.
9  *
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.
14  *
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
19  *
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>
26  *
27  *          Part of this file is copied from GtkSourceView (gtksourceiter.c):
28  *          Paolo Maggi
29  *          Jeroen Zwartepoorte
30  */
31
32 #ifndef __EMPATHY_UI_UTILS_H__
33 #define __EMPATHY_UI_UTILS_H__
34
35 #include <gtk/gtk.h>
36 #include <folks/folks.h>
37
38 #include "empathy-contact.h"
39 #include "empathy-ft-handler.h"
40
41 G_BEGIN_DECLS
42
43 #define ACCOUNT_WIDGETS_RESOURCES_PREFIX "/org/gnome/AccountWidgets"
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) (
51     FolksIndividual *individual,
52     GdkPixbuf *pixbuf,
53     gpointer user_data);
54
55 void empathy_gtk_init (void);
56
57 /* Pixbufs */
58 const gchar * empathy_icon_name_for_presence (
59     TpConnectionPresenceType presence);
60 const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
61 const gchar * empathy_icon_name_for_individual (FolksIndividual *individual);
62 const gchar * empathy_protocol_name_for_contact (EmpathyContact *contact);
63 GdkPixbuf * empathy_pixbuf_from_data (gchar *data,
64     gsize data_size);
65 GdkPixbuf * empathy_pixbuf_from_data_and_mime (gchar *data,
66     gsize data_size,
67     gchar **mime_type);
68 void empathy_pixbuf_avatar_from_individual_scaled_async (
69     FolksIndividual *individual,
70     gint width,
71     gint height,
72     GCancellable *cancellable,
73     GAsyncReadyCallback callback,
74     gpointer user_data);
75 GdkPixbuf * empathy_pixbuf_avatar_from_individual_scaled_finish (
76     FolksIndividual *individual,
77     GAsyncResult *result,
78     GError **error);
79 GdkPixbuf * empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact *contact,
80     gint width,
81     gint height);
82 GdkPixbuf * empathy_pixbuf_contact_status_icon (EmpathyContact *contact,
83     gboolean show_protocol);
84 GdkPixbuf * empathy_pixbuf_contact_status_icon_with_icon_name (
85     EmpathyContact *contact,
86     const gchar *icon_name,
87     gboolean show_protocol);
88 GdkPixbuf * empathy_pixbuf_scale_down_if_necessary (GdkPixbuf *pixbuf,
89     gint max_size);
90 GdkPixbuf * empathy_pixbuf_from_icon_name (const gchar *icon_name,
91     GtkIconSize icon_size);
92 GdkPixbuf * empathy_pixbuf_from_icon_name_sized (const gchar *icon_name,
93     gint size);
94 gchar * empathy_filename_from_icon_name (const gchar *icon_name,
95     GtkIconSize icon_size);
96
97 /* Windows */
98 void empathy_window_present (GtkWindow *window);
99 void empathy_window_present_with_time (GtkWindow *window,
100     guint32 timestamp);
101
102 void empathy_move_to_window_desktop (GtkWindow *window,
103     guint32 timestamp);
104
105 /* URL */
106 gchar * empathy_make_absolute_url (const gchar *url);
107
108 gchar * empathy_make_absolute_url_len (const gchar *url,
109     guint len);
110 void empathy_url_show (GtkWidget *parent,
111     const char *url);
112
113 /* File transfer */
114 void empathy_send_file (EmpathyContact *contact,
115     GFile *file);
116 void empathy_send_file_from_uri_list (EmpathyContact *contact,
117     const gchar *uri_list);
118 void empathy_send_file_with_file_chooser (EmpathyContact *contact);
119 void empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler);
120
121 /* Misc */
122 void  empathy_make_color_whiter (GdkRGBA *color);
123
124 GtkWidget * empathy_context_menu_new (GtkWidget *attach_to);
125
126 gint64 empathy_get_current_action_time (void);
127
128 gboolean empathy_individual_match_string (
129     FolksIndividual *individual,
130     const gchar *text,
131     GPtrArray *words);
132
133 void empathy_launch_program (const gchar *dir,
134     const gchar *name,
135     const gchar *args);
136
137 void empathy_set_css_provider (GtkWidget *widget);
138
139 gboolean empathy_launch_external_app (const gchar *desktop_file,
140     const gchar *args,
141     GError **error);
142
143 G_END_DECLS
144
145 #endif /*  __EMPATHY_UI_UTILS_H__ */