[gedit] Add a "name" property to the file browser's MessageIdLocation
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Add a "name" property to the file browser's MessageIdLocation
- Date: Mon, 1 Jul 2013 15:40:38 +0000 (UTC)
commit 4b2e0e14ca66c9126b718d2ecb50a0c9d9ce12ad
Author: Garrett Regier <garrettregier gmail com>
Date: Mon Jul 1 06:08:46 2013 -0700
Add a "name" property to the file browser's MessageIdLocation
This is the display name for the location and will be useful
when the display of the name can be changed.
plugins/filebrowser/gedit-file-browser-messages.c | 11 +++++++++
plugins/filebrowser/messages.xml | 1 +
.../gedit-file-browser-message-id-location.c | 23 ++++++++++++++++++++
3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-messages.c
b/plugins/filebrowser/gedit-file-browser-messages.c
index 36b78fd..d07fd0b 100644
--- a/plugins/filebrowser/gedit-file-browser-messages.c
+++ b/plugins/filebrowser/gedit-file-browser-messages.c
@@ -320,11 +320,13 @@ set_item_message (WindowData *data,
GeditMessage *message)
{
GeditFileBrowserStore *store;
+ gchar *name;
GFile *location;
guint flags = 0;
store = gedit_file_browser_widget_get_browser_store (data->widget);
gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
+ GEDIT_FILE_BROWSER_STORE_COLUMN_NAME, &name,
GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
-1);
@@ -347,6 +349,13 @@ set_item_message (WindowData *data,
"location", location,
NULL);
+ if (gedit_message_has (message, "name"))
+ {
+ g_object_set (message,
+ "name", name,
+ NULL);
+ }
+
if (gedit_message_has (message, "is_directory"))
{
g_object_set (message,
@@ -358,6 +367,8 @@ set_item_message (WindowData *data,
g_free (track_id);
g_object_unref (location);
}
+
+ g_free (name);
}
static gboolean
diff --git a/plugins/filebrowser/messages.xml b/plugins/filebrowser/messages.xml
index aba0ba6..059dd76 100644
--- a/plugins/filebrowser/messages.xml
+++ b/plugins/filebrowser/messages.xml
@@ -37,6 +37,7 @@
<message namespace="Gedit" name="FileBrowserMessageIdLocation">
<include>gio/gio.h</include>
<property name="id" type="string"/>
+ <property name="name" type="string"/>
<property name="location" type="object" gtype="G_TYPE_FILE"/>
<property name="is-directory" type="boolean"/>
</message>
diff --git a/plugins/filebrowser/messages/gedit-file-browser-message-id-location.c
b/plugins/filebrowser/messages/gedit-file-browser-message-id-location.c
index 0b9e948..9b13a54 100644
--- a/plugins/filebrowser/messages/gedit-file-browser-message-id-location.c
+++ b/plugins/filebrowser/messages/gedit-file-browser-message-id-location.c
@@ -4,6 +4,7 @@
* This file is part of gedit
*
* Copyright (C) 2011 - Jesse van den Kieboom
+ * Copyright (C) 2013 - Garrett Regier
*
* gedit is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +32,7 @@ enum
PROP_0,
PROP_ID,
+ PROP_NAME,
PROP_LOCATION,
PROP_IS_DIRECTORY,
};
@@ -38,6 +40,7 @@ enum
struct _GeditFileBrowserMessageIdLocationPrivate
{
gchar *id;
+ gchar *name;
GFile *location;
gboolean is_directory;
};
@@ -50,6 +53,7 @@ gedit_file_browser_message_id_location_finalize (GObject *obj)
GeditFileBrowserMessageIdLocation *msg = GEDIT_FILE_BROWSER_MESSAGE_ID_LOCATION (obj);
g_free (msg->priv->id);
+ g_free (msg->priv->name);
if (msg->priv->location)
{
g_object_unref (msg->priv->location);
@@ -73,6 +77,9 @@ gedit_file_browser_message_id_location_get_property (GObject *obj,
case PROP_ID:
g_value_set_string (value, msg->priv->id);
break;
+ case PROP_NAME:
+ g_value_set_string (value, msg->priv->name);
+ break;
case PROP_LOCATION:
g_value_set_object (value, msg->priv->location);
break;
@@ -100,6 +107,12 @@ gedit_file_browser_message_id_location_set_property (GObject *obj,
msg->priv->id = g_value_dup_string (value);
break;
}
+ case PROP_NAME:
+ {
+ g_free (msg->priv->name);
+ msg->priv->name = g_value_dup_string (value);
+ break;
+ }
case PROP_LOCATION:
{
if (msg->priv->location)
@@ -136,6 +149,16 @@ gedit_file_browser_message_id_location_class_init (GeditFileBrowserMessageIdLoca
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (object_class,
PROP_LOCATION,
g_param_spec_object ("location",
"Location",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]