1 /* Copyright (c) 2009, Igalia
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <glib/gi18n.h>
31 #ifdef MODEST_TOOLKIT_HILDON2
32 #include <hildon/hildon.h>
33 #include <hildon/hildon-file-chooser-dialog.h>
34 #include <modest-number-editor.h>
35 #include <modest-ui-constants.h>
37 #include "modest-toolkit-factory.h"
39 #ifndef MODEST_TOOLKIT_HILDON2
40 #define USE_SCROLLED_WINDOW
41 #define USE_GTK_FIND_TOOLBAR
42 #define USE_GTK_CHECK_BUTTON
43 #define USE_GTK_CHECK_MENU
45 #define USE_GTK_FILE_CHOOSER
46 #define USE_COUNTRY_COMBOBOX
47 #define USE_SERVERSECURITY_COMBOBOX
48 #define USE_SECUREAUTH_COMBOBOX
49 #define USE_GTK_SECURITY_OPTIONS_VIEW
50 #define USE_GTK_TEXT_VIEW
53 #ifdef USE_SCROLLED_WINDOW
54 #include <modest-scrolled-window-scrollable.h>
56 #include <modest-hildon-pannable-area-scrollable.h>
59 #ifdef USE_GTK_TOOLBAR
60 #include <modest-find-toolbar.h>
62 #include <modest-hildon-find-toolbar.h>
65 #ifdef USE_COUNTRY_COMBOBOX
66 #include <modest-country-combo-box.h>
68 #include <modest-country-picker.h>
71 #ifdef USE_PROVIDER_COMBOBOX
72 #include <modest-provider-combo-box.h>
74 #include <modest-provider-picker.h>
77 #ifdef USE_SERVERTYPE_COMBOBOX
78 #include <modest-servertype-combo-box.h>
80 #include <modest-servertype-picker.h>
83 #ifdef USE_SERVERSECURITY_COMBOBOX
84 #include <modest-serversecurity-combo-box.h>
86 #include <modest-serversecurity-picker.h>
89 #ifdef USE_SECUREAUTH_COMBOBOX
90 #include <modest-secureauth-combo-box.h>
92 #include <modest-secureauth-picker.h>
95 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
96 #include <modest-gtk-security-options-view.h>
98 #include <modest-maemo-security-options-view.h>
101 static void modest_toolkit_factory_class_init (ModestToolkitFactoryClass *klass);
102 static void modest_toolkit_factory_init (ModestToolkitFactory *self);
104 /* GObject interface */
105 static GtkWidget * modest_toolkit_factory_create_scrollable_default (ModestToolkitFactory *self);
106 static GtkWidget * modest_toolkit_factory_create_check_button_default (ModestToolkitFactory *self,
108 static GtkWidget * modest_toolkit_factory_create_check_menu_default (ModestToolkitFactory *self,
110 static GtkWidget * modest_toolkit_factory_create_isearch_toolbar_default (ModestToolkitFactory *self,
112 static GtkWidget * modest_toolkit_factory_create_entry_default (ModestToolkitFactory *self);
113 static GtkWidget * modest_toolkit_factory_create_number_entry_default (ModestToolkitFactory *self,
116 static GtkWidget * modest_toolkit_factory_create_file_chooser_dialog_default (ModestToolkitFactory *self,
119 GtkFileChooserAction action);
120 static GtkWidget * modest_toolkit_factory_create_country_selector_default (ModestToolkitFactory *self);
121 static GtkWidget * modest_toolkit_factory_create_provider_selector_default (ModestToolkitFactory *self);
122 static GtkWidget * modest_toolkit_factory_create_servertype_selector_default (ModestToolkitFactory *self,
123 gboolean filter_providers);
124 static GtkWidget * modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self);
125 static GtkWidget * modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self);
126 static GtkWidget * modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self,
127 ModestSecurityOptionsType type,
129 GtkSizeGroup *title_size_group,
130 GtkSizeGroup *value_size_group);
131 static GtkWidget * modest_toolkit_factory_create_text_view_default (ModestToolkitFactory *self);
133 static GObjectClass *parent_class = NULL;
135 G_DEFINE_TYPE (ModestToolkitFactory,
136 modest_toolkit_factory,
139 ModestToolkitFactory *
140 modest_toolkit_factory_get_instance (void)
142 GObject* self = g_object_new (MODEST_TYPE_TOOLKIT_FACTORY, NULL);
144 return (ModestToolkitFactory *) self;
148 modest_toolkit_factory_class_init (ModestToolkitFactoryClass *klass)
150 parent_class = g_type_class_peek_parent (klass);
152 klass->create_scrollable = modest_toolkit_factory_create_scrollable_default;
153 klass->create_check_button = modest_toolkit_factory_create_check_button_default;
154 klass->create_check_menu = modest_toolkit_factory_create_check_menu_default;
155 klass->create_isearch_toolbar = modest_toolkit_factory_create_isearch_toolbar_default;
156 klass->create_entry = modest_toolkit_factory_create_entry_default;
157 klass->create_number_entry = modest_toolkit_factory_create_number_entry_default;
158 klass->create_file_chooser_dialog = modest_toolkit_factory_create_file_chooser_dialog_default;
159 klass->create_country_selector = modest_toolkit_factory_create_country_selector_default;
160 klass->create_provider_selector = modest_toolkit_factory_create_provider_selector_default;
161 klass->create_servertype_selector = modest_toolkit_factory_create_servertype_selector_default;
162 klass->create_serversecurity_selector = modest_toolkit_factory_create_serversecurity_selector_default;
163 klass->create_secureauth_selector = modest_toolkit_factory_create_secureauth_selector_default;
164 klass->create_security_options_view = modest_toolkit_factory_create_security_options_view_default;
165 klass->create_text_view = modest_toolkit_factory_create_text_view_default;
169 modest_toolkit_factory_init (ModestToolkitFactory *self)
174 modest_toolkit_factory_create_scrollable (ModestToolkitFactory *self)
176 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_scrollable (self);
180 modest_toolkit_factory_create_scrollable_default (ModestToolkitFactory *self)
182 #ifdef USE_SCROLLED_WINDOW
183 return modest_scrolled_window_scrollable_new ();
185 return modest_hildon_pannable_area_scrollable_new ();
190 modest_toolkit_factory_create_check_button (ModestToolkitFactory *self, const gchar *label)
192 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_check_button (self, label);
196 modest_toolkit_factory_create_check_button_default (ModestToolkitFactory *self, const gchar *label)
199 #ifdef USE_GTK_CHECK_BUTTON
200 result = gtk_check_button_new_with_label (label);
202 result = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT);
203 gtk_button_set_label (GTK_BUTTON (result), label);
204 gtk_button_set_alignment (GTK_BUTTON (result), 0.0, 0.5);
210 modest_toolkit_factory_create_check_menu (ModestToolkitFactory *self, const gchar *label)
212 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_check_menu (self, label);
216 modest_toolkit_factory_create_check_menu_default (ModestToolkitFactory *self, const gchar *label)
219 #ifdef USE_GTK_CHECK_MENU
220 result = gtk_check_menu_item_new_with_label (label);
222 result = hildon_check_button_new (0);
223 gtk_button_set_label (GTK_BUTTON (result), label);
224 gtk_button_set_alignment (GTK_BUTTON (result), 0.5, 0.5);
230 modest_togglable_get_active (GtkWidget *widget)
232 if (GTK_IS_CHECK_MENU_ITEM (widget)) {
233 return gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
234 } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
235 return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
236 #ifdef MODEST_TOOLKIT_HILDON2
237 } else if (HILDON_IS_CHECK_BUTTON (widget)) {
238 return hildon_check_button_get_active (HILDON_CHECK_BUTTON (widget));
241 g_return_val_if_reached (FALSE);
246 modest_togglable_set_active (GtkWidget *widget, gboolean active)
248 if (GTK_IS_CHECK_MENU_ITEM (widget)) {
249 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), active);
250 } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
251 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
252 #ifdef MODEST_TOOLKIT_HILDON2
253 } else if (HILDON_IS_CHECK_BUTTON (widget)) {
254 hildon_check_button_set_active (HILDON_CHECK_BUTTON (widget), active);
260 modest_is_togglable (GtkWidget *widget)
262 return GTK_IS_CHECK_MENU_ITEM (widget)
263 || GTK_IS_TOGGLE_BUTTON (widget)
264 #ifdef MODEST_TOOLKIT_HILDON2
265 || HILDON_IS_CHECK_BUTTON (widget)
271 modest_toolkit_factory_create_isearch_toolbar (ModestToolkitFactory *self, const gchar *label)
273 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_isearch_toolbar (self, label);
277 modest_toolkit_factory_create_isearch_toolbar_default (ModestToolkitFactory *self, const gchar *label)
280 #ifdef USE_GTK_FIND_TOOLBAR
281 result = modest_find_toolbar_new (label);
283 result = modest_hildon_find_toolbar_new (label);
289 modest_toolkit_factory_create_entry (ModestToolkitFactory *self)
291 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_entry (self);
295 modest_toolkit_factory_create_entry_default (ModestToolkitFactory *self)
298 return gtk_entry_new ();
300 return hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
305 modest_entry_set_text (GtkWidget *widget, const gchar *text)
307 #ifdef MODEST_TOOLKIT_HILDON2
308 hildon_entry_set_text (HILDON_ENTRY (widget), text);
310 gtk_entry_set_text (GTK_ENTRY (widget), text);
315 modest_entry_get_text (GtkWidget *widget)
317 #ifdef MODEST_TOOLKIT_HILDON2
318 return hildon_entry_get_text (HILDON_ENTRY (widget));
320 return gtk_entry_set_text (GTK_ENTRY (widget));
325 modest_entry_set_hint (GtkWidget *widget, const gchar *hint)
327 #ifdef MODEST_TOOLKIT_HILDON2
328 hildon_entry_set_placeholder (HILDON_ENTRY (widget), hint);
330 gtk_widget_set_tooltip_text (widget, hint);
335 modest_is_entry (GtkWidget *widget)
337 #ifdef MODEST_TOOLKIT_HILDON2
338 return HILDON_IS_ENTRY (widget);
340 return GTK_IS_ENTRY (widget);
345 modest_toolkit_factory_create_number_entry (ModestToolkitFactory *self, gint min, gint max)
347 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_number_entry (self, min, max);
351 modest_toolkit_factory_create_number_entry_default (ModestToolkitFactory *self, gint min, gint max)
354 #ifdef USE_GTK_SPIN_BUTTON
355 result = gtk_spin_button_new_with_range (min, max, 1.0);
356 gtk_spin_button_set_digits (GTK_SPIN_BUTTON (result), 0);
358 result = modest_number_editor_new (min, max);
364 modest_number_entry_set_value (GtkWidget *widget, gint value)
366 #ifdef USE_GTK_SPIN_BUTTON
367 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
369 modest_number_editor_set_value (MODEST_NUMBER_EDITOR (widget), value);
374 modest_number_entry_get_value (GtkWidget *widget)
376 #ifdef USE_GTK_SPIN_BUTTON
377 return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
379 return modest_number_editor_get_value (MODEST_NUMBER_EDITOR (widget));
384 modest_number_entry_is_valid (GtkWidget *widget)
386 #ifdef USE_GTK_SPIN_BUTTON
389 return modest_number_editor_is_valid (MODEST_NUMBER_EDITOR (widget));
394 modest_is_number_entry (GtkWidget *widget)
396 #ifdef USE_GTK_SPIN_BUTTON
397 return GTK_IS_SPIN_BUTTON (widget);
399 return MODEST_IS_NUMBER_EDITOR (widget);
404 modest_toolkit_factory_create_file_chooser_dialog (ModestToolkitFactory *self,
407 GtkFileChooserAction action)
409 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_file_chooser_dialog (self, title, parent, action);
413 modest_toolkit_factory_create_file_chooser_dialog_default (ModestToolkitFactory *self,
416 GtkFileChooserAction action)
419 #ifdef USE_GTK_FILE_CHOOSER
420 result = gtk_file_chooser_dialog_new (title, parent, action,
421 (action == GTK_FILE_CHOOSER_ACTION_OPEN) ? GTK_STOCK_OPEN : GTK_STOCK_SAVE,
423 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
426 result = hildon_file_chooser_dialog_new (parent, action);
427 gtk_window_set_title ((GtkWindow *) result, title);
433 modest_toolkit_factory_create_country_selector (ModestToolkitFactory *self)
435 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_country_selector (self);
439 modest_toolkit_factory_create_country_selector_default (ModestToolkitFactory *self)
442 #ifdef USE_COUNTRY_COMBOBOX
443 result = modest_country_combo_box_new ();
445 result = GTK_WIDGET (modest_country_picker_new (MODEST_EDITABLE_SIZE,
446 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
452 modest_country_selector_get_active_country_mcc (GtkWidget *widget)
454 #ifdef USE_COUNTRY_COMBOBOX
455 return modest_country_combo_box_get_active_country_mcc (MODEST_COUNTRY_COMBO_BOX (widget));
457 return modest_country_picker_get_active_country_mcc (MODEST_COUNTRY_PICKER (widget));
462 modest_country_selector_load_data (GtkWidget *widget)
464 #ifdef USE_COUNTRY_COMBOBOX
465 modest_country_combo_box_load_data (MODEST_COUNTRY_COMBO_BOX (widget));
467 modest_country_picker_load_data (MODEST_COUNTRY_PICKER (widget));
472 modest_country_selector_set_active_country_locale (GtkWidget *widget)
474 #ifdef USE_COUNTRY_COMBOBOX
475 return modest_country_combo_box_set_active_country_locale (MODEST_COUNTRY_COMBO_BOX (widget));
477 return modest_country_picker_set_active_country_locale (MODEST_COUNTRY_PICKER (widget));
482 modest_toolkit_factory_create_provider_selector (ModestToolkitFactory *self)
484 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_provider_selector (self);
488 modest_toolkit_factory_create_provider_selector_default (ModestToolkitFactory *self)
491 #ifdef USE_PROVIDER_COMBOBOX
492 result = GTK_WIDGET (modest_provider_combo_box_new ());
494 result = GTK_WIDGET (modest_provider_picker_new (MODEST_EDITABLE_SIZE,
495 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
501 modest_provider_selector_fill (GtkWidget *widget,
502 ModestPresets *presets,
505 #ifdef USE_PROVIDER_COMBOBOX
506 modest_provider_combo_box_fill (MODEST_PROVIDER_COMBO_BOX (widget),
510 modest_provider_picker_fill (MODEST_PROVIDER_PICKER (widget),
517 modest_provider_selector_get_active_provider_id (GtkWidget *widget)
519 #ifdef USE_PROVIDER_COMBOBOX
520 return modest_provider_combo_box_get_active_provider_id (MODEST_PROVIDER_COMBO_BOX (widget));
522 return modest_provider_picker_get_active_provider_id (MODEST_PROVIDER_PICKER (widget));
527 modest_provider_selector_get_active_provider_label (GtkWidget *widget)
529 #ifdef USE_PROVIDER_COMBOBOX
531 return modest_provider_combo_box_get_active_provider_label (MODEST_PROVIDER_COMBO_BOX (widget));
535 selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (widget)));
536 return g_strdup (hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
540 ModestProviderSelectorIdType
541 modest_provider_selector_get_active_id_type (GtkWidget *widget)
543 ModestProviderSelectorIdType result;
544 #ifdef USE_PROVIDER_COMBOBOX
545 ModestProviderComboBoxIdType id_type;
547 id_type = modest_provider_combo_box_get_active_id_type (MODEST_PROVIDER_COMBO_BOX (widget));
549 case MODEST_PROVIDER_COMBO_BOX_ID_PROVIDER:
550 result = MODEST_PROVIDER_SELECTOR_ID_PROVIDER;
552 case MODEST_PROVIDER_COMBO_BOX_ID_OTHER:
553 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
555 case MODEST_PROVIDER_COMBO_BOX_ID_PLUGIN_PROTOCOL:
556 result = MODEST_PROVIDER_SELECTOR_ID_PLUGIN_PROTOCOL;
559 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
563 ModestProviderPickerIdType id_type;
565 id_type = modest_provider_picker_get_active_id_type (MODEST_PROVIDER_PICKER (widget));
567 case MODEST_PROVIDER_PICKER_ID_PROVIDER:
568 result = MODEST_PROVIDER_SELECTOR_ID_PROVIDER;
570 case MODEST_PROVIDER_PICKER_ID_OTHER:
571 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
573 case MODEST_PROVIDER_PICKER_ID_PLUGIN_PROTOCOL:
574 result = MODEST_PROVIDER_SELECTOR_ID_PLUGIN_PROTOCOL;
577 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
584 modest_provider_selector_set_others_provider (GtkWidget *self)
586 #ifdef USE_PROVIDER_COMBOBOX
587 modest_provider_combo_box_set_others_provider (MODEST_PROVIDER_COMBO_BOX (self));
589 modest_provider_picker_set_others_provider (MODEST_PROVIDER_PICKER (self));
594 modest_toolkit_factory_create_servertype_selector (ModestToolkitFactory *self, gboolean filter_providers)
596 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_servertype_selector (self, filter_providers);
600 modest_toolkit_factory_create_servertype_selector_default (ModestToolkitFactory *self, gboolean filter_providers)
603 #ifdef USE_PROVIDER_COMBOBOX
604 result = GTK_WIDGET (modest_servertype_combo_box_new (filter_providers));
606 result = GTK_WIDGET (modest_servertype_picker_new (MODEST_EDITABLE_SIZE,
607 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
614 modest_servertype_selector_get_active_servertype (GtkWidget *self)
616 #ifdef USE_SERVERTYPE_COMBOBOX
617 return modest_servertype_combo_box_get_active_servertype (MODEST_SERVERTYPE_COMBO_BOX (self));
619 return modest_servertype_picker_get_active_servertype (MODEST_SERVERTYPE_PICKER (self));
624 modest_servertype_selector_set_active_servertype (GtkWidget *self,
625 ModestProtocolType protocol_type_id)
627 #ifdef USE_SERVERTYPE_COMBOBOX
628 modest_servertype_combo_box_set_active_servertype (MODEST_SERVERTYPE_COMBO_BOX (self), protocol_type_id);
630 modest_servertype_picker_set_active_servertype (MODEST_SERVERTYPE_PICKER (self), protocol_type_id);
635 modest_toolkit_factory_create_serversecurity_selector (ModestToolkitFactory *self)
637 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_serversecurity_selector (self);
641 modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self)
644 #ifdef USE_SERVERSECURITY_COMBOBOX
645 result = GTK_WIDGET (modest_serversecurity_combo_box_new ());
647 result = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
648 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
654 modest_serversecurity_selector_fill (GtkWidget *combobox,
655 ModestProtocolType protocol)
657 #ifdef USE_SERVERSECURITY_COMBOBOX
658 modest_serversecurity_combo_box_fill (MODEST_SERVERSECURITY_COMBO_BOX (combobox),
661 modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (combobox),
667 modest_serversecurity_selector_get_active_serversecurity (GtkWidget *combobox)
669 #ifdef USE_SERVERSECURITY_COMBOBOX
670 return modest_serversecurity_combo_box_get_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (combobox));
672 return modest_serversecurity_picker_get_active_serversecurity (MODEST_SERVERSECURITY_PICKER (combobox));
677 modest_serversecurity_selector_set_active_serversecurity (GtkWidget *combobox,
678 ModestProtocolType serversecurity)
680 #ifdef USE_SERVERSECURITY_COMBOBOX
681 return modest_serversecurity_combo_box_set_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (combobox),
684 return modest_serversecurity_picker_set_active_serversecurity (MODEST_SERVERSECURITY_PICKER (combobox),
690 modest_serversecurity_selector_get_active_serversecurity_port (GtkWidget *combobox)
692 #ifdef USE_SERVERSECURITY_COMBOBOX
693 return modest_serversecurity_combo_box_get_active_serversecurity_port (MODEST_SERVERSECURITY_COMBO_BOX (combobox));
695 return modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (combobox));
700 modest_toolkit_factory_create_secureauth_selector (ModestToolkitFactory *self)
702 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_secureauth_selector (self);
706 modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self)
709 #ifdef USE_SECUREAUTH_COMBOBOX
710 result = GTK_WIDGET (modest_secureauth_combo_box_new ());
712 result = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
713 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
719 modest_secureauth_selector_get_active_secureauth (GtkWidget *widget)
721 #ifdef USE_SECUREAUTH_COMBOBOX
722 return modest_secureauth_combo_box_get_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget));
724 return modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (widget));
729 modest_secureauth_selector_set_active_secureauth (GtkWidget *widget,
730 ModestProtocolType secureauth)
732 #ifdef USE_SECUREAUTH_COMBOBOX
733 return modest_secureauth_combo_box_set_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget),
736 return modest_secureauth_picker_set_active_secureauth (MODEST_SECUREAUTH_PICKER (widget),
742 modest_is_secureauth_selector (GtkWidget *widget)
744 #ifdef USE_SECUREAUTH_COMBOBOX
745 return MODEST_IS_SECUREAUTH_COMBO_BOX (widget);
747 return MODEST_IS_SECUREAUTH_PICKER (widget);
752 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self,
753 ModestSecurityOptionsType type,
755 GtkSizeGroup *title_size_group,
756 GtkSizeGroup *value_size_group)
758 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_security_options_view (self, type, full,
759 title_size_group, value_size_group);
763 modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self,
764 ModestSecurityOptionsType type,
766 GtkSizeGroup *title_size_group,
767 GtkSizeGroup *value_size_group)
770 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
771 result = GTK_WIDGET (modest_gtk_security_options_view_new (type, full, title_size_group, value_size_group));
773 result = GTK_WIDGET (modest_maemo_security_options_view_new (type, full, title_size_group, value_size_group));
779 modest_toolkit_factory_create_text_view (ModestToolkitFactory *self)
781 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_text_view (self);
785 modest_toolkit_factory_create_text_view_default (ModestToolkitFactory *self)
787 #ifdef USE_GTK_TEXT_VIEW
788 return gtk_text_view_new ();
790 return hildon_text_view_new ();
795 modest_text_view_get_buffer (GtkWidget *widget)
797 #ifdef USE_GTK_TEXT_VIEW
798 return gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
800 return hildon_text_view_get_buffer (HILDON_TEXT_VIEW (widget));
805 modest_is_text_view (GtkWidget *widget)
807 #ifdef USE_GTK_TEXT_VIEW
808 return GTK_IS_TEXT_VIEW (widget);
810 return HILDON_IS_TEXT_VIEW (widget);