anjuta r4606 - in trunk: . plugins/file-manager
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4606 - in trunk: . plugins/file-manager
- Date: Sun, 18 Jan 2009 19:28:24 +0000 (UTC)
Author: jhs
Date: Sun Jan 18 19:28:24 2009
New Revision: 4606
URL: http://svn.gnome.org/viewvc/anjuta?rev=4606&view=rev
Log:
2009-01-18 Johannes Schmid <jhs gnome org>
* plugins/file-manager/Makefile.am:
* plugins/file-manager/file-model.c (get_vcs_emblem),
(file_model_vcs_status_callback), (file_model_update_file),
(file_model_new):
* plugins/file-manager/file-model.h:
* plugins/file-manager/file-view.c (file_view_init):
Show the vcs status with emblems (from Subclipse/TurtoiseSVN, icons are GPL)
Added:
trunk/plugins/file-manager/vcs-added.png (contents, props changed)
trunk/plugins/file-manager/vcs-conflict.png (contents, props changed)
trunk/plugins/file-manager/vcs-deleted.png (contents, props changed)
trunk/plugins/file-manager/vcs-ignored.png (contents, props changed)
trunk/plugins/file-manager/vcs-locked.png (contents, props changed)
trunk/plugins/file-manager/vcs-modified.png (contents, props changed)
trunk/plugins/file-manager/vcs-unversioned.png (contents, props changed)
trunk/plugins/file-manager/vcs-updated.png (contents, props changed)
Modified:
trunk/ChangeLog
trunk/plugins/file-manager/Makefile.am
trunk/plugins/file-manager/file-model.c
trunk/plugins/file-manager/file-model.h
trunk/plugins/file-manager/file-view.c
Modified: trunk/plugins/file-manager/Makefile.am
==============================================================================
--- trunk/plugins/file-manager/Makefile.am (original)
+++ trunk/plugins/file-manager/Makefile.am Sun Jan 18 19:28:24 2009
@@ -10,7 +10,13 @@
file_manager_pixmapsdir = $(anjuta_image_dir)
file_manager_pixmaps_DATA = \
anjuta-file-manager-plugin.svg \
- anjuta-file-manager-plugin-48.png
+ anjuta-file-manager-plugin-48.png \
+ vcs-added.png \
+ vcs-conflict.png \
+ vcs-deleted.png \
+ vcs-ignored.png \
+ vcs-modified.png \
+ vcs-unversioned.png
# Plugin description file
plugin_in_files = file-manager.plugin.in
Modified: trunk/plugins/file-manager/file-model.c
==============================================================================
--- trunk/plugins/file-manager/file-model.c (original)
+++ trunk/plugins/file-manager/file-model.c Sun Jan 18 19:28:24 2009
@@ -125,6 +125,51 @@
GtkTreeRowReference* ref;
} VcsData;
+#define EMBLEM_ADDED "vcs-added.png"
+#define EMBLEM_CONFLICT "vcs-conflict.png"
+#define EMBLEM_DELETED "vcs-deleted.png"
+#define EMBLEM_IGNORED "vcs-ignored.png"
+#define EMBLEM_LOCKED "vcs-locked.png"
+#define EMBLEM_UNVERSIONED "vcs-unversioned.png"
+#define EMBLEM_UPDATED "vcs-updated.png"
+#define EMBLEM_MODIFIED "vcs-modified.png"
+
+#define COMPOSITE_ALPHA 225
+
+static GdkPixbuf*
+get_vcs_emblem (AnjutaVcsStatus status)
+{
+ GdkPixbuf* emblem ;
+ switch (status)
+ {
+ case ANJUTA_VCS_STATUS_NONE:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_UPDATED, NULL);
+ break;
+ case ANJUTA_VCS_STATUS_ADDED:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_ADDED, NULL);
+ break;
+ case ANJUTA_VCS_STATUS_MODIFIED:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_MODIFIED, NULL);
+ break;
+ case ANJUTA_VCS_STATUS_DELETED:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_DELETED, NULL);
+ break;
+ case ANJUTA_VCS_STATUS_CONFLICTED:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_CONFLICT, NULL);
+ break;
+ case ANJUTA_VCS_STATUS_LOCKED:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_LOCKED, NULL);
+ break;
+ case ANJUTA_VCS_STATUS_UNVERSIONED:
+ emblem = gdk_pixbuf_new_from_file (PACKAGE_PIXMAPS_DIR"/"EMBLEM_UNVERSIONED, NULL);
+ break;
+ default:
+ emblem = NULL;
+ }
+ DEBUG_PRINT ("emblem found: %d", emblem != NULL);
+ return emblem;
+}
+
static void
file_model_vcs_status_callback(GFile *file,
AnjutaVcsStatus status,
@@ -133,33 +178,52 @@
VcsData* data = user_data;
gchar* path = g_file_get_path (file);
+ DEBUG_PRINT ("Status of %s = %d", path, status);
+
GtkTreePath* tree_path = gtk_tree_row_reference_get_path (data->ref);
if (tree_path)
{
- const gchar* color = NULL;
+ GdkPixbuf* file_icon = NULL;
+ GdkPixbuf* emblem = NULL;
GtkTreeIter iter;
GtkTreeModel* model = gtk_tree_row_reference_get_model (data->ref);
- switch (status)
- {
- case ANJUTA_VCS_STATUS_MODIFIED:
- color = "yellow";
- break;
- case ANJUTA_VCS_STATUS_ADDED:
- color = "green";
- break;
- case ANJUTA_VCS_STATUS_CONFLICTED:
- color = "red";
- break;
- default:
- color = "white";
- }
+
gtk_tree_model_get_iter (model,
&iter,
tree_path);
+
+ emblem = get_vcs_emblem (status);
+ if (emblem)
+ {
+ gtk_tree_model_get (model, &iter,
+ COLUMN_PIXBUF, &file_icon,
+ -1);
+ if (file_icon)
+ {
+ gdk_pixbuf_composite (emblem,
+ file_icon,
+ 0, 0,
+ gdk_pixbuf_get_width (file_icon),
+ gdk_pixbuf_get_height (file_icon),
+ 0, 0,
+ 1, 1,
+ GDK_INTERP_BILINEAR,
+ COMPOSITE_ALPHA);
+ gtk_tree_store_set (GTK_TREE_STORE (model),
+ &iter,
+ COLUMN_PIXBUF,
+ file_icon,
+ -1);
+ DEBUG_PRINT ("%s", "setting emblem");
+
+ g_object_unref (file_icon);
+ }
+ g_object_unref (emblem);
+ }
+
+
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
- COLUMN_BACKGROUND,
- color,
COLUMN_STATUS,
status,
-1);
@@ -254,7 +318,6 @@
COLUMN_FILE, file,
COLUMN_PIXBUF, pixbuf,
COLUMN_STATUS, ANJUTA_VCS_STATUS_NONE,
- COLUMN_BACKGROUND, "white",
COLUMN_IS_DIR, is_dir,
COLUMN_SORT, g_file_info_get_sort_order(file_info),
-1);
@@ -636,7 +699,7 @@
GObject* model =
g_object_new (FILE_TYPE_MODEL, "base_uri", base_uri, NULL);
GType types[N_COLUMNS] = {GDK_TYPE_PIXBUF, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_OBJECT,
+ G_TYPE_STRING, G_TYPE_UINT, G_TYPE_OBJECT,
G_TYPE_BOOLEAN, G_TYPE_INT};
FileModelPrivate* priv = FILE_MODEL_GET_PRIVATE(model);
Modified: trunk/plugins/file-manager/file-model.h
==============================================================================
--- trunk/plugins/file-manager/file-model.h (original)
+++ trunk/plugins/file-manager/file-model.h Sun Jan 18 19:28:24 2009
@@ -49,7 +49,6 @@
COLUMN_FILENAME,
COLUMN_DISPLAY,
COLUMN_STATUS,
- COLUMN_BACKGROUND,
COLUMN_FILE,
COLUMN_IS_DIR,
COLUMN_SORT,
Modified: trunk/plugins/file-manager/file-view.c
==============================================================================
--- trunk/plugins/file-manager/file-view.c (original)
+++ trunk/plugins/file-manager/file-view.c Sun Jan 18 19:28:24 2009
@@ -458,20 +458,16 @@
NULL);
renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
- g_object_set (G_OBJECT (renderer_pixbuf), "cell-background-set", TRUE, NULL);
renderer_display = gtk_cell_renderer_text_new ();
- g_object_set (G_OBJECT (renderer_pixbuf), "cell-background-set", TRUE, NULL);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("Filename"));
gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE);
gtk_tree_view_column_pack_start (column, renderer_display, FALSE);
gtk_tree_view_column_set_attributes (column, renderer_pixbuf,
"pixbuf", COLUMN_PIXBUF,
- "cell-background", COLUMN_BACKGROUND,
NULL);
gtk_tree_view_column_set_attributes (column, renderer_display,
"markup", COLUMN_DISPLAY,
- "cell-background", COLUMN_BACKGROUND,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (object), column);
Added: trunk/plugins/file-manager/vcs-added.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-conflict.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-deleted.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-ignored.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-locked.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-modified.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-unversioned.png
==============================================================================
Binary file. No diff available.
Added: trunk/plugins/file-manager/vcs-updated.png
==============================================================================
Binary file. No diff available.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]