[anjuta] git: Add the beginnings of a stash widget to the shell
- From: James Liggett <jrliggett src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] git: Add the beginnings of a stash widget to the shell
- Date: Fri, 24 Jul 2009 01:48:58 +0000 (UTC)
commit 8a8ad2214bdf09f7a19b7457458059d465353b44
Author: James Liggett <jrliggett cox net>
Date: Sat Jul 18 00:50:22 2009 -0700
git: Add the beginnings of a stash widget to the shell
plugins/git/Makefile.am | 4 +-
plugins/git/anjuta-git.ui | 163 +++++++++++++++++++++++++++++++++++++++-
plugins/git/git-stash-widget.c | 56 ++++++++++++++
plugins/git/git-stash-widget.h | 28 +++++++
plugins/git/plugin.c | 19 +++++
plugins/git/plugin.h | 2 +
6 files changed, 270 insertions(+), 2 deletions(-)
---
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index 6693851..255a4ee 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -203,7 +203,9 @@ libanjuta_git_la_SOURCES = \
git-stash-save-command.h \
git-stash-save-command.c \
git-stash-changes-dialog.c \
- git-stash-changes-dialog.h
+ git-stash-changes-dialog.h \
+ git-stash-widget.c \
+ git-stash-widget.h
libanjuta_git_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index ba4d9be..afcebb7 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -35,6 +35,14 @@
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="stash_list_model">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="commit_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
@@ -5153,7 +5161,7 @@
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkCheckButton" id="stash_chnages_keep_index_check">
+ <object class="GtkCheckButton" id="stash_changes_keep_index_check">
<property name="label" translatable="yes">Stash indexed changes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -5228,4 +5236,157 @@
<action-widget response="-5">button41</action-widget>
</action-widgets>
</object>
+ <object class="GtkScrolledWindow" id="stash_widget_scrolled_window">
+ <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">in</property>
+ <child>
+ <object class="GtkTreeView" id="stash_widget_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">stash_list_model</property>
+ <property name="headers_visible">False</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn9">
+ <property name="title">column</property>
+ <child>
+ <object class="GtkCellRendererText" id="stash_widget_view_name_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkHBox" id="stash_widget_grip_hbox">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-save</property>
+ <property name="icon-size">1</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label67">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Stash</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">2</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stash_widget_save_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Stash the working tree's uncommitted changes</property>
+ <child>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-floppy</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stash_widget_apply_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Apply the selected stash</property>
+ <child>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-apply</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stash_widget_show_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Show the contents of the selected stash in an editor</property>
+ <child>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-zoom-100</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stash_widget_delete_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Delete this stash</property>
+ <child>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="stock">gtk-delete</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stash_widget_clear_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Delete all stashes</property>
+ <child>
+ <object class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="stock">gtk-clear</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/plugins/git/git-stash-widget.c b/plugins/git/git-stash-widget.c
new file mode 100644
index 0000000..d903682
--- /dev/null
+++ b/plugins/git/git-stash-widget.c
@@ -0,0 +1,56 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2009 <jrliggett cox net>
+ *
+ * anjuta 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * anjuta 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "git-stash-widget.h"
+
+void
+git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
+ GtkWidget **stash_widget_grip)
+{
+ gchar *objects[] = {"stash_widget_scrolled_window",
+ "stash_widget_grip_hbox",
+ "stash_list_model"};
+ GtkBuilder *bxml;
+ GError *error;
+ GitUIData *data;
+ GtkWidget *stash_widget_scrolled_window;
+ GtkWidget *stash_widget_grip_hbox;
+
+ bxml = gtk_builder_new ();
+ error = NULL;
+ data = git_ui_data_new (plugin, bxml);
+
+ if (!gtk_builder_add_objects_from_file (data->bxml, BUILDER_FILE, objects,
+ &error))
+ {
+ g_warning ("Couldn't load builder file: %s", error->message);
+ g_error_free (error);
+ }
+
+ stash_widget_scrolled_window = GTK_WIDGET (gtk_builder_get_object (bxml,
+ "stash_widget_scrolled_window"));
+ stash_widget_grip_hbox = GTK_WIDGET (gtk_builder_get_object (bxml,
+ "stash_widget_grip_hbox"));
+
+ g_object_set_data_full (G_OBJECT (stash_widget_scrolled_window), "ui-data",
+ data, (GDestroyNotify) git_ui_data_free);
+
+ *stash_widget = stash_widget_scrolled_window;
+ *stash_widget_grip = stash_widget_grip_hbox;
+}
diff --git a/plugins/git/git-stash-widget.h b/plugins/git/git-stash-widget.h
new file mode 100644
index 0000000..30377fd
--- /dev/null
+++ b/plugins/git/git-stash-widget.h
@@ -0,0 +1,28 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2009 <jrliggett cox net>
+ *
+ * anjuta 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * anjuta 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GIT_STASH_WIDGET_H
+#define _GIT_STASH_WIDGET_H
+
+#include "git-ui-utils.h"
+
+void git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
+ GtkWidget **stash_widget_grip);
+
+#endif
\ No newline at end of file
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index 09674a8..b7bae8d 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -50,6 +50,7 @@
#include "git-cherry-pick-dialog.h"
#include "git-delete-tag-dialog.h"
#include "git-stash-changes-dialog.h"
+#include "git-stash-widget.h"
#define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-git.xml"
@@ -577,6 +578,8 @@ on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
gtk_action_set_sensitive (git_menu_action, TRUE);
gtk_action_set_sensitive (git_fm_menu_action, TRUE);
gtk_widget_set_sensitive (git_plugin->log_viewer, TRUE);
+ gtk_widget_set_sensitive (git_plugin->stash_widget, TRUE);
+ gtk_widget_set_sensitive (git_plugin->stash_widget_grip, TRUE);
g_free (project_root_uri);
@@ -612,6 +615,9 @@ on_project_root_removed (AnjutaPlugin *plugin, const gchar *name,
gtk_action_set_sensitive (git_menu_action, FALSE);
gtk_action_set_sensitive (git_fm_menu_action, FALSE);
gtk_widget_set_sensitive (git_plugin->log_viewer, FALSE);
+ gtk_widget_set_sensitive (git_plugin->stash_widget, FALSE);
+ gtk_widget_set_sensitive (git_plugin->stash_widget_grip, FALSE);
+
git_log_window_clear (git_plugin);
g_file_monitor_cancel (git_plugin->bisect_file_monitor);
@@ -732,6 +738,18 @@ git_activate_plugin (AnjutaPlugin *plugin)
ANJUTA_SHELL_PLACEMENT_CENTER,
NULL);
g_object_unref (git_plugin->log_viewer);
+
+ /* Stash widget */
+ git_stash_widget_create (git_plugin, &git_plugin->stash_widget,
+ &git_plugin->stash_widget_grip);
+ anjuta_shell_add_widget_custom (plugin->shell,
+ git_plugin->stash_widget,
+ "GitStashWidget",
+ _("Stash"),
+ GTK_STOCK_SAVE,
+ git_plugin->stash_widget_grip,
+ ANJUTA_SHELL_PLACEMENT_LEFT,
+ NULL);
/* Add watches */
git_plugin->project_root_watch_id = anjuta_plugin_add_watch (plugin,
@@ -797,6 +815,7 @@ git_deactivate_plugin (AnjutaPlugin *plugin)
g_free (git_plugin->current_fm_filename);
anjuta_shell_remove_widget (plugin->shell, git_plugin->log_viewer, NULL);
+ anjuta_shell_remove_widget (plugin->shell, git_plugin->stash_widget, NULL);
gtk_widget_destroy (git_plugin->log_popup_menu);
return TRUE;
diff --git a/plugins/git/plugin.h b/plugins/git/plugin.h
index 62402f2..ae4ab2e 100644
--- a/plugins/git/plugin.h
+++ b/plugins/git/plugin.h
@@ -62,6 +62,8 @@ struct _Git
GtkWidget *log_viewer;
GtkWidget *log_popup_menu;
+ GtkWidget *stash_widget;
+ GtkWidget *stash_widget_grip;
/* File monitors */
GFileMonitor *bisect_file_monitor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]