[gnome-terminal] profile: editor: Show the profile UUID in the prefs dialogue
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] profile: editor: Show the profile UUID in the prefs dialogue
- Date: Thu, 24 Jan 2013 17:49:22 +0000 (UTC)
commit c3c88ce448e90bbfd67b31400110a7d829685515
Author: Christian Persch <chpe gnome org>
Date: Thu Jan 24 18:48:36 2013 +0100
profile: editor: Show the profile UUID in the prefs dialogue
src/profile-editor.c | 7 ++++++
src/profile-preferences.ui | 49 ++++++++++++++++++++++++++++++++---------
src/terminal-app.c | 21 ++---------------
src/terminal-profile-utils.c | 21 ++++++++++++++++++
src/terminal-profile-utils.h | 2 +
5 files changed, 71 insertions(+), 29 deletions(-)
---
diff --git a/src/profile-editor.c b/src/profile-editor.c
index bd26b44..1027035 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -31,6 +31,7 @@
#include "terminal-schemas.h"
#include "terminal-type-builtins.h"
#include "terminal-util.h"
+#include "terminal-profile-utils.h"
typedef struct _TerminalColorScheme TerminalColorScheme;
@@ -709,6 +710,7 @@ terminal_profile_edit (GSettings *profile,
GtkBuilder *builder;
GError *error = NULL;
GtkWidget *editor, *w;
+ char *uuid;
guint i;
editor = g_object_get_data (G_OBJECT (profile), "editor-window");
@@ -747,6 +749,11 @@ terminal_profile_edit (GSettings *profile,
gtk_widget_add_events (w, GDK_BUTTON_PRESS_MASK | GDK_SCROLL_MASK);
g_signal_connect (w, "scroll-event", G_CALLBACK (scroll_event_cb), NULL);
+ uuid = terminal_profile_util_get_profile_uuid (profile);
+ gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "profile-uuid")),
+ uuid);
+ g_free (uuid);
+
w = (GtkWidget *) gtk_builder_get_object (builder, "color-scheme-combobox");
init_color_scheme_menu (w);
diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui
index 8b2c8e9..62e5e08 100644
--- a/src/profile-preferences.ui
+++ b/src/profile-preferences.ui
@@ -209,36 +209,63 @@
<property name="border_width">12</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox135">
+ <object class="GtkTable" id="profile-id-table">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">12</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="profile-name-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
<child>
<object class="GtkLabel" id="profile-name-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="xpad">4</property>
<property name="label" translatable="yes">_Profile name:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">profile-name-entry</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="profile-name-entry">
+ <object class="GtkLabel" id="profile-uuid-label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Profile ID:</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="profile-uuid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
</object>
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 5c2ecd2..ce203bc 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -194,21 +194,6 @@ strv_remove (char **strv,
return strv;
}
-static char *
-profile_get_uuid (GSettings *profile)
-{
- char *path, *uuid;
-
- g_object_get (profile, "path", &path, NULL);
- g_assert (g_str_has_prefix (path, TERMINAL_PROFILES_PATH_PREFIX ":"));
- uuid = g_strdup (path + strlen (TERMINAL_PROFILES_PATH_PREFIX ":"));
- g_free (path);
-
- g_assert (strlen (uuid) == 37);
- uuid[36] = '\0';
- return uuid;
-}
-
static int
profiles_alphabetic_cmp (gconstpointer pa,
gconstpointer pb)
@@ -379,7 +364,7 @@ profile_remove (TerminalApp *app,
char **profiles;
DConfClient *client;
- uuid = profile_get_uuid (profile);
+ uuid = terminal_profile_util_get_profile_uuid (profile);
g_object_get (profile, "path", &path, NULL);
g_settings_get (app->global_settings, TERMINAL_SETTING_PROFILES_KEY, "^a&s", &profiles);
@@ -415,7 +400,7 @@ terminal_app_profile_cell_data_func (GtkTreeViewColumn *tree_column,
gtk_tree_model_get (tree_model, iter, (int) COL_PROFILE, &profile, (int) -1);
g_settings_get (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, "&s", &text);
- uuid = profile_get_uuid (profile);
+ uuid = terminal_profile_util_get_profile_uuid (profile);
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value,
@@ -588,7 +573,7 @@ profile_combo_box_changed_cb (GtkWidget *widget,
if (!profile)
return;
- uuid = profile_get_uuid (profile);
+ uuid = terminal_profile_util_get_profile_uuid (profile);
g_settings_set_string (app->global_settings, TERMINAL_SETTING_DEFAULT_PROFILE_KEY, uuid);
g_free (uuid);
diff --git a/src/terminal-profile-utils.c b/src/terminal-profile-utils.c
index eba5554..a7f5ab7 100644
--- a/src/terminal-profile-utils.c
+++ b/src/terminal-profile-utils.c
@@ -210,3 +210,24 @@ terminal_profile_util_get_profile_by_uuid_or_name (const char *uuid_or_name,
return g_strdup (uuid_or_name);
}
+
+/**
+ * terminal_profile_util_get_profile_uuid:
+ * @profile: a #GSettings for the %TERMINAL_PROFILE_SCHEMA schema
+ *
+ * Returns: (transfer full): the profile's UUID
+ */
+char *
+terminal_profile_util_get_profile_uuid (GSettings *profile)
+{
+ char *path, *uuid;
+
+ g_object_get (profile, "path", &path, NULL);
+ g_assert (g_str_has_prefix (path, TERMINAL_PROFILES_PATH_PREFIX ":"));
+ uuid = g_strdup (path + strlen (TERMINAL_PROFILES_PATH_PREFIX ":"));
+ g_free (path);
+
+ g_assert (strlen (uuid) == 37);
+ uuid[36] = '\0';
+ return uuid;
+}
diff --git a/src/terminal-profile-utils.h b/src/terminal-profile-utils.h
index 13a0f8d..df17a44 100644
--- a/src/terminal-profile-utils.h
+++ b/src/terminal-profile-utils.h
@@ -33,6 +33,8 @@ char *terminal_profile_util_get_profile_by_uuid (const char *uuid,
char *terminal_profile_util_get_profile_by_uuid_or_name (const char *uuid_or_name,
GError **error);
+char *terminal_profile_util_get_profile_uuid (GSettings *profile);
+
G_END_DECLS
#endif /* TERMINAL_UTIL_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]