Ticket #5874: example-of-patch.txt

File example-of-patch.txt, 5.2 KB (added by https://launchpad.net/~polymorphm, 6 years ago)

a example of fixes

Line 
1diff -r 453cd33cf535 data/gui/preferences_window.ui
2--- a/data/gui/preferences_window.ui    Mon Aug 30 21:42:36 2010 +0200
3+++ b/data/gui/preferences_window.ui    Tue Aug 31 02:02:31 2010 +0400
4@@ -12,6 +12,9 @@
5         <col id="0" translatable="yes">Autodetect on every Gajim startup</col>
6       </row>
7       <row>
8+        <col id="0" translatable="yes">Always use Freedesktop.org-standard provided method</col>
9+      </row>
10+      <row>
11         <col id="0" translatable="yes">Always use GNOME default applications</col>
12       </row>
13       <row>
14diff -r 453cd33cf535 src/common/config.py
15--- a/src/common/config.py      Mon Aug 30 21:42:36 2010 +0200
16+++ b/src/common/config.py      Tue Aug 31 02:02:31 2010 +0400
17@@ -59,7 +59,7 @@
18     DEFAULT_ICONSET = 'dcraven'
19     DEFAULT_MOOD_ICONSET = 'default'
20     DEFAULT_ACTIVITY_ICONSET = 'default'
21-    DEFAULT_OPENWITH = 'gnome-open'
22+    DEFAULT_OPENWITH = 'xdg-open'
23     DEFAULT_BROWSER = 'firefox'
24     DEFAULT_MAILAPP = 'mozilla-thunderbird -compose'
25     DEFAULT_FILE_MANAGER = 'xffm'
26diff -r 453cd33cf535 src/common/helpers.py
27--- a/src/common/helpers.py     Mon Aug 30 21:42:36 2010 +0200
28+++ b/src/common/helpers.py     Tue Aug 31 02:02:31 2010 +0400
29@@ -683,7 +683,9 @@
30         if kind == 'url' and uri.startswith('www.'):
31             uri = 'http://' + uri
32 
33-        if gajim.config.get('openwith') == 'gnome-open':
34+        if gajim.config.get('openwith') == 'xdg-open':
35+            command = 'xdg-open'
36+        elif gajim.config.get('openwith') == 'gnome-open':
37             command = 'gnome-open'
38         elif gajim.config.get('openwith') == 'kfmclient exec':
39             command = 'kfmclient exec'
40@@ -710,7 +712,9 @@
41         except Exception:
42             pass
43     else:
44-        if gajim.config.get('openwith') == 'gnome-open':
45+        if gajim.config.get('openwith') == 'xdg-open':
46+            command = 'xdg-open'
47+        elif gajim.config.get('openwith') == 'gnome-open':
48             command = 'gnome-open'
49         elif gajim.config.get('openwith') == 'kfmclient exec':
50             command = 'kfmclient exec'
51diff -r 453cd33cf535 src/config.py
52--- a/src/config.py     Mon Aug 30 21:42:36 2010 +0200
53+++ b/src/config.py     Tue Aug 31 02:02:31 2010 +0400
54@@ -497,14 +497,16 @@
55                 self.applications_combobox.set_active(0)
56             # else autodetect_browser_mailer is False.
57             # so user has 'Always Use GNOME/KDE/Xfce' or Custom
58+            elif gajim.config.get('openwith') == 'xdg-open':
59+                self.applications_combobox.set_active(1)
60             elif gajim.config.get('openwith') == 'gnome-open':
61-                self.applications_combobox.set_active(1)
62+                self.applications_combobox.set_active(2)
63             elif gajim.config.get('openwith') == 'kfmclient exec':
64-                self.applications_combobox.set_active(2)
65+                self.applications_combobox.set_active(3)
66             elif gajim.config.get('openwith') == 'exo-open':
67-                self.applications_combobox.set_active(3)
68+                self.applications_combobox.set_active(4)
69             elif gajim.config.get('openwith') == 'custom':
70-                self.applications_combobox.set_active(4)
71+                self.applications_combobox.set_active(5)
72                 self.xml.get_object('custom_apps_frame').show()
73 
74             self.xml.get_object('custom_browser_entry').set_text(
75@@ -1127,17 +1129,19 @@
76 
77     def on_applications_combobox_changed(self, widget):
78         gajim.config.set('autodetect_browser_mailer', False)
79-        if widget.get_active() == 4:
80+        if widget.get_active() == 5:
81             self.xml.get_object('custom_apps_frame').show()
82             gajim.config.set('openwith', 'custom')
83         else:
84             if widget.get_active() == 0:
85                 gajim.config.set('autodetect_browser_mailer', True)
86             elif widget.get_active() == 1:
87+                gajim.config.set('openwith', 'xdg-open')
88+            elif widget.get_active() == 2:
89                 gajim.config.set('openwith', 'gnome-open')
90-            elif widget.get_active() == 2:
91+            elif widget.get_active() == 3:
92                 gajim.config.set('openwith', 'kfmclient exec')
93-            elif widget.get_active() == 3:
94+            elif widget.get_active() == 4:
95                 gajim.config.set('openwith', 'exo-open')
96             self.xml.get_object('custom_apps_frame').hide()
97         gajim.interface.save_config()
98diff -r 453cd33cf535 src/gtkgui_helpers.py
99--- a/src/gtkgui_helpers.py     Mon Aug 30 21:42:36 2010 +0200
100+++ b/src/gtkgui_helpers.py     Tue Aug 31 02:02:31 2010 +0400
101@@ -223,7 +223,9 @@
102 
103 def autodetect_browser_mailer():
104     # recognize the environment and set appropriate browser/mailer
105-    if user_runs_gnome():
106+    if user_supports_xdg_open():
107+        gajim.config.set('openwith', 'xdg-open')
108+    elif user_runs_gnome():
109         gajim.config.set('openwith', 'gnome-open')
110     elif user_runs_kde():
111         gajim.config.set('openwith', 'kfmclient exec')
112@@ -232,6 +234,11 @@
113     else:
114         gajim.config.set('openwith', 'custom')
115 
116+def user_supports_xdg_open():
117+    import os.path
118+   
119+    return os.path.isfile('/usr/bin/xdg-open')
120+
121 def user_runs_gnome():
122     return 'gnome-session' in get_running_processes()
123