aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-invite-participant-dialog.c
blob: da75e72cdb4cec19a12358df8576699cd81df0e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * empathy-invite-participant-dialog.c
 *
 * EmpathyInviteParticipantDialog
 *
 * (c) 2009, Collabora Ltd.
 *
 * Authors:
 *    Danielle Madeley <danielle.madeley@collabora.co.uk>
 */

#include <glib/gi18n.h>

#include "empathy-invite-participant-dialog.h"

G_DEFINE_TYPE (EmpathyInviteParticipantDialog,
    empathy_invite_participant_dialog, EMPATHY_TYPE_CONTACT_SELECTOR_DIALOG);

static void
empathy_invite_participant_dialog_class_init (EmpathyInviteParticipantDialogClass *klass)
{
}

static void
empathy_invite_participant_dialog_init (EmpathyInviteParticipantDialog *self)
{
  EmpathyContactSelectorDialog *parent = EMPATHY_CONTACT_SELECTOR_DIALOG (self);
  GtkWidget *label;
  char *str;

  label = gtk_label_new (NULL);
  str = g_strdup_printf (
      "<span size=\"x-large\" weight=\"bold\">%s</span>\n\n%s",
      _("Invite Participant"),
      _("Choose a contact to invite into the conversation:"));
  gtk_label_set_markup (GTK_LABEL (label), str);
  g_free (str);

  gtk_box_pack_start (GTK_BOX (parent->vbox), label, FALSE, TRUE, 0);
  /* move to the top -- wish there was a better way to do this */
  gtk_box_reorder_child (GTK_BOX (parent->vbox), label, 0);
  gtk_widget_show (label);

  parent->button_action = gtk_dialog_add_button (GTK_DIALOG (self),
      _("Invite"), GTK_RESPONSE_ACCEPT);
  gtk_widget_set_sensitive (parent->button_action, FALSE);

  gtk_window_set_title (GTK_WINDOW (self), _("Invite Participant"));
  gtk_window_set_role (GTK_WINDOW (self), "invite_participant");
  empathy_contact_selector_dialog_set_show_account_chooser (
      EMPATHY_CONTACT_SELECTOR_DIALOG (self), FALSE);
}

GtkWidget *
empathy_invite_participant_dialog_new (GtkWindow *parent,
    TpAccount *account)
{
  GtkWidget *self = g_object_new (EMPATHY_TYPE_INVITE_PARTICIPANT_DIALOG,
      "filter-account", account,
      NULL);

  if (parent != NULL)
    {
      gtk_window_set_transient_for (GTK_WINDOW (self), parent);
    }

  return self;
}