[gitg/wip/clone: 2/4] Implement clone action
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/clone: 2/4] Implement clone action
- Date: Thu, 21 Mar 2013 16:43:10 +0000 (UTC)
commit 664b3a87b52be0545a624dd9ce8ac04a7854f5ee
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed Mar 20 20:37:25 2013 +0100
Implement clone action
gitg/gitg-window.vala | 33 ++++++++
gitg/resources/gitg-resources.xml | 1 +
gitg/resources/ui/gitg-clone-dialog.ui | 132 ++++++++++++++++++++++++++++++++
3 files changed, 166 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 63bb64e..3661d88 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -172,6 +172,38 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
chooser.show();
}
+ private void on_clone_repository(Gtk.Button button)
+ {
+ var ret = GitgExt.UI.from_builder("ui/gitg-clone-dialog.ui",
+ "dialog-clone",
+ "entry-url",
+ "filechooserbutton-location",
+ "ok-button");
+
+ var dlg = ret["dialog-clone"] as Gtk.Dialog;
+ var entry_url = ret["entry-url"] as Gtk.Entry;
+ var chooser = ret["filechooserbutton-location"] as Gtk.FileChooserButton;
+ var ok_button = ret["ok-button"] as Gtk.Button;
+
+ dlg.modal = true;
+ dlg.set_transient_for(this);
+
+ entry_url.changed.connect((e) => {
+ ok_button.set_sensitive(entry_url.text_length != 0);
+ });
+
+ dlg.response.connect((d, id) => {
+ if (id == Gtk.ResponseType.OK)
+ {
+ //FIXME
+ }
+
+ d.destroy();
+ });
+
+ dlg.show();
+ }
+
private void parser_finished(Gtk.Builder builder)
{
// Extract widgets from the builder
@@ -181,6 +213,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
var button_open_repository = builder.get_object("button_open_repository") as
Gd.HeaderSimpleButton;
button_open_repository.clicked.connect(on_open_repository);
var button_clone_repository = builder.get_object("button_clone_repository") as
Gd.HeaderSimpleButton;
+ button_clone_repository.clicked.connect(on_clone_repository);
d_button_dash = builder.get_object("button_dash") as Gd.HeaderSimpleButton;
d_button_dash.clicked.connect((b) => {
diff --git a/gitg/resources/gitg-resources.xml b/gitg/resources/gitg-resources.xml
index d565f8a..c4a0fad 100644
--- a/gitg/resources/gitg-resources.xml
+++ b/gitg/resources/gitg-resources.xml
@@ -5,6 +5,7 @@
<file compressed="true" preprocess="xml-stripblanks">ui/gitg-menus.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/gitg-preferences-interface.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/gitg-preferences.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">ui/gitg-clone-dialog.ui</file>
<file compressed="true">ui/style.css</file>
<file alias="icons/gitg.svg" compressed="true"
preprocess="xml-stripblanks">../../data/icons/gitg.svg</file>
<file alias="icons/gitg128x128.png">../../data/icons/gitg128x128.png</file>
diff --git a/gitg/resources/ui/gitg-clone-dialog.ui b/gitg/resources/ui/gitg-clone-dialog.ui
new file mode 100644
index 0000000..6f2b9f1
--- /dev/null
+++ b/gitg/resources/ui/gitg-clone-dialog.ui
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="dialog-clone">
+ <property name="width_request">300</property>
+ <property name="height_request">200</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Clone Repository...</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel-button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ok-button">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">URL:</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="GtkEntry" id="entry-url">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</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>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Location:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="filechooserbutton-location">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="action">select-folder</property>
+ <property name="title" translatable="yes">Select location...</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">cancel-button</action-widget>
+ <action-widget response="-5">ok-button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]