aboutsummaryrefslogtreecommitdiffstats
path: root/mail/Mail.idl
blob: f68889e0c2e74c892ba139aaeb82e9a5bba40751 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * mail.idl: Mail interfaces for Evolution
 *
 * Author:
 *   Miguel de Icaza (miguel@ximian.com)
 * 
 * (C) 2000 Ximian, Inc.
 */

#include <Bonobo.idl>

module GNOME {
module Evolution {
    
    interface MessageList : Bonobo::Unknown {
        
        void selectMessage (in long message_number);
        void openMessage   (in long message_number);
    };
    
    /*
     * FolderBrowser object.
     *
     * configuration of this widget is done trough 
     * Bonobo Properties
     */
    interface FolderBrowser : Bonobo::Unknown {
        MessageList getMessageList ();
    };

    interface FolderInfo : Bonobo::Unknown {
        struct MessageCount {
            string path;
            long count;
            long unread;
        };

        void getInfo (in string foldername,
                  in Bonobo::Listener listener);
    };

    interface MailConfig : Bonobo::Unknown {

        struct Identity {
            string name;
            string address;
            string organization;
            string signature;
            string html_signature;
            boolean has_html_signature;
        };

        struct Service {
            string url;
            boolean keep_on_server;
            boolean auto_check;
            long auto_check_time;
            boolean save_passwd;
            boolean enabled;
        };

        struct Account {
            string name;

            Identity id;
            Service source;
            Service transport;

            string drafts_folder_name;
            string drafts_folder_uri;
            string sent_folder_name;
            string sent_folder_uri;
        };

        void addAccount (in Account acc);
    };

    interface MailFilter : Bonobo::Unknown {

        void addFilter (in string rule);

        void removeFilter (in string rule);
    };
};
};

>278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684
/*
 * e-cell-combo.c: Combo cell renderer
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>  
 *
 *
 * Authors:
 *      Damon Chaplin <damon@ximian.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

/*
 * ECellCombo - a subclass of ECellPopup used to support popup lists like a
 * GtkCombo widget. It only supports a basic popup list of strings at present,
 * with no auto-completion.
 */

/*
 * Notes: (handling pointer grabs and GTK+ grabs is a nightmare!)
 *
 * o We must grab the pointer when we show the popup, so that if any buttons
 *   are pressed outside the application we hide the popup.
 *
 * o We have to be careful when popping up any widgets which also grab the
 *   pointer at some point, since we will lose our own pointer grab.
 *   When we pop up a list it will grab the pointer itself when an item is
 *   selected, and release the grab when the button is released.
 *   Fortunately we hide the popup at this point, so it isn't a problem.
 *   But for other types of widgets in the popup it could cause trouble.
 *   - I think GTK+ should provide help for this (nested pointer grabs?).
 *
 * o We must set the 'owner_events' flag of the pointer grab to TRUE so that
 *   pointer events get reported to all the application windows as normal.
 *   If we don't do this then the widgets in the popup may not work properly.
 *
 * o We must do a gtk_grab_add() so that we only allow events to go to the
 *   widgets within the popup (though some special events still get reported
 *   to the widget owning the window). Doing th gtk_grab_add() on the toplevel
 *   popup window should be fine. We can then check for any events that should
 *   close the popup, like the Escape key, or a button press outside the popup.
 */

#include <config.h>

#include <string.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "e-util/e-unicode.h"

#include "e-table-item.h"
#include "e-cell-combo.h"
#include "e-cell-text.h"

#define d(x)


/* The height to make the popup list if there aren't any items in it. */
#define E_CELL_COMBO_LIST_EMPTY_HEIGHT  15

static void e_cell_combo_class_init (ECellComboClass *klass);
static void e_cell_combo_init       (ECellCombo *ecc);
static void e_cell_combo_dispose    (GObject    *object);

static gint e_cell_combo_do_popup   (ECellPopup *ecp,
                     GdkEvent   *event,
                     int             row,
                     int             view_col);
static void e_cell_combo_select_matching_item   (ECellCombo *ecc);
static void e_cell_combo_show_popup (ECellCombo *ecc,
                     int             row,
                     int             view_col);
static void e_cell_combo_get_popup_pos  (ECellCombo *ecc,
                     int             row,
                     int             view_col,
                     gint       *x,
                     gint       *y,
                     gint       *height,
                     gint       *width);

static void e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc);

static gint e_cell_combo_button_press   (GtkWidget  *popup_window,
                     GdkEvent   *event,
                     ECellCombo *ecc);
static gint e_cell_combo_button_release (GtkWidget  *popup_window,
                     GdkEventButton *event,
                     ECellCombo *ecc);
static int e_cell_combo_key_press   (GtkWidget  *popup_window,
                     GdkEventKey    *event,
                     ECellCombo *ecc);

static void e_cell_combo_update_cell    (ECellCombo *ecc);
static void e_cell_combo_restart_edit   (ECellCombo *ecc);

G_DEFINE_TYPE (ECellCombo, e_cell_combo, E_CELL_POPUP_TYPE)

static void
e_cell_combo_class_init         (ECellComboClass    *klass)
{
    ECellPopupClass *ecpc = E_CELL_POPUP_CLASS (klass);
    GObjectClass *object_class = G_OBJECT_CLASS (klass);

    object_class->dispose = e_cell_combo_dispose;

    ecpc->popup = e_cell_combo_do_popup;
}


static void
e_cell_combo_init           (ECellCombo *ecc)
{
    GtkWidget *frame;
    AtkObject *a11y;
    GtkListStore *store;
    GtkTreeSelection *selection;

    /* We create one popup window for the ECell, since there will only
       ever be one popup in use at a time. */
    ecc->popup_window = gtk_window_new (GTK_WINDOW_POPUP);

    gtk_window_set_type_hint (GTK_WINDOW (ecc->popup_window), GDK_WINDOW_TYPE_HINT_COMBO);
    gtk_window_set_resizable (GTK_WINDOW (ecc->popup_window), TRUE);

    frame = gtk_frame_new (NULL);
    gtk_container_add (GTK_CONTAINER (ecc->popup_window), frame);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
    gtk_widget_show (frame);

    ecc->popup_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window),
                    GTK_POLICY_AUTOMATIC,
                    GTK_POLICY_AUTOMATIC);
    GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar, GTK_CAN_FOCUS);
    GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar, GTK_CAN_FOCUS);
    gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window);
    gtk_widget_show (ecc->popup_scrolled_window);

    store = gtk_list_store_new (1, G_TYPE_STRING);
    ecc->popup_tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
    g_object_unref (store);

    gtk_tree_view_append_column (
        GTK_TREE_VIEW (ecc->popup_tree_view),
        gtk_tree_view_column_new_with_attributes ("Text", gtk_cell_renderer_text_new (), "text", 0, NULL));

    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (ecc->popup_tree_view), FALSE);

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view));
    gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), ecc->popup_tree_view);
    gtk_container_set_focus_vadjustment (GTK_CONTAINER (ecc->popup_tree_view),
                         gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
    gtk_container_set_focus_hadjustment (GTK_CONTAINER (ecc->popup_tree_view),
                         gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
    gtk_widget_show (ecc->popup_tree_view);

    a11y = gtk_widget_get_accessible (ecc->popup_tree_view);
    atk_object_set_name (a11y, _("popup list"));

    g_signal_connect (selection,
              "changed",
              G_CALLBACK (e_cell_combo_selection_changed),
              ecc);
    g_signal_connect (ecc->popup_window,
              "button_press_event",
              G_CALLBACK (e_cell_combo_button_press),
              ecc);
    /* We use connect_after here so the list updates the selection before