]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-ui-utils.h
fedf8f7be4408bfcde52cc15051dedd2994d9ded
[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 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., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, 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  * 
26  *          Part of this file is copied from GtkSourceView (gtksourceiter.c):
27  *          Paolo Maggi
28  *          Jeroen Zwartepoorte
29  */
30
31 #ifndef __EMPATHY_UI_UTILS_H__
32 #define __EMPATHY_UI_UTILS_H__
33
34 #include <gtk/gtk.h>
35 #include <glade/glade.h>
36
37 #include <libmissioncontrol/mc-account.h>
38 #include <libmissioncontrol/mc-profile.h>
39
40 #include <libempathy/empathy-contact.h>
41 #include <libempathy/empathy-avatar.h>
42
43 #include "empathy-chat-view.h"
44
45 G_BEGIN_DECLS
46
47 #define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
48
49 /* Glade */
50 GladeXML *      empathy_glade_get                       (const gchar      *filename,
51                                                          const gchar      *root,
52                                                          const gchar      *domain);
53 void            empathy_glade_get_file_simple           (const gchar      *filename,
54                                                          const gchar      *root,
55                                                          const gchar      *domain,
56                                                          const gchar      *first_required_widget,
57                                                          ...);
58 GladeXML *      empathy_glade_get_file                  (const gchar      *filename,
59                                                          const gchar      *root,
60                                                          const gchar      *domain,
61                                                          const gchar      *first_required_widget,
62                                                          ...);
63 void            empathy_glade_connect                   (GladeXML         *gui,
64                                                          gpointer          user_data,
65                                                          gchar            *first_widget,
66                                                          ...);
67 void            empathy_glade_setup_size_group          (GladeXML         *gui,
68                                                          GtkSizeGroupMode  mode,
69                                                          gchar            *first_widget,
70                                                          ...);
71 /* Pixbufs */
72 const gchar * empathy_icon_name_from_account            (McAccount        *account);
73 const gchar * empathy_icon_name_for_presence            (McPresence        presence);
74 const gchar * empathy_icon_name_for_contact             (EmpathyContact   *contact);
75 GdkPixbuf *   empathy_pixbuf_from_data                  (gchar            *data,
76                                                          gsize             data_size);
77 GdkPixbuf *   empathy_pixbuf_from_avatar_scaled         (EmpathyAvatar    *avatar,
78                                                          gint              width,
79                                                          gint              height);
80 GdkPixbuf *   empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact   *contact,
81                                                          gint              width,
82                                                          gint              height);
83 GdkPixbuf * empathy_pixbuf_scale_down_if_necessary      (GdkPixbuf        *pixbuf,
84                                                          gint              max_size);
85 GdkPixbuf * empathy_pixbuf_from_icon_name               (const gchar      *icon_name,
86                                                          GtkIconSize       icon_size);
87 /* Text view */
88 gboolean    empathy_text_iter_forward_search            (const GtkTextIter*iter,
89                                                          const gchar      *str,
90                                                          GtkTextIter      *match_start,
91                                                          GtkTextIter      *match_end,
92                                                          const GtkTextIter*limit);
93 gboolean    empathy_text_iter_backward_search           (const GtkTextIter*iter,
94                                                          const gchar      *str,
95                                                          GtkTextIter      *match_start,
96                                                          GtkTextIter      *match_end,
97                                                          const GtkTextIter*limit);
98 /* Windows */
99 gboolean    empathy_window_get_is_visible               (GtkWindow        *window);
100 void        empathy_window_present                      (GtkWindow        *window,
101                                                          gboolean          steal_focus);
102 void        empathy_window_iconify                      (GtkWindow        *window,
103                                                          GtkStatusIcon    *status_icon);
104 GtkWindow * empathy_get_toplevel_window                 (GtkWidget        *widget);
105 void        empathy_url_show                            (const char       *url);
106 void        empathy_toggle_button_set_state_quietly     (GtkWidget        *widget,
107                                                          GCallback         callback,
108                                                          gpointer          user_data,
109                                                          gboolean          active);
110 GtkWidget * empathy_link_button_new                     (const gchar      *url,
111                                                          const gchar      *title);
112 GtkTextTag *empathy_text_buffer_tag_set                 (GtkTextBuffer *buffer,
113                                                          const gchar   *tag_name,
114                                                          const gchar   *first_property_name,
115                                                          ...);
116
117 G_END_DECLS
118
119 #endif /*  __EMPATHY_UI_UTILS_H__ */