summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorAnsuz Inspirati <[email protected]>2025-08-25 08:35:41 +1000
committerGitHub <[email protected]>2025-08-24 22:35:41 +0000
commitf093cfa7e4cbb27280576d39d63e5000df9f0d7c (patch)
tree9f5d8e14234c9b596327b60e136099421a2c5f0a /libcaja-private
parent1cd4e8eeccc7d2424c674a0ebcf646e71b2d2a7b (diff)
downloadcaja-master.tar.bz2
caja-master.tar.xz
New feature - show git branch with icon view text (#1838)HEADmaster
Display the git branch along with directory name in icon view; when the directory is a git repository. Obviously further work will be required to enable/disable as a displayed option, and potentially some level of customisation. This would require open discussion of possibilities. Solutions for co-existence with other displayable parameters also to be community determined. Consideration and feedback appreciated. * Add UI support to enable/disable option Added user interface support for option to enable and disable the display of the git branch name in icon view. * Add internationsation support for the new feature With translations for most of the currently supported languages. * Update caja.pot Build system regenerated .pot file with additional strings from new feature (already in previous commit), new strings already introduced to code-base, along with updated source file line numbers of existing strings. Required for the automated pull mechanism in Transifex - which should complete once merged with master branch.
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-global-preferences.h1
-rw-r--r--libcaja-private/caja-icon-container.c17
-rw-r--r--libcaja-private/caja-icon-container.h8
-rw-r--r--libcaja-private/caja-icon-private.h3
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml5
5 files changed, 34 insertions, 0 deletions
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index ed888db7..27059ca7 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -141,6 +141,7 @@ typedef enum
#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level"
#define CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS "labels-beside-icons"
+#define CAJA_PREFERENCES_ICON_VIEW_DISPLAY_GIT_BRANCH "display-git-branch"
/* Which text attributes appear beneath icon names */
#define CAJA_PREFERENCES_ICON_VIEW_CAPTIONS "captions"
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index d30add27..dd8e7547 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -8823,6 +8823,23 @@ caja_icon_container_set_label_position (CajaIconContainer *container,
}
}
+void
+caja_display_git_branch_enable (CajaIconContainer *container,
+ CajaDisplayGitBranch enable)
+{
+ g_return_if_fail (CAJA_IS_ICON_CONTAINER (container));
+
+ if (container->details->display_git_branch != enable)
+ {
+ container->details->display_git_branch = enable;
+
+ invalidate_labels (container);
+ caja_icon_container_request_update_all (container);
+
+ schedule_redo_layout (container);
+ }
+}
+
/* Switch from automatic to manual layout, freezing all the icons in their
* current positions instead of restoring icon positions from the last manual
* layout as set_auto_layout does.
diff --git a/libcaja-private/caja-icon-container.h b/libcaja-private/caja-icon-container.h
index 749c3b4e..0874a07c 100644
--- a/libcaja-private/caja-icon-container.h
+++ b/libcaja-private/caja-icon-container.h
@@ -71,6 +71,12 @@ typedef enum
CAJA_ICON_LABEL_POSITION_BESIDE
} CajaIconLabelPosition;
+typedef enum
+{
+ CAJA_DISPLAY_GIT_BRANCH_DISABLED,
+ CAJA_DISPLAY_GIT_BRANCH_ENABLED
+} CajaDisplayGitBranch;
+
#define CAJA_ICON_CONTAINER_TYPESELECT_FLUSH_DELAY 1000000
typedef struct CajaIconContainerDetails CajaIconContainerDetails;
@@ -286,6 +292,8 @@ void caja_icon_container_set_layout_mode (CajaIconCon
CajaIconLayoutMode mode);
void caja_icon_container_set_label_position (CajaIconContainer *container,
CajaIconLabelPosition pos);
+void caja_display_git_branch_enable (CajaIconContainer *container,
+ CajaDisplayGitBranch enabled);
void caja_icon_container_sort (CajaIconContainer *container);
void caja_icon_container_freeze_icon_positions (CajaIconContainer *container);
diff --git a/libcaja-private/caja-icon-private.h b/libcaja-private/caja-icon-private.h
index e975d6ec..3b3110d8 100644
--- a/libcaja-private/caja-icon-private.h
+++ b/libcaja-private/caja-icon-private.h
@@ -231,6 +231,9 @@ struct CajaIconContainerDetails
/* Label position */
CajaIconLabelPosition label_position;
+ /* Display git branch enable/disable */
+ CajaDisplayGitBranch display_git_branch;
+
/* Forced icon size, iff greater than 0 */
int forced_icon_size;
diff --git a/libcaja-private/org.mate.caja.gschema.xml b/libcaja-private/org.mate.caja.gschema.xml
index 0f3bc015..7e9b150e 100644
--- a/libcaja-private/org.mate.caja.gschema.xml
+++ b/libcaja-private/org.mate.caja.gschema.xml
@@ -318,6 +318,11 @@
<summary>Put labels beside icons</summary>
<description>If true, labels will be placed beside icons rather than underneath them.</description>
</key>
+ <key name="display-git-branch" type="b">
+ <default>false</default>
+ <summary>Display the git branch with directory name</summary>
+ <description>If true, git branch name will be displayed.</description>
+ </key>
<key name="default-zoom-level" enum="org.mate.caja.ZoomLevel">
<default>'standard'</default>
<summary>Default icon zoom level</summary>