[gitg] Add short introduction in dash when no repositories have been added
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Add short introduction in dash when no repositories have been added
- Date: Fri, 7 Aug 2015 07:04:21 +0000 (UTC)
commit 53085f518f22259c074048422bacbd229bb44916
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Fri Aug 7 09:03:26 2015 +0200
Add short introduction in dash when no repositories have been added
https://bugzilla.gnome.org/show_bug.cgi?id=727357
gitg/gitg-dash-view.vala | 27 +++++++++++++++++
gitg/resources/ui/gitg-dash-view.ui | 55 ++++++++++++++++++++++++++++++++++-
2 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-dash-view.vala b/gitg/gitg-dash-view.vala
index 982bd0b..1d882c0 100644
--- a/gitg/gitg-dash-view.vala
+++ b/gitg/gitg-dash-view.vala
@@ -30,6 +30,12 @@ class DashView : Gtk.Grid, GitgExt.UIElement, GitgExt.Activity, GitgExt.Selectab
private bool d_search_enabled;
private bool d_setting_mode;
+ [GtkChild( name = "introduction" )]
+ private Gtk.Grid d_introduction;
+
+ [GtkChild( name = "scrolled_window" )]
+ private Gtk.ScrolledWindow d_scrolled_window;
+
[GtkChild( name = "repository_list_box" )]
private RepositoryListBox d_repository_list_box;
@@ -211,6 +217,27 @@ class DashView : Gtk.Grid, GitgExt.UIElement, GitgExt.Activity, GitgExt.Selectab
d_repository_list_box.show_error.connect((primary_message, secondary_message) => {
application.show_infobar(primary_message, secondary_message, Gtk.MessageType.ERROR);
});
+
+ bind_property("has-repositories",
+ d_scrolled_window,
+ "visible",
+ BindingFlags.SYNC_CREATE);
+
+ bind_property("has-repositories",
+ d_introduction,
+ "visible",
+ BindingFlags.SYNC_CREATE |
+ BindingFlags.INVERT_BOOLEAN);
+
+ d_repository_list_box.add.connect(() => {
+ notify_property("has-repositories");
+ notify_property("selectable-enabled");
+ });
+
+ d_repository_list_box.remove.connect(() => {
+ notify_property("has-repositories");
+ notify_property("selectable-enabled");
+ });
}
public RepositoryListBox.Row? add_repository(Repository repository)
diff --git a/gitg/resources/ui/gitg-dash-view.ui b/gitg/resources/ui/gitg-dash-view.ui
index b0c0810..2fe5f45 100644
--- a/gitg/resources/ui/gitg-dash-view.ui
+++ b/gitg/resources/ui/gitg-dash-view.ui
@@ -3,8 +3,61 @@
<!-- interface-requires gtk+ 3.0 -->
<template class="GitgDashView" parent="GtkGrid">
<child>
+ <object class="GtkGrid" id="introduction">
+ <property name="visible">False</property>
+ <property name="column-spacing">12</property>
+ <property name="valign">center</property>
+ <property name="halign">center</property>
+ <property name="hexpand">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="gitg_icon">
+ <property name="visible">True</property>
+ <property name="icon_name">gitg-symbolic</property>
+ <property name="pixel_size">64</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_introduction">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">No repositories have been added yet. To get started,
you can add an existing repository or clone a new one.</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">True</property>
+ <property name="wrap">True</property>
+ <property name="xalign">0</property>
+ <property name="max-width-chars">30</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkScrolledWindow" id="scrolled_window">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]