[gitg] Remove redundant namespacing
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Remove redundant namespacing
- Date: Sun, 23 Jun 2013 19:15:56 +0000 (UTC)
commit 159cc171a9a36dd53482c71064e85cca3c2ee432
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jun 23 21:06:29 2013 +0200
Remove redundant namespacing
Now gtk widgets are in the same Gitg namespace
libgitg/gitg-cell-renderer-lanes.vala | 14 +++---
libgitg/gitg-commit-list-view.vala | 14 +++---
libgitg/gitg-commit-model.vala | 34 +++++++-------
libgitg/gitg-dash-view.vala | 67 ++++++++++++-------------
libgitg/gitg-diff-view-request-resource.vala | 3 +-
libgitg/gitg-diff-view-request.vala | 3 +-
libgitg/gitg-diff-view.vala | 10 ++--
libgitg/gitg-label-renderer.vala | 42 ++++++++--------
libgitg/gitg-when-mapped.vala | 21 ++++++++-
9 files changed, 113 insertions(+), 95 deletions(-)
---
diff --git a/libgitg/gitg-cell-renderer-lanes.vala b/libgitg/gitg-cell-renderer-lanes.vala
index f35a426..a215375 100644
--- a/libgitg/gitg-cell-renderer-lanes.vala
+++ b/libgitg/gitg-cell-renderer-lanes.vala
@@ -21,11 +21,11 @@ namespace Gitg
{
class CellRendererLanes : Gtk.CellRendererText
{
- public Gitg.Commit? commit { get; set; }
- public Gitg.Commit? next_commit { get; set; }
+ public Commit? commit { get; set; }
+ public Commit? next_commit { get; set; }
public uint lane_width { get; set; default = 16; }
public uint dot_width { get; set; default = 10; }
- public unowned SList<Gitg.Ref> labels { get; set; }
+ public unowned SList<Ref> labels { get; set; }
private int d_last_height;
@@ -85,11 +85,11 @@ namespace Gitg
var color = lane.color;
context.set_source_rgb(color.r, color.g, color.b);
- if (lane.tag == Gitg.LaneTag.START)
+ if (lane.tag == LaneTag.START)
{
draw_arrow(context, area, to, true);
}
- else if (lane.tag == Gitg.LaneTag.END)
+ else if (lane.tag == LaneTag.END)
{
draw_arrow(context, area, to, false);
}
@@ -100,7 +100,7 @@ namespace Gitg
private void draw_paths_real(Cairo.Context context,
Gdk.Rectangle area,
- Gitg.Commit? commit,
+ Commit? commit,
double yoffset)
{
if (commit == null)
@@ -233,4 +233,4 @@ namespace Gitg
}
}
-// vi:ts=4
+// ex:ts=4 noet
diff --git a/libgitg/gitg-commit-list-view.vala b/libgitg/gitg-commit-list-view.vala
index 47b6c2e..f4df91a 100644
--- a/libgitg/gitg-commit-list-view.vala
+++ b/libgitg/gitg-commit-list-view.vala
@@ -21,14 +21,14 @@ namespace Gitg
{
public class CommitListView : Gtk.TreeView, Gtk.Buildable
{
- public CommitListView(Gitg.CommitModel model)
+ public CommitListView(CommitModel model)
{
Object(model: model);
}
- public CommitListView.for_repository(Gitg.Repository repository)
+ public CommitListView.for_repository(Repository repository)
{
- this(new Gitg.CommitModel(repository));
+ this(new CommitModel(repository));
}
private void lanes_data_func(Gtk.CellLayout layout,
@@ -44,7 +44,7 @@ namespace Gitg
}
CellRendererLanes lanes = (CellRendererLanes)cell;
- Gitg.Commit? commit = m.commit_from_iter(iter);
+ Commit? commit = m.commit_from_iter(iter);
if (commit == null)
{
@@ -52,14 +52,14 @@ namespace Gitg
}
var cp = iter;
- Gitg.Commit? next_commit = null;
+ Commit? next_commit = null;
if (m.iter_next(ref cp))
{
next_commit = m.commit_from_iter(cp);
}
- unowned SList<Gitg.Ref> labels = m.repository.refs_for_id(commit.get_id());
+ unowned SList<Ref> labels = m.repository.refs_for_id(commit.get_id());
lanes.commit = commit;
lanes.next_commit = next_commit;
@@ -90,4 +90,4 @@ namespace Gitg
}
}
-// vi:ts=4
+// ex:ts=4 noet
diff --git a/libgitg/gitg-commit-model.vala b/libgitg/gitg-commit-model.vala
index 16129f0..2d0fef7 100644
--- a/libgitg/gitg-commit-model.vala
+++ b/libgitg/gitg-commit-model.vala
@@ -52,7 +52,7 @@ namespace Gitg
case AUTHOR_DATE:
return typeof(string);
case COMMIT:
- return typeof(Gitg.Commit);
+ return typeof(Commit);
default:
break;
}
@@ -63,14 +63,14 @@ namespace Gitg
public class CommitModel : Object, Gtk.TreeModel
{
- private Gitg.Repository d_repository;
+ private Repository d_repository;
private Cancellable? d_cancellable;
- private Gitg.Commit[] d_ids;
+ private Commit[] d_ids;
private Thread<void*>? d_thread;
private Ggit.RevisionWalker? d_walker;
private uint d_advertized_size;
private uint d_idleid;
- private Gitg.Lanes d_lanes;
+ private Lanes d_lanes;
private Ggit.SortMode d_sortmode;
private Ggit.OId[] d_include;
@@ -95,7 +95,7 @@ namespace Gitg
}
[Notify]
- public Gitg.Repository repository
+ public Repository repository
{
get { return d_repository; }
set
@@ -111,14 +111,14 @@ namespace Gitg
public signal void update(uint added);
public signal void finished();
- public CommitModel(Gitg.Repository? repository)
+ public CommitModel(Repository? repository)
{
Object(repository: repository);
}
construct
{
- d_lanes = new Gitg.Lanes();
+ d_lanes = new Lanes();
d_cancellable = new Cancellable();
d_cancellable.cancel();
@@ -146,7 +146,7 @@ namespace Gitg
d_idleid = 0;
}
- d_ids = new Gitg.Commit[0];
+ d_ids = new Commit[0];
d_advertized_size = 0;
emit_started();
@@ -179,9 +179,9 @@ namespace Gitg
return d_advertized_size;
}
- public new Gitg.Commit? @get(uint idx)
+ public new Commit? @get(uint idx)
{
- Gitg.Commit? ret;
+ Commit? ret;
if (idx >= d_advertized_size)
{
@@ -291,7 +291,7 @@ namespace Gitg
// Pre-allocate array to store commits
lock(d_ids)
{
- d_ids = new Gitg.Commit[1000];
+ d_ids = new Commit[1000];
size = d_ids.length;
@@ -304,7 +304,7 @@ namespace Gitg
while (true)
{
Ggit.OId? id;
- Gitg.Commit? commit;
+ Commit? commit;
if (d_cancellable.is_cancelled())
{
@@ -320,7 +320,7 @@ namespace Gitg
break;
}
- commit = d_repository.lookup(id, typeof(Gitg.Commit)) as
Gitg.Commit;
+ commit = d_repository.lookup(id, typeof(Commit)) as Commit;
} catch { break; }
// Add the id
@@ -477,7 +477,7 @@ namespace Gitg
return_if_fail(iter.stamp == d_stamp);
uint idx = (uint)(ulong)iter.user_data;
- Gitg.Commit? commit = this[idx];
+ Commit? commit = this[idx];
val.init(get_column_type(column));
@@ -529,7 +529,7 @@ namespace Gitg
}
}
- public Gitg.Commit? commit_from_iter(Gtk.TreeIter iter)
+ public Commit? commit_from_iter(Gtk.TreeIter iter)
{
return_val_if_fail(iter.stamp == d_stamp, null);
@@ -538,7 +538,7 @@ namespace Gitg
return this[idx];
}
- public Gitg.Commit? commit_from_path(Gtk.TreePath path)
+ public Commit? commit_from_path(Gtk.TreePath path)
{
int[] indices = path.get_indices();
@@ -630,4 +630,4 @@ namespace Gitg
}
}
-// ex:set ts=4 noet
+// ex:ts=4 noet
diff --git a/libgitg/gitg-dash-view.vala b/libgitg/gitg-dash-view.vala
index b39615c..94f2260 100644
--- a/libgitg/gitg-dash-view.vala
+++ b/libgitg/gitg-dash-view.vala
@@ -17,31 +17,28 @@
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gitg;
-using Gtk;
-
namespace Gitg
{
- public class DashView : ListBox
+ public class DashView : Gtk.ListBox
{
private static Gtk.IconSize d_icon_size;
private string? d_filter_text;
- private class DashRow : ListBoxRow
+ private class DashRow : Gtk.ListBoxRow
{
public Repository? repository;
public DateTime time;
public ProgressBin bin;
- public Image image;
- public Label repository_label;
- public Label branch_label;
- public Arrow arrow;
- public Spinner spinner;
+ public Gtk.Image image;
+ public Gtk.Label repository_label;
+ public Gtk.Label branch_label;
+ public Gtk.Arrow arrow;
+ public Gtk.Spinner spinner;
}
public signal void repository_activated(Repository repository);
- protected override void row_activated(ListBoxRow row)
+ protected override void row_activated(Gtk.ListBoxRow row)
{
var r = row as DashRow;
@@ -65,25 +62,25 @@ namespace Gitg
add_recent_info();
}
- private void update_header(ListBoxRow row, ListBoxRow? before)
+ private void update_header(Gtk.ListBoxRow row, Gtk.ListBoxRow? before)
{
- row.set_header(before != null ? new Separator(Orientation.HORIZONTAL) : null);
+ row.set_header(before != null ? new Gtk.Separator(Gtk.Orientation.HORIZONTAL) : null);
}
- private bool filter(ListBoxRow row)
+ private bool filter(Gtk.ListBoxRow row)
{
var text = (row as DashRow).repository_label.get_text();
return text.contains(d_filter_text);
}
- private int compare_widgets(ListBoxRow a, ListBoxRow b)
+ private int compare_widgets(Gtk.ListBoxRow a, Gtk.ListBoxRow b)
{
return - (a as DashRow).time.compare((b as DashRow).time);
}
private void add_recent_info()
{
- var recent_manager = RecentManager.get_default();
+ var recent_manager = Gtk.RecentManager.get_default();
var reversed_items = recent_manager.get_items();
reversed_items.reverse();
@@ -108,11 +105,11 @@ namespace Gitg
return;
}
- Gitg.Repository repo;
+ Repository repo;
try
{
- repo = new Gitg.Repository(repo_file, null);
+ repo = new Repository(repo_file, null);
}
catch
{
@@ -129,7 +126,7 @@ namespace Gitg
}
}
- private DashRow get_row_for_repository(Gitg.Repository repository)
+ private DashRow get_row_for_repository(Repository repository)
{
DashRow? row = null;
@@ -153,33 +150,33 @@ namespace Gitg
row.time = new DateTime.now_local();
row.bin = new ProgressBin();
row.add(row.bin);
- var grid = new Grid();
+ var grid = new Gtk.Grid();
grid.margin = 12;
grid.column_spacing = 10;
row.bin.add(grid);
// FIXME: Change folder image for a repository uses github remote.
var folder_icon_name = local ? "folder" : "folder-remote";
- row.image = new Image.from_icon_name(folder_icon_name, d_icon_size);
+ row.image = new Gtk.Image.from_icon_name(folder_icon_name, d_icon_size);
grid.attach(row.image, 0, 0, 1, 2);
- row.repository_label = new Label(null);
+ row.repository_label = new Gtk.Label(null);
row.repository_label.set_markup("<b>%s</b>".printf(name));
row.repository_label.ellipsize = Pango.EllipsizeMode.END;
- row.repository_label.halign = Align.START;
- row.repository_label.valign = Align.END;
+ row.repository_label.halign = Gtk.Align.START;
+ row.repository_label.valign = Gtk.Align.END;
row.repository_label.hexpand = true;
grid.attach(row.repository_label, 1, 0, 1, 1);
- row.branch_label = new Label("");
+ row.branch_label = new Gtk.Label("");
row.branch_label.set_markup("<small>%s</small>".printf(branch_name));
row.branch_label.ellipsize = Pango.EllipsizeMode.END;
- row.branch_label.valign = Align.START;
- row.branch_label.halign = Align.START;
+ row.branch_label.valign = Gtk.Align.START;
+ row.branch_label.halign = Gtk.Align.START;
row.branch_label.get_style_context().add_class("dim-label");
grid.attach(row.branch_label, 1, 1, 1, 1);
- row.arrow = new Arrow(ArrowType.RIGHT, ShadowType.NONE);
+ row.arrow = new Gtk.Arrow(Gtk.ArrowType.RIGHT, Gtk.ShadowType.NONE);
grid.attach(row.arrow, 2, 0, 1, 2);
row.show_all();
@@ -188,7 +185,7 @@ namespace Gitg
if (spin)
{
row.arrow.hide();
- row.spinner = new Spinner();
+ row.spinner = new Gtk.Spinner();
grid.attach(row.spinner, 3, 0, 1, 2);
row.spinner.show();
row.spinner.start();
@@ -199,8 +196,8 @@ namespace Gitg
private void add_repository_to_recent_manager(string uri)
{
- var recent_manager = RecentManager.get_default();
- var item = RecentData();
+ var recent_manager = Gtk.RecentManager.get_default();
+ var item = Gtk.RecentData();
item.app_name = Environment.get_application_name();
item.mime_type = "inode/directory";
item.app_exec = string.join(" ", Environment.get_prgname(), "%f");
@@ -208,7 +205,7 @@ namespace Gitg
recent_manager.add_full(uri, item);
}
- public void add_repository(Gitg.Repository repository)
+ public void add_repository(Repository repository)
{
DashRow? row = get_row_for_repository(repository);
@@ -246,10 +243,10 @@ namespace Gitg
}
}
- private async Gitg.Repository? clone(DashRow row, string url, File location, bool is_bare)
+ private async Repository? clone(DashRow row, string url, File location, bool is_bare)
{
SourceFunc callback = clone.callback;
- Gitg.Repository? repository = null;
+ Repository? repository = null;
ThreadFunc<void*> run = () => {
try
@@ -261,7 +258,7 @@ namespace Gitg
return 0;
});
- repository = Ggit.Repository.clone(url, location, options) as
Gitg.Repository;
+ repository = Ggit.Repository.clone(url, location, options) as
Repository;
}
catch (Ggit.Error e)
{
diff --git a/libgitg/gitg-diff-view-request-resource.vala b/libgitg/gitg-diff-view-request-resource.vala
index d2e7eb1..164b04c 100644
--- a/libgitg/gitg-diff-view-request-resource.vala
+++ b/libgitg/gitg-diff-view-request-resource.vala
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
*/
+
namespace Gitg
{
class DiffViewRequestResource : DiffViewRequest
@@ -103,4 +104,4 @@ namespace Gitg
}
}
-// vi:ts=4
+// ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view-request.vala b/libgitg/gitg-diff-view-request.vala
index bac8a7d..c70d671 100644
--- a/libgitg/gitg-diff-view-request.vala
+++ b/libgitg/gitg-diff-view-request.vala
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
*/
+
namespace Gitg
{
public class DiffViewRequest
@@ -151,4 +152,4 @@ namespace Gitg
}
}
-// vi:ts=4
+// ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view.vala b/libgitg/gitg-diff-view.vala
index c10c665..23125ef 100644
--- a/libgitg/gitg-diff-view.vala
+++ b/libgitg/gitg-diff-view.vala
@@ -22,10 +22,10 @@ namespace Gitg
public class DiffView : WebKit.WebView
{
private Ggit.Diff? d_diff;
- private Gitg.Commit? d_commit;
+ private Commit? d_commit;
private Settings d_fontsettings;
- private static Gee.HashMap<string, Gitg.DiffView> s_diffmap;
+ private static Gee.HashMap<string, DiffView> s_diffmap;
private static uint64 s_diff_id;
public File? custom_css { get; construct; }
@@ -48,7 +48,7 @@ namespace Gitg
}
}
- public Gitg.Commit? commit
+ public Commit? commit
{
get { return d_commit; }
set
@@ -62,7 +62,7 @@ namespace Gitg
static construct
{
- s_diffmap = new Gee.HashMap<string, Gitg.DiffView>();
+ s_diffmap = new Gee.HashMap<string, DiffView>();
var context = WebKit.WebContext.get_default();
context.register_uri_scheme("gitg-diff", gitg_diff_request);
@@ -296,4 +296,4 @@ namespace Gitg
}
}
-// vi:ts=4
+// ex:ts=4 noet
diff --git a/libgitg/gitg-label-renderer.vala b/libgitg/gitg-label-renderer.vala
index e63a2e2..6dcfc58 100644
--- a/libgitg/gitg-label-renderer.vala
+++ b/libgitg/gitg-label-renderer.vala
@@ -24,14 +24,14 @@ namespace Gitg
private static const int margin = 3;
private static const int padding = 4;
- private static string label_text(Gitg.Ref r)
+ private static string label_text(Ref r)
{
var escaped = Markup.escape_text(r.parsed_name.shortname);
return "<span size='smaller'>%s</span>".printf(escaped);
}
private static int get_label_width(Pango.Layout layout,
- Gitg.Ref r)
+ Ref r)
{
var smaller = label_text(r);
@@ -45,7 +45,7 @@ namespace Gitg
public static int width(Gtk.Widget widget,
Pango.FontDescription *font,
- SList<Gitg.Ref> labels)
+ SList<Ref> labels)
{
if (labels == null)
{
@@ -59,7 +59,7 @@ namespace Gitg
layout.set_font_description(font);
- foreach (Gitg.Ref r in labels)
+ foreach (Ref r in labels)
{
ret += get_label_width(layout, r) + margin;
}
@@ -67,22 +67,22 @@ namespace Gitg
return ret + margin;
}
- private static string class_from_ref(Gitg.RefType type)
+ private static string class_from_ref(RefType type)
{
string style_class;
switch (type)
{
- case Gitg.RefType.BRANCH:
+ case RefType.BRANCH:
style_class = "branch";
break;
- case Gitg.RefType.REMOTE:
+ case RefType.REMOTE:
style_class = "remote";
break;
- case Gitg.RefType.TAG:
+ case RefType.TAG:
style_class = "tag";
break;
- case Gitg.RefType.STASH:
+ case RefType.STASH:
style_class = "stash";
break;
default:
@@ -96,7 +96,7 @@ namespace Gitg
private static int render_label(Gtk.Widget widget,
Cairo.Context cr,
Pango.Layout layout,
- Gitg.Ref r,
+ Ref r,
int x,
int y,
int height,
@@ -145,7 +145,7 @@ namespace Gitg
public static void draw(Gtk.Widget widget,
Pango.FontDescription font,
Cairo.Context context,
- SList<Gitg.Ref> labels,
+ SList<Ref> labels,
Gdk.Rectangle area)
{
double pos = margin + 0.5;
@@ -158,7 +158,7 @@ namespace Gitg
layout.set_font_description(font);
- foreach (Gitg.Ref r in labels)
+ foreach (Ref r in labels)
{
var w = render_label(widget,
context,
@@ -175,11 +175,11 @@ namespace Gitg
context.restore();
}
- public static Gitg.Ref? get_ref_at_pos(Gtk.Widget widget,
- Pango.FontDescription font,
- SList<Gitg.Ref> labels,
- int x,
- out int hot_x)
+ public static Ref? get_ref_at_pos(Gtk.Widget widget,
+ Pango.FontDescription font,
+ SList<Ref> labels,
+ int x,
+ out int hot_x)
{
hot_x = 0;
@@ -194,9 +194,9 @@ namespace Gitg
layout.set_font_description(font);
int start = margin;
- Gitg.Ref? ret = null;
+ Ref? ret = null;
- foreach (Gitg.Ref r in labels)
+ foreach (Ref r in labels)
{
int width = get_label_width(layout, r);
@@ -243,7 +243,7 @@ namespace Gitg
public static Gdk.Pixbuf render_ref(Gtk.Widget widget,
Pango.FontDescription font,
- Gitg.Ref r,
+ Ref r,
int height,
int minwidth)
{
@@ -278,4 +278,4 @@ namespace Gitg
}
}
-// vi:ts=4
+// ex:ts=4 noet
diff --git a/libgitg/gitg-when-mapped.vala b/libgitg/gitg-when-mapped.vala
index 5f66206..5716df8 100644
--- a/libgitg/gitg-when-mapped.vala
+++ b/libgitg/gitg-when-mapped.vala
@@ -1,3 +1,22 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2012 - Jesse van den Kieboom
+ *
+ * gitg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * gitg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
namespace Gitg
{
public class WhenMapped
@@ -105,4 +124,4 @@ namespace Gitg
}
}
-// ex: ts=4 noet
+// ex:ts=4 noet
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]