[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] [PATCH 1/2] add grename command
From: |
Ali Gholami Rudi |
Subject: |
[RP] [PATCH 1/2] add grename command |
Date: |
Sat, 11 Oct 2008 08:33:32 +0330 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
---
src/actions.c | 9 +++++++++
src/actions.h | 1 +
src/group.c | 8 ++++++++
src/group.h | 1 +
4 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index c7534bc..cb0fb2c 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -254,6 +254,8 @@ init_user_commands(void)
"Name: ", arg_STRING);
add_command ("gnewbg", cmd_gnewbg, 1, 1, 1,
"Name: ", arg_STRING);
+ add_command ("grename", cmd_grename, 1, 1, 1,
+ "Change group name to: ", arg_STRING);
add_command ("gnext", cmd_gnext, 0, 0, 0);
add_command ("gprev", cmd_gprev, 0, 0, 0);
add_command ("gother", cmd_gother, 0, 0, 0);
@@ -4847,6 +4849,13 @@ cmd_gnewbg (int interactive, struct cmdarg **args)
}
cmdret *
+cmd_grename (int interactive, struct cmdarg **args)
+{
+ group_rename (rp_current_group, ARG_STRING(0));
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
+cmdret *
cmd_gselect (int interactive, struct cmdarg **args)
{
rp_group *g;
diff --git a/src/actions.h b/src/actions.h
index 76ee85f..3fcd3b7 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -140,6 +140,7 @@ RP_CMD (gnext);
RP_CMD (gprev);
RP_CMD (gother);
RP_CMD (gravity);
+RP_CMD (grename);
RP_CMD (groups);
RP_CMD (gselect);
RP_CMD (h_split);
diff --git a/src/group.c b/src/group.c
index e5d66f9..069b677 100644
--- a/src/group.c
+++ b/src/group.c
@@ -101,6 +101,14 @@ group_add_new_group (char *name)
return g;
}
+void
+group_rename (rp_group *g, char *name)
+{
+ if (g->name)
+ free (g->name);
+ g->name = xstrdup (name);
+}
+
rp_group *
group_next_group (void)
{
diff --git a/src/group.h b/src/group.h
index 4e6ad81..176e4ee 100644
--- a/src/group.h
+++ b/src/group.h
@@ -53,6 +53,7 @@ rp_group *group_next_group (void);
rp_group *group_last_group (void);
rp_group *group_add_new_group (char *name);
+void group_rename (rp_group *g, char *name);
rp_window_elem *group_find_window (struct list_head *list, rp_window *win);
rp_window_elem *group_find_window_by_number (rp_group *g, int num);
--
1.6.0.2.307.gc427.dirty
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [RP] [PATCH 1/2] add grename command,
Ali Gholami Rudi <=