| 1 /* pidgin |
|
| 2 * |
|
| 3 * Pidgin is the legal property of its developers, whose names are too numerous |
|
| 4 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
| 5 * source distribution. |
|
| 6 * |
|
| 7 * This program is free software; you can redistribute it and/or modify |
|
| 8 * it under the terms of the GNU General Public License as published by |
|
| 9 * the Free Software Foundation; either version 2 of the License, or |
|
| 10 * (at your option) any later version. |
|
| 11 * |
|
| 12 * This program is distributed in the hope that it will be useful, |
|
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 * GNU General Public License for more details. |
|
| 16 * |
|
| 17 * You should have received a copy of the GNU General Public License |
|
| 18 * along with this program; if not, write to the Free Software |
|
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
| 20 */ |
|
| 21 |
|
| 22 #if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION) |
|
| 23 # error "only <pidgin.h> may be included directly" |
|
| 24 #endif |
|
| 25 |
|
| 26 #ifndef PIDGIN_INVITE_DIALOG_H |
|
| 27 #define PIDGIN_INVITE_DIALOG_H |
|
| 28 |
|
| 29 #include <gtk/gtk.h> |
|
| 30 |
|
| 31 #include <purple.h> |
|
| 32 |
|
| 33 #include "pidginversion.h" |
|
| 34 |
|
| 35 G_BEGIN_DECLS |
|
| 36 |
|
| 37 /** |
|
| 38 * PidginInviteDialog: |
|
| 39 * |
|
| 40 * #PidginInviteDialog is a simple #GtkDialog that presents the user with an |
|
| 41 * interface to invite another user to a conversation. Name completion is |
|
| 42 * automatically setup as well. |
|
| 43 * |
|
| 44 * |[<!-- language="C" --> |
|
| 45 * static void |
|
| 46 * invite_response(GtkWidget *widget, int resp, gpointer data) { |
|
| 47 * PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(widget); |
|
| 48 * |
|
| 49 * if(resp == GTK_RESPONSE_ACCEPT) { |
|
| 50 * g_message( |
|
| 51 * "user wants to invite %s with message %s", |
|
| 52 * pidgin_invite_dialog_get_contact(dialog), |
|
| 53 * pidgin_invite_dialog_get_message(dialog) |
|
| 54 * ); |
|
| 55 * } |
|
| 56 * } |
|
| 57 * |
|
| 58 * static void |
|
| 59 * invite_prompt(PurpleChatConversation *conv) { |
|
| 60 * GtkWidget *dialog = pidgin_invite_dialog_new(conv); |
|
| 61 * g_signal_connect(G_OBJECT(dialog), "response", |
|
| 62 * G_CALLBACK(invite_response), NULL); |
|
| 63 * |
|
| 64 * } |
|
| 65 * ]| |
|
| 66 * |
|
| 67 * Since: 3.0 |
|
| 68 */ |
|
| 69 |
|
| 70 #define PIDGIN_TYPE_INVITE_DIALOG pidgin_invite_dialog_get_type() |
|
| 71 |
|
| 72 PIDGIN_AVAILABLE_IN_3_0 |
|
| 73 G_DECLARE_FINAL_TYPE(PidginInviteDialog, pidgin_invite_dialog, PIDGIN, |
|
| 74 INVITE_DIALOG, GtkDialog) |
|
| 75 |
|
| 76 /** |
|
| 77 * pidgin_invite_dialog_new: |
|
| 78 * @conversation: The #PurpleChatConversation instance. |
|
| 79 * |
|
| 80 * Creates a new #PidginInviteDialog to invite someone to @conversation. |
|
| 81 * |
|
| 82 * Returns: (transfer full): The new #PidginInviteDialog instance. |
|
| 83 * |
|
| 84 * Since: 3.0 |
|
| 85 */ |
|
| 86 PIDGIN_AVAILABLE_IN_3_0 |
|
| 87 GtkWidget *pidgin_invite_dialog_new(PurpleChatConversation *conversation); |
|
| 88 |
|
| 89 /** |
|
| 90 * pidgin_invite_dialog_set_contact: |
|
| 91 * @dialog: The #PidginInviteDialog instance. |
|
| 92 * @contact: The contact to invite. |
|
| 93 * |
|
| 94 * Sets the contact that should be invited. This function is intended to be |
|
| 95 * used to prepopulate the dialog in cases where you just need to prompt the |
|
| 96 * user for an invite message. |
|
| 97 * |
|
| 98 * Since: 3.0 |
|
| 99 */ |
|
| 100 PIDGIN_AVAILABLE_IN_3_0 |
|
| 101 void pidgin_invite_dialog_set_contact(PidginInviteDialog *dialog, const gchar *contact); |
|
| 102 |
|
| 103 /** |
|
| 104 * pidgin_invite_dialog_get_contact: |
|
| 105 * @dialog: #PidginInviteDialog instance. |
|
| 106 * |
|
| 107 * Gets the contact that was entered in @dialog. This string is only valid as |
|
| 108 * long as @dialog exists. |
|
| 109 * |
|
| 110 * Returns: (transfer none): The contact that was entered. |
|
| 111 * |
|
| 112 * Since: 3.0 |
|
| 113 */ |
|
| 114 PIDGIN_AVAILABLE_IN_3_0 |
|
| 115 const gchar *pidgin_invite_dialog_get_contact(PidginInviteDialog *dialog); |
|
| 116 |
|
| 117 /** |
|
| 118 * pidgin_invite_dialog_set_message: |
|
| 119 * @dialog: The #PidginInviteDialog instance. |
|
| 120 * @message: The message that should be displayed. |
|
| 121 * |
|
| 122 * Sets the message to be displayed in @dialog. The main use case is to |
|
| 123 * prepopulate the message. |
|
| 124 * |
|
| 125 * Since: 3.0 |
|
| 126 */ |
|
| 127 PIDGIN_AVAILABLE_IN_3_0 |
|
| 128 void pidgin_invite_dialog_set_message(PidginInviteDialog *dialog, const gchar *message); |
|
| 129 |
|
| 130 /** |
|
| 131 * pidgin_invite_dialog_get_message: |
|
| 132 * @dialog: The #PidginInviteDialog instance. |
|
| 133 * |
|
| 134 * Gets the message that was entered in @dialog. The returned value is only |
|
| 135 * valid as long as @dialog exists. |
|
| 136 * |
|
| 137 * Returns: (transfer none): The message that was entered in @dialog. |
|
| 138 * |
|
| 139 * Since: 3.0 |
|
| 140 */ |
|
| 141 PIDGIN_AVAILABLE_IN_3_0 |
|
| 142 const gchar *pidgin_invite_dialog_get_message(PidginInviteDialog *dialog); |
|
| 143 |
|
| 144 /** |
|
| 145 * pidgin_invite_dialog_get_conversation: |
|
| 146 * @dialog: The #PidginInviteDialog instance. |
|
| 147 * |
|
| 148 * Gets the #PurpleChatConversation that @dialog was created for. |
|
| 149 * |
|
| 150 * Returns: (transfer none): The #PurpleChatConversation that @dialog was |
|
| 151 * created with. |
|
| 152 * |
|
| 153 * Since: 3.0 |
|
| 154 */ |
|
| 155 PIDGIN_AVAILABLE_IN_3_0 |
|
| 156 PurpleChatConversation *pidgin_invite_dialog_get_conversation(PidginInviteDialog *dialog); |
|
| 157 |
|
| 158 G_END_DECLS |
|
| 159 |
|
| 160 #endif /* PIDGIN_INVITE_DIALOG_H */ |
|