Browse Source

better mail display

Enrico Tassi 11 years ago
parent
commit
d893bbbff7
2 changed files with 81 additions and 11 deletions
  1. 50
    8
      smd-applet.ui
  2. 31
    3
      smd-applet.vala

+ 50
- 8
smd-applet.ui View File

@@ -294,18 +294,60 @@
294 294
                             <property name="visible">True</property>
295 295
                             <property name="left_padding">12</property>
296 296
                             <child>
297
-                              <object class="GtkScrolledWindow" id="scrolledwindow1">
297
+                              <object class="GtkVBox" id="vbox3">
298 298
                                 <property name="visible">True</property>
299
-                                <property name="can_focus">True</property>
300
-                                <property name="hscrollbar_policy">automatic</property>
301
-                                <property name="vscrollbar_policy">automatic</property>
299
+                                <property name="orientation">vertical</property>
300
+                                <property name="spacing">2</property>
301
+                                <child>
302
+                                  <object class="GtkHBox" id="hbox2">
303
+                                    <property name="visible">True</property>
304
+                                    <child>
305
+                                      <object class="GtkLabel" id="label8">
306
+                                        <property name="visible">True</property>
307
+                                        <property name="label" translatable="yes">File: </property>
308
+                                      </object>
309
+                                      <packing>
310
+                                        <property name="expand">False</property>
311
+                                        <property name="fill">False</property>
312
+                                        <property name="position">0</property>
313
+                                      </packing>
314
+                                    </child>
315
+                                    <child>
316
+                                      <object class="GtkEntry" id="eMailName">
317
+                                        <property name="visible">True</property>
318
+                                        <property name="can_focus">True</property>
319
+                                        <property name="editable">False</property>
320
+                                        <property name="invisible_char">&#x25CF;</property>
321
+                                        <property name="caps_lock_warning">False</property>
322
+                                      </object>
323
+                                      <packing>
324
+                                        <property name="position">1</property>
325
+                                      </packing>
326
+                                    </child>
327
+                                  </object>
328
+                                  <packing>
329
+                                    <property name="position">0</property>
330
+                                  </packing>
331
+                                </child>
302 332
                                 <child>
303
-                                  <object class="GtkTextView" id="tvMail">
304
-                                    <property name="height_request">200</property>
333
+                                  <object class="GtkScrolledWindow" id="scrolledwindow1">
305 334
                                     <property name="visible">True</property>
306 335
                                     <property name="can_focus">True</property>
307
-                                    <property name="editable">False</property>
336
+                                    <property name="hscrollbar_policy">automatic</property>
337
+                                    <property name="vscrollbar_policy">automatic</property>
338
+                                    <property name="shadow_type">in</property>
339
+                                    <child>
340
+                                      <object class="GtkTextView" id="tvMail">
341
+                                        <property name="height_request">200</property>
342
+                                        <property name="visible">True</property>
343
+                                        <property name="can_focus">True</property>
344
+                                        <property name="editable">False</property>
345
+                                      </object>
346
+                                    </child>
308 347
                                   </object>
348
+                                  <packing>
349
+                                    <property name="position">1</property>
350
+                                  </packing>
309 351
                                 </child>
310 352
                               </object>
311 353
                             </child>
@@ -412,7 +454,7 @@
412 454
             <property name="visible">True</property>
413 455
             <property name="layout_style">end</property>
414 456
             <child>
415
-              <object class="GtkButton" id="button1">
457
+              <object class="GtkButton" id="bClose">
416 458
                 <property name="label" translatable="yes">gtk-close</property>
417 459
                 <property name="visible">True</property>
418 460
                 <property name="can_focus">True</property>

+ 31
- 3
smd-applet.vala View File

@@ -12,7 +12,7 @@ class Event {
12 12
 
13 13
 	public static Event error(string account, string host) {
14 14
 		var e = new Event();
15
-		e.message = "An error occurred";
15
+		e.message = "An error occurred, click on the icon for more details";
16 16
 		e.enter_error_mode = true;
17 17
 		return e;
18 18
 	}
@@ -114,6 +114,16 @@ class smdApplet {
114 114
 			try { gconf.set_bool(key_newmail,b.active); }
115 115
 			catch (GLib.Error e) { stderr.printf("%s\n",e.message); }
116 116
 		};
117
+		var bc = builder.get_object("bClose") as Gtk.Button;
118
+		bc.clicked += (b) => {
119
+			err_win.hide();	
120
+			error_mode = false;
121
+			si.set_from_icon_name("gtk-info");
122
+			si.set_blinking(false);
123
+			// XXX do something else?
124
+		};
125
+		win.delete_event += win.hide_on_delete;
126
+		err_win.delete_event += err_win.hide_on_delete;
117 127
 
118 128
 		// menu popped up when the user clicks on the notification area
119 129
         menu = builder.get_object ("mMain") as Gtk.Menu;
@@ -133,9 +143,9 @@ class smdApplet {
133 143
 				menu.popup(null,null,si.position_menu,0,
134 144
 					Gtk.get_current_event_time());
135 145
 		};
136
-		si.set_visible(true);
146
+		si.set_visible(true); // XXX read from gconf: key_icon
137 147
 
138
-		// error mode
148
+		// error mode data
139 149
 		command_hash = new GLib.HashTable<Gtk.Widget,string>(
140 150
 			GLib.direct_hash,GLib.str_equal);
141 151
 	}
@@ -271,6 +281,9 @@ class smdApplet {
271 281
 							string file = i_cmd.fetch(1);
272 282
 							string output = null;
273 283
 							try {
284
+								var fn = builder.get_object("eMailName") 
285
+									as Gtk.Entry;
286
+								fn.set_text(file);
274 287
 								GLib.Process.spawn_command_line_sync(
275 288
 									"cat " + file, out output, null);
276 289
 								var l = builder.get_object("tvMail") 
@@ -446,6 +459,21 @@ static int main(string[] args){
446 459
 	Gtk.init (ref args);
447 460
 	Notify.init("smd-applet");
448 461
 
462
+	bool foo=false;
463
+	GLib.OptionEntry[] oe = new GLib.OptionEntry[2];
464
+	oe[0].long_name = "foo";
465
+	oe[0].short_name = 'f';
466
+	oe[0].flags = GLib.OptionFlags.NO_ARG;
467
+	oe[0].arg = GLib.OptionArg.NONE;
468
+	oe[0].arg_data = &foo;
469
+	oe[0].description = "ffff";
470
+	oe[0].arg_description = null;
471
+	oe[1].long_name = null;
472
+	var oc = new GLib.OptionContext(" - syncmaildir applet");
473
+	oc.add_main_entries(oe,null);
474
+	oc.parse(ref args);
475
+	// XXX if foo then just show the confi win
476
+
449 477
 	// go!
450 478
 	var smd_applet = new smdApplet();
451 479
 	try { smd_applet.run(); }

Loading…
Cancel
Save