Commit a29b27fd authored by Carl-Anton Ingmarsson's avatar Carl-Anton Ingmarsson Committed by Johannes Schmid

#570136 – add option to not show unversioned files

2009-02-02  Carl-Anton Ingmarsson  <ca.ingmarsson@gmail.com>

	* plugins/file-manager/file-manager.glade:
	* plugins/file-manager/file-model.c
	(file_model_vcs_status_callback), (file_model_set_property),
	(file_model_get_property), (file_model_class_init):
	* plugins/file-manager/plugin.c (on_gconf_notify),
	(file_manager_activate):
	#570136 – add option to not show unversioned files

svn path=/trunk/; revision=4677
parent 73dddb43
2009-02-02 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
* plugins/file-manager/file-manager.glade:
* plugins/file-manager/file-model.c
(file_model_vcs_status_callback), (file_model_set_property),
(file_model_get_property), (file_model_class_init):
* plugins/file-manager/plugin.c (on_gconf_notify),
(file_manager_activate):
#570136 – add option to not show unversioned files
2009-02-02 Pavel Kostyuchenko <ShprotX@gmail.com>
* manuals/anjuta-manual/C/anjuta-manual.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.0 on Sat Jan 12 19:46:18 2008 -->
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gtk+ 2.16 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkWindow" id="filemanager_pref_window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
......@@ -13,7 +13,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
......@@ -33,6 +33,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
......@@ -40,13 +41,13 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_preview_label">False</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
<property name="action">select-folder</property>
<property name="preview_widget_active">False</property>
<property name="title" translatable="yes">Choose Directory to show if no project is open</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
......@@ -69,6 +70,7 @@
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
......@@ -76,7 +78,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
......@@ -88,25 +90,26 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:filemanager.filter.binary">
<property name="label" translatable="yes">Do not show binary files (.o, .la, etc.)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Do not show binary files (.o, .la, etc.)</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:filemanager.filter.hidden">
<property name="label" translatable="yes">Do not show hidden files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Do not show hidden files</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
......@@ -117,11 +120,11 @@
</child>
<child>
<widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:filemanager.filter.backup">
<property name="label" translatable="yes">Do not show backup files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Do not show backup files</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
......@@ -130,6 +133,21 @@
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="preferences_toggle:bool:0:0:filemanager.filter.unversioned">
<property name="label" translatable="yes">Do not show unversioned files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
</child>
</widget>
......
......@@ -51,7 +51,8 @@ enum
PROP_BASE_URI,
PROP_FILTER_BINARY,
PROP_FILTER_HIDDEN,
PROP_FILTER_BACKUP
PROP_FILTER_BACKUP,
PROP_FILTER_UNVERSIONED
};
typedef struct _FileModelPrivate FileModelPrivate;
......@@ -63,6 +64,7 @@ struct _FileModelPrivate
gboolean filter_binary;
gboolean filter_hidden;
gboolean filter_backup;
gboolean filter_unversioned;
GtkTreeView* view;
};
......@@ -179,6 +181,7 @@ file_model_vcs_status_callback(GFile *file,
gpointer user_data)
{
VcsData* data = user_data;
FileModelPrivate *priv = FILE_MODEL_GET_PRIVATE (data->model);
gchar* path = g_file_get_path (file);
GtkTreePath* tree_path = gtk_tree_row_reference_get_path (data->ref);
......@@ -193,41 +196,49 @@ file_model_vcs_status_callback(GFile *file,
&iter,
tree_path);
emblem = get_vcs_emblem (status);
if (emblem)
if (priv->filter_unversioned &&
(status == ANJUTA_VCS_STATUS_UNVERSIONED ||
status == ANJUTA_VCS_STATUS_IGNORED))
{
gtk_tree_model_get (model, &iter,
COLUMN_PIXBUF, &file_icon,
-1);
if (file_icon)
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
}
else
{
emblem = get_vcs_emblem (status);
if (emblem)
{
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,
gtk_tree_model_get (model, &iter,
COLUMN_PIXBUF, &file_icon,
-1);
DEBUG_PRINT ("%s", "setting emblem");
g_object_unref (file_icon);
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);
}
g_object_unref (emblem);
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
COLUMN_STATUS,
status,
-1);
}
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
COLUMN_STATUS,
status,
-1);
gtk_tree_path_free (tree_path);
}
g_free(path);
......@@ -617,6 +628,9 @@ file_model_set_property (GObject *object, guint prop_id, const GValue *value, GP
case PROP_FILTER_BACKUP:
priv->filter_backup = g_value_get_boolean (value);
break;
case PROP_FILTER_UNVERSIONED:
priv->filter_unversioned = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -641,7 +655,9 @@ file_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
case PROP_FILTER_HIDDEN:
g_value_set_boolean (value, priv->filter_hidden);
case PROP_FILTER_BACKUP:
g_value_set_boolean (value, priv->filter_backup);
g_value_set_boolean (value, priv->filter_backup);
case PROP_FILTER_UNVERSIONED:
g_value_set_boolean (value, priv->filter_unversioned);
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -692,6 +708,14 @@ file_model_class_init (FileModelClass *klass)
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_FILTER_UNVERSIONED,
g_param_spec_boolean ("filter_unversioned",
"Filter unversioned files",
"file_unversioned",
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}
FileModel*
......
......@@ -43,6 +43,7 @@
#define PREF_FILTER_BINARY "filemanager.filter.binary"
#define PREF_FILTER_HIDDEN "filemanager.filter.hidden"
#define PREF_FILTER_BACKUP "filemanager.filter.backup"
#define PREF_FILTER_UNVERSIONED "filemanager.filter.unversioned"
#define REGISTER_NOTIFY(key, func) \
notify_id = anjuta_preferences_notify_add (file_manager->prefs, \
......@@ -184,7 +185,8 @@ on_gconf_notify(GConfClient *gclient, guint cnxn_id,
g_object_set (G_OBJECT (file_model),
"filter_binary", anjuta_preferences_get_int (file_manager->prefs, PREF_FILTER_BINARY),
"filter_hidden", anjuta_preferences_get_int (file_manager->prefs, PREF_FILTER_HIDDEN),
"filter_backup", anjuta_preferences_get_int (file_manager->prefs, PREF_FILTER_BACKUP), NULL);
"filter_backup", anjuta_preferences_get_int (file_manager->prefs, PREF_FILTER_BACKUP),
"filter_unversioned", anjuta_preferences_get_int (file_manager->prefs, PREF_FILTER_UNVERSIONED), NULL);
if (!file_manager->have_project)
{
......@@ -263,6 +265,7 @@ file_manager_activate (AnjutaPlugin *plugin)
REGISTER_NOTIFY (PREF_FILTER_BINARY, on_gconf_notify);
REGISTER_NOTIFY (PREF_FILTER_BACKUP, on_gconf_notify);
REGISTER_NOTIFY (PREF_FILTER_HIDDEN, on_gconf_notify);
REGISTER_NOTIFY (PREF_FILTER_UNVERSIONED, on_gconf_notify);
on_gconf_notify (NULL, 0, NULL, file_manager);
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment