# HG changeset patch
# User Steve Borho <st...@borho.org>
# Date 1254198359 18000
# Node ID 007874d890a0e9ff8169cb07b227f7419f6ff439
# Parent  ed7a1082d84b5f82f8f3813ff1fecbac300a8312
history: use a toolbar to control sync button sizes

Unfortunately, I am completely baffled as to how to force the toolbar to not
expand to half of the sync bar width without turning itself into a drop-down
menu.  There doesn't appear to be any way to get 'just the width of the damned
buttons'.  gtk.ToolButtons themselves do not seem to allow the icon size to be
determined.  I'm at a loss as to how to get small icons for the sync bar.

diff -r ed7a1082d84b -r 007874d890a0 tortoisehg/hgtk/history.py
--- a/tortoisehg/hgtk/history.py        Tue Sep 29 12:56:22 2009 +0900
+++ b/tortoisehg/hgtk/history.py        Mon Sep 28 23:25:59 2009 -0500
@@ -680,9 +680,7 @@
         self.tree.connect('thg-revision', self.thgnavigate)
         self.connect('thg-refresh', self.thgrefresh)
 
-        self.syncbox = gtk.HBox()
-        syncbox = self.syncbox
-
+        # Build the sync bar
         incoming = gtk.ToolButton(gtk.STOCK_GO_DOWN)
         pull = gtk.ToolButton(gtk.STOCK_GOTO_BOTTOM)
         outgoing = gtk.ToolButton(gtk.STOCK_GO_UP)
@@ -690,11 +688,6 @@
         conf = gtk.ToolButton(gtk.STOCK_PREFERENCES)
         stop = gtk.ToolButton(gtk.STOCK_STOP)
         stop.set_sensitive(False)
-        syncbox.pack_start(incoming, False)
-        syncbox.pack_start(pull, False)
-        syncbox.pack_start(outgoing, False)
-        syncbox.pack_start(push, False)
-        syncbox.pack_start(stop, False)
 
         self.tooltips.set_tip(incoming,
             _('Download and view incoming changesets'))
@@ -709,13 +702,22 @@
         self.tooltips.set_tip(conf,
             _('Configure aliases and after pull behavior'))
 
+        tbar = gtk.Toolbar()
+        tbar.insert(incoming, -1)
+        tbar.insert(pull, -1)
+        tbar.insert(outgoing, -1)
+        tbar.insert(push, -1)
+        tbar.insert(stop, -1)
+        tbar.insert(conf, -1)
+        tbar.set_icon_size(gtk.ICON_SIZE_MENU)
+        tbar.set_style(gtk.TOOLBAR_ICONS)
+
         ## target path combobox
         urllist = gtk.ListStore(str, str)
         urlcombo = gtk.ComboBoxEntry(urllist, 0)
         cell = gtk.CellRendererText()
         urlcombo.pack_end(cell, False)
         urlcombo.add_attribute(cell, 'text', 1)
-        syncbox.pack_start(urlcombo, True, True, 2)
 
         for alias, path in self.repo.ui.configitems('paths'):
             path = url.hidepassword(path)
@@ -723,14 +725,6 @@
             if alias == 'default':
                 urlcombo.set_active(len(urllist)-1)
 
-        conf.connect('clicked', self.conf_clicked, urlcombo)
-        syncbox.pack_start(conf, False)
-
-        incoming.connect('clicked', self.incoming_clicked, urlcombo)
-        outgoing.connect('clicked', self.outgoing_clicked, urlcombo, stop)
-        push.connect('clicked', self.push_clicked, urlcombo)
-
-        syncbox.pack_start(gtk.Label(_('After Pull:')), False, False, 2)
         ppulldata = [('none', _('Nothing')), ('update', _('Update'))]
         ppull = self.repo.ui.config('tortoisehg', 'postpull', 'none')
         if 'fetch' in self.exs or 'fetch' == ppull:
@@ -752,8 +746,18 @@
                     in enumerate(ppulldata) if name == 'none'][0]
         ppullcombo.set_active(pos)
 
+        incoming.connect('clicked', self.incoming_clicked, urlcombo)
+        outgoing.connect('clicked', self.outgoing_clicked, urlcombo, stop)
+        push.connect('clicked', self.push_clicked, urlcombo)
         pull.connect('clicked', self.pull_clicked, urlcombo, ppullcombo,
                      ppulldata)
+        conf.connect('clicked', self.conf_clicked, urlcombo)
+
+        self.syncbox = gtk.HBox()
+        syncbox = self.syncbox
+        syncbox.pack_start(tbar, True, True, 2)
+        syncbox.pack_start(urlcombo, True, True, 2)
+        syncbox.pack_start(gtk.Label(_('After Pull:')), False, False, 2)
         syncbox.pack_start(ppullcombo, False, False, 2)
 
         self.filterbox = gtk.HBox()

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to