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,
149 static GtkWidget * modest_toolkit_factory_create_details_dialog_with_header_default (ModestToolkitFactory *self, GtkWindow *parent,
150 TnyHeader *header, gboolean get_size);
151 static GtkWidget * modest_toolkit_factory_create_details_dialog_with_folder_default (ModestToolkitFactory *self, GtkWindow *parent,
155 static GObjectClass *parent_class = NULL;
157 G_DEFINE_TYPE (ModestToolkitFactory,
158 modest_toolkit_factory,
161 ModestToolkitFactory *
162 modest_toolkit_factory_get_instance (void)
164 GObject* self = g_object_new (MODEST_TYPE_TOOLKIT_FACTORY, NULL);
166 return (ModestToolkitFactory *) self;
170 modest_toolkit_factory_class_init (ModestToolkitFactoryClass *klass)
172 parent_class = g_type_class_peek_parent (klass);
174 klass->create_scrollable = modest_toolkit_factory_create_scrollable_default;
175 klass->create_check_button = modest_toolkit_factory_create_check_button_default;
176 klass->create_check_menu = modest_toolkit_factory_create_check_menu_default;
177 klass->create_isearch_toolbar = modest_toolkit_factory_create_isearch_toolbar_default;
178 klass->create_entry = modest_toolkit_factory_create_entry_default;
179 klass->create_number_entry = modest_toolkit_factory_create_number_entry_default;
180 klass->create_file_chooser_dialog = modest_toolkit_factory_create_file_chooser_dialog_default;
181 klass->create_country_selector = modest_toolkit_factory_create_country_selector_default;
182 klass->create_provider_selector = modest_toolkit_factory_create_provider_selector_default;
183 klass->create_servertype_selector = modest_toolkit_factory_create_servertype_selector_default;
184 klass->create_serversecurity_selector = modest_toolkit_factory_create_serversecurity_selector_default;
185 klass->create_secureauth_selector = modest_toolkit_factory_create_secureauth_selector_default;
186 klass->create_security_options_view = modest_toolkit_factory_create_security_options_view_default;
187 klass->create_text_view = modest_toolkit_factory_create_text_view_default;
188 klass->create_selector = modest_toolkit_factory_create_selector_default;
189 klass->create_details_dialog_with_header = modest_toolkit_factory_create_details_dialog_with_header_default;
190 klass->create_details_dialog_with_folder = modest_toolkit_factory_create_details_dialog_with_folder_default;
194 modest_toolkit_factory_init (ModestToolkitFactory *self)
199 modest_toolkit_factory_create_scrollable (ModestToolkitFactory *self)
201 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_scrollable (self);
205 modest_toolkit_factory_create_scrollable_default (ModestToolkitFactory *self)
207 #ifdef USE_SCROLLED_WINDOW
208 return modest_scrolled_window_scrollable_new ();
210 return modest_hildon_pannable_area_scrollable_new ();
215 modest_toolkit_factory_create_check_button (ModestToolkitFactory *self, const gchar *label)
217 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_check_button (self, label);
221 modest_toolkit_factory_create_check_button_default (ModestToolkitFactory *self, const gchar *label)
224 #ifdef USE_GTK_CHECK_BUTTON
225 result = gtk_check_button_new_with_label (label);
227 result = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT);
228 gtk_button_set_label (GTK_BUTTON (result), label);
229 gtk_button_set_alignment (GTK_BUTTON (result), 0.0, 0.5);
235 modest_toolkit_factory_create_check_menu (ModestToolkitFactory *self, const gchar *label)
237 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_check_menu (self, label);
241 modest_toolkit_factory_create_check_menu_default (ModestToolkitFactory *self, const gchar *label)
244 #ifdef USE_GTK_CHECK_MENU
245 result = gtk_check_menu_item_new_with_label (label);
247 result = hildon_check_button_new (0);
248 gtk_button_set_label (GTK_BUTTON (result), label);
249 gtk_button_set_alignment (GTK_BUTTON (result), 0.5, 0.5);
255 modest_togglable_get_active (GtkWidget *widget)
257 if (GTK_IS_CHECK_MENU_ITEM (widget)) {
258 return gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
259 } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
260 return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
261 #ifdef MODEST_TOOLKIT_HILDON2
262 } else if (HILDON_IS_CHECK_BUTTON (widget)) {
263 return hildon_check_button_get_active (HILDON_CHECK_BUTTON (widget));
266 g_return_val_if_reached (FALSE);
271 modest_togglable_set_active (GtkWidget *widget, gboolean active)
273 if (GTK_IS_CHECK_MENU_ITEM (widget)) {
274 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), active);
275 } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
276 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
277 #ifdef MODEST_TOOLKIT_HILDON2
278 } else if (HILDON_IS_CHECK_BUTTON (widget)) {
279 hildon_check_button_set_active (HILDON_CHECK_BUTTON (widget), active);
285 modest_is_togglable (GtkWidget *widget)
287 return GTK_IS_CHECK_MENU_ITEM (widget)
288 || GTK_IS_TOGGLE_BUTTON (widget)
289 #ifdef MODEST_TOOLKIT_HILDON2
290 || HILDON_IS_CHECK_BUTTON (widget)
296 modest_toolkit_factory_create_isearch_toolbar (ModestToolkitFactory *self, const gchar *label)
298 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_isearch_toolbar (self, label);
302 modest_toolkit_factory_create_isearch_toolbar_default (ModestToolkitFactory *self, const gchar *label)
305 #ifdef USE_GTK_FIND_TOOLBAR
306 result = modest_find_toolbar_new (label);
308 result = modest_hildon_find_toolbar_new (label);
314 modest_toolkit_factory_create_entry (ModestToolkitFactory *self)
316 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_entry (self);
320 modest_toolkit_factory_create_entry_default (ModestToolkitFactory *self)
323 return gtk_entry_new ();
325 return hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
330 modest_entry_set_text (GtkWidget *widget, const gchar *text)
333 gtk_entry_set_text (GTK_ENTRY (widget), text);
335 hildon_entry_set_text (HILDON_ENTRY (widget), text);
340 modest_entry_get_text (GtkWidget *widget)
343 return gtk_entry_get_text (GTK_ENTRY (widget));
345 return hildon_entry_get_text (HILDON_ENTRY (widget));
350 modest_entry_set_hint (GtkWidget *widget, const gchar *hint)
353 gtk_widget_set_tooltip_text (widget, hint);
355 hildon_entry_set_placeholder (HILDON_ENTRY (widget), hint);
360 modest_is_entry (GtkWidget *widget)
363 return GTK_IS_ENTRY (widget);
365 return HILDON_IS_ENTRY (widget);
370 modest_toolkit_factory_create_number_entry (ModestToolkitFactory *self, gint min, gint max)
372 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_number_entry (self, min, max);
376 modest_toolkit_factory_create_number_entry_default (ModestToolkitFactory *self, gint min, gint max)
379 #ifdef USE_GTK_SPIN_BUTTON
380 result = gtk_spin_button_new_with_range (min, max, 1.0);
381 gtk_spin_button_set_digits (GTK_SPIN_BUTTON (result), 0);
383 result = modest_number_editor_new (min, max);
389 modest_number_entry_set_value (GtkWidget *widget, gint value)
391 #ifdef USE_GTK_SPIN_BUTTON
392 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
394 modest_number_editor_set_value (MODEST_NUMBER_EDITOR (widget), value);
399 modest_number_entry_get_value (GtkWidget *widget)
401 #ifdef USE_GTK_SPIN_BUTTON
402 return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
404 return modest_number_editor_get_value (MODEST_NUMBER_EDITOR (widget));
409 modest_number_entry_is_valid (GtkWidget *widget)
411 #ifdef USE_GTK_SPIN_BUTTON
414 return modest_number_editor_is_valid (MODEST_NUMBER_EDITOR (widget));
419 modest_is_number_entry (GtkWidget *widget)
421 #ifdef USE_GTK_SPIN_BUTTON
422 return GTK_IS_SPIN_BUTTON (widget);
424 return MODEST_IS_NUMBER_EDITOR (widget);
429 modest_toolkit_factory_create_file_chooser_dialog (ModestToolkitFactory *self,
432 GtkFileChooserAction action)
434 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_file_chooser_dialog (self, title, parent, action);
438 modest_toolkit_factory_create_file_chooser_dialog_default (ModestToolkitFactory *self,
441 GtkFileChooserAction action)
444 #ifdef USE_GTK_FILE_CHOOSER
445 result = gtk_file_chooser_dialog_new (title, parent, action,
446 (action == GTK_FILE_CHOOSER_ACTION_OPEN) ? GTK_STOCK_OPEN : GTK_STOCK_SAVE,
448 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
451 result = hildon_file_chooser_dialog_new (parent, action);
452 gtk_window_set_title ((GtkWindow *) result, title);
458 modest_toolkit_factory_create_country_selector (ModestToolkitFactory *self)
460 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_country_selector (self);
464 modest_toolkit_factory_create_country_selector_default (ModestToolkitFactory *self)
467 #ifdef USE_COUNTRY_COMBOBOX
468 result = modest_country_combo_box_new ();
470 result = GTK_WIDGET (modest_country_picker_new (MODEST_EDITABLE_SIZE,
471 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
477 modest_country_selector_get_active_country_mcc (GtkWidget *widget)
479 #ifdef USE_COUNTRY_COMBOBOX
480 return modest_country_combo_box_get_active_country_mcc (MODEST_COUNTRY_COMBO_BOX (widget));
482 return modest_country_picker_get_active_country_mcc (MODEST_COUNTRY_PICKER (widget));
487 modest_country_selector_load_data (GtkWidget *widget)
489 #ifdef USE_COUNTRY_COMBOBOX
490 modest_country_combo_box_load_data (MODEST_COUNTRY_COMBO_BOX (widget));
492 modest_country_picker_load_data (MODEST_COUNTRY_PICKER (widget));
497 modest_country_selector_set_active_country_locale (GtkWidget *widget)
499 #ifdef USE_COUNTRY_COMBOBOX
500 return modest_country_combo_box_set_active_country_locale (MODEST_COUNTRY_COMBO_BOX (widget));
502 return modest_country_picker_set_active_country_locale (MODEST_COUNTRY_PICKER (widget));
507 modest_toolkit_factory_create_provider_selector (ModestToolkitFactory *self)
509 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_provider_selector (self);
513 modest_toolkit_factory_create_provider_selector_default (ModestToolkitFactory *self)
516 #ifdef USE_PROVIDER_COMBOBOX
517 result = GTK_WIDGET (modest_provider_combo_box_new ());
519 result = GTK_WIDGET (modest_provider_picker_new (MODEST_EDITABLE_SIZE,
520 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
526 modest_provider_selector_fill (GtkWidget *widget,
527 ModestPresets *presets,
530 #ifdef USE_PROVIDER_COMBOBOX
531 modest_provider_combo_box_fill (MODEST_PROVIDER_COMBO_BOX (widget),
535 modest_provider_picker_fill (MODEST_PROVIDER_PICKER (widget),
542 modest_provider_selector_refresh (GtkWidget *widget)
544 #ifdef USE_PROVIDER_COMBOBOX
545 modest_provider_combo_box_refresh (MODEST_PROVIDER_COMBO_BOX (widget));
547 modest_provider_picker_refresh (MODEST_PROVIDER_PICKER (widget));
552 modest_provider_selector_get_active_provider_id (GtkWidget *widget)
554 #ifdef USE_PROVIDER_COMBOBOX
555 return modest_provider_combo_box_get_active_provider_id (MODEST_PROVIDER_COMBO_BOX (widget));
557 return modest_provider_picker_get_active_provider_id (MODEST_PROVIDER_PICKER (widget));
562 modest_provider_selector_get_active_provider_label (GtkWidget *widget)
564 #ifdef USE_PROVIDER_COMBOBOX
566 return modest_provider_combo_box_get_active_provider_label (MODEST_PROVIDER_COMBO_BOX (widget));
570 selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (widget)));
571 return g_strdup (hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
575 ModestProviderSelectorIdType
576 modest_provider_selector_get_active_id_type (GtkWidget *widget)
578 ModestProviderSelectorIdType result;
579 #ifdef USE_PROVIDER_COMBOBOX
580 ModestProviderComboBoxIdType id_type;
582 id_type = modest_provider_combo_box_get_active_id_type (MODEST_PROVIDER_COMBO_BOX (widget));
584 case MODEST_PROVIDER_COMBO_BOX_ID_PROVIDER:
585 result = MODEST_PROVIDER_SELECTOR_ID_PROVIDER;
587 case MODEST_PROVIDER_COMBO_BOX_ID_OTHER:
588 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
590 case MODEST_PROVIDER_COMBO_BOX_ID_PLUGIN_PROTOCOL:
591 result = MODEST_PROVIDER_SELECTOR_ID_PLUGIN_PROTOCOL;
594 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
598 ModestProviderPickerIdType id_type;
600 id_type = modest_provider_picker_get_active_id_type (MODEST_PROVIDER_PICKER (widget));
602 case MODEST_PROVIDER_PICKER_ID_PROVIDER:
603 result = MODEST_PROVIDER_SELECTOR_ID_PROVIDER;
605 case MODEST_PROVIDER_PICKER_ID_OTHER:
606 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
608 case MODEST_PROVIDER_PICKER_ID_PLUGIN_PROTOCOL:
609 result = MODEST_PROVIDER_SELECTOR_ID_PLUGIN_PROTOCOL;
612 result = MODEST_PROVIDER_SELECTOR_ID_OTHER;
619 modest_provider_selector_set_others_provider (GtkWidget *self)
621 #ifdef USE_PROVIDER_COMBOBOX
622 modest_provider_combo_box_set_others_provider (MODEST_PROVIDER_COMBO_BOX (self));
624 modest_provider_picker_set_others_provider (MODEST_PROVIDER_PICKER (self));
629 modest_toolkit_factory_create_servertype_selector (ModestToolkitFactory *self, gboolean filter_providers)
631 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_servertype_selector (self, filter_providers);
635 modest_toolkit_factory_create_servertype_selector_default (ModestToolkitFactory *self, gboolean filter_providers)
638 #ifdef USE_PROVIDER_COMBOBOX
639 result = GTK_WIDGET (modest_servertype_combo_box_new (filter_providers));
641 result = GTK_WIDGET (modest_servertype_picker_new (MODEST_EDITABLE_SIZE,
642 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
649 modest_servertype_selector_get_active_servertype (GtkWidget *self)
651 #ifdef USE_SERVERTYPE_COMBOBOX
652 return modest_servertype_combo_box_get_active_servertype (MODEST_SERVERTYPE_COMBO_BOX (self));
654 return modest_servertype_picker_get_active_servertype (MODEST_SERVERTYPE_PICKER (self));
659 modest_servertype_selector_set_active_servertype (GtkWidget *self,
660 ModestProtocolType protocol_type_id)
662 #ifdef USE_SERVERTYPE_COMBOBOX
663 modest_servertype_combo_box_set_active_servertype (MODEST_SERVERTYPE_COMBO_BOX (self), protocol_type_id);
665 modest_servertype_picker_set_active_servertype (MODEST_SERVERTYPE_PICKER (self), protocol_type_id);
670 modest_toolkit_factory_create_serversecurity_selector (ModestToolkitFactory *self)
672 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_serversecurity_selector (self);
676 modest_toolkit_factory_create_serversecurity_selector_default (ModestToolkitFactory *self)
679 #ifdef USE_SERVERSECURITY_COMBOBOX
680 result = GTK_WIDGET (modest_serversecurity_combo_box_new ());
682 result = GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
683 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
689 modest_serversecurity_selector_fill (GtkWidget *combobox,
690 ModestProtocolType protocol)
692 #ifdef USE_SERVERSECURITY_COMBOBOX
693 modest_serversecurity_combo_box_fill (MODEST_SERVERSECURITY_COMBO_BOX (combobox),
696 modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (combobox),
702 modest_serversecurity_selector_get_active_serversecurity (GtkWidget *combobox)
704 #ifdef USE_SERVERSECURITY_COMBOBOX
705 return modest_serversecurity_combo_box_get_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (combobox));
707 return modest_serversecurity_picker_get_active_serversecurity (MODEST_SERVERSECURITY_PICKER (combobox));
712 modest_serversecurity_selector_set_active_serversecurity (GtkWidget *combobox,
713 ModestProtocolType serversecurity)
715 #ifdef USE_SERVERSECURITY_COMBOBOX
716 return modest_serversecurity_combo_box_set_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (combobox),
719 return modest_serversecurity_picker_set_active_serversecurity (MODEST_SERVERSECURITY_PICKER (combobox),
725 modest_serversecurity_selector_get_active_serversecurity_port (GtkWidget *combobox)
727 #ifdef USE_SERVERSECURITY_COMBOBOX
728 return modest_serversecurity_combo_box_get_active_serversecurity_port (MODEST_SERVERSECURITY_COMBO_BOX (combobox));
730 return modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (combobox));
735 modest_toolkit_factory_create_secureauth_selector (ModestToolkitFactory *self)
737 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_secureauth_selector (self);
741 modest_toolkit_factory_create_secureauth_selector_default (ModestToolkitFactory *self)
744 #ifdef USE_SECUREAUTH_COMBOBOX
745 result = GTK_WIDGET (modest_secureauth_combo_box_new ());
747 result = GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
748 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
754 modest_secureauth_selector_get_active_secureauth (GtkWidget *widget)
756 #ifdef USE_SECUREAUTH_COMBOBOX
757 return modest_secureauth_combo_box_get_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget));
759 return modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (widget));
764 modest_secureauth_selector_set_active_secureauth (GtkWidget *widget,
765 ModestProtocolType secureauth)
767 #ifdef USE_SECUREAUTH_COMBOBOX
768 return modest_secureauth_combo_box_set_active_secureauth (MODEST_SECUREAUTH_COMBO_BOX (widget),
771 return modest_secureauth_picker_set_active_secureauth (MODEST_SECUREAUTH_PICKER (widget),
777 modest_is_secureauth_selector (GtkWidget *widget)
779 #ifdef USE_SECUREAUTH_COMBOBOX
780 return MODEST_IS_SECUREAUTH_COMBO_BOX (widget);
782 return MODEST_IS_SECUREAUTH_PICKER (widget);
787 modest_toolkit_factory_create_security_options_view (ModestToolkitFactory *self,
788 ModestSecurityOptionsType type,
790 GtkSizeGroup *title_size_group,
791 GtkSizeGroup *value_size_group)
793 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_security_options_view (self, type, full,
794 title_size_group, value_size_group);
798 modest_toolkit_factory_create_security_options_view_default (ModestToolkitFactory *self,
799 ModestSecurityOptionsType type,
801 GtkSizeGroup *title_size_group,
802 GtkSizeGroup *value_size_group)
805 #ifdef USE_GTK_SECURITY_OPTIONS_VIEW
806 result = GTK_WIDGET (modest_gtk_security_options_view_new (type, full, title_size_group, value_size_group));
808 result = GTK_WIDGET (modest_maemo_security_options_view_new (type, full, title_size_group, value_size_group));
814 modest_toolkit_factory_create_text_view (ModestToolkitFactory *self)
816 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_text_view (self);
820 modest_toolkit_factory_create_text_view_default (ModestToolkitFactory *self)
822 #ifdef USE_GTK_TEXT_VIEW
823 return gtk_text_view_new ();
825 return hildon_text_view_new ();
830 modest_text_view_get_buffer (GtkWidget *widget)
832 #ifdef USE_GTK_TEXT_VIEW
833 return gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
835 return hildon_text_view_get_buffer (HILDON_TEXT_VIEW (widget));
840 modest_is_text_view (GtkWidget *widget)
842 #ifdef USE_GTK_TEXT_VIEW
843 return GTK_IS_TEXT_VIEW (widget);
845 return HILDON_IS_TEXT_VIEW (widget);
850 modest_toolkit_factory_create_selector (ModestToolkitFactory *self,
851 ModestPairList *pairs, GEqualFunc id_equal_func, gboolean center)
853 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_selector (self, pairs, id_equal_func, center);
857 modest_toolkit_factory_create_selector_default (ModestToolkitFactory *self,
858 ModestPairList *pairs, GEqualFunc id_equal_func, gboolean center)
860 #ifdef USE_SELECTOR_COMBOBOX
861 return modest_combo_box_new (pairs, id_equal_func);
863 return modest_selector_picker_new (MODEST_EDITABLE_SIZE,
864 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL,
865 pairs, id_equal_func, center);
870 modest_selector_set_pair_list (GtkWidget *widget,
871 ModestPairList *pairs)
873 #ifdef USE_SELECTOR_COMBOBOX
874 modest_combo_box_set_pair_list (MODEST_COMBO_BOX (widget),
877 modest_selector_picker_set_pair_list (MODEST_SELECTOR_PICKER (widget),
883 modest_selector_get_active_id (GtkWidget *self)
885 #ifdef USE_SELECTOR_COMBOBOX
886 return modest_combo_box_get_active_id (MODEST_COMBO_BOX (self));
888 return modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (self));
893 modest_selector_set_active_id (GtkWidget *self, gpointer id)
895 #ifdef USE_SELECTOR_COMBOBOX
896 modest_combo_box_set_active_id (MODEST_COMBO_BOX (self), id);
898 modest_selector_picker_set_active_id (MODEST_SELECTOR_PICKER (self), id);
903 modest_selector_get_active_display_name (GtkWidget *self)
905 #ifdef USE_SELECTOR_COMBOBOX
906 return modest_combo_box_get_active_display_name (MODEST_COMBO_BOX (self));
908 return modest_selector_picker_get_active_display_name (MODEST_SELECTOR_PICKER (self));
913 modest_selector_set_value_max_chars (GtkWidget *self, gint value_max_width_chars)
915 #ifndef USE_SELECTOR_COMBOBOX
916 modest_selector_picker_set_value_max_chars (MODEST_SELECTOR_PICKER (self), value_max_width_chars);
921 modest_selector_get_value_max_chars (GtkWidget *self)
923 #ifdef USE_SELECTOR_COMBOBOX
926 return modest_selector_picker_get_value_max_chars (MODEST_SELECTOR_PICKER (self));
931 modest_toolkit_factory_create_details_dialog_with_header (ModestToolkitFactory *self,
936 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_details_dialog_with_header (self, parent, header, get_size);
940 modest_toolkit_factory_create_details_dialog_with_header_default (ModestToolkitFactory *self,
945 #ifndef USE_GTK_DETAILS_DIALOG
946 return modest_hildon2_details_dialog_new_with_header (parent, header, get_size);
948 return modest_gtk_details_dialog_new_with_header (parent, header, get_size);
953 modest_toolkit_factory_create_details_dialog_with_folder (ModestToolkitFactory *self,
957 return MODEST_TOOLKIT_FACTORY_GET_CLASS (self)->create_details_dialog_with_folder (self, parent, folder);
961 modest_toolkit_factory_create_details_dialog_with_folder_default (ModestToolkitFactory *self,
965 #ifndef USE_GTK_DETAILS_DIALOG
966 return modest_hildon2_details_dialog_new_with_folder (parent, folder);
968 return modest_gtk_details_dialog_new_with_folder (parent, folder);