LogWindow: better logic for the buttons sensitivity
[empathy-mirror.git] / libempathy-gtk / empathy-ui-utils.h
blobf61e9e348018a817b664aeafa3b219dc98bdf6f0
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.
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>
26 * Travis Reitter <travis.reitter@collabora.co.uk>
28 * Part of this file is copied from GtkSourceView (gtksourceiter.c):
29 * Paolo Maggi
30 * Jeroen Zwartepoorte
33 #ifndef __EMPATHY_UI_UTILS_H__
34 #define __EMPATHY_UI_UTILS_H__
36 #include <gtk/gtk.h>
38 #include <folks/folks.h>
40 #include <libempathy/empathy-contact.h>
41 #include <libempathy/empathy-ft-handler.h>
43 #include "empathy-chat-view.h"
45 G_BEGIN_DECLS
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 ())
52 typedef void (*EmpathyPixbufAvatarFromIndividualCb) (FolksIndividual *individual,
53 GdkPixbuf *pixbuf,
54 gpointer user_data);
56 void empathy_gtk_init (void);
58 /* Glade */
59 GtkBuilder * empathy_builder_get_file (const gchar *filename,
60 const gchar *first_object,
61 ...);
62 void empathy_builder_connect (GtkBuilder *gui,
63 gpointer user_data,
64 const gchar *first_object,
65 ...);
66 GtkWidget *empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
67 GtkWidget *root);
69 /* Pixbufs */
70 const gchar * empathy_icon_name_for_presence (TpConnectionPresenceType presence);
71 const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
72 const gchar * empathy_icon_name_for_individual (FolksIndividual *individual);
73 const gchar * empathy_protocol_name_for_contact (EmpathyContact *contact);
74 GdkPixbuf * empathy_pixbuf_from_data (gchar *data,
75 gsize data_size);
76 GdkPixbuf * empathy_pixbuf_from_data_and_mime (gchar *data,
77 gsize data_size,
78 gchar **mime_type);
79 void empathy_pixbuf_avatar_from_individual_scaled_async (FolksIndividual *individual,
80 gint width,
81 gint height,
82 GCancellable *cancellable,
83 GAsyncReadyCallback callback,
84 gpointer user_data);
85 GdkPixbuf * empathy_pixbuf_avatar_from_individual_scaled_finish (
86 FolksIndividual *individual,
87 GAsyncResult *result,
88 GError **error);
89 GdkPixbuf * empathy_pixbuf_from_avatar_scaled (EmpathyAvatar *avatar,
90 gint width,
91 gint height);
92 GdkPixbuf * empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact *contact,
93 gint width,
94 gint height);
95 GdkPixbuf * empathy_pixbuf_protocol_from_contact_scaled (EmpathyContact *contact,
96 gint width,
97 gint height);
98 GdkPixbuf * empathy_pixbuf_contact_status_icon (EmpathyContact *contact,
99 gboolean show_protocol);
100 GdkPixbuf * empathy_pixbuf_contact_status_icon_with_icon_name (EmpathyContact *contact,
101 const gchar *icon_name,
102 gboolean show_protocol);
103 GdkPixbuf * empathy_pixbuf_scale_down_if_necessary (GdkPixbuf *pixbuf,
104 gint max_size);
105 GdkPixbuf * empathy_pixbuf_from_icon_name (const gchar *icon_name,
106 GtkIconSize icon_size);
107 GdkPixbuf * empathy_pixbuf_from_icon_name_sized (const gchar *icon_name,
108 gint size);
109 gchar * empathy_filename_from_icon_name (const gchar *icon_name,
110 GtkIconSize icon_size);
112 /* Text view */
113 gboolean empathy_text_iter_forward_search (const GtkTextIter*iter,
114 const gchar *str,
115 GtkTextIter *match_start,
116 GtkTextIter *match_end,
117 const GtkTextIter*limit);
118 gboolean empathy_text_iter_backward_search (const GtkTextIter*iter,
119 const gchar *str,
120 GtkTextIter *match_start,
121 GtkTextIter *match_end,
122 const GtkTextIter*limit);
123 /* Windows */
124 void empathy_window_present (GtkWindow *window);
125 void empathy_window_present_with_time (GtkWindow *window,
126 guint32 timestamp);
127 GtkWindow * empathy_get_toplevel_window (GtkWidget *widget);
129 /* URL */
130 gchar * empathy_make_absolute_url (const gchar *url);
132 gchar * empathy_make_absolute_url_len (const gchar *url,
133 guint len);
134 void empathy_url_show (GtkWidget *parent,
135 const char *url);
137 /* File transfer */
138 void empathy_send_file (EmpathyContact *contact,
139 GFile *file);
140 void empathy_send_file_from_uri_list (EmpathyContact *contact,
141 const gchar *uri_list);
142 void empathy_send_file_with_file_chooser (EmpathyContact *contact);
143 void empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler);
145 /* Misc */
146 void empathy_make_color_whiter (GdkRGBA *color);
148 GtkWidget * empathy_context_menu_new (GtkWidget *attach_to);
150 gint64 empathy_get_current_action_time (void);
152 gboolean empathy_individual_match_string (
153 FolksIndividual *individual,
154 const gchar *text,
155 GPtrArray *words);
157 G_END_DECLS
159 #endif /* __EMPATHY_UI_UTILS_H__ */