~ubuntu-branches/ubuntu/utopic/gossip/utopic

« back to all changes in this revision

Viewing changes to src/gossip-contact-list.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2007-10-19 13:02:15 UTC
  • mfrom: (1.1.20 upstream)
  • Revision ID: james.westby@ubuntu.com-20071019130215-k2c45f460ssaft0r
Tags: 1:0.27-4
* Upload to unstable again.
* New patch, 00_debian-branding.patch, to get the distribution into the
  vcard.
* New patch, 01_disable-smooth-scrolling.patch, to disable smooth scrolling
  completely; GNOME #471316.
* New patch, 02_german-translation.patch, to fix german translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "gossip-contact-list.h"
45
45
#include "gossip-edit-contact-dialog.h"
46
46
#include "gossip-email.h"
47
 
#include "gossip-ft-window.h"
 
47
#include "gossip-ft-dialog.h"
48
48
#include "gossip-log-window.h"
49
49
#include "gossip-marshal.h"
50
50
#include "gossip-sound.h"
188
188
                                                              gint                    y,
189
189
                                                              GtkSelectionData       *selection,
190
190
                                                              guint                   info,
191
 
                                                              guint                   time,
192
 
                                                              gpointer                user_data);
 
191
                                                              guint                   time);
193
192
static gboolean contact_list_drag_motion                     (GtkWidget              *widget,
194
193
                                                              GdkDragContext         *context,
195
194
                                                              gint                    x,
196
195
                                                              gint                    y,
197
 
                                                              guint                   time,
198
 
                                                              gpointer                data);
 
196
                                                              guint                   time);
199
197
static gboolean contact_list_drag_motion_cb                  (DragMotionData         *data);
200
198
static void     contact_list_drag_begin                      (GtkWidget              *widget,
201
 
                                                              GdkDragContext         *context,
202
 
                                                              gpointer                user_data);
 
199
                                                              GdkDragContext         *context);
203
200
static void     contact_list_drag_data_get                   (GtkWidget              *widget,
204
201
                                                              GdkDragContext         *contact,
205
202
                                                              GtkSelectionData       *selection,
206
203
                                                              guint                   info,
207
 
                                                              guint                   time,
208
 
                                                              gpointer                user_data);
 
204
                                                              guint                   time);
209
205
static void     contact_list_drag_end                        (GtkWidget              *widget,
210
 
                                                              GdkDragContext         *context,
211
 
                                                              gpointer                user_data);
 
206
                                                              GdkDragContext         *context);
 
207
static gboolean contact_list_drag_drop                       (GtkWidget      *widget,
 
208
                                                              GdkDragContext *drag_context,
 
209
                                                              gint            x,
 
210
                                                              gint            y,
 
211
                                                              guint           time);
 
212
 
212
213
static void     contact_list_cell_set_background             (GossipContactList      *list,
213
214
                                                              GtkCellRenderer        *cell,
214
215
                                                              gboolean                is_group,
355
356
          N_("_Invite to Chat Room"), NULL, N_("Invite to a currently open chat room"),
356
357
          G_CALLBACK (contact_list_action_cb)
357
358
        },
358
 
        { "SendFile", NULL,
 
359
        { "SendFile", GOSSIP_STOCK_FILE_TRANSFER,
359
360
          N_("_Send File..."), NULL, N_("Send a file"),
360
361
          G_CALLBACK (contact_list_action_cb)
361
362
        },
438
439
static void
439
440
gossip_contact_list_class_init (GossipContactListClass *klass)
440
441
{
441
 
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
442
        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
 
443
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
442
444
 
443
 
        object_class->finalize = contact_list_finalize;
 
445
        object_class->finalize     = contact_list_finalize;
444
446
        object_class->get_property = contact_list_get_property;
445
447
        object_class->set_property = contact_list_set_property;
446
448
 
 
449
        widget_class->drag_data_received = contact_list_drag_data_received;
 
450
        widget_class->drag_drop          = contact_list_drag_drop;
 
451
        widget_class->drag_begin         = contact_list_drag_begin;
 
452
        widget_class->drag_data_get      = contact_list_drag_data_get;
 
453
        widget_class->drag_end           = contact_list_drag_end;
 
454
        /* FIXME: noticed but when you drag the row over the treeview
 
455
         * fast, it seems to stop redrawing itself, if we don't
 
456
         * connect this signal, all is fine.
 
457
         */
 
458
        widget_class->drag_motion        = contact_list_drag_motion;
 
459
        
447
460
        signals[CONTACT_ACTIVATED] =
448
461
                g_signal_new ("contact-activated",
449
462
                              G_TYPE_FROM_CLASS (klass),
1758
1771
                           drag_types_dest,
1759
1772
                           G_N_ELEMENTS (drag_types_dest),
1760
1773
                           GDK_ACTION_MOVE | GDK_ACTION_LINK);
1761
 
 
1762
 
        g_signal_connect (GTK_WIDGET (list),
1763
 
                          "drag-data-received",
1764
 
                          G_CALLBACK (contact_list_drag_data_received),
1765
 
                          NULL);
1766
 
 
1767
 
        /* FIXME: noticed but when you drag the row over the treeview
1768
 
         * fast, it seems to stop redrawing itself, if we don't
1769
 
         * connect this signal, all is fine.
1770
 
         */
1771
 
        g_signal_connect (GTK_WIDGET (list),
1772
 
                          "drag-motion",
1773
 
                          G_CALLBACK (contact_list_drag_motion),
1774
 
                          NULL);
1775
 
 
1776
 
        g_signal_connect (GTK_WIDGET (list),
1777
 
                          "drag-begin",
1778
 
                          G_CALLBACK (contact_list_drag_begin),
1779
 
                          NULL);
1780
 
        g_signal_connect (GTK_WIDGET (list),
1781
 
                          "drag-data-get",
1782
 
                          G_CALLBACK (contact_list_drag_data_get),
1783
 
                          NULL);
1784
 
        g_signal_connect (GTK_WIDGET (list),
1785
 
                          "drag-end",
1786
 
                          G_CALLBACK (contact_list_drag_end),
1787
 
                          NULL);
1788
1774
}
1789
1775
 
1790
1776
static void
1794
1780
                                 gint               y,
1795
1781
                                 GtkSelectionData  *selection,
1796
1782
                                 guint              info,
1797
 
                                 guint              time,
1798
 
                                 gpointer           user_data)
 
1783
                                 guint              time)
1799
1784
{
1800
1785
        GossipContactListPriv   *priv;
1801
1786
        GtkTreeModel            *model;
1923
1908
                          GdkDragContext *context,
1924
1909
                          gint            x,
1925
1910
                          gint            y,
1926
 
                          guint           time,
1927
 
                          gpointer        data)
 
1911
                          guint           time)
1928
1912
{
1929
1913
        static DragMotionData *dm = NULL;
1930
1914
        GtkTreePath           *path;
1993
1977
 
1994
1978
static void
1995
1979
contact_list_drag_begin (GtkWidget      *widget,
1996
 
                         GdkDragContext *context,
1997
 
                         gpointer        user_data)
 
1980
                         GdkDragContext *context)
1998
1981
{
1999
1982
        GossipContactListPriv *priv;
2000
1983
        GtkTreeSelection      *selection;
2004
1987
 
2005
1988
        priv = GET_PRIV (widget);
2006
1989
 
 
1990
        GTK_WIDGET_CLASS (gossip_contact_list_parent_class)->drag_begin (widget,
 
1991
                                                                         context);
 
1992
 
2007
1993
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
2008
1994
        if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
2009
1995
                return;
2019
2005
                            GdkDragContext        *context,
2020
2006
                            GtkSelectionData      *selection,
2021
2007
                            guint                  info,
2022
 
                            guint                  time,
2023
 
                            gpointer               user_data)
 
2008
                            guint                  time)
2024
2009
{
2025
2010
        GossipContactListPriv *priv;
2026
2011
        GtkTreePath           *src_path;
2069
2054
 
2070
2055
static void
2071
2056
contact_list_drag_end (GtkWidget      *widget,
2072
 
                       GdkDragContext *context,
2073
 
                       gpointer        user_data)
 
2057
                       GdkDragContext *context)
2074
2058
{
2075
2059
        GossipContactListPriv *priv;
2076
2060
 
2077
2061
        priv = GET_PRIV (widget);
2078
2062
 
 
2063
        GTK_WIDGET_CLASS (gossip_contact_list_parent_class)->drag_end (widget,
 
2064
                                                                       context);
 
2065
        
2079
2066
        if (priv->drag_row) {
2080
2067
                gtk_tree_row_reference_free (priv->drag_row);
2081
2068
                priv->drag_row = NULL;
2082
2069
        }
2083
2070
}
2084
2071
 
 
2072
static gboolean
 
2073
contact_list_drag_drop (GtkWidget      *widget,
 
2074
                        GdkDragContext *drag_context,
 
2075
                        gint            x,
 
2076
                        gint            y,
 
2077
                        guint           time)
 
2078
{
 
2079
        return FALSE;
 
2080
}
 
2081
 
2085
2082
static void
2086
2083
contact_list_cell_set_background (GossipContactList  *list,
2087
2084
                                  GtkCellRenderer    *cell,
2284
2281
        action = gtk_ui_manager_get_action (priv->ui, "/Contact/Log");
2285
2282
        gtk_action_set_sensitive (action, can_show_log);
2286
2283
 
2287
 
        /* FIXME: disable file transfer until finished. */
2288
2284
        action = gtk_ui_manager_get_action (priv->ui, "/Contact/SendFile");
2289
2285
        gtk_action_set_visible (action, can_send_file);
2290
2286
 
2324
2320
        g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL);
2325
2321
 
2326
2322
        can_show_log = gossip_log_exists_for_contact (contact);
2327
 
        can_send_file = FALSE;
 
2323
 
 
2324
        can_send_file = TRUE;
 
2325
 
2328
2326
        can_email = gossip_email_available (contact);
2329
2327
 
2330
2328
        menu = contact_list_get_contact_menu (list,
2833
2831
 
2834
2832
                contact = gossip_contact_list_get_selected (list);
2835
2833
                if (contact) {
2836
 
                        gossip_ft_window_send_file (contact);
 
2834
                        gossip_ft_dialog_send_file (contact);
2837
2835
                        g_object_unref (contact);
2838
2836
                }
2839
2837
 
3507
3505
 
3508
3506
        priv->show_avatars = show_avatars;
3509
3507
 
3510
 
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (list));
 
3508
        model = GTK_TREE_MODEL (priv->store);
3511
3509
 
3512
3510
        gtk_tree_model_foreach (model,
3513
3511
                                (GtkTreeModelForeachFunc)