[gitg/wip/simplify-arch: 4/7] Small code cleanup
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/simplify-arch: 4/7] Small code cleanup
- Date: Mon, 1 Jul 2013 07:32:29 +0000 (UTC)
commit e847ff8ab4c509b53a86c64affca47b26185c145
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Mon Jul 1 09:27:17 2013 +0200
Small code cleanup
gitg/gitg-window.vala | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 96c0984..6073f12 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -206,6 +206,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
{
// set title
File? workdir = d_repository.get_workdir();
+
if (workdir != null)
{
string parent_path = workdir.get_parent().get_path();
@@ -215,6 +216,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
{
parent_path = parent_path.replace(Environment.get_home_dir(), "~");
}
+
title = @"$(d_repository.name) ($parent_path) - gitg";
infobar.hide();
}
@@ -254,7 +256,6 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
}
d_views.update();
- activate_default_view();
}
protected override bool window_state_event(Gdk.EventWindowState event)
@@ -279,6 +280,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
Gtk.FileChooserAction.SELECT_FOLDER,
Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
Gtk.Stock.OPEN, Gtk.ResponseType.OK);
+
chooser.modal = true;
chooser.response.connect((c, id) => {
@@ -298,7 +300,8 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
try
{
d_repository = new Gitg.Repository(this.repository.get_location(),
- null);
+ null);
+
notify_property("repository");
d_views.current.reload();
}
@@ -463,8 +466,10 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
return;
}
}
+
d.destroy();
});
+
user_information_dialog.show();
}
@@ -507,6 +512,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
error_dialog.secondary_text = secondary_message;
error_dialog.show();
+
error_dialog.response.connect((d, id) => {
error_dialog.destroy();
});
@@ -540,13 +546,17 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
// Setup window geometry saving
Gdk.WindowState window_state = (Gdk.WindowState)d_state_settings.get_int("state");
- if (Gdk.WindowState.MAXIMIZED in window_state) {
- maximize ();
+
+ if (Gdk.WindowState.MAXIMIZED in window_state)
+ {
+ maximize();
}
- int width, height;
- d_state_settings.get ("size", "(ii)", out width, out height);
- resize (width, height);
+ int width;
+ int height;
+
+ d_state_settings.get("size", "(ii)", out width, out height);
+ resize(width, height);
return true;
}
@@ -611,7 +621,9 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
catch (Error e)
{
string repo_name = path.get_basename();
+
var primary_msg = ("\"%s\" is not a Git repository!").printf(repo_name);
+
show_infobar(primary_msg, e.message, Gtk.MessageType.WARNING);
return;
}
@@ -628,12 +640,12 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
private void show_infobar(string primary_msg, string secondary_msg, Gtk.MessageType type)
{
infobar.message_type = type;
- infobar_primary_label.set_label ("<b>%s</b>".printf (Markup.escape_text(primary_msg)));
- infobar_secondary_label.set_label ("<small>%s</small>".printf
(Markup.escape_text(secondary_msg)));
- infobar.show ();
+ infobar_primary_label.set_label("<b>%s</b>".printf(Markup.escape_text(primary_msg)));
+
infobar_secondary_label.set_label("<small>%s</small>".printf(Markup.escape_text(secondary_msg)));
+ infobar.show();
- infobar_close_button.clicked.connect (() => {
- infobar.hide ();
+ infobar_close_button.clicked.connect(() => {
+ infobar.hide();
});
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]