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
51 #define USE_SELECTOR_COMBOBOX
52 #define USE_GTK_DETAILS_DIALOG
55 #ifdef USE_SCROLLED_WINDOW
56 #include <modest-scrolled-window-scrollable.h>
58 #include <modest-hildon-pannable-area-scrollable.h>
61 #ifdef USE_GTK_FIND_TOOLBAR
62 #include <modest-find-toolbar.h>
64 #include <modest-hildon-find-toolbar.h>
67 #ifdef USE_COUNTRY_COMBOBOX
68 #include <modest-country-combo-box.h>
70 #include <modest-country-picker.h>
73 #ifdef USE_PROVIDER_COMBOBOX
74 #include <modest-provider-combo-box.h>
76 #include <modest-provider-picker.h>
79 #ifdef USE_SERVERTYPE_COMBOBOX
80 #include <modest-servertype-combo-box.h>
82 #include <modest-servertype-picker.h>
85 #ifdef USE_SERVERSECURITY_COMBOBOX
86 #include <modest-serversecurity-combo-box.h>
88 #include <modest-serversecurity-picker.h>
91 #ifdef USE_SECUREAUTH_COMBOBOX
92 #include <modest-secureauth-combo-box.h>
94 #include <modest-secureauth-picker.h>
97 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
98 #include <modest-gtk-security-options-view.h>
100 #include <modest-maemo-security-options-view.h>
103 #ifdef USE_SELECTOR_COMBOBOX
104 #include <modest-combo-box.h>
106 #include <modest-selector-picker.h>
109 #ifdef USE_GTK_DETAILS_DIALOG
110 #include <modest-gtk-details-dialog.h>
112 #include <modest-hildon2-details-dialog.h>
115 static void modest_toolkit_factory_class_init (ModestToolkitFactoryClass *klass);
116 static void modest_toolkit_factory_init (ModestToolkitFactory *self);
118 /* GObject interface */
119 static GtkWidget * modest_toolkit_factory_create_scrollable_default (ModestToolkitFactory *self);
120 static GtkWidget * modest_toolkit_factory_create_check_button_default (ModestToolkitFactory *self,
122 static GtkWidget * modest_toolkit_factory_create_check_menu_default (ModestToolkitFactory *self,
124 static GtkWidget * modest_toolkit_factory_create_isearch_toolbar_default (ModestToolkitFactory *self,
126 static GtkWidget * modest_toolkit_factory_create_entry_default (ModestToolkitFactory *self);
127 static GtkWidget * modest_toolkit_factory_create_number_entry_default (ModestToolkitFactory *self,
130 static GtkWidget * modest_toolkit_factory_create_file_chooser_dialog_default (ModestToolkitFactory *self,
133 GtkFileChooserAction action);
134 static GtkWidget * modest_toolkit_factory_create_country_selector_default (ModestToolkitFactory *self);
135 static GtkWidget * modest_toolkit_factory_create_provider_selector_default (ModestToolkitFactory *self);
136 static GtkWidget * modest_toolkit_factory_create_servertype_selector_default (ModestToolkitFactory *self,
137 gboolean filter_providers);
138 static GtkWidget * modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self);
139 static GtkWidget * modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self);
140 static GtkWidget * modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self,
141 ModestSecurityOptionsType type,
143 GtkSizeGroup *title_size_group,
144 GtkSizeGroup *value_size_group);
145 static GtkWidget * modest_toolkit_factory_create_text_view_default (ModestToolkitFactory *self);
146 static GtkWidget * modest_toolkit_factory_create_selector_default (ModestToolkitFactory *self,
147 ModestPairList *pairs, GEqualFunc id_equal_func);
148 static GtkWidget * modest_toolkit_factory_create_details_dialog_with_header_default (ModestToolkitFactory *self, GtkWindow *parent,
149 TnyHeader *header, gboolean get_size);
150 static GtkWidget * modest_toolkit_factory_create_details_dialog_with_folder_default (ModestToolkitFactory *self, GtkWindow *parent,
154 static GObjectClass *parent_class = NULL;
156 G_DEFINE_TYPE (ModestToolkitFactory,
157 modest_toolkit_factory,
160 ModestToolkitFactory *
161 modest_toolkit_factory_get_instance (void)
163 GObject* self = g_object_new (MODEST_TYPE_TOOLKIT_FACTORY, NULL);
165 return (ModestToolkitFactory *) self;
169 modest_toolkit_factory_class_init (ModestToolkitFactoryClass *klass)
171 parent_class = g_type_class_peek_parent (klass);
173 klass->create_scrollable = modest_toolkit_factory_create_scrollable_default;
174 klass->create_check_button = modest_toolkit_factory_create_check_button_default;
175 klass->create_check_menu = modest_toolkit_factory_create_check_menu_default;
176 klass->create_isearch_toolbar = modest_toolkit_factory_create_isearch_toolbar_default;
177 klass->create_entry = modest_toolkit_factory_create_entry_default;
178 klass->create_number_entry = modest_toolkit_factory_create_number_entry_default;
179 klass->create_file_chooser_dialog = modest_toolkit_factory_create_file_chooser_dialog_default;
180 klass->create_country_selector = modest_toolkit_factory_create_country_selector_default;
181 klass->create_provider_selector = modest_toolkit_factory_create_provider_selector_default;
182 klass->create_servertype_selector = modest_toolkit_factory_create_servertype_selector_default;
183 klass->create_serversecurity_selector = modest_toolkit_factory_create_serversecurity_selector_default;
184 klass->create_secureauth_selector = modest_toolkit_factory_create_secureauth_selector_default;
185 klass->create_security_options_view = modest_toolkit_factory_create_security_options_view_default;
186 klass->create_text_view = modest_toolkit_factory_create_text_view_default;
187 klass->create_selector = modest_toolkit_factory_create_selector_default;
188 klass->create_details_dialog_with_header = modest_toolkit_factory_create_details_dialog_with_header_default;
189 klass->create_details_dialog_with_folder = modest_toolkit_factory_create_details_dialog_with_folder_default;
193 modest_toolkit_factory_init (ModestToolkitFactory *self)
198 modest_toolkit_factory_create_scrollable (ModestToolkitFactory *self)
200 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_scrollable (self);
204 modest_toolkit_factory_create_scrollable_default (ModestToolkitFactory *self)
206 #ifdef USE_SCROLLED_WINDOW
207 return modest_scrolled_window_scrollable_new ();
209 return modest_hildon_pannable_area_scrollable_new ();
214 modest_toolkit_factory_create_check_button (ModestToolkitFactory *self, const gchar *label)
216 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_check_button (self, label);
220 modest_toolkit_factory_create_check_button_default (ModestToolkitFactory *self, const gchar *label)
223 #ifdef USE_GTK_CHECK_BUTTON
224 result = gtk_check_button_new_with_label (label);
226 result = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT);
227 gtk_button_set_label (GTK_BUTTON (result), label);
228 gtk_button_set_alignment (GTK_BUTTON (result), 0.0, 0.5);
234 modest_toolkit_factory_create_check_menu (ModestToolkitFactory *self, const gchar *label)
236 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_check_menu (self, label);
240 modest_toolkit_factory_create_check_menu_default (ModestToolkitFactory *self, const gchar *label)
243 #ifdef USE_GTK_CHECK_MENU
244 result = gtk_check_menu_item_new_with_label (label);
246 result = hildon_check_button_new (0);
247 gtk_button_set_label (GTK_BUTTON (result), label);
248 gtk_button_set_alignment (GTK_BUTTON (result), 0.5, 0.5);
254 modest_togglable_get_active (GtkWidget *widget)
256 if (GTK_IS_CHECK_MENU_ITEM (widget)) {
257 return gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
258 } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
259 return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
260 #ifdef MODEST_TOOLKIT_HILDON2
261 } else if (HILDON_IS_CHECK_BUTTON (widget)) {
262 return hildon_check_button_get_active (HILDON_CHECK_BUTTON (widget));
265 g_return_val_if_reached (FALSE);
270 modest_togglable_set_active (GtkWidget *widget, gboolean active)
272 if (GTK_IS_CHECK_MENU_ITEM (widget)) {
273 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), active);
274 } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
275 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
276 #ifdef MODEST_TOOLKIT_HILDON2
277 } else if (HILDON_IS_CHECK_BUTTON (widget)) {
278 hildon_check_button_set_active (HILDON_CHECK_BUTTON (widget), active);
284 modest_is_togglable (GtkWidget *widget)
286 return GTK_IS_CHECK_MENU_ITEM (widget)
287 || GTK_IS_TOGGLE_BUTTON (widget)
288 #ifdef MODEST_TOOLKIT_HILDON2
289 || HILDON_IS_CHECK_BUTTON (widget)
295 modest_toolkit_factory_create_isearch_toolbar (ModestToolkitFactory *self, const gchar *label)
297 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_isearch_toolbar (self, label);
301 modest_toolkit_factory_create_isearch_toolbar_default (ModestToolkitFactory *self, const gchar *label)
304 #ifdef USE_GTK_FIND_TOOLBAR
305 result = modest_find_toolbar_new (label);
307 result = modest_hildon_find_toolbar_new (label);
313 modest_toolkit_factory_create_entry (ModestToolkitFactory *self)
315 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_entry (self);
319 modest_toolkit_factory_create_entry_default (ModestToolkitFactory *self)
322 return gtk_entry_new ();
324 return hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
329 modest_entry_set_text (GtkWidget *widget, const gchar *text)
332 gtk_entry_set_text (GTK_ENTRY (widget), text);
334 hildon_entry_set_text (HILDON_ENTRY (widget), text);
339 modest_entry_get_text (GtkWidget *widget)
342 return gtk_entry_get_text (GTK_ENTRY (widget));
344 return hildon_entry_get_text (HILDON_ENTRY (widget));
349 modest_entry_set_hint (GtkWidget *widget, const gchar *hint)
352 gtk_widget_set_tooltip_text (widget, hint);
354 hildon_entry_set_placeholder (HILDON_ENTRY (widget), hint);
359 modest_is_entry (GtkWidget *widget)
362 return GTK_IS_ENTRY (widget);
364 return HILDON_IS_ENTRY (widget);
369 modest_toolkit_factory_create_number_entry (ModestToolkitFactory *self, gint min, gint max)
371 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_number_entry (self, min, max);
375 modest_toolkit_factory_create_number_entry_default (ModestToolkitFactory *self, gint min, gint max)
378 #ifdef USE_GTK_SPIN_BUTTON
379 result = gtk_spin_button_new_with_range (min, max, 1.0);
380 gtk_spin_button_set_digits (GTK_SPIN_BUTTON (result), 0);
382 result = modest_number_editor_new (min, max);
388 modest_number_entry_set_value (GtkWidget *widget, gint value)
390 #ifdef USE_GTK_SPIN_BUTTON
391 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
393 modest_number_editor_set_value (MODEST_NUMBER_EDITOR (widget), value);
398 modest_number_entry_get_value (GtkWidget *widget)
400 #ifdef USE_GTK_SPIN_BUTTON
401 return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
403 return modest_number_editor_get_value (MODEST_NUMBER_EDITOR (widget));
408 modest_number_entry_is_valid (GtkWidget *widget)
410 #ifdef USE_GTK_SPIN_BUTTON
413 return modest_number_editor_is_valid (MODEST_NUMBER_EDITOR (widget));
418 modest_is_number_entry (GtkWidget *widget)
420 #ifdef USE_GTK_SPIN_BUTTON
421 return GTK_IS_SPIN_BUTTON (widget);
423 return MODEST_IS_NUMBER_EDITOR (widget);
428 modest_toolkit_factory_create_file_chooser_dialog (ModestToolkitFactory *self,
431 GtkFileChooserAction action)
433 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_file_chooser_dialog (self, title, parent, action);
437 modest_toolkit_factory_create_file_chooser_dialog_default (ModestToolkitFactory *self,
440 GtkFileChooserAction action)
443 #ifdef USE_GTK_FILE_CHOOSER
444 result = gtk_file_chooser_dialog_new (title, parent, action,
445 (action == GTK_FILE_CHOOSER_ACTION_OPEN) ? GTK_STOCK_OPEN : GTK_STOCK_SAVE,
447 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
450 result = hildon_file_chooser_dialog_new (parent, action);
451 gtk_window_set_title ((GtkWindow *) result, title);
457 modest_toolkit_factory_create_country_selector (ModestToolkitFactory *self)
459 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_country_selector (self);
463 modest_toolkit_factory_create_country_selector_default (ModestToolkitFactory *self)
466 #ifdef USE_COUNTRY_COMBOBOX
467 result = modest_country_combo_box_new ();
469 result = GTK_WIDGET (modest_country_picker_new (MODEST_EDITABLE_SIZE,
470 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
476 modest_country_selector_get_active_country_mcc (GtkWidget *widget)
478 #ifdef USE_COUNTRY_COMBOBOX
479 return modest_country_combo_box_get_active_country_mcc (MODEST_COUNTRY_COMBO_BOX (widget));
481 return modest_country_picker_get_active_country_mcc (MODEST_COUNTRY_PICKER (widget));
486 modest_country_selector_load_data (GtkWidget *widget)
488 #ifdef USE_COUNTRY_COMBOBOX
489 modest_country_combo_box_load_data (MODEST_COUNTRY_COMBO_BOX (widget));
491 modest_country_picker_load_data (MODEST_COUNTRY_PICKER (widget));
496 modest_country_selector_set_active_country_locale (GtkWidget *widget)
498 #ifdef USE_COUNTRY_COMBOBOX
499 return modest_country_combo_box_set_active_country_locale (MODEST_COUNTRY_COMBO_BOX (widget));
501 return modest_country_picker_set_active_country_locale (MODEST_COUNTRY_PICKER (widget));
506 modest_toolkit_factory_create_provider_selector (ModestToolkitFactory *self)
508 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_provider_selector (self);
512 modest_toolkit_factory_create_provider_selector_default (ModestToolkitFactory *self)
515 #ifdef USE_PROVIDER_COMBOBOX
516 result = GTK_WIDGET (modest_provider_combo_box_new ());
518 result = GTK_WIDGET (modest_provider_picker_new (MODEST_EDITABLE_SIZE,
519 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
525 modest_provider_selector_fill (GtkWidget *widget,
526 ModestPresets *presets,
529 #ifdef USE_PROVIDER_COMBOBOX
530 modest_provider_combo_box_fill (MODEST_PROVIDER_COMBO_BOX (widget),
534 modest_provider_picker_fill (MODEST_PROVIDER_PICKER (widget),
541 modest_provider_selector_refresh (GtkWidget *widget)
543 #ifdef USE_PROVIDER_COMBOBOX
544 modest_provider_combo_box_refresh (MODEST_PROVIDER_COMBO_BOX (widget));
546 modest_provider_picker_refresh (MODEST_PROVIDER_PICKER (widget));
551 modest_provider_selector_get_active_provider_id (GtkWidget *widget)
553 #ifdef USE_PROVIDER_COMBOBOX
554 return modest_provider_combo_box_get_active_provider_id (MODEST_PROVIDER_COMBO_BOX (widget));
556 return modest_provider_picker_get_active_provider_id (MODEST_PROVIDER_PICKER (widget));
561 modest_provider_selector_get_active_provider_label (GtkWidget *widget)
563 #ifdef USE_PROVIDER_COMBOBOX
565 return modest_provider_combo_box_get_active_provider_label (MODEST_PROVIDER_COMBO_BOX (widget));
569 selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (widget)));
570 return g_strdup (hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
574 ModestProviderSelectorIdType
575 modest_provider_selector_get_active_id_type (GtkWidget *widget)
577 ModestProviderSelectorIdType result;
578 #ifdef USE_PROVIDER_COMBOBOX
579 ModestProviderComboBoxIdType id_type;
581 id_type = modest_provider_combo_box_get_active_id_type (MODEST_PROVIDER_COMBO_BOX (widget));
583 case MODEST_PROVIDER_COMBO_BOX_ID_PROVIDER:
584 result = MODEST_PROVIDER_SELECTOR_ID_PROVIDER;
586 case MODEST_PROVIDER_COMBO_BOX_ID_OTHER:
587 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
589 case MODEST_PROVIDER_COMBO_BOX_ID_PLUGIN_PROTOCOL:
590 result = MODEST_PROVIDER_SELECTOR_ID_PLUGIN_PROTOCOL;
593 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
597 ModestProviderPickerIdType id_type;
599 id_type = modest_provider_picker_get_active_id_type (MODEST_PROVIDER_PICKER (widget));
601 case MODEST_PROVIDER_PICKER_ID_PROVIDER:
602 result = MODEST_PROVIDER_SELECTOR_ID_PROVIDER;
604 case MODEST_PROVIDER_PICKER_ID_OTHER:
605 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
607 case MODEST_PROVIDER_PICKER_ID_PLUGIN_PROTOCOL:
608 result = MODEST_PROVIDER_SELECTOR_ID_PLUGIN_PROTOCOL;
611 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
618 modest_provider_selector_set_others_provider (GtkWidget *self)
620 #ifdef USE_PROVIDER_COMBOBOX
621 modest_provider_combo_box_set_others_provider (MODEST_PROVIDER_COMBO_BOX (self));
623 modest_provider_picker_set_others_provider (MODEST_PROVIDER_PICKER (self));
628 modest_toolkit_factory_create_servertype_selector (ModestToolkitFactory *self, gboolean filter_providers)
630 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_servertype_selector (self, filter_providers);
634 modest_toolkit_factory_create_servertype_selector_default (ModestToolkitFactory *self, gboolean filter_providers)
637 #ifdef USE_PROVIDER_COMBOBOX
638 result = GTK_WIDGET (modest_servertype_combo_box_new (filter_providers));
640 result = GTK_WIDGET (modest_servertype_picker_new (MODEST_EDITABLE_SIZE,
641 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
648 modest_servertype_selector_get_active_servertype (GtkWidget *self)
650 #ifdef USE_SERVERTYPE_COMBOBOX
651 return modest_servertype_combo_box_get_active_servertype (MODEST_SERVERTYPE_COMBO_BOX (self));
653 return modest_servertype_picker_get_active_servertype (MODEST_SERVERTYPE_PICKER (self));
658 modest_servertype_selector_set_active_servertype (GtkWidget *self,
659 ModestProtocolType protocol_type_id)
661 #ifdef USE_SERVERTYPE_COMBOBOX
662 modest_servertype_combo_box_set_active_servertype (MODEST_SERVERTYPE_COMBO_BOX (self), protocol_type_id);
664 modest_servertype_picker_set_active_servertype (MODEST_SERVERTYPE_PICKER (self), protocol_type_id);
669 modest_toolkit_factory_create_serversecurity_selector (ModestToolkitFactory *self)
671 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_serversecurity_selector (self);
675 modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self)
678 #ifdef USE_SERVERSECURITY_COMBOBOX
679 result = GTK_WIDGET (modest_serversecurity_combo_box_new ());
681 result = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
682 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
688 modest_serversecurity_selector_fill (GtkWidget *combobox,
689 ModestProtocolType protocol)
691 #ifdef USE_SERVERSECURITY_COMBOBOX
692 modest_serversecurity_combo_box_fill (MODEST_SERVERSECURITY_COMBO_BOX (combobox),
695 modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (combobox),
701 modest_serversecurity_selector_get_active_serversecurity (GtkWidget *combobox)
703 #ifdef USE_SERVERSECURITY_COMBOBOX
704 return modest_serversecurity_combo_box_get_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (combobox));
706 return modest_serversecurity_picker_get_active_serversecurity (MODEST_SERVERSECURITY_PICKER (combobox));
711 modest_serversecurity_selector_set_active_serversecurity (GtkWidget *combobox,
712 ModestProtocolType serversecurity)
714 #ifdef USE_SERVERSECURITY_COMBOBOX
715 return modest_serversecurity_combo_box_set_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (combobox),
718 return modest_serversecurity_picker_set_active_serversecurity (MODEST_SERVERSECURITY_PICKER (combobox),
724 modest_serversecurity_selector_get_active_serversecurity_port (GtkWidget *combobox)
726 #ifdef USE_SERVERSECURITY_COMBOBOX
727 return modest_serversecurity_combo_box_get_active_serversecurity_port (MODEST_SERVERSECURITY_COMBO_BOX (combobox));
729 return modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (combobox));
734 modest_toolkit_factory_create_secureauth_selector (ModestToolkitFactory *self)
736 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_secureauth_selector (self);
740 modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self)
743 #ifdef USE_SECUREAUTH_COMBOBOX
744 result = GTK_WIDGET (modest_secureauth_combo_box_new ());
746 result = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
747 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
753 modest_secureauth_selector_get_active_secureauth (GtkWidget *widget)
755 #ifdef USE_SECUREAUTH_COMBOBOX
756 return modest_secureauth_combo_box_get_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget));
758 return modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (widget));
763 modest_secureauth_selector_set_active_secureauth (GtkWidget *widget,
764 ModestProtocolType secureauth)
766 #ifdef USE_SECUREAUTH_COMBOBOX
767 return modest_secureauth_combo_box_set_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget),
770 return modest_secureauth_picker_set_active_secureauth (MODEST_SECUREAUTH_PICKER (widget),
776 modest_is_secureauth_selector (GtkWidget *widget)
778 #ifdef USE_SECUREAUTH_COMBOBOX
779 return MODEST_IS_SECUREAUTH_COMBO_BOX (widget);
781 return MODEST_IS_SECUREAUTH_PICKER (widget);
786 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self,
787 ModestSecurityOptionsType type,
789 GtkSizeGroup *title_size_group,
790 GtkSizeGroup *value_size_group)
792 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_security_options_view (self, type, full,
793 title_size_group, value_size_group);
797 modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self,
798 ModestSecurityOptionsType type,
800 GtkSizeGroup *title_size_group,
801 GtkSizeGroup *value_size_group)
804 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
805 result = GTK_WIDGET (modest_gtk_security_options_view_new (type, full, title_size_group, value_size_group));
807 result = GTK_WIDGET (modest_maemo_security_options_view_new (type, full, title_size_group, value_size_group));
813 modest_toolkit_factory_create_text_view (ModestToolkitFactory *self)
815 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_text_view (self);
819 modest_toolkit_factory_create_text_view_default (ModestToolkitFactory *self)
821 #ifdef USE_GTK_TEXT_VIEW
822 return gtk_text_view_new ();
824 return hildon_text_view_new ();
829 modest_text_view_get_buffer (GtkWidget *widget)
831 #ifdef USE_GTK_TEXT_VIEW
832 return gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
834 return hildon_text_view_get_buffer (HILDON_TEXT_VIEW (widget));
839 modest_is_text_view (GtkWidget *widget)
841 #ifdef USE_GTK_TEXT_VIEW
842 return GTK_IS_TEXT_VIEW (widget);
844 return HILDON_IS_TEXT_VIEW (widget);
849 modest_toolkit_factory_create_selector (ModestToolkitFactory *self,
850 ModestPairList *pairs, GEqualFunc id_equal_func)
852 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_selector (self, pairs, id_equal_func);
856 modest_toolkit_factory_create_selector_default (ModestToolkitFactory *self,
857 ModestPairList *pairs, GEqualFunc id_equal_func)
859 #ifdef USE_SELECTOR_COMBOBOX
860 return modest_combo_box_new (pairs, id_equal_func);
862 return modest_selector_picker_new (MODEST_EDITABLE_SIZE,
863 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
864 pairs, id_equal_func);
869 modest_selector_set_pair_list (GtkWidget *widget,
870 ModestPairList *pairs)
872 #ifdef USE_SELECTOR_COMBOBOX
873 modest_combo_box_set_pair_list (MODEST_COMBO_BOX (widget),
876 modest_selector_picker_set_pair_list (MODEST_SELECTOR_PICKER (widget),
882 modest_selector_get_active_id (GtkWidget *self)
884 #ifdef USE_SELECTOR_COMBOBOX
885 return modest_combo_box_get_active_id (MODEST_COMBO_BOX (self));
887 return modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (self));
892 modest_selector_set_active_id (GtkWidget *self, gpointer id)
894 #ifdef USE_SELECTOR_COMBOBOX
895 modest_combo_box_set_active_id (MODEST_COMBO_BOX (self), id);
897 modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (self), id);
902 modest_selector_get_active_display_name (GtkWidget *self)
904 #ifdef USE_SELECTOR_COMBOBOX
905 return modest_combo_box_get_active_display_name (MODEST_COMBO_BOX (self));
907 return modest_selector_picker_get_active_display_name (MODEST_SELECTOR_PICKER (self));
912 modest_selector_set_value_max_chars (GtkWidget *self, gint value_max_width_chars)
914 #ifndef USE_SELECTOR_COMBOBOX
915 modest_selector_picker_set_value_max_chars (MODEST_SELECTOR_PICKER (self), value_max_width_chars);
920 modest_selector_get_value_max_chars (GtkWidget *self)
922 #ifdef USE_SELECTOR_COMBOBOX
925 return modest_selector_picker_get_value_max_chars (MODEST_SELECTOR_PICKER (self));
930 modest_toolkit_factory_create_details_dialog_with_header (ModestToolkitFactory *self,
935 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_details_dialog_with_header (self, parent, header, get_size);
939 modest_toolkit_factory_create_details_dialog_with_header_default (ModestToolkitFactory *self,
944 #ifndef USE_GTK_DETAILS_DIALOG
945 return modest_hildon2_details_dialog_new_with_header (parent, header, get_size);
947 return modest_gtk_details_dialog_new_with_header (parent, header, get_size);
952 modest_toolkit_factory_create_details_dialog_with_folder (ModestToolkitFactory *self,
956 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_details_dialog_with_folder (self, parent, folder);
960 modest_toolkit_factory_create_details_dialog_with_folder_default (ModestToolkitFactory *self,
964 #ifndef USE_GTK_DETAILS_DIALOG
965 return modest_hildon2_details_dialog_new_with_folder (parent, folder);
967 return modest_gtk_details_dialog_new_with_folder (parent, folder);