Added untested/unfinished commit ability

This commit is contained in:
Jesse van den Kieboom 2009-01-28 18:24:46 +01:00
parent 8ae8c69622
commit 04176b8399
4 changed files with 1039 additions and 329 deletions

394
gitg/gitg-commit.c Normal file
View file

@ -0,0 +1,394 @@
#include "gitg-commit.h"
#include "gitg-runner.h"
#include "gitg-utils.h"
#define GITG_COMMIT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_COMMIT, GitgCommitPrivate))
/* Properties */
enum
{
PROP_0,
PROP_REPOSITORY
};
struct _GitgCommitPrivate
{
GitgRepository *repository;
GitgRunner *runner;
guint update_id;
guint end_id;
gchar *dotgit;
};
G_DEFINE_TYPE(GitgCommit, gitg_commit, G_TYPE_OBJECT)
static void
runner_cancel(GitgCommit *commit)
{
if (commit->priv->update_id)
{
g_signal_handler_disconnect(commit->priv->runner, commit->priv->update_id);
commit->priv->update_id = 0;
}
if (commit->priv->end_id)
{
g_signal_handler_disconnect(commit->priv->runner, commit->priv->end_id);
commit->priv->update_id = 0;
}
gitg_runner_cancel(commit->priv->runner);
}
static void
gitg_commit_finalize(GObject *object)
{
GitgCommit *commit = GITG_COMMIT(object);
runner_cancel(commit);
g_object_unref(commit->priv->runner);
g_free(commit->priv->dotgit);
G_OBJECT_CLASS(gitg_commit_parent_class)->finalize(object);
}
static void
gitg_commit_dispose(GtkObject *object)
{
GitgCommit *self = GITG_COMMIT(object);
if (self->priv->repository)
{
g_object_unref(self->priv->repository);
self->priv->repository = NULL;
}
}
static void
gitg_commit_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GitgCommit *self = GITG_COMMIT(object);
switch (prop_id)
{
case PROP_REPOSITORY:
g_value_set_object(value, self->priv->repository);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
gitg_commit_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GitgCommit *self = GITG_COMMIT(object);
switch (prop_id)
{
case PROP_REPOSITORY:
self->priv->repository = g_value_get_object(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static GObject *
gitg_constructor(GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
{
GObject *ret = G_OBJECT_CLASS(gitg_commit_parent_class)->constructor(type, n_construct_properties, construct_properties);
GitgCommit *commit = GITG_COMMIT(ret);
commit->priv->dotgit = gitg_utils_dot_git_path(gitg_repository_get_path(commit->priv->repository));
return ret;
}
static void
gitg_commit_class_init(GitgCommitClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
widget_class->destroy = gitg_commit_dispose;
object_class->finalize = gitg_commit_finalize;
object_class->constructor = gitg_constructor;
g_object_class_install_property(object_class, PROP_REPOSITORY,
g_param_spec_object("repository",
"REPOSITORY",
"Repository",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private(object_class, sizeof(GitgCommitPrivate));
}
static void
gitg_commit_init(GitgCommit *self)
{
self->priv = GITG_COMMIT_GET_PRIVATE(self);
self->priv->runner = gitg_runner_new(5000);
}
GitgCommit *
gitg_commit_new(GitgRepository *repository)
{
return g_object_new(GITG_TYPE_COMMIT, "repository", repository, NULL);
}
static void
runner_connect(GitgCommit *commit, GCallback updatefunc, GCallback endfunc)
{
if (commit->priv->update_id)
{
g_signal_handler_disconnect(commit->priv->runner, commit->priv->update_id);
commit->priv->update_id = 0;
}
if (commit->priv->end_id)
{
g_signal_handler_disconnect(commit->priv->runner, commit->priv->end_id);
commit->priv->end_id = 0;
}
if (updatefunc)
commit->priv->update_id = g_signal_connect(commit->priv->runner, "update", updatefunc, commit);
if (endfunc)
commit->priv->end_id = g_signal_connect(commit->priv->runner, "end-loading", endfunc, commit);
}
static void
gitg_changed_file_free(GitgChangedFile *f)
{
g_free(f->commit_blob_mode);
g_free(f->commit_blob_sha);
g_object_unref(f->file);
g_slice_free(GitgChangedFile, f);
}
static GitgChangedFile *
gitg_changed_file_new(GFile *file)
{
GitgChangedFile *f = g_slice_alloc0(GitgChangedFile);
f->file = g_object_ref(file);
return f;
}
static void
add_files(GitgCommit *commit, gchar **buffer, gboolean cached)
{
gchar *line;
while (line = *buffer++)
{
gchar **parts = g_strsplit(line, " ", 0);
gchar const *mode = parts[0] + 1;
gchar const *sha = parts[2];
GSList *item;
bool new = TRUE;
gchar *path = g_build_filename(gitg_repository_get_path(commit->priv->repository), line, NULL);
GFile *file = g_file_new_for_path(path);
g_free(path);
for (item = commit->priv->files; item; item = item->next)
{
GitgChangedFile *f = (GitgChangedFile *)item->data;
if (g_file_equal(f->file, file))
{
f->deleted = FALSE;
if (cached)
{
g_free (f->commit_blob_sha);
g_free (f->commit_blob_mode);
f->commit_blob_sha = g_strdup(sha);
f->commit_blob_mode = g_strdup(mode);
f->cached_changes = TRUE;
}
else
{
f->unstanged_changes = TRUE;
}
new = FALSE;
break;
}
}
if (!new)
{
g_object_unref(file);
g_strfreev(parts);
continue;
}
GitgChangedFile *f = gitg_changed_file_new(file);
g_object_unref(file);
if (strcmp(parts[4], "M") == 0)
f->status = GITG_CHANGED_FILE_STATUS_DELETED;
else if (strcmp(mode, "000000") == 0)
f->status = GITG_CHANGED_FILE_STATUS_NEW;
else
f->status = GITG_CHANGED_FILE_STATUS_MODIFIED;
f->commit_blob_sha = g_strdup(sha);
f->commit_blob_mode = g_strdup(mode);
f->cached_changes = cached;
f->unstanged_changes = !cached;
commit->priv->files = g_slist_prepend(commit->priv->files, f);
g_strfreev(parts);
}
}
static void
read_cached_files_update(GitgRunner *runner, gchar **buffer, GitgCommit *commit)
{
add_files(commit, buffer, TRUE);
}
static void
read_unstaged_files_end(GitgRunner *runner, GitgCommit *commit)
{
/* FIXME: something with having no head ref... */
static gchar const *argv[] = {"git", "--git-dir", NULL, "diff-index", "--cached", "HEAD", NULL};
gitg_runner_cancel(runner);
argv[2] = commit->priv->dotgit;
runner_connect(commit, G_CALLBACK(read_cached_files_update), NULL);
gitg_runner_run(commit->priv->runner, argv, NULL);
}
static void
read_unstaged_files_update(GitgRunner *runner, gchar **buffer, GitgCommit *commit)
{
add_files(commit, buffer, FALSE);
}
static void
read_other_files_end(GitgRunner *runner, GitgCommit *commit)
{
static gchar const *argv[] = {"git", "--git-dir", NULL, "diff-files", NULL};
gitg_runner_cancel(runner);
argv[2] = commit->priv->dotgit;
runner_connect(commit, G_CALLBACK(read_unstaged_files_update), G_CALLBACK(read_unstaged_files_end));
gitg_runner_run(commit->priv->runner, argv, NULL);
}
static void
changed_file_new(GitgChangedFile *f)
{
f->deleted = FALSE;
f->status = GITG_CHANGED_FILE_STATUS_NEW;
f->cached_changes = FALSE;
f->unstanged_changes = TRUE;
}
static void
read_other_files_update(GitgRunner *runner, gchar **buffer, GitgCommit *commit)
{
gchar *line;
while ((line = *buffer++))
{
/* Skip empty lines */
if (!*line)
continue;
/* Check if file is already in our index */
gboolean added = FALSE;
GSList *item;
gchar *path = g_build_filename(gitg_repository_get_path(commit->priv->repository), line, NULL);
GFile *file = g_file_new_for_path(path);
g_free(path);
for (item = commit->priv->files; item; item = item->next)
{
GitgChangedFile *f = (GitgChangedFile *)item->data;
if (g_file_equal(f->file, file))
{
added = TRUE;
changed_file_new(f);
continue;
}
}
if (added)
{
g_object_unref(file);
continue;
}
GitgChangedFile *f = gitg_changed_file_new(file);
changed_file_new(f);
g_object_unref(file);
commit->priv->files = g_slist_prepend(commit->priv->files, f);
}
}
static void
update_index_end(GitgRunner *runner, GitgCommit *commit)
{
static gchar const *argv[] = {"git", "--git-dir", NULL, "ls-files", "--others", "--exclude-standard", NULL};
gitg_runner_cancel(runner);
argv[2] = commit->priv->dotgit;
runner_connect(commit, G_CALLBACK(read_other_files_update), G_CALLBACK(read_other_files_end));
gitg_runner_run(commit->priv->runner, argv, NULL);
}
static void
update_index(GitgCommit *commit)
{
static gchar const *argv[] = {"git", "--git-dir", NULL, "update-index", "-q", "--unmerged", "--ignore-missing", "--refresh", NULL};
argv[2] = commit->priv->dotgit;
runner_connect(commit, NULL, G_CALLBACK(update_index_end));
gitg_runner_run(commit->priv->runner, argv, NULL);
}
void
gitg_commit_refresh(GitgCommit *commit)
{
runner_cancel(commit);
/* Read other files */
update_index(commit);
}
void
gitg_commit_stage(GitgCommit *commit)
{
}
void
gitg_commit_unstage(GitgCommit *commit)
{
}

58
gitg/gitg-commit.h Normal file
View file

@ -0,0 +1,58 @@
#ifndef __GITG_COMMIT_H__
#define __GITG_COMMIT_H__
#include <glib-object.h>
G_BEGIN_DECLS
#define GITG_TYPE_COMMIT (gitg_commit_get_type ())
#define GITG_COMMIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_COMMIT, GitgCommit))
#define GITG_COMMIT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_COMMIT, GitgCommit const))
#define GITG_COMMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_COMMIT, GitgCommitClass))
#define GITG_IS_COMMIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_COMMIT))
#define GITG_IS_COMMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_COMMIT))
#define GITG_COMMIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_COMMIT, GitgCommitClass))
typedef struct _GitgCommit GitgCommit;
typedef struct _GitgCommitClass GitgCommitClass;
typedef struct _GitgCommitPrivate GitgCommitPrivate;
typedef struct _GitgChangedFile GitgChangedFile;
enum GitgChangedFileStatus
{
GITG_CHANGED_FILE_STATUS_NEW,
GITG_CHANGED_FILE_STATUS_MODIFIED,
GITG_CHANGED_FILE_STATUS_DELETED
};
struct _GitgChangedFile {
GFile *file;
guint status;
gboolean deleted;
gboolean cached_changes;
gboolean unstanged_changes;
gchar *commit_blob_sha;
gchar *commit_blob_mode;
};
struct _GitgCommit {
GObject parent;
GitgCommitPrivate *priv;
};
struct _GitgCommitClass {
GObjectClass parent_class;
};
GType gitg_commit_get_type(void) G_GNUC_CONST;
GitgCommit *gitg_commit_new(GitgRepository *repository);
void gitg_commit_refresh(GitgCommit *commit);
void gitg_commit_stage(GitgCommit *commit);
void gitg_commit_unstage(GitgCommit *commit);
G_END_DECLS
#endif /* __GITG_COMMIT_H__ */

View file

@ -1,6 +1,27 @@
<?xml version="1.0"?>
<!--Generated with glade3 3.4.2 on Thu Jun 26 12:26:40 2008 -->
<interface>
<object class="GtkListStore" id="list_store_unstaged">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name filename -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="list_store_staged">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name filename -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkImage" id="image_commit">
<property name="visible">True</property>
<property name="stock">gtk-apply</property>
<property name="icon-size">4</property>
</object>
<object class="GitgWindow" id="window">
<property name="title" translatable="yes">GitG</property>
<property name="default_width">800</property>
@ -9,340 +30,114 @@
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkVPaned" id="vpaned1">
<object class="GtkNotebook" id="notebook_main">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">300</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<object class="GtkVBox" id="vbox_history">
<property name="visible">True</property>
<child>
<object class="GtkHBox" id="hbox_top">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label_branches">
<property name="label" translatable="yes">Branch:</property>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="combo_box_branches">
<child>
<object class="GtkCellRendererText" id="branches_renderer"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="padding">3</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<object class="GtkVPaned" id="vpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<property name="position">300</property>
<child>
<object class="GtkTreeView" id="tree_view_rv">
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_clickable">True</property>
<property name="rules_hint">True</property>
<property name="search_column">1</property>
<property name="fixed_height_mode">True</property>
<child>
<object class="GtkTreeViewColumn" id="rv_column_subject">
<property name="title" translatable="yes">Subject</property>
<property name="fixed-width">400</property>
<property name="sizing">GTK_TREE_VIEW_COLUMN_FIXED</property>
<property name="resizable">True</property>
<object class="GtkHBox" id="hbox_top">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GitgCellRendererPath" id="rv_renderer_subject"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
<object class="GtkLabel" id="label_branches">
<property name="label" translatable="yes">Branch:</property>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="rv_column2">
<property name="title" translatable="yes">Author</property>
<property name="fixed-width">200</property>
<property name="sizing">GTK_TREE_VIEW_COLUMN_FIXED</property>
<property name="resizable">True</property>
<child>
<object class="GtkCellRendererText" id="rv_renderer_author"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="rv_column3">
<property name="title" translatable="yes">Date</property>
<property name="fixed-width">200</property>
<property name="sizing">GTK_TREE_VIEW_COLUMN_FIXED</property>
<property name="resizable">True</property>
<child>
<object class="GtkCellRendererText" id="rv_renderer_date"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GitgRevisionView" id="revision_view">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">2</property>
<child>
<object class="GtkVBox" id="vbox_parents">
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_subject">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_date">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_author">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_sha">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_parent_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Parent:</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_subject_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Subject:</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_date_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Date:</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_author_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Author:</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_sha_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">SHA:</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="padding">3</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_details">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<object class="GtkSourceView" id="revision_diff">
<property name="tab-width">4</property>
<property name="editable">False</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Details</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GitgRevisionTreeView" id="revision_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">200</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<object class="GtkTreeView" id="revision_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers-visible">False</property>
<child>
<object class="GtkTreeViewColumn" id="revision_tree_column">
<property name="title" translatable="yes">Filename</property>
<object class="GtkComboBox" id="combo_box_branches">
<child>
<object class="GtkCellRendererPixbuf" id="renderer_icon"/>
<object class="GtkCellRendererText" id="branches_renderer"/>
<attributes>
<attribute name="pixbuf">0</attribute>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="padding">3</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="tree_view_rv">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_clickable">True</property>
<property name="rules_hint">True</property>
<property name="search_column">1</property>
<property name="fixed_height_mode">True</property>
<child>
<object class="GtkCellRendererText" id="rv_renderer_date"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="rv_column_subject">
<property name="title" translatable="yes">Subject</property>
<property name="fixed-width">400</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<child>
<object class="GitgCellRendererPath" id="rv_renderer_subject"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="rv_column2">
<property name="title" translatable="yes">Author</property>
<property name="fixed-width">200</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<child>
<object class="GtkCellRendererText" id="rv_renderer_author"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="rv_column3">
<property name="title" translatable="yes">Date</property>
<property name="fixed-width">200</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<child>
<object class="GtkCellRendererText" id="rv_renderer_date"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
@ -351,18 +146,269 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_tree_contents">
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<object class="GtkSourceView" id="revision_tree_contents">
<property name="editable">False</property>
<property name="show-line-numbers">True</property>
<object class="GitgRevisionView" id="revision_view">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">2</property>
<child>
<object class="GtkVBox" id="vbox_parents">
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_subject">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_date">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_author">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_sha">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_parent_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Parent:</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_subject_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Subject:</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_date_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Date:</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_author_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Author:</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_sha_lbl">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">SHA:</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="padding">3</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_details">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkSourceView" id="revision_diff">
<property name="tab-width">4</property>
<property name="editable">False</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Details</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GitgRevisionTreeView" id="revision_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">200</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="revision_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers-visible">False</property>
<child>
<object class="GtkTreeViewColumn" id="revision_tree_column">
<property name="title" translatable="yes">Filename</property>
<child>
<object class="GtkCellRendererPixbuf" id="renderer_icon"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="rv_renderer_date"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_tree_contents">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkSourceView" id="revision_tree_contents">
<property name="editable">False</property>
<property name="show-line-numbers">True</property>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Tree</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
@ -371,23 +417,232 @@
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label2">
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label_history">
<property name="visible">True</property>
<property name="label" translatable="yes">History</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkHPaned" id="hpaned_commit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">200</property>
<child>
<object class="GtkVBox" id="vbox_staging">
<property name="visible">True</property>
<property name="label" translatable="yes">Tree</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label_unstaged">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">1</property>
<property name="label" translatable="yes">_Unstaged</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">tree_view_unstaged</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_unstaged">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="tree_view_unstaged">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">list_store_unstaged</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_staged">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Staged</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">tree_view_staged</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_staged">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTreeView" id="tree_view_staged">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">list_store_staged</property>
</object>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkVPaned" id="vpaned_commit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">350</property>
<child>
<object class="GtkVBox" id="vbox_changes">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label_changes">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">1</property>
<property name="label" translatable="yes">_Changes</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">source_view_changes</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_changes">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkSourceView" id="source_view_changes">
<property name="tab-width">4</property>
<property name="editable">False</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox_comment">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label_comment">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">1</property>
<property name="label" translatable="yes">Co_mment</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">text_view_comment</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_comment">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">etched-in</property>
<child>
<object class="GtkTextView" id="text_view_comment">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbutton_box_commit">
<property name="visible">True</property>
<property name="spacing">3</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_commit">
<property name="label" translatable="yes">Commit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image_commit</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label_commit">
<property name="visible">True</property>
<property name="label" translatable="yes">Commit</property>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkStatusbar" id="statusbar">
@ -396,7 +651,7 @@
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>

View file

@ -93,7 +93,10 @@ gitg_utils_find_git(gchar const *path)
else
dir = g_strdup(path);
return find_dot_git(dir);
gchar *ret = find_dot_git(dir);
g_free(dir);
return ret;
}
gchar *