~ubuntu-branches/debian/jessie/empathy/jessie

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-chat.c

  • Committer: Package Import Robot
  • Author(s): Sjoerd Simons
  • Date: 2011-11-01 13:43:50 UTC
  • mfrom: (1.7.2)
  • Revision ID: package-import@ubuntu.com-20111101134350-13xb8db5d7mpojid
Tags: 3.2.1.1-1
* New upstream release
* debian/control: Bump libtelepathy-glib b-d

Show diffs side-by-side

added added

removed removed

Lines of Context:
756
756
                    GStrv        strv)
757
757
{
758
758
        EmpathyChatPriv *priv = GET_PRIV (chat);
759
 
        EmpathyTpChatProperty *property;
760
 
        GValue value = {0, };
761
759
 
762
 
        property = empathy_tp_chat_get_property (priv->tp_chat, "subject");
763
 
        if (property == NULL) {
 
760
        if (!empathy_tp_chat_supports_subject (priv->tp_chat)) {
764
761
                empathy_chat_view_append_event (chat->view,
765
762
                        _("Topic not supported on this conversation"));
766
763
                return;
767
764
        }
768
765
 
769
 
        if (!(property->flags & TP_PROPERTY_FLAG_WRITE)) {
 
766
        if (!empathy_tp_chat_can_set_subject (priv->tp_chat)) {
770
767
                empathy_chat_view_append_event (chat->view,
771
768
                        _("You are not allowed to change the topic"));
772
769
                return;
773
770
        }
774
771
 
775
 
        g_value_init (&value, G_TYPE_STRING);
776
 
        g_value_set_string (&value, strv[1]);
777
 
        empathy_tp_chat_set_property (priv->tp_chat, "subject", &value);
778
 
        g_value_unset (&value);
 
772
        empathy_tp_chat_set_subject (priv->tp_chat, strv[1]);
779
773
}
780
774
 
781
775
void
1528
1522
}
1529
1523
 
1530
1524
static void
1531
 
chat_property_changed_cb (EmpathyTpChat *tp_chat,
1532
 
                          const gchar   *name,
1533
 
                          GValue        *value,
1534
 
                          EmpathyChat   *chat)
 
1525
chat_subject_changed_cb (EmpathyChat *chat)
1535
1526
{
1536
1527
        EmpathyChatPriv *priv = GET_PRIV (chat);
1537
1528
 
1538
 
        if (!tp_strdiff (name, "subject")) {
1539
1529
                g_free (priv->subject);
1540
 
                priv->subject = g_value_dup_string (value);
 
1530
                priv->subject = g_strdup (empathy_tp_chat_get_subject (priv->tp_chat));
1541
1531
                g_object_notify (G_OBJECT (chat), "subject");
1542
1532
 
1543
1533
                if (EMP_STR_EMPTY (priv->subject)) {
1567
1557
                        empathy_chat_view_append_event (EMPATHY_CHAT (chat)->view, str);
1568
1558
                        g_free (str);
1569
1559
                }
1570
 
        }
1571
 
        else if (!tp_strdiff (name, "name")) {
 
1560
}
 
1561
 
 
1562
static void
 
1563
chat_title_changed_cb (EmpathyChat *chat)
 
1564
{
 
1565
        EmpathyChatPriv *priv = GET_PRIV (chat);
 
1566
 
1572
1567
                g_free (priv->name);
1573
 
                priv->name = g_value_dup_string (value);
 
1568
                priv->name = g_strdup (empathy_tp_chat_get_title (priv->tp_chat));
1574
1569
                g_object_notify (G_OBJECT (chat), "name");
1575
 
        }
1576
1570
}
1577
1571
 
1578
1572
static gboolean
3086
3080
                g_signal_handlers_disconnect_by_func (priv->tp_chat,
3087
3081
                        chat_state_changed_cb, chat);
3088
3082
                g_signal_handlers_disconnect_by_func (priv->tp_chat,
3089
 
                        chat_property_changed_cb, chat);
3090
 
                g_signal_handlers_disconnect_by_func (priv->tp_chat,
3091
3083
                        chat_members_changed_cb, chat);
3092
3084
                g_signal_handlers_disconnect_by_func (priv->tp_chat,
3093
3085
                        chat_remote_contact_changed_cb, chat);
 
3086
                g_signal_handlers_disconnect_by_func (priv->tp_chat,
 
3087
                        chat_title_changed_cb, chat);
 
3088
                g_signal_handlers_disconnect_by_func (priv->tp_chat,
 
3089
                        chat_subject_changed_cb, chat);
3094
3090
                empathy_tp_chat_leave (priv->tp_chat, "");
3095
3091
                g_object_unref (priv->tp_chat);
3096
3092
        }
3770
3766
                          EmpathyTpChat *tp_chat)
3771
3767
{
3772
3768
        EmpathyChatPriv *priv = GET_PRIV (chat);
3773
 
        GPtrArray       *properties;
3774
3769
 
3775
3770
        g_return_if_fail (EMPATHY_IS_CHAT (chat));
3776
3771
        g_return_if_fail (EMPATHY_IS_TP_CHAT (tp_chat));
3801
3796
        g_signal_connect (tp_chat, "chat-state-changed-empathy",
3802
3797
                          G_CALLBACK (chat_state_changed_cb),
3803
3798
                          chat);
3804
 
        g_signal_connect (tp_chat, "property-changed",
3805
 
                          G_CALLBACK (chat_property_changed_cb),
3806
 
                          chat);
3807
3799
        g_signal_connect (tp_chat, "members-changed",
3808
3800
                          G_CALLBACK (chat_members_changed_cb),
3809
3801
                          chat);
3822
3814
        g_signal_connect_swapped (tp_chat, "notify::n-messages-sending",
3823
3815
                                  G_CALLBACK (chat_n_messages_sending_changed_cb),
3824
3816
                                  chat);
 
3817
        g_signal_connect_swapped (tp_chat, "notify::title",
 
3818
                                  G_CALLBACK (chat_title_changed_cb),
 
3819
                                  chat);
 
3820
        g_signal_connect_swapped (tp_chat, "notify::subject",
 
3821
                                  G_CALLBACK (chat_subject_changed_cb),
 
3822
                                  chat);
3825
3823
 
3826
3824
        /* Get initial value of properties */
3827
 
        properties = empathy_tp_chat_get_properties (priv->tp_chat);
3828
 
        if (properties != NULL) {
3829
 
                guint i;
3830
 
 
3831
 
                for (i = 0; i < properties->len; i++) {
3832
 
                        EmpathyTpChatProperty *property;
3833
 
 
3834
 
                        property = g_ptr_array_index (properties, i);
3835
 
                        if (property->value == NULL)
3836
 
                                continue;
3837
 
 
3838
 
                        chat_property_changed_cb (priv->tp_chat,
3839
 
                                                  property->name,
3840
 
                                                  property->value,
3841
 
                                                  chat);
3842
 
                }
3843
 
        }
3844
 
 
3845
3825
        chat_sms_channel_changed_cb (chat);
3846
3826
        chat_remote_contact_changed_cb (chat);
 
3827
        chat_title_changed_cb (chat);
 
3828
        chat_subject_changed_cb (chat);
3847
3829
 
3848
3830
        if (chat->input_text_view) {
3849
3831
                gtk_widget_set_sensitive (chat->input_text_view, TRUE);