void plugin_load(void)
{
	debug_print("autoenc plug-in loaded!\n");

	syl_init_gettext(GETTEXT_PACKAGE, LOCALEDIR);

	syl_plugin_add_menuitem("/Configuration", NULL, NULL, NULL);
	syl_plugin_add_menuitem("/Configuration", _("Configure automatic attachment encryption"), autoenc_setting, NULL);

	g_signal_connect_after(syl_app_get(), "init-done", G_CALLBACK(init_done_cb), NULL);
	autoenc_app_exit_handler_id =
		g_signal_connect(syl_app_get(), "app-exit", G_CALLBACK(app_exit_cb), NULL);
	syl_plugin_signal_connect("compose-created",
				  G_CALLBACK(compose_created_cb), NULL);
	syl_plugin_signal_connect("compose-destroy",
				  G_CALLBACK(compose_destroy_cb), NULL);
	syl_plugin_signal_connect("compose-send",
				  G_CALLBACK(compose_send_cb), NULL);
	syl_plugin_signal_connect("compose-toolbar-changed",
				  G_CALLBACK(compose_toolbar_changed_cb), NULL);
	syl_plugin_signal_connect("compose-attach-changed",
				  G_CALLBACK(compose_attach_changed_cb), NULL);

	/* load config */
	read_config();

	if (is_dir_exist(get_autoenc_tmp_dir())) {
		remove_all_files(get_autoenc_tmp_dir());
	}

	debug_print("autoenc plug-in loading done\n");
}
Beispiel #2
0
void plugin_load(void)
{
  gpointer mainwin;

  syl_init_gettext(HTMLVIEW, "lib/locale");
  g_print("HtmlView plug-in loaded!\n");

  syl_plugin_add_menuitem("/Tools", NULL, NULL, NULL);
  syl_plugin_add_menuitem("/Tools", _("HtmlView [htmlview]"), exec_htmlview_menu_cb, NULL);

  mainwin = syl_plugin_main_window_get();
  syl_plugin_main_window_popup(mainwin);

  g_signal_connect_after(syl_app_get(), "init-done", G_CALLBACK(init_done_cb),
                         NULL);
  g_signal_connect(syl_app_get(), "app-exit", G_CALLBACK(app_exit_cb), NULL);

  syl_plugin_signal_connect("messageview-show",
                            G_CALLBACK(messageview_show_cb), NULL);

  load_option_from_rcfile();

  SYLPF_OPTION.is_show_attach_tab = SYLPF_GET_RC_SHOW_ATTACH_TAB;

  g_print("htmlview plug-in loading done\n");
}
Beispiel #3
0
void plugin_load(void)
{
  gpointer mainwin;

  SYLPF_START_FUNC;

  syl_init_gettext(MSG2CLIP, "lib/locale");
  
  syl_plugin_add_menuitem("/Tools", NULL, NULL, NULL);
  syl_plugin_add_menuitem("/Tools", _("Msg2Clip [msg2clip]"), exec_msg2clip_menu_cb, NULL);

  mainwin = syl_plugin_main_window_get();
  g_print("mainwin: %p\n", mainwin);
  syl_plugin_main_window_popup(mainwin);

  g_signal_connect_after(syl_app_get(), "init-done", G_CALLBACK(init_done_cb),
                         NULL);
  app_exit_handler_id =
	g_signal_connect(syl_app_get(), "app-exit", G_CALLBACK(app_exit_cb),
                     NULL);

  syl_plugin_signal_connect("messageview-show",
                            G_CALLBACK(messageview_show_cb), NULL);
  
  SYLPF_END_FUNC;
}
Beispiel #4
0
void syl_init(void)
{
#ifdef G_OS_WIN32
	gchar *newpath;
	const gchar *lang_env;

	/* disable locale variable such as "LANG=1041" */

#define DISABLE_DIGIT_LOCALE(envstr)			\
{							\
	lang_env = g_getenv(envstr);			\
	if (lang_env && g_ascii_isdigit(lang_env[0]))	\
		g_unsetenv(envstr);			\
}

	DISABLE_DIGIT_LOCALE("LC_ALL");
	DISABLE_DIGIT_LOCALE("LANG");
	DISABLE_DIGIT_LOCALE("LC_CTYPE");
	DISABLE_DIGIT_LOCALE("LC_MESSAGES");

#undef DISABLE_DIGIT_LOCALE

	g_unsetenv("LANGUAGE");
#endif /* G_OS_WIN32 */

#ifdef HAVE_LOCALE_H
	setlocale(LC_ALL, "");
#endif

	set_startup_dir();

#ifdef G_OS_WIN32
	/* include startup directory into %PATH% for GSpawn */
	newpath = g_strconcat(get_startup_dir(), ";", g_getenv("PATH"), NULL);
	g_setenv("PATH", newpath, TRUE);
	g_free(newpath);
#endif

#ifdef ENABLE_NLS
	syl_init_gettext(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);
#endif

	sock_init();

#ifdef G_OS_UNIX
	/* ignore SIGPIPE signal for preventing sudden death of program */
	signal(SIGPIPE, SIG_IGN);
#endif
}
void plugin_load(void)
{
  GtkWidget *mainwin;
  GtkWidget *statusbar;
  GtkWidget *plugin_box;
  GdkPixbuf *on_pixbuf;
  GdkPixbuf *off_pixbuf;
  gchar *rcpath;
  gboolean startup;

  syl_init_gettext("autoforward", "lib/locale");
  
  debug_print(gettext("Auto mail forward Plug-in"));
  debug_print(dgettext("autoforward", "Auto mail forward Plug-in"));

  syl_plugin_add_menuitem("/Tools", _("Autoforward Settings [autoforward]"), exec_autoforward_menu_cb, NULL);

  g_signal_connect(syl_app_get(), "add-msg", G_CALLBACK(exec_autoforward_cb), NULL);

  mainwin = syl_plugin_main_window_get();
  statusbar = syl_plugin_main_window_get_statusbar();
  plugin_box = gtk_hbox_new(FALSE, 0);

  on_pixbuf = gdk_pixbuf_new_from_xpm_data((const char**)online);
  g_plugin_on=gtk_image_new_from_pixbuf(on_pixbuf);
    
  off_pixbuf = gdk_pixbuf_new_from_xpm_data((const char**)offline);
  g_plugin_off=gtk_image_new_from_pixbuf(off_pixbuf);

  gtk_box_pack_start(GTK_BOX(plugin_box), g_plugin_on, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(plugin_box), g_plugin_off, FALSE, FALSE, 0);
    
  g_tooltip = gtk_tooltips_new();
    
  g_onoff_switch = gtk_button_new();
  gtk_button_set_relief(GTK_BUTTON(g_onoff_switch), GTK_RELIEF_NONE);
  GTK_WIDGET_UNSET_FLAGS(g_onoff_switch, GTK_CAN_FOCUS);
  gtk_widget_set_size_request(g_onoff_switch, 20, 20);

  gtk_container_add(GTK_CONTAINER(g_onoff_switch), plugin_box);
  g_signal_connect(G_OBJECT(g_onoff_switch), "clicked",
                   G_CALLBACK(exec_autoforward_onoff_cb), mainwin);
  gtk_box_pack_start(GTK_BOX(statusbar), g_onoff_switch, FALSE, FALSE, 0);

  gtk_widget_show_all(g_onoff_switch);
  gtk_widget_hide(g_plugin_on);
  info.name = g_strdup(_(PLUGIN_NAME));
  info.description = g_strdup(_(PLUGIN_DESC));

  rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "autoforwardrc", NULL);
  g_keyfile = g_key_file_new();
  if (g_key_file_load_from_file(g_keyfile, rcpath, G_KEY_FILE_KEEP_COMMENTS, NULL)){
    startup=g_key_file_get_boolean (g_keyfile, "forward", "startup", NULL);
    debug_print("startup:%s", startup ? "true" : "false");

    if (startup){
      g_enable=TRUE;
      gtk_widget_hide(g_plugin_off);
      gtk_widget_show(g_plugin_on);
      gtk_tooltips_set_tip(g_tooltip, g_onoff_switch,
                           _("Autoforward is enabled. Click the icon to disable plugin."),
                           NULL);
    }
      
    g_free(rcpath);
  }
}