[gnome-builder] libide/editor: use basename for tab title
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/editor: use basename for tab title
- Date: Tue, 27 Sep 2022 04:52:23 +0000 (UTC)
commit ff6fbe2ed616450712ca939f5b63cfb51a63dd60
Author: Christian Hergert <chergert redhat com>
Date: Mon Sep 26 21:52:11 2022 -0700
libide/editor: use basename for tab title
But provide the project-relative path (or absolute if not in the project)
for the tooltip on the tab.
Related #1821
meson.build | 2 +-
src/libide/editor/ide-editor-page.c | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5bdf669df..7b0360117 100644
--- a/meson.build
+++ b/meson.build
@@ -297,7 +297,7 @@ libgio_dep = dependency('gio-2.0', version: glib_req)
libgiounix_dep = dependency('gio-unix-2.0', version: glib_req)
libgtk_dep = dependency('gtk4', version: gtk_req)
libadwaita_dep = dependency('libadwaita-1', version: libadwaita_req)
-libpanel_dep = dependency('libpanel-1', version: '>= 1.0.0')
+libpanel_dep = dependency('libpanel-1', version: '>= 1.1.0')
libgtksource_dep = dependency('gtksourceview-5', version: gtksourceview_req)
libjson_glib_dep = dependency('json-glib-1.0', version: '>= 1.2.0')
libjsonrpc_glib_dep = dependency('jsonrpc-glib-1.0', version: '>= 3.42.0')
diff --git a/src/libide/editor/ide-editor-page.c b/src/libide/editor/ide-editor-page.c
index 863989beb..d7bb561b3 100644
--- a/src/libide/editor/ide-editor-page.c
+++ b/src/libide/editor/ide-editor-page.c
@@ -142,6 +142,17 @@ ide_editor_page_style_scheme_changed_cb (IdeEditorPage *self,
ide_gutter_style_changed (self->gutter);
}
+static gboolean
+file_to_basename (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ GFile *file = g_value_get_object (from_value);
+ g_value_take_string (to_value, g_file_get_basename (file));
+ return TRUE;
+}
+
static void
ide_editor_page_set_buffer (IdeEditorPage *self,
IdeBuffer *buffer)
@@ -187,8 +198,13 @@ ide_editor_page_set_buffer (IdeEditorPage *self,
self,
G_CONNECT_SWAPPED);
+ g_object_bind_property_full (buffer, "file",
+ self, "title",
+ G_BINDING_SYNC_CREATE,
+ file_to_basename, NULL,
+ NULL, NULL);
g_object_bind_property (buffer, "title",
- self, "title",
+ self, "tooltip",
G_BINDING_SYNC_CREATE);
ide_editor_page_notify_file_cb (self, NULL, buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]