51 public CustomMessageDialog(
string _msg_title,
string _msg_body, Gtk.MessageType _msg_type, Window? parent, Gtk.ButtonsType _buttons_type) {
53 set_transient_for(parent);
63 lbl_msg.hexpand =
true;
65 lbl_msg.vexpand =
true;
66 sw_msg.hexpand =
true;
67 sw_msg.vexpand =
true;
68 sw_msg.vscrollbar_policy = PolicyType.NEVER;
70 sw_msg.set_size_request(500, 150);
74 if (
lbl_msg.get_allocated_height() > 400){
75 sw_msg.vscrollbar_policy = PolicyType.AUTOMATIC;
76 sw_msg.set_size_request(500, 400);
83 this.set_icon_name(
"bastionguard-backup");
84 this.resizable =
false;
85 this.deletable =
false;
88 vbox_main = get_content_area () as Gtk.Box;
89 vbox_main.margin_start = 6;
90 vbox_main.margin_end = 6;
91 vbox_main.margin_top = 6;
92 vbox_main.margin_bottom = 6;
95 var hbox_contents =
new Gtk.Box(Orientation.HORIZONTAL, 6);
96 hbox_contents.margin_start = 6;
97 hbox_contents.margin_end = 6;
98 hbox_contents.margin_top = 6;
99 hbox_contents.margin_bottom = 6;
102 string icon_name =
"dialog-info";
105 case Gtk.MessageType.INFO:
106 icon_name =
"dialog-info";
108 case Gtk.MessageType.WARNING:
109 icon_name =
"dialog-warning";
111 case Gtk.MessageType.QUESTION:
112 icon_name =
"dialog-question";
114 case Gtk.MessageType.ERROR:
115 icon_name =
"dialog-error";
117 case Gtk.MessageType.OTHER:
118 icon_name =
"dialog-info";
125 hbox_contents.append(img);
129 var text =
"<span weight=\"bold\" size=\"x-large\">%s</span>\n\n%s".printf(
133 lbl_msg.xalign = 0.0f;
134 lbl_msg.yalign = 0.0f;
135 lbl_msg.max_width_chars = 70;
137 lbl_msg.wrap_mode = Pango.WrapMode.WORD_CHAR;
138 lbl_msg.use_markup =
true;
141 sw_msg =
new Gtk.ScrolledWindow();
144 sw_msg.hscrollbar_policy = PolicyType.NEVER;
145 sw_msg.vscrollbar_policy = PolicyType.NEVER;
147 hbox_contents.append(
sw_msg);
152 case Gtk.ButtonsType.NONE:
break;
153 case Gtk.ButtonsType.OK:
154 btn_ok = (Gtk.Button) add_button (
_(
"OK"), Gtk.ResponseType.OK);
157 case Gtk.ButtonsType.CLOSE:
158 btn_cancel = (Gtk.Button) add_button (
_(
"Close"), Gtk.ResponseType.CLOSE);
161 case Gtk.ButtonsType.CANCEL:
162 btn_cancel = (Gtk.Button) add_button (
_(
"Cancel"), Gtk.ResponseType.CANCEL);
165 case Gtk.ButtonsType.OK_CANCEL:
166 btn_ok = (Gtk.Button) add_button (
_(
"OK"), Gtk.ResponseType.OK);
167 btn_cancel = (Gtk.Button) add_button (
_(
"Cancel"), Gtk.ResponseType.CANCEL);
170 case Gtk.ButtonsType.YES_NO:
171 btn_yes = (Gtk.Button) add_button (
_(
"Yes"), Gtk.ResponseType.YES);
172 btn_no = (Gtk.Button) add_button (
_(
"No"), Gtk.ResponseType.NO);