Browse Source

added pause menu item, 2 menus != for left/right click

Enrico Tassi 11 years ago
parent
commit
82b4a6ebba
2 changed files with 44 additions and 29 deletions
  1. 35
    26
      smd-applet.ui
  2. 9
    3
      smd-applet.vala

+ 35
- 26
smd-applet.ui View File

@@ -2,16 +2,14 @@
2 2
 <interface>
3 3
   <requires lib="gtk+" version="2.16"/>
4 4
   <!-- interface-naming-policy project-wide -->
5
-  <object class="GtkMenu" id="mMain">
5
+  <object class="GtkMenu" id="mLeft">
6 6
     <property name="visible">True</property>
7 7
     <child>
8
-      <object class="GtkImageMenuItem" id="miPrefs">
9
-        <property name="label">gtk-preferences</property>
8
+      <object class="GtkCheckMenuItem" id="miPause">
10 9
         <property name="visible">True</property>
11
-        <property name="tooltip_text" translatable="yes">Configure smd-applet</property>
10
+        <property name="tooltip_text" translatable="yes">Pause</property>
11
+        <property name="label" translatable="yes">Pause</property>
12 12
         <property name="use_underline">True</property>
13
-        <property name="use_stock">True</property>
14
-        <property name="always_show_image">True</property>
15 13
       </object>
16 14
     </child>
17 15
     <child>
@@ -22,25 +20,6 @@
22 20
         <property name="use_stock">False</property>
23 21
       </object>
24 22
     </child>
25
-    <child>
26
-      <object class="GtkImageMenuItem" id="miAbout">
27
-        <property name="label">gtk-about</property>
28
-        <property name="visible">True</property>
29
-        <property name="tooltip_text" translatable="yes">About smd-applet</property>
30
-        <property name="use_underline">True</property>
31
-        <property name="use_stock">True</property>
32
-        <property name="always_show_image">True</property>
33
-      </object>
34
-    </child>
35
-    <child>
36
-      <object class="GtkImageMenuItem" id="miQuit">
37
-        <property name="label">gtk-quit</property>
38
-        <property name="visible">True</property>
39
-        <property name="use_underline">True</property>
40
-        <property name="use_stock">True</property>
41
-        <property name="always_show_image">True</property>
42
-      </object>
43
-    </child>
44 23
   </object>
45 24
   <object class="GtkListStore" id="namelist">
46 25
     <columns>
@@ -1408,8 +1387,8 @@ Public License instead of this License.  But first, please read
1408 1387
             <property name="vscrollbar_policy">automatic</property>
1409 1388
             <child>
1410 1389
               <object class="GtkTextView" id="tvLog">
1411
-                <property name="height_request">200</property>
1412 1390
                 <property name="width_request">500</property>
1391
+                <property name="height_request">200</property>
1413 1392
                 <property name="visible">True</property>
1414 1393
                 <property name="can_focus">True</property>
1415 1394
                 <property name="editable">False</property>
@@ -1460,4 +1439,34 @@ Public License instead of this License.  But first, please read
1460 1439
     <property name="visible">True</property>
1461 1440
     <property name="icon_name">emblem-documents</property>
1462 1441
   </object>
1442
+  <object class="GtkMenu" id="mRight">
1443
+    <property name="visible">True</property>
1444
+    <child>
1445
+      <object class="GtkImageMenuItem" id="miPrefs">
1446
+        <property name="label">gtk-preferences</property>
1447
+        <property name="visible">True</property>
1448
+        <property name="use_underline">True</property>
1449
+        <property name="use_stock">True</property>
1450
+        <property name="always_show_image">True</property>
1451
+      </object>
1452
+    </child>
1453
+    <child>
1454
+      <object class="GtkImageMenuItem" id="miAbout">
1455
+        <property name="label">gtk-about</property>
1456
+        <property name="visible">True</property>
1457
+        <property name="use_underline">True</property>
1458
+        <property name="use_stock">True</property>
1459
+        <property name="always_show_image">True</property>
1460
+      </object>
1461
+    </child>
1462
+    <child>
1463
+      <object class="GtkImageMenuItem" id="miQuit">
1464
+        <property name="label">gtk-quit</property>
1465
+        <property name="visible">True</property>
1466
+        <property name="use_underline">True</property>
1467
+        <property name="use_stock">True</property>
1468
+        <property name="always_show_image">True</property>
1469
+      </object>
1470
+    </child>
1471
+  </object>
1463 1472
 </interface>

+ 9
- 3
smd-applet.vala View File

@@ -100,7 +100,8 @@ class smdApplet {
100 100
 	Gtk.Builder builder = null;
101 101
 
102 102
 	// main widgets
103
-	Gtk.Menu menu = null;
103
+	Gtk.Menu menuL = null;
104
+	Gtk.Menu menuR = null;
104 105
 	Gtk.StatusIcon si = null;
105 106
 	Gtk.Window win = null;
106 107
 	Gtk.Window err_win = null;
@@ -230,7 +231,8 @@ class smdApplet {
230 231
 		};
231 232
 
232 233
 		// menu popped up when the user clicks on the notification area
233
-        menu = builder.get_object ("mMain") as Gtk.Menu;
234
+        menuL = builder.get_object ("mLeft") as Gtk.Menu;
235
+        menuR = builder.get_object ("mRight") as Gtk.Menu;
234 236
 		var quit = builder.get_object ("miQuit") as Gtk.MenuItem;
235 237
 		quit.activate += (b) => { 
236 238
 			thread_die = true;
@@ -255,13 +257,17 @@ class smdApplet {
255 257
 
256 258
 		si = new Gtk.StatusIcon.from_icon_name("mail-send-receive");
257 259
 		si.set_tooltip_text("smd-applet is running");
260
+		si.popup_menu += (button,time) => {
261
+				menuR.popup(null,null,si.position_menu,0,
262
+					Gtk.get_current_event_time());
263
+		};
258 264
 		si.activate += (s) => { 
259 265
 			if ( error_mode ) 
260 266
 				err_win.reshow_with_initial_size();
261 267
 			else if( config_wait_mode )
262 268
 				win.show();
263 269
 			else
264
-				menu.popup(null,null,si.position_menu,0,
270
+				menuL.popup(null,null,si.position_menu,0,
265 271
 					Gtk.get_current_event_time());
266 272
 		};
267 273
 

Loading…
Cancel
Save