[gitg] Make sure staging/unstaging labels fit
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Make sure staging/unstaging labels fit
- Date: Sun, 30 May 2010 15:42:30 +0000 (UTC)
commit 4b82edcf495d74e265cd327ae71bcf7e8fab5b79
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun May 30 17:42:22 2010 +0200
Make sure staging/unstaging labels fit
gitg/gitg-commit-view.c | 35 +++++++++--------------------------
gitg/gitg-diff-line-renderer.c | 2 ++
2 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/gitg/gitg-commit-view.c b/gitg/gitg-commit-view.c
index f7c75f6..f39d553 100644
--- a/gitg/gitg-commit-view.c
+++ b/gitg/gitg-commit-view.c
@@ -1113,26 +1113,16 @@ stage_unstage_label_func (GitgDiffView *diff_view,
{
static gchar const *format = "<small><b>%s</b></small>";
- if (line == -1)
- {
- static gchar const *longest_label = NULL;
-
- gchar const *stage = _("stage");
- gchar const *unstage = _("unstage");
+ gchar const *labels[] = {
+ _("unstage"),
+ _("stage")
+ };
- if (!longest_label)
- {
- if (g_utf8_strlen (stage, -1) > g_utf8_strlen (unstage, -1))
- {
- longest_label = stage;
- }
- else
- {
- longest_label = unstage;
- }
- }
+ gboolean staging = (view->priv->current_changes & GITG_CHANGED_FILE_CHANGES_UNSTAGED) != 0;
- return g_markup_printf_escaped (format, _("stage"));
+ if (line == -1)
+ {
+ return g_markup_printf_escaped (format, labels[staging]);
}
else if (view->priv->highlight_mark)
{
@@ -1149,14 +1139,7 @@ stage_unstage_label_func (GitgDiffView *diff_view,
if (gtk_text_iter_equal (&iter, &hl_iter))
{
- if (view->priv->current_changes & GITG_CHANGED_FILE_CHANGES_UNSTAGED)
- {
- return g_markup_printf_escaped (format, _("stage"));
- }
- else
- {
- return g_markup_printf_escaped (format, _("unstage"));
- }
+ return g_markup_printf_escaped (format, labels[staging]);
}
}
diff --git a/gitg/gitg-diff-line-renderer.c b/gitg/gitg-diff-line-renderer.c
index ecae376..b24f2e4 100644
--- a/gitg/gitg-diff-line-renderer.c
+++ b/gitg/gitg-diff-line-renderer.c
@@ -357,6 +357,8 @@ gitg_diff_line_renderer_get_size_impl (GtkCellRenderer *cell,
&lbl_pixel_width,
&lbl_pixel_height);
+ lbl_pixel_width += 4;
+
if (lbl_pixel_width > pixel_width)
{
pixel_width = lbl_pixel_width;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]