Merge lp:~kprav33n/gwibber/googleshortlinks into lp:~gwibber-committers/gwibber/trunk.merge.backup

Proposed by Praveen Kumar
Status: Needs review
Proposed branch: lp:~kprav33n/gwibber/googleshortlinks
Merge into: lp:~gwibber-committers/gwibber/trunk.merge.backup
Diff against target: None lines
To merge this branch: bzr merge lp:~kprav33n/gwibber/googleshortlinks
Reviewer Review Type Date Requested Status
Ken VanDine Needs Resubmitting
Praveen Kumar (community) Needs Information
Review via email: mp+11308@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Praveen Kumar (kprav33n) wrote :

Google short links URL shortening support.

413. By Praveen Kumar

Rename 'googleshortlinks' to 'Google short links'.

Revision history for this message
Praveen Kumar (kprav33n) wrote :

> Google short links URL shortening support.

Is there something wrong with these changes? Any idea on when it is going to be merged?

review: Needs Information
Revision history for this message
Ken VanDine (ken-vandine) wrote :

We have been focusing on stabilizing 2.0 for release, post 2.0 we will look at merging this. Thanks!

review: Abstain
Revision history for this message
Praveen Kumar (kprav33n) wrote :

> We have been focusing on stabilizing 2.0 for release, post 2.0 we will look at
> merging this. Thanks!

Is there still a plan to merge this branch into the master? Thanks!

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Please resubmit your branch against current trunk. Your branch was proposed for a branch that had to be moved out of the way because of some bzr problems we had a few months back.

review: Needs Resubmitting

Unmerged revisions

413. By Praveen Kumar

Rename 'googleshortlinks' to 'Google short links'.

412. By Praveen Kumar

Use gconf stored settings for Google short links URL shortening.

411. By Praveen Kumar

Hook Google short links configuration with gconf.

410. By Praveen Kumar

Add Google short links configuration dialog and hook it up.

409. By Praveen Kumar

Add initial support for Google short links configuration.

408. By Praveen Kumar

Add initial support for Google short links URL shortening service.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gwibber/client.py'
--- gwibber/client.py 2009-09-04 00:07:09 +0000
+++ gwibber/client.py 2009-09-07 14:24:19 +0000
@@ -892,6 +892,39 @@
892 errorwin.add(vb)892 errorwin.add(vb)
893 errorwin.show_all()893 errorwin.show_all()
894894
895 def on_urlshorter_change(self, combobox, glade):
896 model = combobox.get_model()
897 active = combobox.get_active()
898 if active < 0:
899 return
900 selected_service = model[active][0]
901
902 if selected_service == 'googleshortlinks':
903 glade.get_widget("buttonURLShorterConfigure").set_sensitive(True)
904 else:
905 glade.get_widget("buttonURLShorterConfigure").set_sensitive(False)
906
907
908 def on_urlshorter_configure(self, button):
909 def on_save(button, dialog):
910 dialog.destroy()
911 return
912
913 glade = gtk.glade.XML(resources.get_ui_asset("preferences.glade"))
914 dialog = glade.get_widget("dialog_googleshortlinks")
915 glade.get_widget("googleshortlinks_btnclose").\
916 connect("clicked", lambda a: dialog.destroy())
917 glade.get_widget("googleshortlinks_btnsave").\
918 connect("clicked", on_save, dialog)
919 self.preferences.bind(glade.get_widget("googleshortlinks_server"),
920 "googleshortlinks_server")
921 self.preferences.bind(glade.get_widget("googleshortlinks_user"),
922 "googleshortlinks_user")
923 self.preferences.bind(glade.get_widget("googleshortlinks_secret"),
924 "googleshortlinks_secret")
925 dialog.show_all()
926 return
927
895 def on_preferences(self, mi):928 def on_preferences(self, mi):
896 # reset theme to default if no longer available929 # reset theme to default if no longer available
897 if self.preferences['theme'] not in resources.get_themes():930 if self.preferences['theme'] not in resources.get_themes():
@@ -931,7 +964,10 @@
931 theme_selector.show_all()964 theme_selector.show_all()
932965
933 # add combo box with url shorter services966 # add combo box with url shorter services
967 glade.get_widget("buttonURLShorterConfigure").\
968 connect("clicked", self.on_urlshorter_configure)
934 urlshorter_selector = gtk.combo_box_new_text()969 urlshorter_selector = gtk.combo_box_new_text()
970 urlshorter_selector.connect("changed", self.on_urlshorter_change, glade)
935 for us in sorted(urlshorter.PROTOCOLS.keys()):971 for us in sorted(urlshorter.PROTOCOLS.keys()):
936 urlshorter_name = urlshorter.PROTOCOLS[us].PROTOCOL_INFO["name"]972 urlshorter_name = urlshorter.PROTOCOLS[us].PROTOCOL_INFO["name"]
937 urlshorter_selector.append_text(urlshorter_name)973 urlshorter_selector.append_text(urlshorter_name)
938974
=== modified file 'gwibber/urlshorter/__init__.py'
--- gwibber/urlshorter/__init__.py 2009-04-15 22:56:03 +0000
+++ gwibber/urlshorter/__init__.py 2009-09-07 08:53:16 +0000
@@ -1,5 +1,5 @@
11
2import cligs, isgd, tinyurlcom, trim, ur1ca2import cligs, isgd, tinyurlcom, trim, ur1ca, googleshortlinks
3#import snipurlcom, zima3#import snipurlcom, zima
44
5PROTOCOLS = {5PROTOCOLS = {
@@ -10,4 +10,5 @@
10 "tr.im": trim,10 "tr.im": trim,
11 "ur1.ca": ur1ca,11 "ur1.ca": ur1ca,
12 #"zi.ma": zima,12 #"zi.ma": zima,
13 "googleshortlinks": googleshortlinks
13}14}
1415
=== added file 'gwibber/urlshorter/googleshortlinks.py'
--- gwibber/urlshorter/googleshortlinks.py 1970-01-01 00:00:00 +0000
+++ gwibber/urlshorter/googleshortlinks.py 2009-09-07 14:27:14 +0000
@@ -0,0 +1,71 @@
1
2"""
3
4Google short links interface for Gwibber.
5kprav33n (Praveen Kumar) - 09/06/2009
6
7"""
8
9import base64
10import datetime
11import hmac
12import gconf
13import hashlib
14import os
15import time
16import urllib
17import urllib2
18
19PROTOCOL_INFO = {
20
21 'name' : 'googleshortlinks',
22 'version' : 0.1,
23 'fqdn' : 'www.google.com'
24}
25
26class URLShorter:
27
28 def short(self, url):
29 # Get Google Short Links configuration.
30 try:
31 # FIXME: Is this the right way to get the configuration
32 # parameters here?
33 client = gconf.client_get_default()
34 server = \
35 client.get_string('/apps/gwibber/preferences/googleshortlinks_server')
36 user = \
37 client.get_string('/apps/gwibber/preferences/googleshortlinks_user')
38 secret = \
39 client.get_string('/apps/gwibber/preferences/googleshortlinks_secret')
40 base_url = 'http://%s/js/get_or_create_hash' % server.lower()
41 except:
42 return "SHORTENING_FAILURE"
43
44 # Generate the query string.
45 parameters = {'url' : url,
46 'user' : user,
47 'is_public' : 'true',
48 'oauth_signature_method' : 'HMAC-SHA1',
49 'timestamp' : \
50 str(time.mktime(datetime.datetime.now().timetuple()))}
51 param_array = [(k, v) for k, v in parameters.items()]
52 param_array.sort()
53 keyvals = ['%s=%s' % (urllib.quote(a, ''), urllib.quote(str(b), ''))
54 for a, b in param_array]
55 query_string = '&'.join(keyvals)
56
57 # Sign the query using HMAC-SHA1.
58 signature_base_string = 'GET&%s&%s' % (urllib.quote(base_url, ''),
59 urllib.quote(query_string, ''))
60 signature = \
61 urllib.quote(base64.b64encode(hmac.new(secret, signature_base_string,
62 hashlib.sha1).digest()),
63 '')
64
65 # Request for URL shortening.
66 request_url = '%s?%s&oauth_signature=%s' % \
67 (base_url, query_string, signature)
68 response_string = urllib2.urlopen(request_url).read()
69 short_suffix = eval(response_string.replace('true', '"true"'))['shortcut']
70 short_url = 'http://%s/%s' % (server, short_suffix)
71 return short_url
072
=== modified file 'ui/preferences.glade'
--- ui/preferences.glade 2009-08-16 05:49:21 +0000
+++ ui/preferences.glade 2009-09-07 14:24:19 +0000
@@ -287,9 +287,34 @@
287 </child>287 </child>
288 </widget>288 </widget>
289 <packing>289 <packing>
290 <property name="top_attach">1</property>
291 <property name="bottom_attach">2</property>
292 </packing>
293 </child>
294 <child>
295 <widget class="GtkVBox" id="vboxURLShorterConfiguration">
296 <property name="visible">True</property>
297 <property name="orientation">vertical</property>
298 <child>
299 <widget class="GtkButton" id="buttonURLShorterConfigure">
300 <property name="label" translatable="yes">gtk-preferences</property>
301 <property name="visible">True</property>
302 <property name="sensitive">False</property>
303 <property name="can_focus">True</property>
304 <property name="receives_default">True</property>
305 <property name="use_stock">True</property>
306 </widget>
307 <packing>
308 <property name="position">0</property>
309 </packing>
310 </child>
311 </widget>
312 <packing>
313 <property name="left_attach">1</property>
290 <property name="right_attach">2</property>314 <property name="right_attach">2</property>
291 <property name="top_attach">1</property>315 <property name="top_attach">1</property>
292 <property name="bottom_attach">2</property>316 <property name="bottom_attach">2</property>
317 <property name="x_options">GTK_SHRINK</property>
293 </packing>318 </packing>
294 </child>319 </child>
295 </widget>320 </widget>
@@ -4884,5 +4909,152 @@
4884 </widget>4909 </widget>
4885 </child>4910 </child>
4886 </widget>4911 </widget>
48874912 <widget class="GtkDialog" id="dialog_googleshortlinks">
4913 <property name="border_width">5</property>
4914 <property name="title" translatable="yes">Edit Google Short Links Configuration</property>
4915 <property name="type_hint">normal</property>
4916 <property name="has_separator">False</property>
4917 <child internal-child="vbox">
4918 <widget class="GtkVBox" id="dialog-vbox19">
4919 <property name="visible">True</property>
4920 <property name="orientation">vertical</property>
4921 <property name="spacing">2</property>
4922 <child>
4923 <widget class="GtkFrame" id="frame_googleshortlinks">
4924 <property name="visible">True</property>
4925 <property name="label_xalign">0</property>
4926 <property name="shadow_type">none</property>
4927 <child>
4928 <widget class="GtkAlignment" id="alignment1">
4929 <property name="visible">True</property>
4930 <property name="left_padding">12</property>
4931 <child>
4932 <widget class="GtkTable" id="table1">
4933 <property name="visible">True</property>
4934 <property name="n_rows">3</property>
4935 <property name="n_columns">2</property>
4936 <child>
4937 <widget class="GtkLabel" id="googleshortlinks_lblserver">
4938 <property name="visible">True</property>
4939 <property name="label" translatable="yes">Server:</property>
4940 </widget>
4941 </child>
4942 <child>
4943 <widget class="GtkLabel" id="googleshortlinks_lbluser">
4944 <property name="visible">True</property>
4945 <property name="label" translatable="yes">User:</property>
4946 </widget>
4947 <packing>
4948 <property name="top_attach">1</property>
4949 <property name="bottom_attach">2</property>
4950 </packing>
4951 </child>
4952 <child>
4953 <widget class="GtkLabel" id="googleshortlinks_lblsecret">
4954 <property name="visible">True</property>
4955 <property name="label" translatable="yes">HMAC secret:</property>
4956 </widget>
4957 <packing>
4958 <property name="top_attach">2</property>
4959 <property name="bottom_attach">3</property>
4960 </packing>
4961 </child>
4962 <child>
4963 <widget class="GtkEntry" id="googleshortlinks_server">
4964 <property name="visible">True</property>
4965 <property name="can_focus">True</property>
4966 <property name="invisible_char">&#x25CF;</property>
4967 </widget>
4968 <packing>
4969 <property name="left_attach">1</property>
4970 <property name="right_attach">2</property>
4971 </packing>
4972 </child>
4973 <child>
4974 <widget class="GtkEntry" id="googleshortlinks_user">
4975 <property name="visible">True</property>
4976 <property name="can_focus">True</property>
4977 <property name="invisible_char">&#x25CF;</property>
4978 </widget>
4979 <packing>
4980 <property name="left_attach">1</property>
4981 <property name="right_attach">2</property>
4982 <property name="top_attach">1</property>
4983 <property name="bottom_attach">2</property>
4984 </packing>
4985 </child>
4986 <child>
4987 <widget class="GtkEntry" id="googleshortlinks_secret">
4988 <property name="visible">True</property>
4989 <property name="can_focus">True</property>
4990 <property name="invisible_char">&#x25CF;</property>
4991 </widget>
4992 <packing>
4993 <property name="left_attach">1</property>
4994 <property name="right_attach">2</property>
4995 <property name="top_attach">2</property>
4996 <property name="bottom_attach">3</property>
4997 </packing>
4998 </child>
4999 </widget>
5000 </child>
5001 </widget>
5002 </child>
5003 <child>
5004 <widget class="GtkLabel" id="label_googleshortlinks">
5005 <property name="visible">True</property>
5006 <property name="label" translatable="yes">&lt;b&gt;Google Short Links Configuration&lt;/b&gt;</property>
5007 <property name="use_markup">True</property>
5008 </widget>
5009 <packing>
5010 <property name="type">label_item</property>
5011 </packing>
5012 </child>
5013 </widget>
5014 <packing>
5015 <property name="position">1</property>
5016 </packing>
5017 </child>
5018 <child internal-child="action_area">
5019 <widget class="GtkHButtonBox" id="dialog-action_area19">
5020 <property name="visible">True</property>
5021 <property name="layout_style">end</property>
5022 <child>
5023 <widget class="GtkButton" id="googleshortlinks_btnclose">
5024 <property name="label" translatable="yes">gtk-close</property>
5025 <property name="visible">True</property>
5026 <property name="can_focus">True</property>
5027 <property name="receives_default">True</property>
5028 <property name="use_stock">True</property>
5029 </widget>
5030 <packing>
5031 <property name="expand">False</property>
5032 <property name="fill">False</property>
5033 <property name="position">0</property>
5034 </packing>
5035 </child>
5036 <child>
5037 <widget class="GtkButton" id="googleshortlinks_btnsave">
5038 <property name="label" translatable="yes">gtk-save</property>
5039 <property name="visible">True</property>
5040 <property name="can_focus">True</property>
5041 <property name="receives_default">True</property>
5042 <property name="use_stock">True</property>
5043 </widget>
5044 <packing>
5045 <property name="expand">False</property>
5046 <property name="fill">False</property>
5047 <property name="position">1</property>
5048 </packing>
5049 </child>
5050 </widget>
5051 <packing>
5052 <property name="expand">False</property>
5053 <property name="pack_type">end</property>
5054 <property name="position">0</property>
5055 </packing>
5056 </child>
5057 </widget>
5058 </child>
5059 </widget>
4888</glade-interface>5060</glade-interface>

Subscribers

People subscribed via source and target branches

to all changes: