aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-05-10 04:08:35 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-05-10 04:08:35 +0000
commit88fb2b8f6b56d33486e358869a4abeb4a6e44306 (patch)
treef39fe9079ca2c03d603f1fa64ea2f9622175a161
parent6b2af6b8b67b7d0abc2d19a89c895f64239487f3 (diff)
also supported '--open' in initial startup.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1687 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.ja4
-rw-r--r--src/main.c65
3 files changed, 48 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 4890c5c9..07168c52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2007-05-09
+ src/main.c: also supported '--open' in initial startup.
+
+2007-05-09
+
* src/main.c: implemented '--open' command line option which open
messages specified with command-line in new window.
* libsylph/mh.c: mh_fetch_msg(): don't show warning when num is
diff --git a/ChangeLog.ja b/ChangeLog.ja
index aa965d90..07704df6 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,9 @@
2007-05-09
+ * src/main.c: 初回起動でも '--open' に対応。
+
+2007-05-09
+
* src/main.c: コマンドラインで指定されたメッセージを新規ウィンドウで
開く '--open' コマンドラインオプションを実装。
* libsylph/mh.c: mh_fetch_msg(): num が範囲外でも警告を表示しない
diff --git a/src/main.c b/src/main.c
index 649d79f1..2e5bc15a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -146,6 +146,7 @@ static void migrate_old_config (void);
static void open_compose_new (const gchar *address,
GPtrArray *attach_files);
+static void open_message (const gchar *path);
static void send_queue (void);
@@ -1253,36 +1254,12 @@ static gboolean lock_socket_input_cb(GIOChannel *source, GIOCondition condition,
g_free(status);
if (folders) g_ptr_array_free(folders, TRUE);
} else if (!strncmp(buf, "open", 4)) {
- gchar *path;
- gchar *id;
- gchar *msg;
- gint num;
- FolderItem *item;
- MsgInfo *msginfo;
- MessageView *msgview;
-
strretchomp(buf);
if (strlen(buf) < 6 || buf[4] != ' ') {
fd_close(sock);
return TRUE;
}
-
- path = buf + 5;
- id = g_path_get_dirname(path);
- msg = g_path_get_basename(path);
- num = to_number(msg);
- item = folder_find_item_from_identifier(id);
- debug_print("open folder id: %s (msg %d)\n", id, num);
- if (num > 0 && item) {
- msginfo = folder_item_get_msginfo(item, num);
- if (msginfo) {
- msgview = messageview_create_with_new_window();
- messageview_show(msgview, msginfo, FALSE);
- } else
- debug_print("message %d not found\n", num);
- }
- g_free(msg);
- g_free(id);
+ open_message(buf + 5);
} else if (!strncmp(buf, "exit", 4)) {
fd_close(sock);
app_will_exit(TRUE);
@@ -1320,6 +1297,9 @@ static void remote_command_exec(void)
if (cmd.send)
send_queue();
+
+ if (cmd.open_msg)
+ open_message(cmd.open_msg);
}
if (cmd.attach_files) {
@@ -1335,6 +1315,10 @@ static void remote_command_exec(void)
g_ptr_array_free(cmd.status_full_folders, TRUE);
cmd.status_full_folders = NULL;
}
+ if (cmd.open_msg) {
+ g_free(cmd.open_msg);
+ cmd.open_msg = NULL;
+ }
if (cmd.exit) {
app_will_exit(TRUE);
}
@@ -1460,6 +1444,37 @@ static void open_compose_new(const gchar *address, GPtrArray *attach_files)
g_free(utf8addr);
}
+static void open_message(const gchar *path)
+{
+ gchar *id;
+ gchar *msg;
+ gint num;
+ FolderItem *item;
+ MsgInfo *msginfo;
+ MessageView *msgview;
+
+ if (gtkut_window_modal_exist())
+ return;
+
+ id = g_path_get_dirname(path);
+ msg = g_path_get_basename(path);
+ num = to_number(msg);
+ item = folder_find_item_from_identifier(id);
+ debug_print("open folder id: %s (msg %d)\n", id, num);
+
+ if (num > 0 && item) {
+ msginfo = folder_item_get_msginfo(item, num);
+ if (msginfo) {
+ msgview = messageview_create_with_new_window();
+ messageview_show(msgview, msginfo, FALSE);
+ } else
+ debug_print("message %d not found\n", num);
+ }
+
+ g_free(msg);
+ g_free(id);
+}
+
static void send_queue(void)
{
GList *list;