~ubuntu-branches/ubuntu/oneiric/empathy/oneiric-security

« back to all changes in this revision

Viewing changes to src/empathy-main-window.c

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-08-22 14:16:36 UTC
  • mfrom: (1.1.75 upstream)
  • Revision ID: james.westby@ubuntu.com-20110822141636-iiju0fvx1f9sl3oz
Tags: 3.1.5.1-1ubuntu1
* New upstream version
  - crashed with SIGSEGV in dbus_connection_dispatch (LP: #829826)

Show diffs side-by-side

added added

removed removed

Lines of Context:
904
904
main_window_balance_update_balance (GtkAction   *action,
905
905
                                    TpConnection *conn)
906
906
{
907
 
        TpAccount *account = g_object_get_data (G_OBJECT (action), "account");
 
907
        TpAccount *account = tp_connection_get_account (conn);
908
908
        GtkWidget *label;
909
909
        int amount = 0;
910
910
        guint scale = G_MAXINT32;
980
980
        g_object_bind_property (account, "icon-name", action, "icon-name",
981
981
                G_BINDING_SYNC_CREATE);
982
982
 
983
 
        g_object_set_data (G_OBJECT (action), "account", account);
984
983
        g_signal_connect (action, "activate",
985
984
                G_CALLBACK (main_window_balance_activate_cb), window);
986
985
 
1019
1018
 
1020
1019
static GtkWidget *
1021
1020
main_window_setup_balance_create_widget (EmpathyMainWindow *window,
1022
 
                                         GtkAction         *action)
 
1021
                                         GtkAction         *action,
 
1022
                                         TpAccount *account)
1023
1023
{
1024
1024
        EmpathyMainWindowPriv *priv = GET_PRIV (window);
1025
 
        TpAccount *account;
1026
1025
        GtkWidget *hbox, *image, *label, *button;
1027
1026
 
1028
 
        account = g_object_get_data (G_OBJECT (action), "account");
1029
 
        g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
1030
 
 
1031
1027
        hbox = gtk_hbox_new (FALSE, 6);
1032
1028
 
1033
1029
        /* protocol icon */
1066
1062
}
1067
1063
 
1068
1064
static void
1069
 
main_window_setup_balance_conn_ready (GObject      *source,
1070
 
                                      GAsyncResult *result,
1071
 
                                      gpointer      user_data)
 
1065
main_window_setup_balance (EmpathyMainWindow *window,
 
1066
                           TpAccount         *account)
1072
1067
{
1073
 
        EmpathyMainWindow *window = user_data;
1074
1068
        EmpathyMainWindowPriv *priv = GET_PRIV (window);
1075
 
        TpConnection *conn = TP_CONNECTION (source);
1076
 
        TpAccount *account = g_object_get_data (source, "account");
 
1069
        TpConnection *conn = tp_account_get_connection (account);
1077
1070
        GtkAction *action;
1078
 
        GError *error = NULL;
1079
1071
        const gchar *uri;
1080
1072
 
1081
 
        if (!tp_proxy_prepare_finish (conn, result, &error)) {
1082
 
                DEBUG ("Failed to prepare connection: %s", error->message);
1083
 
 
1084
 
                g_error_free (error);
 
1073
        if (conn == NULL)
1085
1074
                return;
1086
 
        }
1087
1075
 
1088
1076
        if (!tp_proxy_is_prepared (conn, TP_CONNECTION_FEATURE_BALANCE))
1089
1077
                return;
1100
1088
        gtk_action_set_visible (priv->view_balance_show_in_roster, TRUE);
1101
1089
 
1102
1090
        /* create the display widget */
1103
 
        main_window_setup_balance_create_widget (window, action);
 
1091
        main_window_setup_balance_create_widget (window, action, account);
1104
1092
 
1105
1093
        /* check the current balance and monitor for any changes */
1106
1094
        uri = tp_connection_get_balance_uri (conn);
1113
1101
 
1114
1102
        g_signal_connect (conn, "balance-changed",
1115
1103
                G_CALLBACK (main_window_balance_changed_cb), action);
1116
 
}
1117
 
 
1118
 
static void
1119
 
main_window_setup_balance (EmpathyMainWindow *window,
1120
 
                           TpAccount         *account)
1121
 
{
1122
 
        TpConnection *conn = tp_account_get_connection (account);
1123
 
        GQuark features[] = { TP_CONNECTION_FEATURE_BALANCE, 0 };
1124
 
 
1125
 
        if (conn == NULL)
1126
 
                return;
1127
 
 
1128
 
        /* need to prepare the connection:
1129
 
         * store the account on the connection */
1130
 
        g_object_set_data (G_OBJECT (conn), "account", account);
1131
 
        tp_proxy_prepare_async (conn, features,
1132
 
                main_window_setup_balance_conn_ready, window);
 
1104
 
1133
1105
}
1134
1106
 
1135
1107
static void