summaryrefslogtreecommitdiffstats
path: root/g-ed-it
diff options
context:
space:
mode:
authorMatthieu Gautier <mgautier@fedoraproject.org>2009-05-04 18:53:45 +0200
committerMatthieu Gautier <mgautier@fedoraproject.org>2009-05-04 19:02:48 +0200
commit445c9725f1198d1bcaeb640e85cba1b3175fbbd2 (patch)
tree96c914958063cc6371f39e707600b12b20a57e75 /g-ed-it
parentb720af68f07507c1149baeb5dfddb5057a29dcdc (diff)
downloadg-ed-it-445c9725f1198d1bcaeb640e85cba1b3175fbbd2.tar.gz
g-ed-it-445c9725f1198d1bcaeb640e85cba1b3175fbbd2.tar.xz
g-ed-it-445c9725f1198d1bcaeb640e85cba1b3175fbbd2.zip
Rewrite gitAction depending of modifications of the docBar
Diffstat (limited to 'g-ed-it')
-rw-r--r--g-ed-it/commitDialog.py2
-rw-r--r--g-ed-it/docBar.py15
-rw-r--r--g-ed-it/gitAction.py32
3 files changed, 24 insertions, 25 deletions
diff --git a/g-ed-it/commitDialog.py b/g-ed-it/commitDialog.py
index 4144b8e..668a5c0 100644
--- a/g-ed-it/commitDialog.py
+++ b/g-ed-it/commitDialog.py
@@ -49,10 +49,8 @@ class CommitDialog (object):
self.cwd = os.path.dirname(fileURI)
if allFile:
self.fileName = None
-# templateMsg = subprocess.Popen(["git-status","-s"],stdout=subprocess.PIPE,cwd=self.cwd).communicate()[0]
else:
self.fileName = os.path.basename(fileURI)
-# templateMsg = subprocess.Popen(["git-status","-s",self.fileName],stdout=subprocess.PIPE,cwd=self.cwd).communicate()[0]
self.commit_text_box.get_buffer().set_text("")
self.commit_dialog.show()
diff --git a/g-ed-it/docBar.py b/g-ed-it/docBar.py
index a3d1712..dcd40c3 100644
--- a/g-ed-it/docBar.py
+++ b/g-ed-it/docBar.py
@@ -58,16 +58,16 @@ class DocBar (object):
self.commit_text = gtk.Entry()
self.btn_add = gtk.Button("add")
- self.btn_add.connect("clicked", self.gitAction.add)
+ self.btn_add.connect("clicked", self.gitAction.add, self.window)
self.btn_commit = gtk.Button("commit")
- self.btn_commit.connect("clicked", self.gitAction.commit, self.window,self.get_and_clear_commitText)
+ self.btn_commit.connect("clicked", self.gitAction.commit_current_file, self.window)
self.btn_diff_head_index = gtk.Button("diff HEAD/INDEX")
- self.btn_diff_head_index.connect("clicked", self.gitAction.diff_head_index)
+ self.btn_diff_head_index.connect("clicked", self.gitAction.diff_head_index, self.window)
self.btn_diff_index_wt = gtk.Button("diff INDEX/WT")
- self.btn_diff_index_wt.connect("clicked", self.gitAction.diff_index_wt)
+ self.btn_diff_index_wt.connect("clicked", self.gitAction.diff_index_wt, self.window)
self.docBar.pack_start(self.btn_diff_head_index, False, False)
self.docBar.pack_start(self.btn_diff_index_wt, False, False)
@@ -109,10 +109,13 @@ class DocBar (object):
if not self.currentTab:
return
_docHelper = self.currentTab.get_data(docHelper.DocHelper.KEY)
- if not _docHelper or not _docHelper.inGitDir :
+ if not _docHelper :
+ self.docBar.hide()
+ return
+ _docHelper.getDocState()
+ if not _docHelper.inGitDir :
self.docBar.hide()
return
-
self.docBar.show()
self.btn_add.set_sensitive(_docHelper.index2WT!=None or not _docHelper.isCached)
self.btn_commit.set_sensitive(_docHelper.HEAD2index!=None)
diff --git a/g-ed-it/gitAction.py b/g-ed-it/gitAction.py
index 28460f8..1f48d51 100644
--- a/g-ed-it/gitAction.py
+++ b/g-ed-it/gitAction.py
@@ -33,36 +33,34 @@ class GitAction (object):
self.plugin = plugin
pass
- def commit(self,launcher,window,fileUriMethod = None, commitTextMethod = None):
- if fileUriMethod :
- fileUri = fileUriMethod()
- allFile = False
- else:
- fileUri = window.get_active_document().get_uri_for_display()
- allFile = True
+ def commit(self, button, window):
+ fileUri = window.get_active_tab().get_document().get_uri_for_display()
+ self.commitDialog.run(window,fileUri,True)
+
+ def commit_current_file(self, button, window, commitTextMethod = None):
+ fileUri = window.get_active_tab().get_document().get_uri_for_display()
if commitTextMethod:
text = commitTextMethod()
if text != "":
subprocess.call('git-commit -m "'+text+'" '+os.path.basename(fileUri),stdout=subprocess.PIPE,cwd=os.path.dirname(fileUri), shell=True)
self.plugin.fast_update_ui()
else:
- self.commitDialog.run(window,fileUri,allFile)
+ self.commitDialog.run(window,fileUri,False)
else:
- self.commitDialog.run(window,fileUri,allFile)
- pass
+ self.commitDialog.run(window,fileUri,False)
- def add(self,launcher,fileUriMethod = None):
- if fileUriMethod : fileUri = fileUriMethod()
+ def add(self, button, window):
+ fileUri = window.get_active_tab().get_document().get_uri_for_display()
subprocess.call("git-add "+os.path.basename(fileUri),stdout=subprocess.PIPE,cwd=os.path.dirname(fileUri), shell=True)
- self.plugin.fast_update_ui()
+ window.emit("active-tab-state-changed")
pass
- def diff_head_index(self,launcher, fileUriMethod = None):
- if fileUriMethod : fileUri = fileUriMethod()
+ def diff_head_index(self, button, window):
+ fileUri = window.get_active_tab().get_document().get_uri_for_display()
subprocess.call("git-diff --cached "+os.path.basename(fileUri),stdout=subprocess.PIPE,cwd=os.path.dirname(fileUri), shell=True)
pass
- def diff_index_wt(self, launcher, fileUriMethod = None):
- if fileUriMethod : fileUri = fileUriMethod()
+ def diff_index_wt(self, button, window):
+ fileUri = window.get_active_tab().get_document().get_uri_for_display()
subprocess.call("git-diff "+os.path.basename(fileUri),stdout=subprocess.PIPE,cwd=os.path.dirname(fileUri), shell=True)
pass