aboutsummaryrefslogtreecommitdiffstats
path: root/mail/folder-browser-window.c
blob: 4905ae02f2a5b747faaa457c4205c41fca5c5486 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 *  Authors: Jeffrey Stedfast <fejj@ximian.com>
 *
 *  Copyright 2002 Ximian, Inc. (www.ximian.com)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
 *
 */


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-ui-component.h>
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>

#include <gal/util/e-util.h>

#include "folder-browser-window.h"

#include "folder-browser-ui.h"


#define MINIMUM_WIDTH  600
#define MINIMUM_HEIGHT 400

#define PARENT_TYPE (bonobo_window_get_type ())

static BonoboWindowClass *folder_browser_window_parent_class = NULL;

static GtkAllocation last_allocation = { 0, 0 };

static void
folder_browser_window_destroy (GtkObject *object)
{
    FolderBrowserWindow *folder_browser_window;
    
    folder_browser_window = FOLDER_BROWSER_WINDOW (object);
    
    if (folder_browser_window->folder_browser) {
        gtk_widget_destroy (GTK_WIDGET (folder_browser_window->folder_browser));
        folder_browser_window->folder_browser = NULL;
    }
    
    if (GTK_OBJECT_CLASS (folder_browser_window_parent_class)->destroy)
        (GTK_OBJECT_CLASS (folder_browser_window_parent_class)->destroy) (object);
}

static void
folder_browser_window_class_init (GtkObjectClass *object_class)
{
    object_class->destroy = folder_browser_window_destroy;
    
    folder_browser_window_parent_class = gtk_type_class (PARENT_TYPE);
}

static void
folder_browser_window_init (GtkObject *object)
{
    ;
}

static void
folder_browser_window_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation)
{
    last_allocation = *allocation;
}

static void
set_default_size (GtkWidget *widget)
{
    int width, height;
    
    width  = MAX (MINIMUM_WIDTH, last_allocation.width);
    height = MAX (MINIMUM_HEIGHT, last_allocation.height);
    
    gtk_window_set_default_size (GTK_WINDOW (widget), width, height);
}

GtkWidget *
folder_browser_window_new (FolderBrowser *fb)
{
    FolderBrowserWindow *new;
    BonoboUIContainer *uicont;
    BonoboUIComponent *uic;
    
    g_return_val_if_fail (IS_FOLDER_BROWSER (fb), NULL);
    
    new = gtk_type_new (FOLDER_BROWSER_WINDOW_TYPE);
    new = (FolderBrowserWindow *) bonobo_window_construct (BONOBO_WINDOW (new), "Ximian Evolution", "");
    if (!new)
        return NULL;
    
    set_default_size (GTK_WIDGET (new));
    
    new->folder_browser = fb;
    bonobo_window_set_contents (BONOBO_WINDOW (new), GTK_WIDGET (fb));
    
    uicont = bonobo_ui_container_new ();
    bonobo_ui_container_set_win (uicont, BONOBO_WINDOW (new));
    
    uic = bonobo_ui_component_new_default ();
    bonobo_ui_component_set_container (uic, BONOBO_OBJREF (uicont));
    
    folder_browser_set_ui_component (FOLDER_BROWSER (fb), uic);
    
    bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, "evolution-mail-global.xml", "evolution-mail");
    
    folder_browser_ui_add_global (fb);
    folder_browser_ui_add_list (fb);
    folder_browser_ui_add_message (fb);
    
    /*folder_browser_set_shell_view (fb, fb_get_svi (control));*/
    
    gtk_signal_connect (GTK_OBJECT (new), "size_allocate", 
                GTK_SIGNAL_FUNC (folder_browser_window_size_allocate_cb), NULL);
    
    return GTK_WIDGET (new);
}

E_MAKE_TYPE (folder_browser_window, "FolderBrowserWindow", FolderBrowserWindow, folder_browser_window_class_init, folder_browser_window_init, PARENT_TYPE);
d>Fixes #41916Rodrigo Moya2003-04-292-2/+10 * (main): Add e_proxy_init()Ettore Perazzoli2003-04-292-0/+9 * Comment out the pinging code again since it's only being used byDan Winship2003-04-262-0/+12 * (async_open_cb): Added a missing unref of theEttore Perazzoli2003-04-262-7/+19 * cast to remove warning. (construct): set a physiucal uri on the rootNot Zed2003-04-242-1/+11 * Add appropriate padding to the Evolution Settings window. This is anotherAnna Marie Dirks2003-04-243-1/+14 * *glade/e-folder-list.glade : replaced buttons with stock buttons and addedAnna Marie Dirks2003-04-242-98/+103 * Set the border width of the message dialog to 6. Also corrected theAnna Marie Dirks2003-04-232-3/+23 * this should never happen unless you're really trying, but don't crash ifChris Toshok2003-04-222-4/+14 * (create_folder_directory): Don't signal anEttore Perazzoli2003-04-222-6/+11 * Corrected border with for Delete Folder dialog. Fixes 41036.Anna Marie Dirks2003-04-222-3/+17 * Added appropriate border width to the folder selection dialog. FixesAnna Marie Dirks2003-04-222-4/+21 * Added spacing/padding to first-run dialog. Fixes 41242.Anna Marie Dirks2003-04-222-1/+7 * Misc HIG-related tweaks, mostly spacing and padding related. Fixes 41008.Anna Marie Dirks2003-04-223-6/+16 * Added appropriate spacing/padding to the default folder pages of theAnna Marie Dirks2003-04-222-189/+188 * Fixed padding/spacing/caps of the "Go Offline" dialog. Fixes 41225 andAnna Marie Dirks2003-04-222-5/+11 * [ fixes #21499 ]Rodney Dawes2003-04-192-1/+6 * If the default_type is "foo/bar" and "foo" appears in the list butDan Winship2003-04-182-13/+18 * If the new folder's parent has unresolved children, async_open the parentDan Winship2003-04-182-8/+79 * Turn off debugging. Fixes bug #41469.Jeffrey Stedfast2003-04-182-1/+5 * Increase the default value forEttore Perazzoli2003-04-163-13/+21 * Free the temporary string.Hans Petter Jansson2003-04-164-5/+29 * new boolean flag.Dan Winship2003-04-164-36/+96 * fix the title of the dialogue box. #41304.Not Zed2003-04-152-1/+6 * Update for e_option_menu prototype constificationDan Winship2003-04-103-16/+28 * Add a "--setup-only" flag, to just run e_setup() and exit. (For #40889)Dan Winship2003-04-102-0/+8 * Commit the right version.Larry Ewing2003-04-091-2/+2 * remove call to gtk_html_set_default_background_color, replace with callsLarry Ewing2003-04-091-2/+2 * kill an old e_utf8_gtk usageMike Kestner2003-04-091-1/+0 * (setup_bonobo_conf_private_directory): Removed.Ettore Perazzoli2003-04-092-84/+6 * Remove the color specs so the druid will use theme colorsDan Winship2003-04-083-35/+7 * (impl_dispose): g_object_weak_unref() the shell here.Ettore Perazzoli2003-04-082-0/+12 * Fix arg types on REMOVED_SHARED_FOLDER signal. #40888Dan Winship2003-04-082-3/+6 * Desensitize the window's top-level container rather than desensitizing theDan Winship2003-04-084-32/+40 * ignore wombat filesDan Winship2003-04-081-0/+4 * Substitute version number into the evolution binary name in the serverDan Winship2003-04-084-6/+32 * [#40536]Not Zed2003-04-07