src/mn-mailbox-properties.gob (3541B) - raw
1 /* 2 * Mail Notification 3 * Copyright (C) 2003-2008 Jean-Yves Lefort <jylefort@brutele.be> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 %headertop{ 21 #include <gtk/gtk.h> 22 #include "mn-mailbox.h" 23 %} 24 25 %{ 26 #include "mn-util.h" 27 #include "mn-mailbox-properties-dialog.h" 28 %} 29 30 class MN:Mailbox:Properties from G:Object (abstract) 31 { 32 classwide const char *type; 33 classwide const char *stock_id; 34 classwide const char *combo_label; 35 classwide gboolean enable_check_delay = TRUE; 36 37 protected GtkWidget *dialog; 38 property POINTER dialog (flags = CONSTRUCT_ONLY, link, type = GtkWidget *); 39 40 protected GtkSizeGroup *label_size_group = {gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL)} unrefwith g_object_unref; 41 42 protected GSList *entries destroywith g_slist_free; 43 44 private GSList *general_sections destroywith mn_g_object_slist_free; 45 46 property BOOLEAN complete 47 get { g_value_set_boolean(VAL, TRUE); }; 48 49 property STRING default_name 50 get { g_value_set_string(VAL, NULL); }; 51 52 property INT default_check_delay 53 get 54 { 55 MNMailboxClass *class; 56 57 class = mn_mailbox_get_class_from_name(SELF_GET_CLASS(self)->type); 58 g_value_set_int(VAL, class->default_check_delay); 59 g_type_class_unref(class); 60 }; 61 62 virtual public void 63 activate (self); 64 65 virtual public void 66 deactivate (self); 67 68 virtual public void 69 set_mailbox (self, MN:Mailbox *mailbox (check null type)); 70 71 virtual public MNMailbox * 72 get_mailbox (self) 73 { 74 return mn_mailbox_new(SELF_GET_CLASS(self)->type, NULL); 75 } 76 77 protected GtkWidget * 78 add_general_section (self, const char *title (check null)) 79 { 80 GtkWidget *section; 81 GtkWidget *vbox; 82 83 section = mn_hig_section_new_with_box(title, NULL, &vbox); 84 g_object_ref_sink(section); 85 gtk_widget_show(section); 86 87 selfp->general_sections = g_slist_append(selfp->general_sections, section); 88 return vbox; 89 } 90 91 override (MN:Mailbox:Properties) void 92 activate (MNMailboxProperties *properties) 93 { 94 Self *self = SELF(properties); 95 GSList *l; 96 97 MN_LIST_FOREACH(l, selfp->general_sections) 98 gtk_box_pack_start(GTK_BOX(MN_MAILBOX_PROPERTIES_DIALOG(properties->dialog)->general_vbox), l->data, FALSE, FALSE, 0); 99 } 100 101 override (MN:Mailbox:Properties) void 102 deactivate (MNMailboxProperties *properties) 103 { 104 Self *self = SELF(properties); 105 GSList *l; 106 107 MN_LIST_FOREACH(l, selfp->general_sections) 108 gtk_container_remove(GTK_CONTAINER(MN_MAILBOX_PROPERTIES_DIALOG(properties->dialog)->general_vbox), l->data); 109 } 110 111 protected void 112 notify_complete (self) 113 { 114 g_object_notify(G_OBJECT(self), "complete"); 115 } 116 117 protected void 118 notify_default_name (self) 119 { 120 g_object_notify(G_OBJECT(self), "default-name"); 121 } 122 123 protected void 124 notify_default_check_delay (self) 125 { 126 g_object_notify(G_OBJECT(self), "default-check-delay"); 127 } 128 }