add --(on|off)line switches
This commit is contained in:
parent
b34c712165
commit
20350252d6
5 changed files with 42 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2002-10-15 [colin] 0.8.5claws39
|
||||
|
||||
* src/main.c
|
||||
src/mainwindow.[ch]
|
||||
Added --online and --offline command-line
|
||||
switches
|
||||
|
||||
2002-10-15 [christoph] 0.8.5claws38
|
||||
|
||||
* src/procmime.c
|
||||
|
|
|
@ -11,7 +11,7 @@ MINOR_VERSION=8
|
|||
MICRO_VERSION=5
|
||||
INTERFACE_AGE=0
|
||||
BINARY_AGE=0
|
||||
EXTRA_VERSION=claws38
|
||||
EXTRA_VERSION=claws39
|
||||
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
|
||||
|
||||
dnl set $target
|
||||
|
|
21
src/main.c
21
src/main.c
|
@ -103,6 +103,8 @@ static struct Cmd {
|
|||
gboolean status;
|
||||
gboolean send;
|
||||
gboolean crash;
|
||||
gboolean online;
|
||||
gboolean offline;
|
||||
gchar *crash_params;
|
||||
} cmd;
|
||||
|
||||
|
@ -356,6 +358,11 @@ int main(int argc, char *argv[])
|
|||
if (cmd.send)
|
||||
send_queue();
|
||||
|
||||
if (cmd.offline)
|
||||
main_window_toggle_work_offline(mainwin, TRUE);
|
||||
if (cmd.online)
|
||||
main_window_toggle_work_offline(mainwin, FALSE);
|
||||
|
||||
gtk_main();
|
||||
|
||||
addressbook_destroy();
|
||||
|
@ -414,6 +421,10 @@ static void parse_cmd_opt(int argc, char *argv[])
|
|||
exit(0);
|
||||
} else if (!strncmp(argv[i], "--status", 8)) {
|
||||
cmd.status = TRUE;
|
||||
} else if (!strncmp(argv[i], "--online", 8)) {
|
||||
cmd.online = TRUE;
|
||||
} else if (!strncmp(argv[i], "--offline", 9)) {
|
||||
cmd.offline = TRUE;
|
||||
} else if (!strncmp(argv[i], "--help", 6)) {
|
||||
g_print(_("Usage: %s [OPTION]...\n"),
|
||||
g_basename(argv[0]));
|
||||
|
@ -426,6 +437,8 @@ static void parse_cmd_opt(int argc, char *argv[])
|
|||
puts(_(" --receive-all receive new messages of all accounts"));
|
||||
puts(_(" --send send all queued messages"));
|
||||
puts(_(" --status show the total number of messages"));
|
||||
puts(_(" --online switch to online mode"));
|
||||
puts(_(" --offline switch to offline mode"));
|
||||
puts(_(" --debug debug mode"));
|
||||
puts(_(" --help display this help and exit"));
|
||||
puts(_(" --version output version information and exit"));
|
||||
|
@ -653,6 +666,10 @@ static gint prohibit_duplicate_launch(void)
|
|||
g_free(compose_str);
|
||||
} else if (cmd.send) {
|
||||
fd_write(uxsock, "send\n", 5);
|
||||
} else if (cmd.online) {
|
||||
fd_write(uxsock, "online\n", 6);
|
||||
} else if (cmd.offline) {
|
||||
fd_write(uxsock, "offline\n", 7);
|
||||
} else if (cmd.status) {
|
||||
gchar buf[BUFFSIZE];
|
||||
|
||||
|
@ -704,6 +721,10 @@ static void lock_socket_input_cb(gpointer data,
|
|||
open_compose_new(buf + strlen("compose") + 1, NULL);
|
||||
} else if (!strncmp(buf, "send", 4)) {
|
||||
send_queue();
|
||||
} else if (!strncmp(buf, "online", 6)) {
|
||||
main_window_toggle_work_offline(mainwin, FALSE);
|
||||
} else if (!strncmp(buf, "offline", 7)) {
|
||||
main_window_toggle_work_offline(mainwin, TRUE);
|
||||
} else if (!strncmp(buf, "status", 6)) {
|
||||
guint new, unread, total;
|
||||
|
||||
|
|
|
@ -2993,13 +2993,17 @@ static void separate_widget_cb(MainWindow *mainwin, guint action,
|
|||
prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
|
||||
}
|
||||
|
||||
static void toggle_work_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
|
||||
void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline)
|
||||
{
|
||||
if (GTK_CHECK_MENU_ITEM(widget)->active) {
|
||||
if (offline)
|
||||
online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
|
||||
} else {
|
||||
online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
|
||||
}
|
||||
else
|
||||
online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
|
||||
}
|
||||
|
||||
static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget *widget)
|
||||
{
|
||||
main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active);
|
||||
}
|
||||
|
||||
static void online_switch_clicked (GtkButton *btn, gpointer data)
|
||||
|
|
|
@ -220,4 +220,8 @@ void toolbar_set_sensitive (MainWindow *mainwin);
|
|||
void toolbar_set_compose_button (MainToolbar *toolbar,
|
||||
ComposeButtonType compose_btn_type);
|
||||
void main_window_destroy_all (void);
|
||||
|
||||
void main_window_toggle_work_offline (MainWindow *mainwin,
|
||||
gboolean offline);
|
||||
|
||||
#endif /* __MAINWINDOW_H__ */
|
||||
|
|
Loading…
Reference in a new issue